[FFmpeg-devel] [PATCH] avformat: add some documentation about seeking

Michael Niedermayer michaelni at gmx.at
Wed May 14 06:54:39 CEST 2014


On Tue, May 13, 2014 at 09:35:50PM -0700, Aman Gupta wrote:
> >> + *     // seek forward to the next keyframe in this stream
> >> + *     av_seek_frame(ic, pkt.stream_index, pkt.dts, 0);
> >
> > wont that seek to the same frame again ?
> 
> It works in my experience, but I agree that it's ambiguous.
> 
> Does pkt.dts+AV_TIME_BASE make more sense?

.pts instead of .dts but you also have to check
whichever you use to be != AV_NOPTS_VALUE

but even then i dont think this is completely safe

just because you ask for a keyframe at or after 4sec in the movie
doesnt mean that this can be satisfied exactly that way, you very
well could end up seeking to 3.5 sec because thats the only random
access point before the target keyframe at 4.1 sec and then there
might be another keyframe, lets say at 3.8sec

and thats not considering subtitle streams which way require going
furher back to have all data available at the requested target of 4.0

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140514/bd699155/attachment.asc>


More information about the ffmpeg-devel mailing list