How To – Watch YouTube on the Raspberry Pi

Here are 2 options for you to choose from both are very small installations so why not get them both.

NEW – Updated documentation for YouTube clients

Thanks to CalumJEadie follow either links below for updated install instructions March 2013

yt documentation – https://github.com/CalumJEadie/yt/blob/ … README.rst

raspytube documentation – https://github.com/CalumJEadie/raspytub … /README.md

Raspytube an OpenVG front-end for youtube-dl

This was posted here by bbond007

Both setups will need youtube-dl once installed you won’t need to install it again.

Automatic install

wget --no-check-certificate https://github.com/bbond007/raspytube/raw/master/install.sh -O - | sh

Installing using ultra-simple binary-only install.

# Install dependancies
echo "> Installing dependancies."
sudo apt-get install omxplayer wget libjpeg8 youtube-dl

# Updating youtube-dl to make sure it's the latest version.
echo "> Updating youtube-dl."
sudo youtube-dl -U

# Download binary
echo "> Downloading raspytube binary."
sudo wget https://github.com/bbond007/raspytube/raw/master/raspytube.bin -O /usr/local/bin/raspytube.bin
sudo chmod a+x /usr/local/bin/raspytube.bin

# Launch raspytube!
echo "> Launching raspytube!"
raspytube.bin

Installing from source

wget https://github.com/rg3/youtube-dl/raw/2012.02.27/youtube-dl
chmod +x youtube-dl
sudo mv youtube-dl /usr/bin/youtube-dl

You need to update youtube-dl this has to be done a few times go ahead and do this if you have an older version or just downloaded it.

sudo youtube-dl -U
This will output
Updating to latest version...
Updated youtube-dl. Restart youtube-dl to use the new version.

Run the update again
sudo youtube-dl -U
This will output

Hi! We changed distribution method and now youtube-dl needs to update itself one more time.
This will only happen once. Simply press enter to go on. Sorry for the trouble!
From now on, get the binaries from http://rg3.github.com/youtube-dl/download.html, not from the git repository

Done! Now you can run youtube-dl.

sudo apt-get update
sudo apt-get install build-essential git-core libjpeg8-dev
cd /opt/vc/src/hello_pi/libs/ilclient
make
cd ~
git clone https://github.com/bbond007/raspytube
cd raspytube
make
./raspytube.bin

Controls
s - search (edit existing txt)
n - nex search
cursor down - next record
cursor up - prev record
cursor right- get next 10 results
cursor left- get prev 10 results
Q or ESC - exit screen/proram
F - set youtube-dl format
P- toggle between OMXPlayer and MPlayer
H- toggle between HDMI/Local audio output
I- more information on selected record
X- toggle between software (libjpeg) and hardware (OMX) jpeg decoding.

YT a command line interface to YouTube:

The install is found here

In short from Terminal follow these steps. This works absoulutely well without even getting to the desktop and probably will run better without all the overhead that you’ll get from startx.

Default settings will output audio to HDMI see below for tips on how to change this.

sudo apt-get install python-setuptools
wget http://pypi.python.org/packages/source/w/whitey/whitey-0.2.tar.gz
tar -zxvf whitey-0.2.tar.gz
cd whitey-0.2.
sudo python setup.py install

Skip this if you already have youtube-dl

wget https://github.com/rg3/youtube-dl/raw/2012.02.27/youtube-dl
chmod +x youtube-dl
sudo mv youtube-dl /usr/bin/youtube-dl

You need to update youtube-dl this has to be done a few times go ahead and do this if you have an older version or just downloaded it.

sudo youtube-dl -U
This will output
Updating to latest version...
Updated youtube-dl. Restart youtube-dl to use the new version.

Run the update again
sudo youtube-dl -U
This will output

Hi! We changed distribution method and now youtube-dl needs to update itself one more time.
This will only happen once. Simply press enter to go on. Sorry for the trouble!
From now on, get the binaries from http://rg3.github.com/youtube-dl/download.html, not from the git repository

Done! Now you can run youtube-dl.

Now to see some YouTube vids.

yt --player omxplayer

To verify you have the latest youtube-dl run sudo youtube-dl -U until it says it is up to date.

The default audio out is hdmi this is in __init__.py you may have to edit this fle if you wish to use the 3.5mm audio jack instead.

cd /whitey-0.2/src/yt

sudo nano __init__.py

CTRL+W and search hdmi it will take you to:

def play_url_omxplayer(url):
player = subprocess.Popen(
['omxplayer', '-ohdmi', url.decode('UTF-8'.strip()]

Try changing that line to:
['omxplayer', url.decode('UTF-8'.strip()]

Controls are:

1-9 to select the first 9 videos
v to choose a higher number
p to pause and play a video
q to quit playing the video and q again to exit yt
[ to see more videos and ] to go back a page
s to search
u to see more videos from a username seen on the right Tin orange

Troubleshooting:

The video can take some time to load wait before trying any commands

My first attempt at this was on a 256mb Rev 2. board I had my memory_split at 32 and this was too low I was only clocked at 800mHz I was also using an image from back in October that was updated with sudo apt-get update && sudo apt-get ugrade on a weekly basis.

Run sudo raspi-config and make sure you have 128 in your memory_split settings your overclocking is up to you. I also had to reboot. On a 512 board I didn’t need to reboot it was running December’s image.

I can run yt from the desktop on the 256mb board but do notice a bit of lag when starting the program from terminal or loading videos. It’s still watchable.

Many thanks to the OP for posting this info on the forums.

Here’s a short shot of it in action: