How to use youtube-dl + mplayer to stream youtube video



Hi!

In my last post, I explained how to use youtube-dl script tool.


My goal was to use MPlayer to watch Youtube videos on top of all opened windows.

So, I found some sites on Google that explains how to do it. And you can use with youtube-dl script.

First of all, make sure you have MPlayer installed. Check this post of how install MPlayer.

Then, go to Terminal and type:


$ mplayer -ontop -cookies -cookies-file ./cookie.txt $(youtube-dl -gf 34 --cookies ./cookie.txt "https://www.youtube.com/watch?v=<VIDEO ID>")


Now, explaining mplayer. It's a powerful video player program. You can play, rip, convert,... Its arguments could be found here.

Then, youtube-dl. You can find in my last post, or google-it. For its parameters, you can find the explanation here. Basically, "-gf 34" means "using the URL, starts streaming H264 video in FLV container at 360p".

Just take care about Youtube Video ID and Cookies file path. Both are very important to play the video.

Sometimes, Youtube changes any part of its code and youtube-dl could not be working. It's recommended to update it by using "youtube-dl --update"

If you do everything correct, you can work and watch some Youtube like me:



Comments

  1. Hi this is really useful information. Do you know if youtube-dl will continue despite the continual changes that youtube (presumably google) are making RE. Advertising. Because at the moment it doesnt work for me despite updating. Thanks all the same.

    ReplyDelete
  2. Thanks for your comment.

    Actually, I don't know. I am not the developer of this script. If I have any news, I'll post it here.

    Thanks!

    ReplyDelete
  3. Another way to do this where youtube-dl does the net operation is this:
    youtube-dl -o - | mplayer -

    I can even play 144p youtube videos on my 486(!) like that

    ReplyDelete
  4. I've updated my post. I could not play Youtube videos as I explained. Try a new way! Check the following post:

    http://curious-developer.blogspot.com.br/2014/09/how-to-use-curl-youtube-dl-mplayer-to.html

    ReplyDelete

Post a Comment