fourchette
Posts: 5
Joined: Fri Dec 13, 2013 4:33 pm

[SOLVED] omxplayer does not work on second run

Fri Dec 13, 2013 4:48 pm

with raspbian freshly installed from NOOBS_v1_3_2.zip
if i start the following command

omxplayer -o hdmi myfile.avi
=> it plays just fine in 1080 both video and audio, it's fantastic !!

then if I press [ESC] to quit. i return to the console as expected.

then if i start again the same command, it gives the very same ouput:

Code: Select all

pi@raspberrypi ~ $ omxplayer -o hdmi /home/pi/Desktop/myvideo.avi 
Video codec omx-h264 width 1920 height 1080 profile 100 fps 30.000000
Audio codec pcm_s16le channels 2 samplerate 48000 bitspersample 16
Subtitle count: 0, state: off, index: 1, delay: 0
=> but then the video does not show up and i can not hear any sound. only console remains onscreen

Then if i press [CTRL+C] i get

Code: Select all

have a nice day ;)
pi@raspberrypi ~ $
if i repeat the same process again and again, video never plays again

I have to reboot the rpi to be able to play the video, works only the first time.

i read in http://elinux.org/Omxplayer
that maybe i should use the following command

Code: Select all

xrefresh -display :0
then in case i configure raspbian to start the graphic interface (choice selected in rasp-config)
=> in that case the above commands seems to work, but i have the same behaviour with omxplayer

in case i configure rpi to start only the command line
then i get an error claiming the display :0 does not exist

and just the same omxplayer refuses to play video without throwing error

it seems something stupid

what am i doing wrong ?
Last edited by fourchette on Wed Dec 18, 2013 1:42 pm, edited 1 time in total.

fourchette
Posts: 5
Joined: Fri Dec 13, 2013 4:33 pm

Re: omxplayer does not work on second run

Sun Dec 15, 2013 8:30 pm

should i try with another distribution ? raspbmc maybe ? any clue ?

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

Re: omxplayer does not work on second run

Mon Dec 16, 2013 6:41 am

Did you set gpu_mem to a higher value in config.txt?

gpu_mem=128

is recommended for playing 1080p video.
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

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

Re: omxplayer does not work on second run

Mon Dec 16, 2013 8:22 am

It could be that pressing ESC to quit is leaving a copy of omxplayer running. q is the key required to quit omxplayer

To find if omxplayer is still running open a second terminal window and type top -upi you may see omxplayer and omxplayer.bin
Pi Presents - A toolkit to produce multi-media interactive display applications for museums, visitor centres, and more
Download from http://pipresents.wordpress.com

fourchette
Posts: 5
Joined: Fri Dec 13, 2013 4:33 pm

Re: omxplayer does not work on second run

Tue Dec 17, 2013 6:13 pm

gkreidl wrote:Did you set gpu_mem to a higher value in config.txt?

gpu_mem=128

is recommended for playing 1080p video.
no i have not touched /boot/config.txt (but will try soon)
KenT wrote:It could be that pressing ESC to quit is leaving a copy of omxplayer running. q is the key required to quit omxplayer
=> good one. i had not thought of testing that, though i am pretty sure i tried leaving the video playing 'till then with the following oneliner

Code: Select all

while(true) ; do omxplayer -o hdmi /home/pi/Desktop/myvideo.avi ; done
i will check the "omxplayer still working in background" thing. however, in case it actually is the source of the issue, then it would be nice to have a "warn user in case another instance of omxplayer is already running" feature in omxplayer

as a side note, since i was stuck with rasbian, i tried with raspbmc and this simple python script does the job :

Code: Select all

pi@raspbmc:~$ cat /home/pi/.xbmc/userdata/autoexec.py
import sys
import xbmc

def RepeatVideo(file):
     playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
     playlist.clear()
     playlist.add(file)
     xbmc.Player().play(playlist)
     xbmc.executebuiltin("PlayerControl(RepeatOne)")

RepeatVideo("/home/pi/this_is_my_video.avi")

pi@raspbmc:~$
i will insist with raspbian though

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5551
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: omxplayer does not work on second run

Tue Dec 17, 2013 8:08 pm

I've just tried omxplayer -o hdmi <file>, and pressed ESC and tried again and it worked.

Does it fail for you with all files?

Have you tried "sudo apt-get update && sudo apt-get upgrade"?

fourchette
Posts: 5
Joined: Fri Dec 13, 2013 4:33 pm

Re: omxplayer does not work on second run

Wed Dec 18, 2013 1:42 pm

for the record : i am using raspbian installed with NOOB_1.3.2.zip, installed on a SD card (this one actually => http://www.amazon.fr/gp/product/B003VNK ... UTF8&psc=1)

so well i tried with [Q] key instead of [ESC] => same behavior (for the record, ps aux | grep omxplayer => no instance of omxplayer is running regardless of using [Q] or [ESC] to quit omxplayer)

i tried sudo apt-get update && sudo apt-get upgrade => does not change behavior (i had done it anyway a few days ago i think)

i tried with another video ==> in that case, the video plays just fine again and again and again, regardless of using [Q] or [ESC] (it is 1920x800)

so it seems to be something related to the first video i was playing which is 1920x1080 (and not 1920x800)

i tried

gpu_mem=128 in /boot/config.txt

==> then in that case both videos loop just fine

problem fixed

put with infinite loop in a play.sh script that i start with /etc/rc.local

works like a charm

topic closed. thanks you guys, good one gkreidl

fourchette
Posts: 5
Joined: Fri Dec 13, 2013 4:33 pm

Re: [SOLVED] omxplayer does not work on second run

Thu Dec 19, 2013 9:33 am

for the record,

using the same installation procedure with NOOBS 1.3.2
using the same Transcend SD card model (see amazon link above)

here are the time it takes between raspberry pi electrically powered on and the video showing on TV :

using raspbian (*) => 57sec
using raspbmc => 1m58sec

I have not measured the dead time between the end of the current video and next video being shown on screen

i'll stick to raspbian for the time being

(*) booting in console mode, i guess it could have an influence over results

Return to “Raspberry Pi OS”