[FFmpeg-devel] audio gop_size

Justin Ruggles justin.ruggles
Sun Aug 22 22:40:54 CEST 2010


Hi,

There are several audio codecs (such as MLP, ALS, and Speex) which
utilize the concept of groups of frames.  For decoding, it is simple
enough to either decode the whole group at once or decode
frame-by-frame, but for encoding there are other issues.  This is how
Thilo and I have implemented it in the ALS encoder we've been working
on, and I wanted to run it by the list to make sure we're on the right
track.

1) Make gop_size an audio option as well.

alternative: The downside is that it defaults to 12, which may not be an
appropriate default for some audio codecs.  Would changing the gop_size
default have API implications?  Should we instead add another field for
audio group of frames size that would default to 0 or -1?

2) Use an internal buffer in the encoder to store each encoded frame
until it has enough for a group, then set coded_frame->pts appropriately
and output the whole group.  The reason that the whole group needs to be
encoded at once is because the container packet should always contain a
whole group (at least this is the case for ALS and Speex).

alternative: Set avctx->frame_size to the group size and encode the
whole group at once.  One downside to this would be that sometimes the
number of frames in a group needs to be known outside the encoder.
Also, it could be confusing to require the user to specify the group
size in avctx->frame_size instead of the frame size, or to specify frame
size and have the value changed by the encoder to the group size.


Thoughts?

-Justin



More information about the ffmpeg-devel mailing list