[Ffmpeg-devel] -acodec copy an AMR 3gp file breaks

Baptiste Coudurier baptiste.coudurier
Mon Dec 11 14:22:28 CET 2006


Hi

Rudolf Schwab wrote:
> Hello,
> 
> Using ffmpeg with option '-acodec copy' to transcode from a h263 encoded
> 3gp file with AMR encoded audio to another fails with error
> 'sample duration is not set' for the audio track (see [1] below).
> It works fine when omitting the '-acodec copy' flag which lets ffmpeg
> actually encode and decode the audio frames (see [2] below).
> 
> Some investigation:
> 
> I have checked in the source and it seems that function mov_write_header in
> libavformat/movenc.c breaks in line 1523 since the frame_size of the audio
> stream is set to 0. The codec context's frame_size field is initialized
> by the
> encoder/decoder initialization routines in libavcodec/amr.c to 160
> once the encoders and decoders are actually allocated (which do not seem
> to be allocated when using option '-acodec copy').
> 

That is right, currently you cannot copy audio stream from mov to mov.
For muxing audio correctly, muxer needs enc->frame_size.

Also, for AMR, libavcodec needs a AVParser, to extract exactly one AMR
frame from 3gp/mov chunk, and parser could detect and set avctx->frame_size.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list