2

I'd like to control omxplayer seeking with frame precision from an existing instance with python.

I have seen this that I think is the way to go: open via python subprocess an instance, have a keyboard polling loop and echoing commands to the shell that is running the omxplayer instance.

Everything ok but I can not find the ability of frame-precision seeking.

Anyone can give me some suggestions?

nkint
  • 215
  • 3
  • 9

2 Answers2

3

tldr; use VLC + e.

Can not be done using omxplayer

I am kind of stating the obvious, but it looks like it cannot be done with omxplayer. A quick search results in the following the keyboard shortcuts that are related but do not offer a solution.

Left Arrow  Seek -30
Right Arrow Seek +30
Down Arrow  Seek -600
Up Arrow    Seek +600

Also, starting up the process at a specific frame is not possible, because it is limited to precision in seconds.

Usage: omxplayer [OPTIONS] [FILE]
Options :
# omitted other options for brevity
-l / --pos  start position (in seconds)

Can be done using VLC!

I just stumbled upon the topic VLC Hardware acceleration on this RP Exchange. This enables you to run VLC on your Raspberry Pi. Since VLC features frame-by-frame navigation (since 2008) you are saved, just press e!

Command line options

Just like omxplayer, there are also keyboard shortcuts available - and configurable at command line startup - for VLC but again only with seconds as time unit.

Jump sizes:
--extrashort-jump-size=<integer [-2147483648 .. 2147483647]>
Very short jump length, in seconds.

--short-jump-size=<integer [-2147483648 .. 2147483647]>
Short jump length, in seconds.

--medium-jump-size=<integer [-2147483648 .. 2147483647]>
Medium jump length, in seconds.

--long-jump-size=<integer [-2147483648 .. 2147483647]>
Long jump length, in seconds.

Since this doesn't really work, you could also start VLC --start-time={x} where x is the amount of milliseconds. This starts the video on the defined point in time.

M. Mimpen
  • 191
  • 1
  • 5
1

For anyone who comes across this later, you can start omxplayer from any point with the -l command. While the help says seconds, internally it multiplies whatever you put in by 1000.0f. So if you want to specify a start of 10 milliseconds just say -l 0.10

Max Healey
  • 11
  • 2