Playing online music videos in terminal (one-liner)
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); } 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: |
If you want to use youtube-dl and mplayer then give this a try. It's
a little more versatile. Code:
#! /usr/bin/env bash |
All times are GMT -5. The time now is 10:54 PM. |