Playing YouTube videos in the browser on the Raspberry Pi

This will allow you to stream up to 1080p youtube videos in the browser on the Raspberry pi using omxplayer. Its a crude hack but it seems to work pretty well on my system. Install instructions and a demonstration video are shown below.

You can install this by pulling the git repository and running the scripts below.
Commands to install are below (your user should have sudo privileges but you dont need to be root):

You may have to enable user scripts in Midori by going to Menu>Preferences>Extensions>UserScripts and clicking the check box.


sudo apt-get install git-core
git clone git://github.com/StevenHickson/PiAUISuite.git
cd PiAUISuite/Install/
./InstallAUISuite.sh

**NOTE, this will ask you if you want to install a lot of different scripts because it is a SUITE. You only have to pick the ones you want to use. If you only want to use the youtube scripts, press n on any other question except for the dependencies and youtube.

Update Instructions 

cd PiAUISuite
git pull
cd Install
sudo ./UpdateAUISuite.sh



Demonstration


There is a lot of misinformation out there on how to do this. Using gnash or HTML5 is going to result in a frame rate so slow it can be considered unworkable. Ive tried both of them out and you cant really watch videos with them. XBMC has a youtube plugin but it is buggy and crashes often.

Ive been playing youtube videos using the command line and my voicecommand using the scripts found here.
After seeing a couple people ask about playing youtube in the browser last night, I decided to go ahead and do that and create some user scripts for midori which allow the browser to utilize the same hack.

Here is the technical overview:
I created a script called youtube which uses the youtube-dl -g flag to grab the video URL. It also handles playlists and other parsing. Then it passes that video URL to omxplayer for it to stream. 
Next I registered a new URL protocol yt:// and made it pass its information to the youtube program whenever it runs. 
Finally, I created a user script in Midori which simply replaces all http://youtube.com/watch?* URLs with yt://youtube.com/watch?*.

Feel free to let me know any problems you have and enjoy your Youtube browsing experience.


 Consider donating to further my tinkering


Places you can find me

Related Posts by Categories

0 comments:

Post a Comment