This can be useful for games which are launched from the command line and also for other multimedia programs like video players. OMXPlayer is a command line video player for the Raspberry Pi. It was originally developed as a testbed for the Raspberry Pi implementation of XBMC, but it works equally well as a standalone video player.
To install the player, use the following command:
To launch it, call “
omxplayer” along with the filename of the video you want to play:
The player will likely take a few seconds before any video is shown as the Raspberry isn’t the fastest computer in the world and the video player needs to perform some initial processing of the video file (e.g. it needs to work out which codecs are used in the file and so on).
Once the video is playing, you can control the playback using the keyboard. Use SPACE to pause/resume, right arrow to jump forward 30 seconds, up arrow to jump forward 10 minutes, + or – to change the volume, and q to quit. Here is a full listing of the keyboard controls:
- 1 decrease speed
- 2 increase speed
- < rewind
- > fast forward
- z show info
- j previous audio stream
- k next audio stream
- i previous chapter
- o next chapter
- n previous subtitle stream
- m next subtitle stream
- s toggle subtitles
- d decrease subtitle delay (- 250 ms)
- f increase subtitle delay (+ 250 ms)
- q exit omxplayer
- p / space pause/resume
- – decrease volume
- + / = increase volume
- left arrow seek -30 seconds
- right arrow seek +30 seconds
- down arrow seek -600 seconds
- up arrow seek +600 seconds
You may find that the rewind and fast forward controls don’t perform as expected. During my testing, I found that the on screen display (OSD) reported that the playback speed had been changed, but the video continued to run at the same rate.
OMXPlayer tends to output a lot of information onto the command line. Because the video is overlaid upon the command line, this extra text can be quite distracting. To turn the background black and hide the extra output, invoke the player with the “
By default, the sound is sent to the Raspberry Pi’s audio jack, however HDMI is capable of carrying sound as well as video. So if your Pi is connected to a TV (rather than a monitor) then you can send the audio via HDMI using the “
-o hdmi” option.
The Raspberry Pi isn’t powerful enough to perform video decoding in software. This means that although it can decode a range of popular video formats, it won’t work with less popular codecs like DivX 3.0. It can play H.264 and MPEG-4 videos in 1080p HD as well as MJPEG, VP6, VP8 and OGG Theora videos. These last four are limited to SD, as they aren’t fully supported in hardware, and the decoding is performed in software with help from the GPU. If you need to play MPEG2 or VC-1 (used in some Blu-ray discs), you need to buy additional video codec licenses from the Raspberry Pi Foundation online shop.
If you do get an error related to unknown or unsupported codecs, then the chances are that OMXPlayer can’t playback the video. Your best move in this situation would be to re-encode the video on a PC using H.264. You can ask OMXPlayer to display information about a video file using the
The output can help you determine if the video is compatible with the Raspberry Pi.
If you have tried OMXPlayer, how are you using it? As a media player connected to your TV? With a projector? Please share your story in the comments below.