[FFmpeg-devel] problem copying audio stream in mov or mp4 container

Luca Abeni lucabe72
Thu Jul 9 13:16:39 CEST 2009


Hi all,

it seems that mov_write_header() fails if codec->frame_size is
not set:
luca at nowhere:/tmp/F$ libavformat/output-example test.avi
Output #0, avi, to 'test.avi':
     Stream #0.0: Video: mpeg4, yuv420p, 352x288, q=2-31, 400 kb/s, 90k tbn, 25 tbc
     Stream #0.1: Audio: mp2, 44100 Hz, 2 channels, s16, 64 kb/s
luca at nowhere:/tmp/F$ ./ffmpeg -i test.avi -acodec copy test.mov
FFmpeg version git-929ef81, Copyright (c) 2000-2009 Fabrice Bellard, et al.
   configuration:
   libavutil     50. 3. 0 / 50. 3. 0
   libavcodec    52.32. 0 / 52.32. 0
   libavformat   52.36. 0 / 52.36. 0
   libavdevice   52. 2. 0 / 52. 2. 0
   libswscale     0. 7. 1 /  0. 7. 1
   built on Jul  9 2009 08:31:03, gcc: 4.3.2
Input #0, avi, from 'test.avi':
   Duration: 00:00:05.01, start: 0.000000, bitrate: 748 kb/s
     Stream #0.0: Video: mpeg4, yuv420p, 352x288 [PAR 1:1 DAR 11:9], 25 tbr, 25 tbn, 25 tbc
     Stream #0.1: Audio: mp2, 44100 Hz, 2 channels, s16, 64 kb/s
[mov @ 0x95722a0]track 1: codec frame size is not set
Output #0, mov, to 'test.mov':
     Stream #0.0: Video: mpeg4, yuv420p, 352x288 [PAR 1:1 DAR 11:9], q=2-31, 200 kb/s, 25 tbn, 25 tbc
     Stream #0.1: Audio: mp2, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
   Stream #0.1 -> #0.1
Could not write header for output file #0 (incorrect codec parameters ?)

So, what's the correct procedure to copy an audio stream in .mov or
.mp4 files (without re-encoding it: frame_size is correctly set when
encoding)?


			Thanks,
				Luca



More information about the ffmpeg-devel mailing list