2016-05-13 16:58 GMT+03:00 Gonzalo Garramuño <[email protected]>: > On 11/05/2016 11:46 a.m., Anton Shekhovtsov wrote: > >> Hello, >> >> I used the following code: av_seek_frame(ctx, id, pos, >> AVSEEK_FLAG_BACKWARD); >> > In principle that should work for all files. How are you calculating pos > and selecting id? > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user >
Thanks for reply. I decided I can loop through index_entries and if there is no 'keyframes' apply AVSEEK_FLAG_ANY. When it comes to seeking I do not select id, I just have it. The code deals with single stream (audio), other streams are AVDISCARD_ALL. For pos something like this, but why do you ask? int64_t pos = (destination_sample-discard_samples) * time_base.den / time_base.num; where discard_samples is magic 1024 (experimentally derived corrupt samples) and time_base is product of stream time_base and sample_rate
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
