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

Piotr Bandurski ami_stuff at o2.pl
Tue May 7 22:49:09 CEST 2013


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).
> 
> any news on this patch ?
> is there something working & ready to be applied/reviewed ?

Yes, my patch works ok when used together with your patch for ac3enc.c,
so it would be needed to disable "best_br" when rm muxer is in use.

Regards



More information about the ffmpeg-devel mailing list