I hope anyone can help. I have built a Python script that uses a triggering action to start playing a video of a door opening. When triggered, it should start playing the video of a door opening, and after that, rewind and pause with the image of a closed door again (first part of the video)

I´m using Python, OMXPLayer, Raspberry Pi 3, Raspbian, all updated. To control OMXPlayer (the process is always active, I use a sub process and I send keystrokes from my python script to pause/play/rewind.

Basically what I do for each trigger 1. Resume 2. Wait for the length of the video 3. Rewind 4. Sleep for 250ms so the video restarts and next pause will show an image of the beginning of the video. 5. Pause

It works well using HDMI connected to my TV. But when conneting to my monitor with HDMI->DVI, the rewind part does not work. It seems like the rewind does not take place with the sleep of 250ms. Its like the sub process does not detect rewind, only pause. If I increase the sleep from 250ms to 600 ms it works but then it wont work when using HDMI.

And I am REALLY confused how the connection to the display makes this difference tv-service -s reports DVI CEA for the monitor and HDMI CEA för the TV TV is detected as 1080i and Monitor 1080P

This is how I initiate the player

self.moviePlayer = subprocess.Popen(['omxplayer','--no-osd'
,'-b','--       loop','/tmp/1.mov'],stdin=subprocess.PIPE,stdout=subprocess.PIPE

This is the code that is executed when triggered:

#Resume movie           
self.moviePlayer.stdin.write(bytes("p", "ascii"))

#Wait for the movie to almost finish...
time.sleep((currentMovieLength - 0.2))

#Previous chapter to rewind
self.moviePlayer.stdin.write(bytes("i", "ascii"))

#Wait 250ms before we pause so an actual image will be displayed when we pause
time.sleep(.25) #<- This delay needs to be increased to .60 when using DVI!!??
self.moviePlayer.stdin.write(bytes("p", "ascii"))

It seems like the sub process does not detect the rewind keystroke when the pause keystroke comes 250ms after when using DVI. But it works perfect using HDMI...I have tested different arguments with OMXPLayer like -y -z -r -d etc. I have tries disabling HDMI CEC, I have tested Setting HDMI_drive=2 which causes the monitor to clicker, hdmi boost, hdmi_safe etc etc with no luck

PLEASE help me

EDIT: After 8 hours of troubleshooting I posted this question. Then after additional 5 minutes I managed to find a solution. I added hdmi_force_edid_audio=1 to the config.txt forcing the Pi to believe all audio formats are supported. Now it works like a charm. Unbelievable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.