macosyoutubevideo-streaminghomebrewmplayer

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.


Solution

  • 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