[FFmpeg-devel] [PATCH] libspeex encoder
Tue Jul 7 01:13:06 CEST 2009
On Sat, Jun 20, 2009 at 10:08 PM, Justin Ruggles
<justin.ruggles at gmail.com>wrote:
> This patch adds Speex encoding through libspeex. It depends on the
> speex-in-ogg muxer patch I sent earlier.
> The sample rate must match 8000, 16000, or 32000.
> Both mono and stereo are supported.
> CBR mode is the default.
> Using -aq (or CODEC_FLAG_QSCALE and global_quality) turns on VBR mode.
> (global_quality 0.0 to 10.0)
> Using -compression_level changes the encoding complexity.
> (compression_level 1 to 10)
Ah, found it :)
I like your approach on VBR and compression setting much better than mine.
We still have the problem of how many frames per packet to use (sure would
be nice if we could get it from AVCodecContext). Here's my other thoughts:
0) SPEEX_FRAMES_PER_PACKET of 10 results in 200ms of audio data per packet
-- which in some ways defeats the purpose of using Speex (for example, we
want to use speex to reduce the speech latency in a conferencing
application). We really need to make that configurable so users can
determine if they want increased latency (your approach) or increased
1) Try it with my FLV muxer patch and see if you can make the resulting FLV
play with Adobe's Flash player. I had to add the bit-termination stuff for
that -- but who knows, that might have been user error during testing.
2) I like using the SpeexHeader to maintain things like packet_size in your
LibSpeexEncContext rather than separate fields like packet_size.
3) Once you set the mode in speex you don't need to separately set the
4) You may want to add the FLT code from my patch if you want to support the
FMT_FLT audio sample type
5) You check buf_size for being too small AFTER you write to it. You
probably want to check before you write. Use speex_bits_nbytes to detect
how many bytes needed.
Otherwise, I think this is great.
xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and
Use Xuggle to get the power of FFmpeg in Java.
More information about the ffmpeg-devel