You can download videos and/or just the audio and then watch/listen to them using youtube-dl
. The script is written in Python and makes use of ffmpeg
I believe.
$ youtube-dl --help
Usage: youtube-dl [options] url [url...]
Options:
General Options:
-h, --help print this help text and exit
--version print program version and exit
-U, --update update this program to latest version.
Make sure that you have sufficient
permissions (run with sudo if needed)
...
...
To download videos you simply give it the URL from the page you want the video on and the script does the rest:
$ youtube-dl https://www.youtube.com/watch?v=OwvZemXJhF4
[youtube] Setting language
[youtube] OwvZemXJhF4: Downloading webpage
[youtube] OwvZemXJhF4: Downloading video info webpage
[youtube] OwvZemXJhF4: Extracting video information
[youtube] OwvZemXJhF4: Encrypted signatures detected.
[youtube] OwvZemXJhF4: Downloading js player 7N
[youtube] OwvZemXJhF4: Downloading js player 7N
[download] Destination: Joe Nichols - Yeah (Audio)-OwvZemXJhF4.mp4
[download] 100% of 21.74MiB in 00:16
You can then use vlc
or mplayer
to watch these locally:
$ vlc "Joe Nichols - Yeah (Audio)-OwvZemXJhF4.mp4"
VLC media player 2.1.5 Rincewind (revision 2.1.4-49-gdab6cb5)
[0x1cd1118] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
OK but I want to watch these videos as they're streamed & in ASCII
I found this blog article titled: On ascii, youtube and letting go (Wayback Machine) that demonstrates the method that I discussed in the chatroom, mainly using youtube-dl
as the "backend" which could do the downloading of the YouTube stream and then redirecting it to some other app.
This article shows it being done with mplayer
:
$ youtube-dl http://www.youtube.com/watch?v=OC83NA5tAGE -o - | \
mplayer -vo aa -monitorpixelaspect 0.5 -
The video being downloaded by youtube-dl
is redirected via STDOUT above, -o -
. There's a demo of the effect here.

With the installation of additional libraries the ASCII video can be enhanced further.

OK but I want the video in my actual terminal?
I found this trick which allows video to be played in an xterm
in the O'Reilly articled titled: Watch Videos in ASCII Art.
$ xterm -fn 5x7 -geometry 250x80 -e "mplayer -vo aa:driver=curses j.mp4
The above results in a xterm
window being opened where the video plays.

So I thought, why not put the peanut butter and the chocolate together like this:
$ xterm -fn 5x7 -geometry 250x80 -e \
"youtube-dl http://www.youtube.com/watch?v=OC83NA5tAGE -o - | \
mplayer -vo aa:driver=curses -"
This almost works! I'm not sure why the video cannot play in the window, but it would seem like it should be able to. The window comes up and starts to play but then closes. I see video for a brief few seconds and then nothing.
Perhaps the above will get you closer to your ultimate solution, or perhaps it just needs to be tweaked a bit on the options.
Additional libraries
If you have libcaca
installed (the colorized version of aalib
) and you reduce the font size in your gnome-terminal
to something really small, like say 3, the following command will display a much better looking ASCII video directly within the terminal:
$ CACA_DRIVER=ncurses mplayer -vo caca video.mp4

Terminals
It would seem that the choice of terminal can make a big deal as to whether mplayer
can play directly inside the terminal or whether it opens a separate window. Caching too on mplayer
made a dramatic difference in being able to play directly in ones terminals.
Using this command I was able to play in terminator
, at least for the first 1/4 of the video before it cut out:
$ youtube-dl http://www.youtube.com/watch?v=OC83NA5tAGE -o - | \
mplayer -cache 32767 -vo aa:driver=curses -
The colored version used this command:
$ youtube-dl http://www.youtube.com/watch?v=OC83NA5tAGE -o - | \
CACA_DRIVER=ncurses mplayer -cache 64000 -vo caca -
These same commands could play in gnome-terminal
& xterm
too.

NOTE: That's (from Left to Right) xterm
, terminator
, gnome-terminal
, and terminology
.
mpv <youtube url>
. It also works for a bunch of other video sites. But this opens a new window. – Gerardo Marset Oct 10 '14 at 00:43