[Libav-user] ffmpeg for matlab (mex function)

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Apr 8 14:59:57 CEST 2014


ReSearchIT Eng <researchiteng at ...> writes:

> the input or the output format?

As said, this is difficult to understand:
FFmpeg / libavcodec support decoding audio 
(to raw audio, different formats depending 
on the input) and encoding audio (from raw 
audio, format depending on the encoder you 
requested, unfortunately not on what the 
user wishes).
Some options apply to both encoding and 
decoding, some only for encoding, others 
only to decoding.
"bit_rate" (to use one example) is only 
useful for encoded audio, not for the raw 
audio the decoder provides and the encoder 
needs. The documentation in avcodec.h 
explains it (or at least I believe so):

/**
 * the average bitrate
 * - encoding: Set by user; unused for constant quantizer encoding.
 * - decoding: Set by libavcodec. 0 or some bitrate if this info is
available in the stream.
 */
 int bit_rate;

One more thing: When decoding, you absolutely 
have to test sample_fmt: Do not rely on the fact 
that today you get s16 because this may change 
in the future! (without major version bump!)
Similar with encoding: It may work fine with fltp 
at the moment but the encoder that you get at 
runtime in the future may need another format!

Hope that helps, Carl Eugen



More information about the Libav-user mailing list