[FFmpeg-devel] [RFC] ac3enc: how do I force ac3 encoder tooutput frames with the same size?

Piotr Bandurski ami_stuff at o2.pl
Sat Dec 29 13:00:30 CET 2012


Hi,

> > one way is to use a bitrate that produces an integer size
> > (like 65536) and apply
> > 
> > diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
> > index de8defc..b4acea2 100644
> > --- a/libavcodec/ac3enc.c
> > +++ b/libavcodec/ac3enc.c
> > @@ -2210,7 +2210,7 @@ static av_cold int validate_options(AC3EncodeContext *s)
> >  if (!best_diff)
> >  break;
> >  }
> > - avctx->bit_rate = best_br;
> > +// avctx->bit_rate = best_br;
> >  s->frame_size_code = best_code << 1;
> >  s->frame_size_min = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code];
> >  s->num_blks_code = 0x3;
> 
> Attached works with your patch.

I would also need constant frame sizes to write correct length of audio data to the output rm file
(currently muxer writes some random value).

Regards


More information about the ffmpeg-devel mailing list