VLC: "avcodec error: more than 5 seconds of late video"

Igor R. picture Igor R. · Nov 18, 2012 · Viewed 9.3k times · Source

I'm muxing mpeg4 video to avi container. The video stream is ~4fps, so I set AVCodecContext time_base to 1/4 (formatContext->streams[0]->codec->time_base...) , and then rescal each frame timestamp, because the original time-stamps are in milliseconds. The resulting value I assign to a packet pts and dts.

When I play this avi with VLC, the video is not smooth, and I get the following message repeatedly:

avcodec error: more than 5 seconds of late video -> dropping frame (computer too slow ?)

Is there something wrong with the above pts/dts calculation?

The following table demonstrates how the timestamps are rescaled (original->rescaled)

stream: 0 1329471005111->1
stream: 0 1329471005348->2
stream: 0 1329471005588->3
stream: 0 1329471005828->4
stream: 0 1329471006068->5
stream: 0 1329471006308->6
stream: 0 1329471006551->7
stream: 0 1329471006788->8
stream: 0 1329471007028->9
stream: 0 1329471007268->10
stream: 0 1329471007508->11
stream: 0 1329471007748->12
stream: 0 1329471007988->13
stream: 0 1329471008228->14
stream: 0 1329471008468->15

Answer