[FFmpeg-user] Reducing seek time when start time offset (-ss) is large

Nicolas George nicolas.george at normalesup.org
Sat Aug 11 00:27:04 CEST 2012


Le quartidi 24 thermidor, an CCXX, Robert Krüger a écrit :
> I suggested this:
> 
> https://groups.google.com/forum/?fromgroups#!topic/ffmbc-discuss/w6w9Yuo6_oo%5B1-25%5D
> 
> on the ffmbc list for the exact same problem (if I understand your
> posting correctly). Not a pretty solution but for use cases like yours
> (and mine) it does the job. I was going to make a patch against ffmpeg
> before posting this here but have not had time yet to do it but I'll
> try to do that in the next few days. I hope this is at least going to
> get a discussion about this started because I think this may be a
> practical problem many people have.

Let me recap, and correct me if I am wrong:

-ss before -i uses seeking, and is inaccurate since it seeks only to
keyframes; -ss after -i uses skipping and is very slow, you want a new
option that does most of the work by seeking and then skips from the last
keyframe until the target time.

I do not think it is necessary.

The thing is -ss seeks with the "backwards" flag: if there is no keyframe
exactly at the requested time, it will look for a keyframe before it, not
after. On the other hand, the timestamps are adjusted according to the
target time, not the found keyframe, which means that timestamps will
usually begin slightly negative.

Which leads to a solution:

ffmpeg -ss time -i file -ss 0 output

A few tests I ran some days ago shows it is not exactly equivalent to
"ffmpeg -i file -ss time output", but only up to one or two frames. I must
run some more test to find out why exactly.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20120811/2c12fa70/attachment.asc>


More information about the ffmpeg-user mailing list