I have a video with actual total length over 10 seconds. But when I opened it with VFormatContext.duration, it showed that it is only 10 seconds long. And then I tried to get the pts of final frame via seek, but unfortunately, the got_picture is always 0. <br><br>int err;<br>int ret = av_seek_frame(video_in, -1, INT64_MAX, AVSEEK_FLAG_FRAME);<br>if (ret < 0)<br>{<br>    return -1;<br>}<br>avcodec_flush_buffers(video_dec);<br><br>err = av_read_frame(video_in, &pkt);<br>if(err == AVERROR(EAGAIN) || err < 0)<br>{<br>    return -1;<br>}<br>if (pkt.stream_index == st_video_index)<br>{<br>    int got_picture = 0;<br>    avcodec_decode_video2(video_dec, &frame, &got_picture, &pkt);<br>    if (got_picture)<br>    {<br>        pts = frame.best_effort_timestamp * AV_TIME_BASE_LL * video_stream->time_base.num / video_stream->time_base.den;<br>    }<br>}<br>Is there anybody that has any idea to get the actual total length of the video? Thanks in advance.<br>