I want a FFmpeg seeking command that fast and accurate. I found this.
The solution is that we apply -ss
for both input (fast seeking) and output (accurate seeking). But: If the input seeking is not accurate, how can we be sure that the seeking position is accurate?
For example: If we wanted to seek to 00:03:00, the command is something like:
ffmpeg -ss 00:02:30 -i <INPUT> ... -ss 00:00:30 <OUTPUT>
The first -ss
will seek to somewhere else, not 00:02:30
, say 00:02:31
. And after applying the second seek, the final result would be 00:03:01
- not what we want. Is that correct?
Where does the first -ss
seek to? Does it seek to the keyframe that is closest to 00:02:30
?
If so, here is my thought—correct me if I'm wrong: after first seeking, we get the timestamp of the result (in this example: 00:02:31
), then we apply second seeking with appropriate time, in this case 00:00:29
.
Question is: How do we get time stamp of the first seek result?