[FFmpeg-cvslog] movenc: leave st->codec->frame_size as is instead of forcing it to 1.

Andrew Wason git at videolan.org
Fri Feb 17 17:00:50 CET 2012


ffmpeg | branch: master | Andrew Wason <rectalogic at rectalogic.com> | Fri Feb 17 16:24:18 2012 +0100| [a0e44414dfc4ab2d9aa5fdd207fa6ea5f39658e8] | committer: Michael Niedermayer

movenc: leave st->codec->frame_size as is instead of forcing it to 1.

Muxing pcm audio in MOV using avcodec_encode_audio() was 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 ML 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.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0e44414dfc4ab2d9aa5fdd207fa6ea5f39658e8
---

 libavformat/movenc.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2c96f34..1f56fe1 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3124,7 +3124,6 @@ static int mov_write_header(AVFormatContext *s)
             }else if(st->codec->frame_size > 1){ /* assume compressed audio */
                 track->audio_vbr = 1;
             }else{
-                st->codec->frame_size = 1;
                 track->sample_size = (av_get_bits_per_sample(st->codec->codec_id) >> 3) * st->codec->channels;
             }
             if (track->mode != MODE_MOV) {



More information about the ffmpeg-cvslog mailing list