I have created a video player using the ffmpeg libraries, but want to know if the same is possible using ffmpeg.exe and piping, specifically the seeking part. Is it possible to send seek command to a running ffmpeg.exe instance? Such a command is not present in the help but it does show the 'c' command which can be used to send commands to filters. I cannot find any further documentation however on how to address filters this way, all examples assuming command line parameters, nor if a filter can be used to seek in video.
Actually a seek command is kind of documented in the ffmpeg documentation:
Both
movie
andamovie
support the following commands:
seek
Perform seek using "av_seek_frame". The syntax is:seek stream_index|timestamp|flags
stream_index
: If stream_index is -1, a default stream is selected, and timestamp is automatically converted from AV_TIME_BASE units to the stream specific time_base.timestamp
: Timestamp in AVStream.time_base units or, if no stream is specified, in AV_TIME_BASE units.flags
: Flags which select direction and seeking mode.
get_duration
Get movie duration in AV_TIME_BASE units.
I have tried running a command like this:
ffmpeg -f lavfi -i 'movie=filename=myvid.mp4' -codec:v libx264 -an -f mpegts - > /dev/null
Then I press c
and enter the command all -1 seek 0|3|0
, but no matter which combination I try, I get back the same error Command reply for stream 0: ret:-78 res:
I've also tried this command, but it gives the same error when trying to seek:
ffmpeg -i myvid.mp4 -codec:v libx264 -an -f mpegts - > /dev/null
There is very little information about the seek operation on the internet, but I managed to find this: http://ffmpeg.org/pipermail/ffmpeg-devel/2013-September/148070.html
Here he says that:
the "lavfi" demuxer has its own private filtergraph and provides no means (that i know of) to inject command from the outside of this filtergraph into it.
So all this indicates that may or may not be possible to seek on a running ffmpeg instance. At least those who may have succeeded with it have kept how to do it to themselves.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With