The answer: use youtube-dl to provide the correct download link, then stream to mplayer and null the video.
- Download youtube-dl and put somewhere in your path (such as ~/bin/) and make executable. If your player breaks, just download the latest version (up within 24 hrs of a youtube site modification) and it should work again. They have a youtube-dl .deb package in the ubuntu repos, but it is obsoleted pretty fast (for instance 10.04 doesn't work).
- make sure mplayer and python are installed: (sudo apt-get install mplayer python)
- Use this command:
Of course, you will change the video link to be the one you like. Here is some explanation of what is going on:
- Youtube requires cookies to be enabled. We get the video link via youtube-dl and put it into the cookie file. mplayer is using cookies and reads the url to play from the cookie file.
- The -g means get the url, and -f changes which file format you are getting the link to (look up youtube codes... current options are 5, 34, 35, 18, 22, 37, 38, 43, 44, 45, 17). 34 is the lowest resolution flv format at 128 kbits/s sound (and I think is standard "360"). 18 would give you 96 kbits/s sound.
- -vo null means no video output. Use -fs instead if you want full screen, or nothing for that option if you want regular.
This also seems to work on short playlists, but not always:
mplayer -vo null -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g -f 34 --cookies /tmp/cookie.txt "http://www.youtube.com/view_play_list?p=460F66B8E8E56FB6")
Navigate through the tracks with ">" and "<".