[Libav-user] [Audacity-devel] Requesting help to port Audacity to recent FFmpeg

Benjamin Drung bdrung at debian.org
Tue May 20 23:41:53 CEST 2014


Hi Michael,

first, let me thank you for your work.

Am Dienstag, den 20.05.2014, 19:17 +0200 schrieb Michael Niedermayer:
> Hi
> 
> On Tue, May 20, 2014 at 09:14:33AM +0100, Richard Ash wrote:
> > On Wed, 14 May 2014 19:27:38 +0200
> > Michael Niedermayer <michaelni at gmx.at> wrote:
> > > On Sun, May 11, 2014 at 09:16:29PM +0200, Benjamin Drung wrote:
> > > > That's why I send this mail to this mailing list to request help. Is
> > > > there anyone who has the time and skill to help porting Audacity to
> > > > the latest FFmpeg API version?
> > > > 
> > > > [1] http://bugzilla.audacityteam.org/show_bug.cgi?id=606
> > 
> > I think I'm right in saying that no-one on the audacity-devel list was
> > specifically aware of this work/request (or I might have said something
> > earlier).

I had the spontaneous idea to ask for help on the libav-user mailing
list. I didn't communicated this idea to any audacity developer or
mailing list.

> > As a result of this problem, one of the Audacity contributors, Leyland
> > Lucius, has been perusing the use of Gstreamer as an abstraction layer
> > for ffmpeg. This work has recently arrived in Audacity SVN, so you
> > should be able to see where it is at (it isn't working for me, but I
> > don't think it's Leyland's fault).
> 
> I wasnt aware of that, but still is there no interrest in directly
> supporting FFmpeg ?

The lacking interest in continue supporting FFmpeg was caused by the
missing manpower to keep Audacity updated against the changing API of
FFmpeg.

I assume that no Audacity will be against having FFmpeg support in the
source code if this support is kept up-to-date. I like to commit your
work to the Audacity SVN so that we have both - support for FFmpeg and
Gstreamer.

> Also i just fixed planar export & put the disabled options back so
> my github should contain a audacity that fully works with latest
> ffmpeg, of course there will be bugs but iam happy to fix them if
> they get reported to me ...

I tested your patches with FFmpeg 2.2.1-2 on Ubuntu 14.04 with the
--disable-dynamic-loading configure flag. To succeed compiling, I had to
apply the attached 0001*.patch.

Then I modified the code and successfully compiled Audacity against the
libav version from Ubuntu 14.04. For that I had to create the second
0002*.patch (there you have to use --disable-dynamic-loading)

Importing and exporting ac3 and wma works with both libraries (including
setting the audio quality).

I found some issues:

1) There was a debugging line left in the code: fprintf(stderr, "READ %d
ret %d\n", size, ret);

2) I can't export audio as mp4. Neither as mp4 export, nor as custom
FFmpeg export (can't be selected there). FFmpeg has mp4 support enabled:

$ ffmpeg -formats 2>/dev/null | grep mp4
 D  mov,mp4,m4a,3gp,3g2,mj2 QuickTime / MOV
  E mp4             MP4 (MPEG-4 Part 14)


> >
> > The rationale for doing this is that the Gstreamer 1.0 API is much more
> > stable than the libAV one, and there is an (actively maintained)
> > gst-plugin-libav which provides the functionality of libAV through that
> > API. Thus the problem of providing up-to-date builds of libAV is
> > reduced, and an abstraction layer is provided.
> 
> Iam quite aware of the API stability issues in our API.
> Its a result of FFmpeg supporting all features and bugfixes as well
> as to be API compatible to the fork (libav) and that changing the API
> all the time.
> 
> One question here would be if there would be interrest if FFmpeg would
> provide a seperate simple API which isnt designed to be as efficient
> as possible and which makes no attempt to be compatible with libav.
> such API could then be long term stable
> ?
> This idea did come up already a few times IIRC. Just noone imlpemented
> it yet, but the more people support the idea the more likely someone
> will sit down and write it ...

IMO it would make sense to have a subset of the API (it doesn't have to
be a separate API) where you promise long term stability.

> > This also has the benefit of allowing (in principal) any other codecs
> > which are supported in Gstreamer (or by plugins for it) to be added to
> > Audacity relatively easily. This is something we hope to make modular,
> > so that it doesn't need a complete new build of audacity to use new
> > gstreamer plug-ins, and every download of Audacity doesn't have to ship
> > with every possible codec library.

Are there really codecs that are supported by Gstreamer, but not by
FFmpeg?

> hmm, i dont know exactly which codecs gstreamer supports but ffmpeg
> also supports quite a few external libs as codecs, the ones ive enabled
> on my local build:
> 
> decoders:
>  A....D libfdk_aac           Fraunhofer FDK AAC (codec aac)
>  A....D libopencore_amrnb    OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band) (codec amr_nb)
>  A....D libopencore_amrwb    OpenCORE AMR-WB (Adaptive Multi-Rate Wide-Band) (codec amr_wb)
>  A....D libgsm               libgsm GSM (codec gsm)
>  A....D libgsm_ms            libgsm GSM Microsoft variant (codec gsm_ms)
>  A....D libilbc              iLBC (Internet Low Bitrate Codec) (codec ilbc)
>  A....D libopus              libopus Opus (codec opus)
>  A....D libspeex             libspeex Speex (codec speex)
>  A..... libvorbis            libvorbis (codec vorbis)
> 
> encoders:
>  A..... libfaac              libfaac AAC (Advanced Audio Coding) (codec aac)
>  A..... libfdk_aac           Fraunhofer FDK AAC (codec aac)
>  A..... libvo_aacenc         Android VisualOn AAC (Advanced Audio Coding) (codec aac)
>  A..... libaacplus           libaacplus AAC+ (Advanced Audio Codec with SBR+PS) (codec aac)
>  A..... libopencore_amrnb    OpenCORE AMR-NB (Adaptive Multi-Rate Narrow-Band) (codec amr_nb)
>  A..... libvo_amrwbenc       Android VisualOn AMR-WB (Adaptive Multi-Rate Wide-Band) (codec amr_wb)
>  A..... libgsm               libgsm GSM (codec gsm)
>  A..... libgsm_ms            libgsm GSM Microsoft variant (codec gsm_ms)
>  A..... libilbc              iLBC (Internet Low Bitrate Codec) (codec ilbc)
>  A..... libmp3lame           libmp3lame MP3 (MPEG audio layer 3) (codec mp3)
>  A..... libopus              libopus Opus (codec opus)
>  A..... libspeex             libspeex Speex (codec speex)
>  A..... libvorbis            libvorbis (codec vorbis)
> 
> changing these would generally require a rebuild of libavcodec though
> but not audacity.
> Also if someone wants to change ffmpegs external lib support to use
> dlopen for some or all cases, i surely wouldnt mind ...
> 
> Also according to:
> ./ffmpeg -filters | egrep '\->A|A\-' | wc
> there are 58 audio filters in ffmpegs libavfilter (not counting ones
> that arent enabled in my local build)
> So maybe libavfilter support might be interresting to audacity too ?
> 
> And the codecs in ffmpeg support quite a few more options than what
> is available to be set from audacity currently. It should be fairly
> easy to add generic option support for someone who knows the
> audacity API.
> random example:
> ./ffmpeg -help encoder=libopus
> ...
> Encoder libopus [libopus Opus]:
>     Threading capabilities: no
>     Supported sample rates: 48000 24000 16000 12000 8000
>     Supported sample formats: s16 flt
>     Supported channel layouts: mono stereo 3.0 quad 5.0 5.1 6.1 7.1
> libopus AVOptions:
>   -application       <int>        E...A... Intended application type (from 2048 to 2051) (default 2049)
>      voip                         E...A... Favor improved speech intelligibility
>      audio                        E...A... Favor faithfulness to the input
>      lowdelay                     E...A... Restrict to only the lowest delay modes
>   -frame_duration    <float>      E...A... Duration of a frame in milliseconds (from 2.5 to 60) (default 20)
>   -packet_loss       <int>        E...A... Expected packet loss percentage (from 0 to 100) (default 0)
>   -vbr               <int>        E...A... Variable bit rate mode (from 0 to 2) (default 1)
>      off                          E...A... Use constant bit rate
>      on                           E...A... Use variable bit rate
>      constrained                  E...A... Use constrained VBR
> 
> 
> Thanks
> 


-- 
Benjamin Drung
Debian & Ubuntu Developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Prefer-newer-av_get_bits_per_sample_fmt-over-av_get_.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140520/6f690cde/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-support-for-libav-9.patch
Type: text/x-patch
Size: 5630 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140520/6f690cde/attachment-0001.bin>


More information about the Libav-user mailing list