Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic library path does not change unless using "Browse..." dialog #2282

Closed
wildwestrom opened this issue Dec 13, 2021 · 6 comments
Closed
Assignees
Labels
bug An error, undesired behaviour, or missed functionality P2 High priority bugs

Comments

@wildwestrom
Copy link

wildwestrom commented Dec 13, 2021

Is your feature request related to a problem? Please describe.
There's a link to download a .pkg file containing dynamic libraries required for audacity to work. These are outdated, and probably the reason why I can't import various formats supported by ffmpeg (opus for example).
When I try to point to the path $HOMEBREW_PREFIX/Cellar/ffmpeg/4.4.1/lib/*.dylib nothing happens, it uses the same path as before.

Describe the solution you'd like
I'd much rather use the libraries provided by the homebrew package. This way I can use the latest stable or nightly release of ffmpeg.

Describe alternatives you've considered
I thought to try compiling the libraries myself, but I don't know how to do it in such a way that Audacity will accept the libs. It looks like it's expecting these three:
ffmpeg.55.64bit.dylib ffmpeg_utils.52.64bit.dylib ffmpeg_codecs.55.64bit.dylib
Homebrew creates these:

main@MacBook ~/h/C/f/4/lib> ls
libavformat.58.76.100.dylib  libpostproc.55.dylib
libavcodec.58.134.100.dylib  libavformat.58.dylib         libpostproc.a
libavcodec.58.dylib          libavformat.a                libpostproc.dylib
libavcodec.a                 libavformat.dylib            libswresample.3.9.100.dylib
libavcodec.dylib             libavresample.4.0.0.dylib    libswresample.3.dylib
libavdevice.58.13.100.dylib  libavresample.4.dylib        libswresample.a
libavdevice.58.dylib         libavresample.a              libswresample.dylib
libavdevice.a                libavresample.dylib          libswscale.5.9.100.dylib
libavdevice.dylib            libavutil.56.70.100.dylib    libswscale.5.dylib
libavfilter.7.110.100.dylib  libavutil.56.dylib           libswscale.a
libavfilter.7.dylib          libavutil.a                  libswscale.dylib
libavfilter.a                libavutil.dylib
libavfilter.dylib            libpostproc.55.9.100.dylib

It seems Audacity is hardcoded to only accept certain filenames:

audacity/src/FFmpeg.cpp

Lines 180 to 192 in 0b3ba4f

void OnBrowse(wxCommandEvent & WXUNUSED(event))
{
static const FileNames::FileTypes types = {
# if defined(__WXMSW__)
{ XO("Only avformat.dll"), { wxT("avformat-*.dll") } },
# elif defined(__WXMAC__)
{ XO("Only ffmpeg.*.dylib"), { wxT("ffmpeg.*.dylib") } },
# else
{ XO("Only libavformat.so"), { wxT("libavformat.so.*") } },
# endif
FileNames::DynamicLibraries,
FileNames::AllFiles
};

std::vector<wxString> BuildAVFormatPaths(int version)
{
return {
#if defined(__WXMSW__)
wxString::Format("avformat-%d.dll", version),
#elif defined(__WXMAC__)
wxString::Format("ffmpeg.%d.64bit.dylib", version),
wxString::Format("libavformat.%d.dylib", version),
#else
wxString::Format("libavformat.so.%d", version)
#endif
};
}

Additional context
N/A, maybe later

@crsib
Copy link
Member

crsib commented Dec 13, 2021

Audacity 3.1+ should be able to load libavformat.58.dylib just fine (i.e., just pasting the full path should help), although the "FindFFmpegDialog" dialog needs fixing...

I will check, but just one small question - do you have an Intel Mac?

@wildwestrom
Copy link
Author

wildwestrom commented Dec 13, 2021

@crsib Yes, it is an Intel Mac.

@wildwestrom
Copy link
Author

wildwestrom commented Dec 13, 2021

Ok, it seems to load libavformat.dylib okay.
I had to navigate manually instead of putting in the full path.
Screen Shot 2021-12-13 at 14 23 49

Opus audio also imports without any problem.
Screen Shot 2021-12-13 at 14 25 24

@wildwestrom wildwestrom changed the title Allow Audacity to use ffmpeg dynamic libraries provided by homebrew Dynamic library path does not change unless using "Browse..." dialog Dec 13, 2021
@wildwestrom
Copy link
Author

wildwestrom commented Dec 13, 2021

It should either be clear that the text box to input the path does nothing, or fix that functionality. Right now the only way to change the dylib path is to use the Browse... dialog.

Audacity 3.1.2
MacOS 12.0.1 (Intel)

I also think there should be some documentation on how to use ffmpeg via Homebrew on the wiki.

Steps to reproduce:

  • Navigate to:
    • Preferences
    • Libraries
  • Click Locate...
  • Click Yes
  • Put full path to the dynamic library directory in the text box under Location of 'ffmpeg.*.64bit.dylib':
  • E.g. /Library/Application Support/audacity/libs
    /Library/Application Support/audacity/libs/
    /Library/Application Support/audacity/libs/*
  • Click Ok

Expected:
Library version and path to library changes.
Actual:
Library version and path to library does not change.

Workaround:

  • Use Browse... dialog.
  • Navigate to the directory containing the libs.
  • Select one of the .dylib files.

@crsib
Copy link
Member

crsib commented Dec 13, 2021

I was sure it was fixed. I will recheck

@crsib crsib added the P2 High priority bugs label Dec 15, 2021
@crsib crsib self-assigned this Dec 15, 2021
@crsib crsib added this to To do in Sprint 10 - Enhancements&Bug fixes via automation Dec 15, 2021
@crsib crsib added this to the Audacity 3.1.3 milestone Dec 15, 2021
@AnitaBats AnitaBats added the bug An error, undesired behaviour, or missed functionality label Dec 15, 2021
@crsib crsib moved this from To do to In progress in Sprint 10 - Enhancements&Bug fixes Dec 16, 2021
@crsib
Copy link
Member

crsib commented Dec 16, 2021

Turns out that the check was very confusing (and quite wrong). It was expected that the path would be a full path to a dylib.

crsib added a commit to crsib/audacity that referenced this issue Dec 16, 2021
The meaning of the "Location of " field became confusing after the support for multiple FFmpeg versions was added. 

This commit changes the way how the content of the dialog is interpreted. 
Both full paths to avformat and to the directory containing avformat are now valid.

Additionally, it fixes the way Audacity checks that FFmpeg works. Audacity will check if it can load the library instead of checking that the file exists.
@crsib crsib moved this from In progress to Review in progress in Sprint 10 - Enhancements&Bug fixes Dec 16, 2021
crsib added a commit to crsib/audacity that referenced this issue Dec 17, 2021
The meaning of the "Location of " field became confusing after the support for multiple FFmpeg versions was added. 

This commit changes the way how the content of the dialog is interpreted. 
Both full paths to avformat and to the directory containing avformat are now valid.

Additionally, it fixes the way Audacity checks that FFmpeg works. Audacity will check if it can load the library instead of checking that the file exists.
crsib added a commit to crsib/audacity that referenced this issue Dec 17, 2021
The meaning of the "Location of " field became confusing after the support for multiple FFmpeg versions was added. 

This commit changes the way how the content of the dialog is interpreted. 
Both full paths to avformat and to the directory containing avformat are now valid.

Additionally, it fixes the way Audacity checks that FFmpeg works. Audacity will check if it can load the library instead of checking that the file exists.
crsib added a commit that referenced this issue Dec 17, 2021
The meaning of the "Location of " field became confusing after the support for multiple FFmpeg versions was added. 

This commit changes the way how the content of the dialog is interpreted. 
Both full paths to avformat and to the directory containing avformat are now valid.

Additionally, it fixes the way Audacity checks that FFmpeg works. Audacity will check if it can load the library instead of checking that the file exists.
@crsib crsib moved this from Review in progress to Ready for QA in Sprint 10 - Enhancements&Bug fixes Dec 17, 2021
@Penikov Penikov moved this from Ready for QA to In QA in Sprint 10 - Enhancements&Bug fixes Dec 17, 2021
@Penikov Penikov moved this from In QA to Done in Sprint 10 - Enhancements&Bug fixes Dec 20, 2021
Sprint 10 - Enhancements&Bug fixes automation moved this from Done to Ready for QA Dec 20, 2021
@LWinterberg LWinterberg moved this from Ready for QA to Done in Sprint 10 - Enhancements&Bug fixes Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error, undesired behaviour, or missed functionality P2 High priority bugs
Projects
No open projects
Development

No branches or pull requests

4 participants