Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

osx - Playing youtube videos in terminal as text using mpv or mplayer with libcaca or aalib?

I installed via homebrew:

brew install mplayer mpv libcaca aalib

to try to play videos as text in my terminal. Using mplayer, I tried aa:

youtube-dl https://www.youtube.com/watch?v=urxk4mveLCw -o - | mplayer -cache 64000 -vo aa -

and also caca:

youtube-dl https://www.youtube.com/watch?v=urxk4mveLCw -o - | CACA_DRIVER=ncurses mplayer -cache 64000 -vo caca -

however, both give the following error:

Error opening/initializing the selected video_out (-vo) device.

Trying again with mpv:

mpv "http://www.youtube.com/watch?v=OC83NA5tAGE" -vo caca
mpv "http://www.youtube.com/watch?v=OC83NA5tAGE" -vo aa

Which outputs:

09:00 $ mpv "http://www.youtube.com/watch?v=OC83NA5tAGE" -vo aalib
Playing: http://www.youtube.com/watch?v=OC83NA5tAGE
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=eng (*) 'DASH audio' (opus) (external)
[vo] Video output aalib not found!
Error opening/initializing the selected video_out (-vo) device.
Video: no video

Exiting... (Errors when loading file)
✘-2 ~

When looking at the man page for mpv, I find:

   caca   Color  ASCII art video output driver that works on a text console.

          NOTE:
             This driver is a joke.

What am I doing wrong, and how can I correctly watch the youtube videos in the terminal?

Thanks.

P.S If it makes a difference, here is my screenfetch information:

OS: 64bit Mac OS X 10.9.5 13F1603
Kernel: x86_64 Darwin 13.4.0
DE: Aqua
WM: Quartz Compositor
WM Theme: Blue
GPU: Intel Iris

Also I am using iterm2 as my terminal, but I also have xterm via xquartz, and the normal terminal.

like image 397
thepiercingarrow Avatar asked Jul 05 '16 13:07

thepiercingarrow


2 Answers

caca is not installed with mpv by default, you will need to set it as an option flag.

You can reinstall this with caca with

brew reinstall mpv --with-libcaca

or if you are installing from fresh

brew install mpv --with-libcaca

Now running

mpv --vo=help

Outputs the following

Available video outputs:
  opengl         : Extended OpenGL Renderer
  null           : Null video output
  image          : Write video frames to image files
  caca           : libcaca
  opengl-hq      : Extended OpenGL Renderer (high quality rendering preset)

So you can see that caca is now available to be used. Then simply run your command to play your chosen video in terminal.

mpv "http://www.youtube.com/watch?v=OC83NA5tAGE" -vo caca
like image 187
Phil Cook Avatar answered Nov 05 '22 11:11

Phil Cook


I think you don't have caca/aa driver compiled in mpv/mplayer; check:

mpv --vo=help
mplayer --vo=help

if they don't list caca, you should try to compile mpv (or mplayer) from source.

like image 3
dercz Avatar answered Nov 05 '22 10:11

dercz