Watch youtube on the Raspberry Pi

January 05, 2014

The raspberry pi, however awesome, does not have the power to run youtube well in the default distro. Even if you don’t have X installed, a simple script allows you to take a youtube video’s URL and instantly start streaming its video!

To use this, you will have to get a working omxplayer and the awesome youtube-dl library. If you are using debian, they should be available using apt-get.

#!/bin/bash
#Different formats are: 18-360p, 22-720p, 37-1080p
omxplayer -o hdmi $(youtube-dl -g "$1") #Standard def
#omxplayer -o hdmi $(youtube-dl -f 22 -g "$1") #720
#omxplayer -o hdmi $(youtube-dl -f 37 -g "$1") #1080

Voila, instant streaming youtube videos!