[FFmpeg-devel] [PATCH] 1 of 5 Add Speex Encoding
Art Clarke
aclarke
Tue Jul 7 00:58:51 CEST 2009
On Mon, Jul 6, 2009 at 3:50 PM, Justin Ruggles <justin.ruggles at gmail.com>wrote:
> 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?
>
Didn't appear to in our testing. It needs 2 frames per packet. Technically
the Flash net.media.Microphone suggests it's settable, but I haven't found
an example file with anything other than the default 2 frames 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.
>
Fair enough but see below.
>
> > 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.
>
Actually I missed it (we've had this series of patches in our code-base for
a while but are about to release it next week which is why I'm e-mailing
now). What's the subject line of your patch in the archives?
>
> > [...]
> > + // 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.
yeah; I kinda went both ways on that. Easy enough fix to make, but see
below.
> > [...]
> > + // 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
> speex_bits_write().
>
I found without the terminator we got playback problems with FLV.
>
> 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.
>
Actually how about this -- if you have already have a patch, let's work to
make one unified patch (and I'm happy to use yours as a starting point -- no
pride of ownership here). One patch is better than two competing ones.
Just send me the link to your patch (sorry I missed it, but ffmpeg-devel is
pretty high traffic) and I'll do a review.
- Art
--
http://www.xuggle.com/
xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and
video.
Use Xuggle to get the power of FFmpeg in Java.
More information about the ffmpeg-devel
mailing list