[Ffmpeg-devel] Speex proposed addition to ffmpeg and suggestions

Michel Bardiaux mbardiaux
Thu Jun 23 10:35:19 CEST 2005

Dario Andrade wrote:
> So glad you've mentioned, since I have done something I use it for my own
> purposes.
> You're right, the reception to such a project was somewhat a little radical,
> then I decided to keep it private. (Anyway, doing a native decoder did not
> make sense to me. Speex is evolving really fast with tons of ports to DSP
> chips and an included fixed point version, if needed).

I agree. IMHO the only sensible approach to a 'native' codec would be to 
hook the cvs-co tree of speex *in* the cvs-co tree of ffmpeg (just like 
mplayer does w.r.t. ffmpeg). Opinions from the core?

> Do you have the interest in it? 

> I have only a few issues that I needed to
> clarify, such as:
> 4) In order for the speex codec to interpolate frames (in case of a lost
>>>packet), I am expecting NULL to the "buf" parameter when decoding it.
>>>That will create a single interpolated frame with no bytes consumed. May
>>>I do that? Or should I just use the "flush" function for that?
> The avcodec API does not specify a way for user to create a "lost frame"
> (codec dependent interpolated frame). What do you think about that? (I guess
> nobody will ever pass NULL to that function anyway).

A NULL buffer to avcodec_decode_video requests the codec to output 
delayed frames (e.g. after a IBP in presentation order, thus IPB in 
stream order, decode returns image[the I]/nothing/image[the B] then you 
have to call decode again with a null buffer to get the P. I dont know 
what a NULL buffer is supposed to mean to an audio codec. But its no big 
issue to me, since AAMOF I take great care there is no lost frame in any 
of my files!

> Anyway, I've attached my version, which may contain errors.
> Along with speex.c, 

Which one gets from www.speex.org I guess, but which version?

> one should add:
> -=-=-=-=-=-=--=

Could you please repost this as a 'cvs diff -du', *attached*? Also, some 
usage eaxmples; esp. when using -acodec speex, what format (ogg?) and 
what are recommended or mandatory parameters, like sample rate, is 
stereo allowed, range of bitrates,...

> to avcodec.h:
> 177a178
>     CODEC_ID_SPEEX=0x17000,
> 344a346,352
> #define CODEC_FLAG2_AUDIO_PREPROC_AGC       0x01000000 // automatic gain
> control (encoder or decoder)
> #define CODEC_FLAG2_AUDIO_PREPROC_VAD       0x02000000 // voice activity
> detection (no activity -> returns 0 bytes encoded)
> #define CODEC_FLAG2_AUDIO_PREPROC_DENOISE   0x04000000 // denoising
> (preprocessing)
> #define CODEC_FLAG2_AUDIO_DTX               0x08000000 // discontinous
> transmission (DTX) (no activity -> generates 5 bits/frame, only if vbr or
> cng enabled)
> #define CODEC_FLAG2_AUDIO_CNG               0x10000000 // confort noise
> generation (CNG) (no activity (codec vad) -> generates confort noise, always
> when vbr is enabled)
> #define CODEC_FLAG2_AUDIO_ENH               0x20000000 // perceptual
> enhancement (ENH) (decoder)
> 1945a1961
> extern AVCodec speex_encoder;
> 2046a2063
> extern AVCodec speex_decoder;
> -=-=-=-=-=-=-=-=-=
> to libavformat/wav.c:
> 38a39
>     { CODEC_ID_SPEEX, ('S'<<8)+'x' }, //dats: speex wave format (?)
> Let me know if something is missing.
> Anyway, I accept suggestions for the proposed changes in API (flags,
> etc...).
> Cheers,

Michel Bardiaux
Peaktime Belgium S.A.  Bd. du Souverain, 191  B-1160 Bruxelles
Tel : +32 2 790.29.41

More information about the ffmpeg-devel mailing list