Bug 1695

Summary: Patch (again!) audacity-freeworld to allow loading of current ffmpeg libs
Product: Fedora Reporter: FeRD (Frank Dana) <ferdnyc>
Component: audacity-freeworldAssignee: David Timms <dtimms>
Status: RESOLVED UPSTREAM    
Severity: minor    
Priority: P5    
Version: 14   
Hardware: All   
OS: GNU/Linux   
namespace:
Bug Depends on: 1356    
Bug Blocks:    
Attachments: Patch for audacity 1.3.12 to link with recent ffmpeg-0.6 / ffmpeg-0.6.1 for import/export

Description FeRD (Frank Dana) 2011-04-12 18:20:14 CEST
Created attachment 610 [details]
Patch for audacity 1.3.12 to link with recent ffmpeg-0.6 / ffmpeg-0.6.1 for import/export

+++ This bug was initially created as a clone of Bug #1356 +++

It's that time of year again!

Under the current rpmfusion build of ffmpeg-libs (ffmpeg-libs-0.6-4.20100704svn.fc14), audacity-freeworld-0:1.3.12-0.11.beta.fc14 is not able to properly link with the ffmpeg libraries for import and export of supported formats. (In fact, I suspect ffmpeg import/export has been broken since F14 release; my apologies for the lateness of this report.)

FFmpeg linking APPEARS to be successful, and the FFmpeg library versions are correctly displayed in Audacity's preferences. However, any attempt to load an ffmpeg-format file results in an error dialog stating: "Audacity recognized the type of the file '$FILENAME'. Importers supposedly supporting such files are: FFmpeg-compatible files, but none of them understood this file format."

The attached patch corrects this issue. Due to its extensive nature, further explanation seems warranted.[*]

The patch REPLACES both of the following patches:
audacity-1.3.12-ffmpeg-apichange-av_match_ext.patch
audacity-1.3.12-ffmpeg-fix-ufile_write.patch

and due to its origins on the audacity-1.3.13 codebase, needs to be applied with a patch "fuzz" of 10 lines:

Patch99: audacity-1.3.12-v8-ffmpeg-0.6.1.patch
%patch99 -p0 -F10 -b .ffmpeg061

I have successfully built and installed an audacity-freeworld binary RPM from the current rpmfusion spec with these changes, and have verified that it both functions normally, and properly imports/exports files in ffmpeg-provided formats.

Apologies for the long-winded submission, but I felt a 4800-line patch warranted at least a tenth as many lines of justification! :-)


[* - Further Explanation...]
This patch is far more extensive than the patch submitted previously (in bug #1356 — AKA the one that stopped working), reflecting the audacity team's own evolved understanding of the problem. The history of this process can be found at their internal bug: http://bugzilla.audacityteam.org/show_bug.cgi?id=176 The developers' goal there is not simply to "band-aid" ffmpeg support, but instead to develop and enhance it.

Audacity developer Leland Lucius has developed a number of patches against the 1.3.13 development sources which enhance support for various ffmpeg codecs and releases, and he continues to make refinements to better integrate with ffmpeg-libs. Unfortunately those patches, and the svn sources themselves, diverge farther and farther from the 1.3.12 sources as time passes, and they become increasingly difficult to apply.

The patch submitted here, as its name attempts to indicate (renaming is encouraged!), is built off of Leland's "v8" patch from 2011-03-25. I've backported his patch to apply cleanly (with some "fuzz") to our 1.3.12 sources. The only addition is to FileNames.cpp: some of his patched code relies on a method added since 1.3.12, which I've also backported. This is a pure expansion of functionality, and should have no impact on the remaining codebase (which doesn't call into the new code).

These changes will allow audacity-freeworld to properly link with current ffmpeg-libs-0.6 builds, and with any ffmpeg-libs-0.6.1 packages to be released in the future. It also corrects several deficiencies in audacity's ffmpeg-calling code, eliminating problems with various codecs such as the export crash I mentioned in bug #1356.
Comment 1 David Timms 2011-04-24 08:14:51 CEST
(In reply to comment #0)
> Created an attachment (id=610) [details]
...
> These changes will allow audacity-freeworld to properly link with current
> ffmpeg-libs-0.6 builds, and with any ffmpeg-libs-0.6.1 packages to be released
> in the future. It also corrects several deficiencies in audacity's
> ffmpeg-calling code, eliminating problems with various codecs such as the
> export crash I mentioned in bug #1356.

Hi, thanks a lot for working on a patch for the issue you found. I was about to add to my build, when I realized that audacity project has released 1.3.13 beta, so I'm working on that (since it carries the upstream of the patch you made). This should be a lot simpler than a huge patch.
Comment 2 FeRD (Frank Dana) 2011-04-25 10:32:31 CEST
Oh, absolutely! If rpmfusion is ready to advance to 1.3.13 in any form, that's a much simpler solution.

I forgot to mention, in my initial submission, that the reason I chose to backport the Leland Lucius patch (despite the added complexity/work) was that it represented development that had since made it into the audacity project svn, and would come "free" whenever they finally released 1.3.13. Of course, I didn't expect that release to happen within only 2 weeks. :)

Thanks for the attention to this. Looking forward to rpmfusion's audacity 1.3.13 build!
Comment 4 FeRD (Frank Dana) 2011-04-29 00:37:35 CEST
I upgraded to your audacity-freeworld-1.3.13-0.2.beta.fc14.x86_64.rpm on the same system I've been using to generate and test my own audacity builds, and preliminarily everything looks good!

I was able to:
- Import the audio (AAC) from a .mp4 file
- Edit (split, copy, move) sections of the waveform
- Apply several effects, including some from plugins (LADSPA, VAMP)
- Export a selection as ALAC inside a MOV container (custom FFMPEG export)
- Play the resulting file in Totem

An attempt to run a VST plugin using the WINE bridge failed (and took audacity down with it), but I'd only have been surprised if that test had *succeeded*.