Opened 10 years ago
Last modified 10 years ago
#3827 new enhancement
Provide an option to quickly seek by a number of frames
Reported by: | Ridley Combs | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | nfxjfg@googlemail.com | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
There are some cases where a user has the start and end frame numbers for their desired transcode, but not the corresponding timestamps. It'd be convenient to have an option analogous to -ss
(as an input option) that skipped to the given frame number.
As most formats don't have frame numbers, this would require the file to be read all the way up to the seek point to count frames, but shouldn't necessitate *decoding* video until the first keyframe before the seek point. This would likely involve reading up to the given frame, then acting as if -ss
was given with that frame's timestamp (i.e. index-seek to nearest keyframe, then insert trim filters).
Change History (5)
comment:1 by , 10 years ago
comment:4 by , 10 years ago
Cc: | added |
---|
Seeking to an exact frame number is impossible (edit: without decoding the file from the start), unless the file format has a complete index.
But API extensions to know _if_ the index is complete and frame exact, and the ability to use it, would be nice.
comment:5 by , 10 years ago
Component: | ffmpeg → undetermined |
---|
avformat_seek_file()
has an almost unused flag calledAVSEEK_FLAG_FRAME
that could be used for this purpose if implemented properly. Subtitles use that (seeff_subtitles_queue_seek()
) because they actually have a complete index. Assuming we do an index-pass, that might be realizable with some demuxers supporting the load of that index.Note that your proposed method would work only if 1 packet = 1 video frame, which AFAIK is not always true.