[FFmpeg-devel] [PATCH] fix muxing pcm in MOV when using avcodec_encode_audio()

Michael Niedermayer michaelni at gmx.at
Fri Feb 17 16:27:39 CET 2012


On Thu, Feb 09, 2012 at 10:39:09AM -0500, Andrew Wason wrote:
> Muxing pcm audio in MOV using avcodec_encode_audio() is failing
> because avcodec_encode_audio() returns an incorrect packet size of 4
> bytes. This can be reproduced by modifying the sample
> ffmpeg/doc/examples/muxing.c to encode PCM, see attached patch
> muxing-test.diff
> 
> I git bisected and commit 89ddff92a385 is the one that broke this. In
> mov_write_header() if st->codec->frame_size <= 1 it sets it to 1. Then
> avcodec_encode_audio() sets frame->nb_samples = avctx->frame_size, and
> frame->nb_samples of 1 is used to compute a packet size of 4 bytes.
> 
> Attached patch mov-pcm-framesize.diff changes mov_write_header() to
> leave st->codec->frame_size as is instead of forcing it to 1.
> 
> Andrew

>  muxing.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> adff863a4ce5c7ed8a7a8fa7eb60b69959a4aad2  muxing-test.diff
> diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c

applied, thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120217/78704df8/attachment.asc>


More information about the ffmpeg-devel mailing list