<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>After some more digging I found out that my videos in question have incorrect starting AVFrame.pkt_dts coded</p><p class=MsoNormal>and start at around 0.5 seconds. Which explains my 13 frame discrepancy when calculating current_frame.</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I now have a frame_offset that I calculate if I detect this discrepancy with </p><p class=MsoNormal>frame_offset = (pFrame->pkt_dts/pFrame->pkt_duration);</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>But is this really the best way to do that?</p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>And event with corrected frames, my </p><p class=MsoNormal>av_seek_frame(ptrFormatCtx_, -1, seekTarget, AVSEEK_FLAG_FRAME | AVSEEK_FLAG_BACKWARD); </p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>still won’t seek to first I-Frame backward. Is this because of incorrect pkt_dts that start well into a file?</p><p class=MsoNormal>And also what do I generally do when this happens?</p></div></body></html>