Terminal Video Player banner

Terminal Video Player

8 devlogs
26h 13m 25s

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 to introduce me to optimisations and inline code suggestions.

Demo Repository

Loading README...

stunt

Shipped this project!

Hours: 7.23
Cookies: 🍪 210
Multiplier: 29.04 cookies/hr

Since my last ship I have improved the ASCII renderer massively and added colour rendering. This was a very fun project to do and I enjoyed spending the time going back to my code and making optimisations, now with a good enough computer you could use this to actually watch videos.

stunt

I tried some optimisations for a bit but almost none of them worked but I have been able to slighly improve the printing times by not resetting the colouring every frame and also not clearing the frame instead opting to overwrite it. This is my last devlog and most likely last release of this project as I have to lock in for school. Thank you to everyone who folllowed me in this journey!

Attachment
0
stunt

I have optimised the rendering for colour frames where it is now somewhat usable (although a memory hog). Attached is a pre rendered video in colour in 268x68 resolution at 15 fps. As you can see it is kinda blurry but it is technically watchable.

1

Comments

nmsoukmandjiev007

This is insane!

stunt

WE HAVE COLOUR! Granted it is currently really slow so I have to run it at a really low resolution but we do have color. Now i need to optimise it so it is actually usable. No joke it genuinely transitions frames like a slideshow

Some frames from the video I rendered.
www.youtube.com/watch?v=HYlinsnqka0&t

Attachment
Attachment
1

Comments

kuratus89
kuratus89 30 days ago

dammm

stunt

I have been able to optimise the ASCII conversion to O(1) with frame conversion times of like 2 ms compared to the 30 before at the same resolution which we get to increase the resolution again! This video is rendered at 920 by 240 resolution whereas the old video was at 420 by 180 resoluton. I honetsly dont know what other optimisations I can do in python casue GPU stuff is out fo the window as I do not have an NVIDIA GPU so can’t do CUDA stuff.

The next goal is colours!

See you guys next time!

1

Comments

stunt
stunt about 1 month ago

Any lag is due to compression to be able to upload this.

stunt

I have finally returned to this project after a 3 week hiatus. I plan on adding colour support and optimising the render speeds. From some rough timing the worst offender is the greyscale to ASCII conversion which takes upwards of 10x the time converting the frame to greyscale takes.

Attachment
1

Comments

stunt
stunt about 1 month ago

Also this logged time also included the time i spent getting it ready for ship like posting to pypi and that

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 about 2 months 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 about 2 months 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 about 2 months 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 about 2 months ago

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

Steve
Steve about 2 months ago

dang this was in python???