[Libav-user] asf (.wmv) muxer problem : duration is not good !

Gonzalo Garramuno ggarra13 at gmail.com
Fri Sep 28 16:04:17 CEST 2012


On 28/09/12 09:01, Stephane Debusne wrote:
> Hi all,
>
> i'm developing a graphical application using libav libraries. The 
> application typically takes one MJPEG avi file and a wav file as input 
> and output a muxed video file.
> I Know that ffmpeg.exe does it well but i have to do it inside my 
> application, without a call to ffmpeg.exe, so i use the libav librairies.
>
> A lot of things are working well and i can output avi files, or mov 
> files, with different codec.
> I can also output .wmv movies with AV_CODEC_ID_MSMPEG4V3 as video 
> codec and CODEC_ID_MWAV2 as audio codec, but in that case, the video 
> duration is not good. Typically, 50 dummy images are added and so the 
> duration is 2s too long.
> If i remove the audio stream, then the duration is ok. So the audio 
> stream seems to be involved in that problem.
>
> Before calling av_write_trailer(), the data in the video and audio 
> streams seems to be good. As an example, i've got a video with :
> video stream : pts: val = 12760 num=12 den =25  ; nb frames = 319
> audio stream : pts: val=12800 num=24000 den=48000 ; nb frames = 299
>
> but after writing the trailer, if i close and reopen the file, the 
> duration read by avlibs is 14805. not 12800...
> However, the movie plays well and it plays only for 12.8 seconds.
>
> If i do exactly the same thing, but in a avi file instead of a wmv 
> file (so the muxer is not the same), movie duration is ok.
>
> ==> I really think this is due to asf muxer, but can see why and 
> where. I think it can be solved because ffmpeg.exe has not this 
> problem, so i probably missed something somewhere.
> My intuition is that it is linked to time_base that is set to 1/1000 
> in asf files.
>
Hi, Stephane.

I found all sort of weird behavior encoding using mov format (ghost 
images, audio out of sync, etc).  Avi format works better.  I am still 
struggling with audio that shows up as chopped audio.  I would 
appreciate it if you would provide the source code to what you have.



More information about the Libav-user mailing list