Can't load mp4 (mp41/avc1) encoded audio files [solved. sort of]

I tried several threads with the exact same problem, but it all ends one way or another in, follow the download instructions on our page and you’re fine. I tried that, it didn’t work.

In Audacity library preferences, I clicked download (leads here) then clicked the link for Windows (leads here) where I choose either the normal or ‘alternative zip’ link, both with lead incidentally to the Lame chapter of the loaded page. Scrolling a bit down I found the ffmpeg section where I chose the ‘recommended zip’ option (this).

I extracted it somewhere, pointed Audacity to it (which works as seen in the logs) but it errors out on it. Can’t find symbols. In one thread I read it can be a conflict between different ffmpeg versions stored on disk, but I don’t see how this is possible since the PATH it lists has no reference to any ffmpeg in it. I found two other programs that come bundled with ffmpeg, OBS and BitWarden, but I don’t see how Audacity can ever be affected by this (and I need both programs).

I removed Audacity and downloaded a fresh Audacity zip (it kept the settings in my Windows user profile), but no success.

ps: Is there an Audacity release that comes bundled with ffmpeg so it works out-of-the-box?

23:24:35: Audacity 2.3.2
23:24:35: Error: Couldn't find symbol 'AudacityModule' in a dynamic library (error 127: The specified procedure could not be found.)
23:24:38: Trying to load FFmpeg libraries...
23:24:38: mLibAVFormatPath ('D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll') is not empty. Loading from it.
23:24:38: Looking up PATH environment variable...
23:24:38: PATH = 'C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\Program Files\TortoiseHg\;C:\Program Files\TortoiseGit\bin;C:\Users\Zom-B\AppData\Local\Microsoft\WindowsApps;'
23:24:38: Checking that 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2' is in PATH...
23:24:38: Warning: FFmpeg directory 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2' is not in PATH.
23:24:38: Temporarily prepending ';D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2' to PATH...
23:24:38: Checking for monolithic avformat from 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll'.
23:24:38: Error: Couldn't find symbol 'avutil_version' in a dynamic library (error 127: The specified procedure could not be found.)
23:24:38: Error: Couldn't find symbol 'avcodec_version' in a dynamic library (error 127: The specified procedure could not be found.)
23:24:38: avformat not monolithic
23:24:38: Loading avutil from 'avutil-52.dll'.
23:24:38: Loading avcodec from 'avcodec-55.dll'.
23:24:38: Loading avformat from 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll'.
23:24:38: Returning PATH to previous setting...
23:24:38: Actual avutil path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avutil-52.dll
23:24:38: Actual avcodec path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avcodec-55.dll
23:24:38: Actual avformat path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll
23:24:38: Importing symbols...
23:24:38: All symbols loaded successfully. Initializing the library.
23:24:38: Retrieving FFmpeg library version numbers:
23:24:38:    AVCodec version 0x373466 - 55.52.102 (built against 0x373466 - 55.52.102)
23:24:38:    AVFormat version 0x372164 - 55.33.100 (built against 0x372164 - 55.33.100)
23:24:38:    AVUtil version 0x344264 - 52.66.100 (built against 0x344264 - 52.66.100)
23:24:38: FFmpeg libraries loaded successfully.
23:24:45: Using internal LAME
23:24:52: Trying to load FFmpeg libraries...
23:24:52: mLibAVFormatPath ('D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll') is not empty. Loading from it.
23:24:52: Looking up PATH environment variable...
23:24:52: PATH = 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\Program Files\TortoiseHg\;C:\Program Files\TortoiseGit\bin;C:\Users\Zom-B\AppData\Local\Microsoft\WindowsApps'
23:24:52: Checking that 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2' is in PATH...
23:24:52: FFmpeg directory is in PATH.
23:24:52: Checking for monolithic avformat from 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll'.
23:24:52: Error: Couldn't find symbol 'avutil_version' in a dynamic library (error 127: The specified procedure could not be found.)
23:24:52: Error: Couldn't find symbol 'avcodec_version' in a dynamic library (error 127: The specified procedure could not be found.)
23:24:52: avformat not monolithic
23:24:52: Loading avutil from 'avutil-52.dll'.
23:24:52: Loading avcodec from 'avcodec-55.dll'.
23:24:53: Loading avformat from 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll'.
23:24:53: Actual avutil path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avutil-52.dll
23:24:53: Actual avcodec path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avcodec-55.dll
23:24:53: Actual avformat path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll
23:24:53: Importing symbols...
23:24:53: All symbols loaded successfully. Initializing the library.
23:24:53: Retrieving FFmpeg library version numbers:
23:24:53:    AVCodec version 0x373466 - 55.52.102 (built against 0x373466 - 55.52.102)
23:24:53:    AVFormat version 0x372164 - 55.33.100 (built against 0x372164 - 55.33.100)
23:24:53:    AVUtil version 0x344264 - 52.66.100 (built against 0x344264 - 52.66.100)
23:24:53: FFmpeg libraries loaded successfully.
23:24:55: Looking for FFmpeg libraries...
23:24:55: mLibAVFormatPath ('D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll') is not empty.
23:24:57: User-specified path = 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll'
23:24:57: User-specified FFmpeg file exists. Success.
23:24:57: Trying to load FFmpeg libraries...
23:24:57: mLibAVFormatPath ('D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll') is not empty. Loading from it.
23:24:57: Looking up PATH environment variable...
23:24:57: PATH = 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;D:\Program Files\TortoiseHg\;C:\Program Files\TortoiseGit\bin;C:\Users\Zom-B\AppData\Local\Microsoft\WindowsApps'
23:24:57: Checking that 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2' is in PATH...
23:24:57: FFmpeg directory is in PATH.
23:24:57: Checking for monolithic avformat from 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll'.
23:24:57: Error: Couldn't find symbol 'avutil_version' in a dynamic library (error 127: The specified procedure could not be found.)
23:24:57: Error: Couldn't find symbol 'avcodec_version' in a dynamic library (error 127: The specified procedure could not be found.)
23:24:57: avformat not monolithic
23:24:57: Loading avutil from 'avutil-52.dll'.
23:24:57: Loading avcodec from 'avcodec-55.dll'.
23:24:57: Loading avformat from 'D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll'.
23:24:57: Actual avutil path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avutil-52.dll
23:24:57: Actual avcodec path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avcodec-55.dll
23:24:57: Actual avformat path D:\1syncedHDD\Resources\Libraries\ffmpeg-win-2.2.2\avformat-55.dll
23:24:57: Importing symbols...
23:24:57: All symbols loaded successfully. Initializing the library.
23:24:57: Retrieving FFmpeg library version numbers:
23:24:57:    AVCodec version 0x373466 - 55.52.102 (built against 0x373466 - 55.52.102)
23:24:57:    AVFormat version 0x372164 - 55.33.100 (built against 0x372164 - 55.33.100)
23:24:57:    AVUtil version 0x344264 - 52.66.100 (built against 0x344264 - 52.66.100)
23:24:57: FFmpeg libraries loaded successfully.
23:25:03: File name is D:\Temp\foo.mp4
23:25:03: Mime type is *
23:25:03: Opening with libav
23:25:03: Error: can't flush file descriptor 3 (error 5: Access is denied.)
23:25:03: Error: FFmpeg : av_open_input_file() failed for file D:\Temp\foo.mp4
23:25:03: Opening with libsndfile
23:25:03: Opening with liboggvorbis
23:25:03: Opening with libflac
23:25:03: Opening with lof
23:25:03: Error: Importer::Import: Opening failed.

I’ve never used the ZIP method. The EXE installer has always worked for me, and it’s easier.

Do the extracted files include avcodec-55.dll, avformat-55.dll, and a bunch of other dlls?


ps: Is there an Audacity release that comes bundled with ffmpeg so it works out-of-the-box?

No. LAME is now included, but I believe there are “licensing issues” with FFmpeg. It’s probably illegal since nobody is paying any patent-license fees. MP3 (LAME) is more straightforward since it’s only one CODEC and the patents have (finally) expired. With all of the CODECS in FFmpeg, there are probably still some enforceable patents. You’ll notice that you can’t download FFmpeg directly from the Audacity website… It comes from somewhere else so the Audacity developers are not distributing it.

There “may” be a version in the future. The problem, as described by DVDdoug is that there may be license / patent issues with some of the codecs. If Audacity does ship FFmpeg, it will have to limit the FFmpeg build to include only those codecs that are considered “safe” from a license /patent point of view. We have no intention of leaving Audacity vulnerable to being shut down by some multi-national on license / patent grounds.

According to the log you posted, you were able to load FFmpeg:

Installed the Audacity exe installer. No change. I removed the Audacity folders from my user profile. No change.

Yes.


According to the log I posted, I wasn’t able to open an AAC-coded file like it should.

According to the log I posted, I wasn’t able to open an AAC-coded file like it should.

If that’s the only file giving you trouble maybe there’s something wrong with that file. :wink:

Where did that file come from? Have you tried other AAC/MP4 files? Can you play that file in Windows Media Player? Maybe check it with [u]MediaInfo[/u] to see if there are any “clues”.

The files came from a radio stream recorded with VLC without transcoding. They play fine in Winamp and MPC-HC (Don’t have Windows Media Player).

I have other files (m4a extension instead of mp4) encoded with iTunes, which load fine in Audacity.

According to Mediainfo the files are both “MPEG-4” but the exact codes differ. The unloadable mp4 file is “isom (mp41/avc1)” and the loadable m4a file is “M4A (M4A /mp42/isom)”.

Changed the title accordingly.

I found the reason. By googling the Mediainfo output, I found the answer on videohelp.com Apparently it’s because the files are truncated. When I save a radio stream and stop correctly, the file can be loaded, but when I take a snapshot of the file while recording (which I often did successfully when streams were still mp3 format) it becomes unloadable. The radio event I am recording presently run for ~16 hours each, for 5 days. I tested parts of the recording before the show, and I wanted to test loading part of day 1 in Audacity without having to copy the entire 3GiB file over network. In both cases incidentally a truncated file leading me to a false induction that all my mp4 files are unreadable.

So there are two problems:

  • Why are truncated mp4-container files unloadable? (Being a radio stream, it should have fragments and metadata everywhere in the file, right?)


  • Why does Audacity give the wrong error messages, leading me on incorrect goose trails twice over?

Yes, but a correctly formed MP4 file requires a correctly formed file header.


Which error messages are you referring to?

Sorry I didn’t mention the error message.

The first (misleading) error message is the dialog […] is an Advanced Audio Coding file. Audacity cannot open this type of file. You need to convert it to a supported audio format, while in fact it can perfectly open AAC audio, it’s just that the MP4 container is corrupt.

The second (misleading) error message is in the log. I’m not the only one. Everyone with the above problem pastes a log on a forum with the following lines: Error: Couldn’t find symbol […] in a dynamic library (error 127: The specified procedure could not be found.) followed by avformat not monolithic So people go on a goose chase to find/install/fix the ffmpeg libraries when in fact it probably has nothing to do with the original problem.

I don’t think it’s possible for software to tell the difference between a corrupt file and an unsupported file type. In both cases, what the software sees is that it is unable to open the file. The error message “could” say something like:
“Audacity cannot open this file. It is either not a supported format or is damaged. You need to convert it to a properly formed audio file of a supported type”

However, the last part of that is surely superfluous - nobody would expect Audacity to support corrupt files. So that just leaves the addition of “or is damaged”. In the vast majority of cases, the problem is not due to the file being damaged, but due to the file being an unsupported type.

What would you suggest the error message should be?

First off, Audacity telling it can’t open “Advanced Audio Coding” files when it clearly can, is wrong. It suould state it cannot open “damaged Advanced Audio Coding files” or rather “damaged mp4 containers”, depending on where the ffmpeg actually failed to read the file and it’s error code (if any).

Then on a similar note, I have two more ‘correct’ (not damaged) files which differ from 4 other ‘openable’ files only in the header:
audacityfailedmp4.png
These files are not truncated, instead it looks like the header is a lot smaller. FYI all of them are created with VLC from the same radio station. I think I may have toggled ‘save all streams’ a few too many times so that may have caused the difference between the files.

In any case, all other programs that I have that support mp4 play these files, as well as the truncated ones, correctly. I don’t know why Audacity has to be the exception.