[Libav-user] How to get a video with the actual total length?
leachong at qq.com
Thu Jun 5 11:02:41 CEST 2014
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.
int ret = av_seek_frame(video_in, -1, INT64_MAX, AVSEEK_FLAG_FRAME);
if (ret < 0)
err = av_read_frame(video_in, &pkt);
if(err == AVERROR(EAGAIN) || err < 0)
if (pkt.stream_index == st_video_index)
int got_picture = 0;
avcodec_decode_video2(video_dec, &frame, &got_picture, &pkt);
pts = frame.best_effort_timestamp * AV_TIME_BASE_LL * video_stream->time_base.num / video_stream->time_base.den;
Is there anybody that has any idea to get the actual total length of the video? Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user