[FFmpeg-devel] [PATCH] 1 of 5 Add Speex Encoding

Justin Ruggles justin.ruggles
Tue Jul 7 01:22:40 CEST 2009

Art Clarke wrote:
> 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.

ok.  Well, that makes things a bit more difficult, but I think we can
get it to work.

>>> 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?

[PATCH] libspeex encoder

>>> [...]
>>> +    // 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.

Wow, that's strange.  If you look at the libspeex source,
speex_bits_write() always calls speex_bits_insert_terminator() and the
Speex documentation says the same.  But speexenc does indeed call it
explicitly and then again through speex_bits_write() so I guess it is

>> 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.

That sounds fine.  I'm certainly open to any suggestions.  I will need
to modify it to add support for floating-point samples.



More information about the ffmpeg-devel mailing list