[Libav-user] libavcodec differences between versions

Tuukka Pasanen pasanen.tuukka at gmail.com
Thu Nov 7 09:00:18 CET 2013


On 07.11.2013 04:53, fkwatson at aol.com wrote:
>
>     Hello! I've been using libavcodec 0.10.2 for decoding audio in a
>     certain application (calling avcodec_decode_audio4() to use the
>     "mp3" and "mp3float" decoders) and now I've tried to upgrade to
>     version 2.0.2. Everything builds fine without changes in my code,
>     but for some reason I get Mickey Mouse kind of sound after
>     decoding. I've tried other releases and come to the conclusion
>     that release 1.0.8 works straight off, but release 1.1.x (I've
>     tried 1.1.7) and later will produce this effect.
>     From reading the "Old FFmpeg Releases" page on the website I can
>     see that 1.0 was branched on 2012-09-28 and 1.1 on 2013-01-06. So
>     the change I'm looking for is probably somewhere between those
>     dates. But I also see that the 1.1.7 release use libav 9.10 and
>     1.0.8 use libav 0.8.3. What does that mean, which versions are you
>     referring to? Where can I find out what the differences (or rather
>     "changes of concept") there are between these "libav" versions?
>     Has there for instance been some change in the sample format,
>     sample rate or whatever between these version, so that I need to
>     call avcodec_open2() with some more or less undocumented option in
>     order to get the same behaviour as before?
>     I've tried to find release notes or any kind of documentation
>     where I can find out which changes were implemented and what I
>     need to do to cope with this. Could anybody please spread some
>     light on what might have changed, not the whole changelog for each
>     and every change of a comment or whatever but for a broader
>     picture. Is something like that available?
>     Better yet, perhaps somebody knows exactly what I'll have to do to
>     avoid this effect?
>     BR,
>     Mathias
>
>
> Sorry Mathias,
>
> You will have to make changes because the decoding API has changed.   
> See audio decoding example in examples directory.   The major 
> difference is that what is contained in a decoded frame is not 16-bit 
> linear interleaved samples. The output is now codec dependent.  You 
> have to use the API to get the sample format, and planar/not planar.
>
> avcodec_get_frame_defaults 
> <http://ffmpeg.org/doxygen/trunk/group__lavc__core.html#ga1cb4e0fd7b8eb2f56d977ff96973479d>(decoded_frame);
> avcodec_decode_audio4 
> <http://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#ga834bb1b062fbcc2de4cf7fb93f154a3e>(c, 
> decoded_frame, &got_frame, &avpkt);
> if (got_frame) {
> /* if a frame has been decoded, output it */
> int data_size = av_samples_get_buffer_size 
> <http://ffmpeg.org/doxygen/trunk/samplefmt_8c.html#aa7368bc4e3a366b688e81938ed55eb06>(NULL, 
> c->channels 
> <http://ffmpeg.org/doxygen/trunk/structAVCodecContext.html#ac1e6c2cd1269caa7570575725c682a49>,
> decoded_frame->nb_samples 
> <http://ffmpeg.org/doxygen/trunk/structAVFrame.html#a02f45ab8191aea1660159f1e464237ea>,
> c->sample_fmt 
> <http://ffmpeg.org/doxygen/trunk/structAVCodecContext.html#a1bdba69ea111e2a9d03fdaa7a46a4c45>, 
> 1);
> }
>
> If you are only dealing with one codec you can modify your code to use 
> this output sample format directly. Otherwise use libresample with in 
> rate = out rate to convert from c->sample_fmt to desired sample 
> format. See samplefmt.h and swresample.h.
>
>
Hello,
Most Audio outputs Plananar stuff now a days and it sounds like Mickey. 
Like abo said MP3 outputs S16P and Ogg/Vorbis FLTP. So just playing them 
like 0.10 is out of question witth out major source overhaul. When I 
developped Mixxx input plugin I also suffered this one and broken out 
little example app to solve this problem with resampling audio to wanted 
(As FFmpeg has real good capabilities to do that). I uploaded it to 
Github: https://github.com/illuusio/ffmpeg-example
Look at 'example2.c' there is this dirty resampler example that can use 
swresampler/avresampler which is provided. It should work from FFmpeg 
versions 0.10->2.1.

Sincerely,
Tuukka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131107/d82302a7/attachment.html>


More information about the Libav-user mailing list