User avatar
Posts: 14
Joined: Sun Dec 30, 2012 2:11 pm

Is it possible to run 'omxplayer' from Python?

Sun Jun 16, 2013 5:58 pm

I am developing an application for a heritage railway museum, where the user selects one of a set of video clips from a menu using a keypad. Is it possible to embed a call to omxplayer within the Python code. The alternative is to read the return value from the Python code in a script and respond appropriately, but this seems to be a bit clunky!

Thanks in advance


Posts: 143
Joined: Tue Jan 08, 2013 10:35 am
Contact: Website

Re: Is it possible to run 'omxplayer' from Python?

Sun Jun 16, 2013 6:31 pm

try using search on the forums here, there's a ton of people that have done the same thing already. This is the first good result I found: ... er#p220358
and this:
If it isnt smoking and blown into pieces, it's not pushed far enough yet. :P

Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Is it possible to run 'omxplayer' from Python?

Mon Jun 17, 2013 10:06 am

you can use

Code: Select all

import os

call(["mplayer", "-vo", "fbdev2:/dev/fb1", "-x", "128", "-y", "160", "-zoom", "VfE_html5.mp4"])

Above is an an example for testing the screens I sell. This is for mplayer, but the process should be the same. You won't need the fdev2:/dev/fb1 bit ;-)

Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):

Posts: 758
Joined: Tue Jan 24, 2012 9:30 am
Location: Hertfordshire, UK
Contact: Website

Re: Is it possible to run 'omxplayer' from Python?

Tue Jun 18, 2013 8:24 pm

I'm currently working on an extension to my Pi Presents (see sig) which will allow just this ( assuming the keypad looks like a keyboard and gives alphanumeric character codes. If you want to write your own than pyomxplayer is a good way to go.

Note however that pyomxplayer will not work with the current omxplayer, the fix is simple as it just a matter of missing out the few lines that read the track details.
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from

Return to “Python”