Welcome to bytebang » The blog about all and nothing » ASCII - Art youtube player

ASCII - Art youtube player

Aug 28 2014

I was sitting in front of my raspberry pi and asked myself: "What if X Servers, Windowmanagers and all the other graphical stuff would heve never been invented ? .. How would pepole watch youtube videos.". Beside the fact that the possibility of having youtube in this very special case is really small, this type of question reveals that it was not one of my brightest moments ... but it lead me to a really cool attempt how to watch videos in ascii art.

As written here mplayer has a cool feature for all of us that are not able to start a X server. It enables its users to view a video in ascii art by selecting the correct output mode. So with a downloaded file things are easy:

# Black and white
mplayer -vo aa movie.avi

# .. also with options
mplayer -vo aa:extended:driver=curses:contrast=50 movie.avi

# or color
mplayer -vo caca movie.avi

What leads to the following output:

http://everydaylht.com/wp-content/uploads/2010/02/mplayeraa.png http://everydaylht.com/wp-content/uploads/2010/02/mplayercaca.png

Cool - isn't it ? But the initial question has not been answered yet: How to watch YouTube videos in ascii ?

Ok, here the solution is to download the video first or stream it directly into mplayer. Here is my final script that could be run on a raspberry.

#!/bin/bash
mplayer -vo caca -cookies -cookies-file /tmp/ytcookie.txt ffmpeg://$(youtube-dl -g --cookies=/tmp/ytcookie.txt $1)

So if we save this script into a file called ytascii.sh then we can run it like this:

$./ytascii.sh https://www.youtube.com/watch?v=brI06E-p5GY

And yes - it works with the https url that you see in your browser whie watching a youtube video:

ytascii_screenshot.png

If it doesnt work out of the box then try to install the packages mplayer and youtube-dl

Get Social


(c) 2024, by bytebang e.U. - Impressum - Datenschutz / Nutzungsbedingungen
-