Stops the video playing in Omxplayer from the Python code.
test.py
import subprocess
import time
#Play the video
command = 'omxplayer test.mov'
proc = subprocess.Popen(command,shell=True,stdin=subprocess.PIPE)
#--Processing from what(In this example, wait 10 seconds) --
time.sleep(10)
#-------------------------------------
#End processing
proc.stdin.write("q")
It uses that Omxplayer exits when it receives the q key input.
Recommended Posts