Terminal Video Player banner

Terminal Video Player

3 devlogs
18h 59m 35s

This project lets you play any video from the terminal! It can prerender videos so you can watch at higher resolutions and framerates or you can watch the video immediately through live rendering. This also plays the audio alongside the video.

This project uses AI

ChatGPT was used for this project only to introduce me to optimisations such as some of the for loop optimisations like when converting Greyscale to ASCII, the del keyword to free up memory, and doing basic debugging with mismatched variable names.

Loading README...

stunt

Shipped this project!

Hours: 18.99
Cookies: 🍪 540
Multiplier: 28.45 cookies/hr

This project is as the name suggests a Video Player in the terminal. It can play any downloaded video by converting each frame into an ASCII image and printing that frame. The player can both render videos live to remove wait times or prerender videos to be able to watch better quality videos at higher resolutions.

The project was my first dive into computer graphics and my first performance critical project and was a great experience to develop. I hope you try it out and enjoy using it!

stunt

Hello again! This is the final devlog before shipping. For this update I have done a lot but definitely not 12 hours worth of work. Anyways here is a full list of all the changes. The attatched video is live rendered.

  • Added Live Rendering. Does as the name suggests it renders the video as it is playing 1 frame rendered then displayed. This is more useful for if you don’t want to wait for your video to load however it can cause slowdown at higher resolutions and framerates.
  • Improved performance significantly where higher resolutions render faster and are significantly more memory efficient so it isnt eating up 3GB of RAM rendering a video anymore. Also greyscaling and ASCIIfying a frame has been optimised to O(1) efficiency per frame, (O(n) for the whole video).
  • Improved frame display. I have now (hopefully) fixed the flickering issue and now the frame prints and clears seamlessly. However you may notice the bottom 2 lines being left empty. This is to prevent the frame from jittering and I cannot be asked to find a better solution
  • Made it so other videos can actually be played. It’s not much but it’s honest work.
  • Added an actual options menu. Lets you select your playback settings.

I am quite content with where this project is and it is my first project that I am truly proud of. Thank you to whoever has followed this project!
<3

2

Comments

stunt
stunt 10 days ago

Sorry for the shit video quality had to compress so I could upload.

Now where did that 12 hours come from? Mostly failed attempts at performance enhancments and testing slight adjustments to the code where testing once can take like 2 miniutes. I also ended up heavily restructuring the code and did a fair amount of documentation in the code as I wanted it to be somewhat decent. One such attempt was to decode the video via the GPU which theoretically was just importing the gpu portion of decord and passing it as an argument. Unfortunately, CUDA does not come precompiled so for like 1 and a half hours I was attempting to compile it with my decord installation and failing so I just gave up on it.

ValixT
ValixT 7 days ago

That’s sick! I even tried it out myself.
I’m genuinely impressed. Something like that definitely is something I could try attempt make myself.

stunt

I have added a few improvements to the code such as

  • MASSIVELY reducing rendering times from like 40 miniutes to ~1 miniute through rendering frames using vector calcs.
  • Increased the ASCII colourmap from 10 characters to 70 so it should be more precise now.
  • The sizing of the video has also been made to scale with the terminal window size.
  • I have also added audio to the video so now you can actually listen to the video as it plays.
  • Fixed the framerate issue so now it should only allow playback as fast as the original video. (not really tested yet though.)

The main rendering opimisation needed is ASCIIfing the frames.
The main playback problem is the flickering which happens if the user does not scroll their terminal window up as well as at higher video resolutions.
I also need to add a low resolution mode as otherwise the edges don’t look as sharp.

I probably won’t be able to get too much more done but I will try to add some more usablility features so it is ready to ship and if I can find the time I will try add colour and/or a live rendering feature so you don’t have to wait for it to be pre rendered but no promises.

See you guys next time!
Also sorry for really bad video quality as I had to get it under 50 MB

1

Comments

kuratus89
kuratus89 13 days ago

dammmmmmmmmmmmmmmmmm
broo , its too cool
u can also add colors!!
bro talk me in discord pleaseeee
discord server link ->https://discord.gg/PC8NWDr2Mv

stunt

This is V0.1 of the program! It is functional but has a lot of bugs, optimisations and features to be made which should hopefully come out soon. This was quite fun to put together and I’m glad I found the time to make some version of this. As you can see the flickering is quite a big problem as it works by wiping the screen after each frame and pasting the new frame. Another big issue is the huge amount of time spent rendering the video at higher frame rates. From the video you can also see that things like speed are issues which is hopefully a quick fix!

See you guys next time!

Also I promise I am not trying to farm time with the fact that it took 4 hours to do this. I genuinely just suck balls at programming.

2

Comments

stunt
stunt 14 days ago

For reference this video was rendered at 60fps but i think the original was 30 which is what caused the speedup.

Steve
Steve 14 days ago

dang this was in python???