Inchy
Posts: 2
Joined: Wed Nov 14, 2012 1:05 pm

Script to play video using omxplayer

Wed Nov 14, 2012 1:42 pm

Hi all,

I am new to Python, so please excuse my lack of knowledge.
I have managed to play a video in omxplayer using the following command in terminal:

omxplayer test.mov

Which play the test.mov video file located in /home/pi

I would now like to create a script using geany, which will do exactly the same thing.

Thank you in advance for your help.

Craig

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: Script to play video using omxplayer

Thu Nov 22, 2012 1:33 am

if you want to wrap it in python I think you would have to use something like "exec".
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

TillM
Posts: 36
Joined: Wed Oct 17, 2012 7:54 am

Re: Script to play video using omxplayer

Sat Nov 24, 2012 1:09 am

This should work and get you started.

Code: Select all

#!/usr/bin/env python
# -*- coding: utf-8 -*-

movie_path = '/path/to/your/file.mpg'

from subprocess import Popen

omxp = Popen(['omxplayer',movie_path])

User avatar
pstorey
Posts: 52
Joined: Wed Sep 19, 2012 11:14 am

Re: Script to play video using omxplayer

Sat Nov 24, 2012 7:56 pm

Have a look at KenT's tboplayer

https://github.com/KenT2/tboplayer

The player uses pyomxplayer which interfaces with omxplayer with the gui being Tinker.

I am working on a wxPython gui wrapper but it's not finished yet and won't be to KenT's coding standard.

Hope this helps..

Cheers

Inchy
Posts: 2
Joined: Wed Nov 14, 2012 1:05 pm

Re: Script to play video using omxplayer

Fri Jan 04, 2013 5:07 pm

Thank you all for your help :-)

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

Re: Script to play video using omxplayer

Mon Jun 17, 2013 8:36 pm

Thanks, works great, once I copied the code correctly :D

Smaker
Posts: 20
Joined: Wed Jan 22, 2014 4:04 pm

Re: Script to play video using omxplayer

Fri Jan 24, 2014 11:32 am

Ya... this coding playing video good

Code: Select all

#!/usr/bin/env python
# -*- coding: utf-8 -*-

movie_path = '/path/to/your/file.mpg'

from subprocess import Popen

omxp = Popen(['omxplayer',movie_path])
But How to make it full screen of My TV without desktop shown side of video ;)

gkreidl
Posts: 6355
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Script to play video using omxplayer

Fri Jan 24, 2014 12:58 pm

Smaker wrote: But How to make it full screen of My TV without desktop shown side of video ;)
Read my answer to your separate posting.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

ebinmj
Posts: 1
Joined: Sat Jan 28, 2017 10:49 am

Re: Script to play video using omxplayer

Sat Jan 28, 2017 10:54 am

I have the same problem. My desktop backround is always shown while playing. I need a script to avoid it. Please help ....

Raspi2User
Posts: 17
Joined: Mon Aug 20, 2018 9:55 am

Re: Script to play video using omxplayer

Thu Aug 30, 2018 8:20 am

can i run this script on my MPI cluster 3 nodes?

DirkS
Posts: 10442
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Script to play video using omxplayer

Thu Aug 30, 2018 8:23 am

Raspi2User wrote:
Thu Aug 30, 2018 8:20 am
can i run this script on my MPI cluster 3 nodes?
Why not just try it...

Raspi2User
Posts: 17
Joined: Mon Aug 20, 2018 9:55 am

Re: Script to play video using omxplayer

Thu Aug 30, 2018 8:58 am

when i run this code on putty mpiexec -f machinefile -n 3 python cluster.py, only one node works, run video not other 2. help

Return to “Python”