Playing Videos

From SingletonMillerWiki
Jump to: navigation, search


The GPU of the RPi is capable of many things, a quick google search will show many people playing videos of bunnys.

The best way to get video playing on the RPi is to use the specially compiled player OMXplayer.

Omxplayer makes use of the hardware accelerated capability to play H.264 nd MPEG4 encoded data.

Installing OMXplayer

Code the following steps at the CLI, enter your user password if prompted.

Download the installation package

wget http://seyrsnys.myzen.co.uk/rpi/omxplayer_0.0.1-arm.deb

It should return something like:

--2012-06-05 11:14:04--  http://seyrsnys.myzen.co.uk/rpi/omxplayer_0.0.1-arm.deb
Resolving seyrsnys.myzen.co.uk... 212.23.8.80
Connecting to seyrsnys.myzen.co.uk|212.23.8.80|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4568660 (4.4M) [application/x-debian-package]
Saving to: `omxplayer_0.0.1-arm.deb'

100%[======================================>] 4,568,660   1.40M/s   in 3.1s    

2012-06-05 11:14:07 (1.40 MB/s) - `omxplayer_0.0.1-arm.deb' saved [4568660/4568660]

To install the .deb package:

sudo dpkg -i omxplayer_0.0.1-arm.deb

Tell the RPi to try to fix an broken dependencies, this shouldn't return any errors.

sudo apt-get -f install

If the installation fails and your RPi returns information regarding other missing dependencies, make a note of them and install them using sudo apt-get <MissingDependencyName> .

The missing packages will vary depending on what other packages you've installed on you RPi, for me I needed to add:

sudo apt-get install libpcre3-dev libpcrecpp0 libva-dev libva-x11-1 libva1

Enable Audio

if your video has sound and you want to hear it, you need to enable it, see Enable Sound.

Playing Video

If you don't have a video to play, get the well used example from http://www.bigbuckbunny.org, select the correct resolution for your RPi monitor and the codec you want to test (hint: only mpeg4 and h.264 work]

omxplayer is a command line interface (CLI) programme only, use the following to play videos.

omxplayer -o <audiochannel> <videofilename>

You need to tell omxplayer which audio channel to use, the options are analogue/hdmi/passthrough.

analogue sound will come out the analogue audio jack, omitting the audiochannel option will also use this channel.

hdmi sound via the HDMI digital

passthrough untested, I've no idea what this will do.!!

Assuming you've downloaded the trailer with

wget http://download.blender.org/peach/trailer/trailer_1080p.mov
omxplayer -o hdmi trailer_1080p.mov

You should see the video play in fullscreen and the CLI showing.

file : trailer_1080p.mov reult 47 format mov,mp4,m4a,3gp,3g2,mj2 audio streams 1 video streams 1 chapters 0 subtitles 0
Video codec omx-h264 width 1920 height 1080 profile 77 fps 25.000000
Audio codec aac channels 8 samplerate 48000 bitspersample 16

Known Limitations

mpeg2 encoded files don't play. This is because in an effort to reduce costs the Raspberry Pi Foundation opted to limit the number of licensable technologies deployed in the RPi. This means that the processor doesn't have support for all video codecs.

If you want to play MPEG2 data on the RPi, the best bet is to use another programme to convert it. Transcoding mpeg2 to h.264 is unlikely to be sucessfull on the RPi itself.! [it might be worth testing it and recording the results at some point].

other video players

I'm unaware of any other video players that directly support the codecs in the RPi GPU.

mplayer has also been shown to play video.

References

  1. http://elinux.org/Omxplayer
  2. http://www.bethanycorcoran.co.uk/2012/05/16/raspberry-pi-video-playback/