Pyomxplayer didn't work for me. And Pi Presents looks great, but is way more than I needed.
So I thought I would start this thread dedicated to just doing simple movie control.
The easiest I've found so far is using the Pexpect Python module:
Easy to install, and pure Python.
And here is some basic code to use it for movie control:
(tested on a 60 second long movie)
Code: Select all
import pexpect import time # Location of movie here flocal = '/home/pi/Fun/test.mp4' c = pexpect.spawn('/usr/bin/omxplayer ' + flocal) c.expect ('Video') # start paused time.sleep(.4) #.4 was the shortest time that worked on my Pi c.send ('p') # pause time.sleep(4) # wait 4 seconds c.send ('p') # play # jumps to start while playing. If paused before jump, seems longer time.sleep(4) c.send ('i') # jumps to start of movie time.sleep(4) c.send ('\x1b[C') # jump ahead 30 seconds time.sleep(4) c.send ('\x1b[D') # jump back 30 seconds # have not tested these commented lines ''' time.sleep(4) c.send ('\x1b[A') # seek +600 seconds time.sleep(4) c.send ('\x1b[B') # seek -600 seconds time.sleep(4) c.send ('=') # increase volume time.sleep(4) c.send ('-') # decrease volume ''' time.sleep(4) c.send ('q') # quit the player ''' 1 decrease speed 2 increase speed z show info j previous audio stream k next audio stream i previous chapter o next chapter n previous subtitle stream m next subtitle stream s toggle subtitles d decrease subtitle delay (- 250 ms) f increase subtitle delay (+ 250 ms) q exit omxplayer p / space pause/resume - decrease volume + / = increase volume left arrow seek -30 seconds right arrow seek +30 seconds down arrow seek -600 seconds up arrow seek +600 seconds'''
Hopefully omxplayer will get better in future versions.
jump to a specific frame and play or pause
specific playback speed and direction
My current question: is there any way to stop the black screen that occurs for a moment when seeking or changing chapters? It is distracting.
Best would be if it would hold its last frame until the next one is shown.
Also, is there a good way to jump from the movie to an image, and then maybe back?
Thank you : )