Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 233 - Option to link against system lame and ffmpeg
Option to link against system lame and ffmpeg
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: Formats
1.3.14 alpha
PC Linux
: P4 Enhancement
Assigned To: Default Assignee for New Bugs
: patch
Depends on:
Blocks: 300
  Show dependency treegraph
 
Reported: 2010-09-21 08:44 UTC by Benjamin Drung
Modified: 2018-08-20 11:51 UTC (History)
5 users (show)

See Also:
Steps To Reproduce:
Release Note:
First Git SHA:
Group: ---
Workaround:
Closed: 2018-08-20 00:00:00


Attachments
audacity-ffmpeg.patch (39.66 KB, patch)
2010-12-28 20:53 UTC, Benjamin Drung
Details | Diff
audacity-system-ffmpeg3.patch (43.72 KB, patch)
2010-12-29 10:48 UTC, Benjamin Drung
Details | Diff
audacity-system-ffmpeg4.patch (45.10 KB, patch)
2010-12-29 18:53 UTC, Benjamin Drung
Details | Diff
audacity-system-ffmpeg5.patch (45.29 KB, patch)
2010-12-30 04:54 UTC, Benjamin Drung
Details | Diff
audacity-system-ffmpeg6.patch (44.70 KB, patch)
2011-02-08 18:14 UTC, Benjamin Drung
Details | Diff
audacity-system-ffmpeg7.patch (44.87 KB, patch)
2011-02-22 17:25 UTC, Benjamin Drung
Details | Diff
disable-dynamic-ffmpeg.patch (4.06 KB, patch)
2011-08-27 17:48 UTC, Benjamin Drung
Details | Diff
disable-dynamic-lame.patch (11.65 KB, patch)
2011-08-27 17:49 UTC, Benjamin Drung
Details | Diff
disable-dynamic-ffmpeg.patch (4.68 KB, patch)
2012-06-24 20:37 UTC, Benjamin Drung
Details | Diff
disable-dynamic-lame.patch (10.61 KB, patch)
2012-06-24 20:37 UTC, Benjamin Drung
Details | Diff
disable-dynamic-lame.patch (12.16 KB, patch)
2012-06-24 20:45 UTC, Benjamin Drung
Details | Diff
VC++ errors in applying disable-dynamic-ffmpeg.patch (9.40 KB, text/plain)
2012-06-24 21:26 UTC, Vaughan Johnson
Details
disable-dynamic-ffmpeg-v2.patch (5.45 KB, patch)
2012-06-25 17:10 UTC, Benjamin Drung
Details | Diff
use-newer-ffmpeg-function-name.patch (1014 bytes, patch)
2012-07-14 11:43 UTC, Benjamin Drung
Details | Diff
disable-dynamic-ffmpeg-v3.patch (4.58 KB, patch)
2012-07-14 11:47 UTC, Benjamin Drung
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Drung 2010-09-21 08:44:33 UTC
On Linux we don't need to load dynamically (dlopen) lame and ffmpeg. Instead we prefer to compile audacity using system libraries. If we compile audacity using system libraries, it will be easier to detect and fix bugs like #176. Edit -> Preferences... -> Libraries can be removed then.
Comment 1 Gale Andrews 2010-09-21 15:41:57 UTC
(In reply to comment #0)
You mean you can remove Edit > Preferences: Libraries if defined wxGTK? They can't be removed on windows/Mac, I think. FFmpeg is not autodetected yet (bug 141) and even when it is, users still sometimes need to browse (or prefer not to use the library location Audacity specifies). Plus they can download the libraries from that Prefs pane.
Comment 2 Benjamin Drung 2010-09-21 15:50:43 UTC
I mean to have an configure flag for compiling audacity against the system lame and ffmpeg. If this flag is enable, audacity should drop the dlopen part and just link against the system libraries. If this flag is enabled, Edit > Preferences: Libraries should be disabled.
Comment 3 Benjamin Drung 2010-10-20 16:40:09 UTC
A bug was filed in Debian: http://bugs.debian.org/600747
Comment 4 Benjamin Drung 2010-12-28 20:53:05 UTC
Created attachment 64 [details]
audacity-ffmpeg.patch

Attached the patch that allows compiling against system ffmpeg (and dropping dlopen part) if USE_SYSTEM_FFMPEG is set. If USE_SYSTEM_FFMPEG is not set, everything should behave like before. This patch needs some improvements:

1a. autoconf part: There should be a configure flag for setting USE_SYSTEM_FFMPEG. Currently I set it manually after ./configure with:
echo "#define USE_SYSTEM_FFMPEG 1" >> src/configunix.h

1b. Following line should only be set if USE_SYSTEM_FFMPEG is defined:
FFMPEG_SYSTEM_LIBS="$AVCODEC_LIBS $AVFORMAT_LIBS"

2. The patch compiles and audacity starts. When using USE_SYSTEM_FFMPEG, no ffmpeg format is detected.
Comment 5 Gale Andrews 2010-12-28 23:07:39 UTC
(In reply to comment #4)
>  The patch compiles and audacity starts. When using USE_SYSTEM_FFMPEG, no
> ffmpeg format is detected.
Is this the problem most people get when they compile FFmpeg > 0.5 themselves?
http://forum.audacityteam.org/viewtopic.php?f=18&t=39251&p=119648#p114553
Comment 6 Benjamin Drung 2010-12-29 06:00:43 UTC
> Is this the problem most people get when they compile FFmpeg > 0.5 themselves?
> http://forum.audacityteam.org/viewtopic.php?f=18&t=39251&p=119648#p114553

No, because the linking will fail if an unknown symbol is used. I hit this linking error and applied the patch from bug #176.
Comment 7 Benjamin Drung 2010-12-29 10:48:18 UTC
Created attachment 65 [details]
audacity-system-ffmpeg3.patch

Here's an updated patch. It fixes all issues described above. I forgot to initialize the FFmpeg library if the dynamic loading was disabled. This patch has a proper configure integration.

After applying the patch, you need to make autogen.sh executable and run autogen.sh to regenerate the configure script.

Everything should behave like before unless you pass --disable-dynamic-loading to configure. If you run configure with --disable-dynamic-loading, the dynamic loading of FFmpeg will be disabled and audacity will be linked against the system FFmpeg.

My patch includes the bug fix for bug #176 and I added more #ifdefs for deprecated FFmpeg functions.
Comment 8 Benjamin Drung 2010-12-29 18:53:11 UTC
Created attachment 66 [details]
audacity-system-ffmpeg4.patch

Updated audacity-system-ffmpeg4.patch attached. This patch works on Debian unstable and Ubuntu 11.04 (natty).

Two things are changes:
1) FFmpeg.h declares match_ext for FFmpeg 0.5 (because audacity uses this internal function).
2) audacity_checklib_ffmpeg.m4 checks for libavutil too, because libavutil is required too.
Comment 9 Gale Andrews 2010-12-29 23:14:48 UTC
(In reply to comment #7)
> After applying the patch, you need to make autogen.sh executable and run
> autogen.sh to regenerate the configure script.
I applied the patch (only) but I don't know which autogen.sh file you mean. I have eight files with this name in various parts of the Audacity tree but none seem relevant to FFmpeg. And when I find it and make it executable, what do I type from which location?
Comment 10 Benjamin Drung 2010-12-30 04:54:41 UTC
Created attachment 67 [details]
audacity-system-ffmpeg5.patch

> I applied the patch (only) but I don't know which autogen.sh file you mean.
> And when I find it and make it executable, what do I type from which location?

autogen.sh was part of the patch. I lost it in version 4. Attached is version 5 with autogen.sh in it. It does nothing else than calling aclocal and autoconf with the correct parameters (because I always forget the commands).

patch -p0 < audacity-system-ffmpeg5.patch
chmod +x autogen.sh
./autogen.sh
Comment 11 Gale Andrews 2011-02-07 13:53:56 UTC
From http://tinyurl.com/4goaj6p:
>> Richard: We have never asked the FFmpeg team whether they are happy for GPL
>> builds to be linked against Audacity with it's binary plug-in support...
>> we don't do the things they ask for (http://ffmpeg.org/legal.html)
> Benjamin: My patch allows build-time linkage, but it would be still dynamic 
> linked (just not using dlopen). 
I don't think the enhancement in bug 233 can go ahead unless we do ask. Even then there may be questions if we want Audacity to (have the capability to) behave differently on different platforms. I usually favour flexibility in these cases, but should the user be completely denied the dlopen method to a different version of FFmpeg through the Preferences (or would Auadacity refuse that other version)?

If we resolve 233 "wontfix" we should still address bug 176 on its own, though I could not make Audacity accept self-compiled FFmpeg using the patch attached to that bug.
Comment 12 Benjamin Drung 2011-02-07 15:21:55 UTC
From http://tinyurl.com/4goaj6p:
>>> Richard: We have never asked the FFmpeg team whether they are happy for GPL
>>> builds to be linked against Audacity with it's binary plug-in support...
>>> we don't do the things they ask for (http://ffmpeg.org/legal.html)
>> Benjamin: My patch allows build-time linkage, but it would be still dynamic 
>> linked (just not using dlopen). 
> I don't think the enhancement in bug 233 can go ahead unless we do ask.
My patch doesn't change anything regarding licensing. Currently Audacity is linked dynamical to FFmpeg and can be shipped separated due to dlopen. With the patch it is possible to disable the dlopen part and just link dynamical (if the configure flag --disable-dynamic-loading is used).

If there is a problem with Audacity's binary plug-in support and FFmpeg, it is unrelated to my patch.

> Even then there may be questions if we want Audacity to (have the capability
> to) behave differently on different platforms.

It's a nice feature for distributions to make audacity work smoothly with the FFmpeg version provided by the distribution.

> I usually favour flexibility in these cases, but should the user be
> completely denied the dlopen method to a different version of FFmpeg through
> the Preferences (or would Auadacity refuse that other version)?

If audacity is compiled with --disable-dynamic-loading, the user can only use the FFmpeg version which it was compiled with (or a binary compatible one). If audacity is compiled without --disable-dynamic-loading, the user can select a FFmpeg version to dlopen.

If a distribution uses --disable-dynamic-loading, audacity will work with the FFmpeg package from the distribution and the users have to do no configuration. They can replace the package by a compatible one. The user can compile FFmpeg trunk and install in locally and then compile audacity with --disable-dynamic-loading against their local version.

> If we resolve 233 "wontfix" we should still address bug 176 on its own, though
> I could not make Audacity accept self-compiled FFmpeg using the patch attached
> to that bug.

That should be possible. If audacity is compiled and linked against the wrong FFmpeg version, you probably have to play with configure.
Comment 13 Benjamin Drung 2011-02-08 18:14:20 UTC
Created attachment 71 [details]
audacity-system-ffmpeg6.patch

Updated patch to make it apply to the latest svn revision.
Comment 14 Benjamin Drung 2011-02-22 17:25:49 UTC
Created attachment 93 [details]
audacity-system-ffmpeg7.patch

Refreshed and replaced USE_SYSTEM_FFMPEG by DISABLE_DYNAMIC_LOADING_FFMPEG.
Comment 15 Gale Andrews 2011-08-09 16:01:45 UTC
(In reply to comment #14)
A user e-mailed to request that we consider applying this patch as it would help his distro (openSUSE}.
Comment 16 Benjamin Drung 2011-08-27 17:48:17 UTC
Created attachment 196 [details]
disable-dynamic-ffmpeg.patch

Here's the updated patch that we use in Debian/Ubuntu to disable the dynamic loading of FFmpeg.
Comment 17 Benjamin Drung 2011-08-27 17:49:08 UTC
Created attachment 197 [details]
disable-dynamic-lame.patch

Here is the second patch that does the same for LAME. The second patch needs the first patch to work.
Comment 18 Benjamin Drung 2012-06-09 12:56:05 UTC
What prevents you from applying the proposed patches? They do not have any effect on Windows or Mac. They do not have any effect on Linux unless --disable-dynamic-loading is specified as configure flag.

With --disable-dynamic-loading specified, the FFmpeg and LAME version of the system will be used. The user looses the option to disable FFmpeg or LAME. The user can still change the used FFmpeg or LAME version by installing a different version into /usr/local for example.
Comment 19 Gale Andrews 2012-06-09 14:15:42 UTC
(In reply to comment #18)
Does Ubuntu 12.04 use FFmpeg for their Audacity package or is it linking with avconv (which seems the same thing, renamed)? I see terminal warnings that FFmpeg is "not developed anymore... use avconv instead." So is this patch still valid?
Comment 20 Benjamin Drung 2012-06-09 18:06:13 UTC
Debian and Ubuntu uses libav instead of FFmpeg. libav is a fork of FFmpeg. Both projects are still active and in development. The fork was created due to disagreements beyond the developers of FFmpeg. It is not clear, which project will be superior.

The libav team deprecated the command line tool 'ffmpeg' and recommend to use 'libav' instead. This is totally unrelated to the library which is used by Audacity.

Audacity can use FFmpeg or libav. The proposed patches do not have any effect on the FFmpeg/libav issue.
Comment 21 Benjamin Drung 2012-06-24 20:37:09 UTC
Created attachment 267 [details]
disable-dynamic-ffmpeg.patch

Here are the refreshed patches for 2.0.1 with a TortoiseSVN friendly strip level 0.
Comment 22 Benjamin Drung 2012-06-24 20:37:40 UTC
Created attachment 268 [details]
disable-dynamic-lame.patch
Comment 23 Benjamin Drung 2012-06-24 20:45:13 UTC
Created attachment 269 [details]
disable-dynamic-lame.patch

Another update for disable-dynamic-lame.patch (I forgot to add m4/audacity_checklib_lame.m4 to the patch).
Comment 24 Vaughan Johnson 2012-06-24 21:24:49 UTC
(In reply to comment #21)

Thanks. Patches fine. Does not build. Log attached.
Comment 25 Vaughan Johnson 2012-06-24 21:26:34 UTC
Created attachment 271 [details]
VC++ errors in applying disable-dynamic-ffmpeg.patch
Comment 26 Vaughan Johnson 2012-06-24 21:32:06 UTC
Applied disable-dynamic-lame.patch. Fixed a couple of compile warnings.
Comment 27 Benjamin Drung 2012-06-25 17:10:49 UTC
Created attachment 273 [details]
disable-dynamic-ffmpeg-v2.patch

Here's a fixed version of disable-dynamic-ffmpeg.patch. It builds with and without having --disable-dynamic-loading specified when running configure.
Comment 28 Benjamin Drung 2012-07-14 11:43:20 UTC
Created attachment 290 [details]
use-newer-ffmpeg-function-name.patch
Comment 29 Benjamin Drung 2012-07-14 11:47:53 UTC
Created attachment 291 [details]
disable-dynamic-ffmpeg-v3.patch

I spitted the patch into two parts and updated the second part.
Comment 30 Vaughan Johnson 2012-08-29 17:20:30 UTC
(In reply to comment #29)

Applied and committed use-newer-ffmpeg-function-name.patch (r11956) and disable-dynamic-ffmpeg-v3.patch (r11957).
Comment 31 Gale Andrews 2013-01-13 15:12:21 UTC
AFAICT this is long ago deemed satisfactory so moved to RESOLVED-FIXED. 

However should Michael's FFmpeg On-Demand Loading (or something else) be added to Libraries Preferences this will need revisiting .