[Libav-user] Muxing problems: audio extending too far

Gonzalo Garramuno ggarra13 at gmail.com
Thu May 29 18:08:57 CEST 2014

I have added muxing to my gpl viewer and found some issues.

With saving vcodec mpeg4, acodec libmp3lame, my video works fine and 
audio is in sync.
However the audio (without any sound) extends past the video for several 
hundred frames.  The flushing of the audio seems to create this.  If I 
don't flush the audio (calling multiple times avcodec_encode_audio2 with 
the NULL pointer), I get missing audio.

When playing back the resulting video sometimes (and only sometimes) 
ffmpeg complains (multiple times):

Trying to remove 1839 samples, but the queue is empty

1839 samples is exactly the size of a AVCodecContext->frame_size 
I was wondering if someone saw this before or if someone has an idea on 
how to debug the problem of the audio extending too far.

More information about the Libav-user mailing list