Code:
pvl() { (for i in "$@"; do youtube-dl -q --max-downloads 1 --no-playlist "$i" -o - | mplayer -vo null /dev/fd/3 3<&0 </dev/tty; sleep .5; done); }
This plays video files (youtube, vimeo, etc) isolated to the terminal, without video.
I'm particularly proud of this one since it solved a lot of things I've been stumped about. Plus - it really converges the online video media and cli together.
First off, there is no downloading to a file or any conversion of files. youtube-dl downloads and sends to stdout and is immediately caught by mplayer which then
dumps any video elements (-vo null). This also avoids any need for a fifo and avoids costly conversion (ffmpeg -i - -f ogg -vn -)
If you've ever piped to mplayer, you've noticed that you cannot control it. Turns out with some
redirection magic (/dev/fd/3 3<&0 </dev/tty), you can!
If you're inclined and have mplayer and
youtube-dl installed, try it out.
Code:
Usage:
pvl 'link1' 'link2' 'link3'
http://www.commandlinefu.com/command...os-in-terminal