[FFmpeg-devel] [PATCH 1/2] avformat/avformat: Introduced `AVInputFormat.read_timestamp2` to fix keyframe seeking for formats that rely on `read_timestamp` for seeking
Michael Niedermayer
michael at niedermayer.cc
Tue Sep 3 14:39:25 EEST 2019
On Mon, Sep 02, 2019 at 01:01:50PM -0700, Darren Mo wrote:
> That’s true. However, I think your approach would produce incorrect results when `AVSEEK_FLAG_BACKWARD` is used.
>
> The bisection would find the frame just before the target time and then we would search for the next keyframe, which would be after the target time. Instead, we want to return the keyframe just before the target time.
>
> Any ideas on how to do that more efficiently?
stepwise searching for the keyframe in forward direction while taking steps
backward
......................k.K.................v-start
A--->
B------->
C-------->k-K-->
there is code somewhere in git to do something similar already
this should be faster than always searching for keyframes during bisection as
long as the initial step is reasonable in relation to the keyframe distance
also as both approaches are quite similar one could even choose which
way to do it depending on the expected cost of seeks and bandwidth and
if some statistics on the keyframe distance are known and or the
search direction
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct answer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190903/5ccb95c9/attachment.sig>
More information about the ffmpeg-devel
mailing list