[FFmpeg-devel] [PATCH] 1 of 5 Add Speex Encoding
Tue Jul 7 00:50:47 CEST 2009
Art Clarke wrote:
> Encodes speex audio with the following features:
> 1) FLT or S16 audio
> 2) mono or stereo
> 3) narrow, wide, or ultra band
> 4) either settable bit-rate or quality settings
> Beyond whatever comments you have, I had some requests:
> 1) Adobe's implementation of speex in FLV asusmes speex to be encoded with
> two frames per packet, so that's what this encoder does. I'd like to make
> this configurable, but couldn't find an AVCodecContext field to use for
That's interesting. This means stream copy of speex to FLV will not be
easy. Does Flash Player work with just 1 frame per packet?
> 2) I'd like to support variable bit-rate, but didn't know which
> AVCodecContext flag to query for that.
I would recommend using CODEC_FLAG_QSCALE and global_quality for this
instead of setting CBR using quality.
> Comments appreciated,
Did you see my patch sent on June 21 to do the same thing? I'm fine
with an alternative patch, and I'll comment on yours since nobody has
responded to mine yet.
> + // get the actual sample rate
> + speex_encoder_ctl(s->enc_state, SPEEX_GET_SAMPLING_RATE, &s->header.rate);
> + avctx->sample_rate = s->header.rate;
I'm not sure it's a good idea to set the sample rate to something other
than that specified by the user. I think it might be better to fail if
they do not match.
> + // put in a terminator so this will fit in a OGG or FLV packet
> + speex_bits_insert_terminator(&s->bits);
This is not needed. The terminator is automatically inserted by
You might want to consider adding to the patch:
- setting encoding complexity based on AVCodecContext.compression_level.
- supporting a small last frame by padding with silence.
More information about the ffmpeg-devel