[Libav-user] When Seeking to specific frame with AVSEEK_FLAG_BACKWARD, libav will seek to exact specified frame

dario.maljur at solutions4media.com dario.maljur at solutions4media.com
Wed May 6 11:20:24 EEST 2020


Answering my own message the second time because Win10 default mail client
cut off my text.

 

After some more digging I found out that my videos in question have
incorrect starting AVFrame.pkt_dts coded

and start at around 0.5 seconds. Which explains my 13 frame discrepancy when
calculating current_frame.

 

I now have a frame_offset that I calculate if I detect this discrepancy with


frame_offset = (pFrame->pkt_dts/pFrame->pkt_duration);

 

But is this really the best way to do that?

 

And event with corrected frames, my 

av_seek_frame(ptrFormatCtx_, -1, seekTarget, AVSEEK_FLAG_FRAME  |
AVSEEK_FLAG_BACKWARD); 

 

still won't seek to first I-Frame backward. Is this because of incorrect
pkt_dts that start well into a file?

And also what do I generally do when this happens?

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200506/bea752a0/attachment.html>


More information about the Libav-user mailing list