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

ffmpeg and libfdk_aac - consider switching to opus? #503

Open
biglifedecision opened this issue Jan 9, 2025 · 3 comments
Open

ffmpeg and libfdk_aac - consider switching to opus? #503

biglifedecision opened this issue Jan 9, 2025 · 3 comments

Comments

@biglifedecision
Copy link

Running Emissary on Debian Bookwork I see Unknown encoder 'libfdk_aac' errors from ffmpeg whenever audio files are converted because the version of ffmpeg I have does not include the library for converting audio to aac. This doesn't appear to cause any problems besides errors, because I think mp3 is also being used as a fall back.

Emissary uses ffmpeg to convert media files. ffmpeg is a GPL license, which prevents it from being distributed with various proprietary codecs, including aac. Although many versions of ffmpeg do include the aac (it can be compiled with this encoder). The version of ffmpeg you'd get on MacOS, (maybe through homebrew?) does include it, but the version of ffmpeg in many repositories for many common Linux distros (in my case, Debian) do not. Compiling ffmpeg with this library myself is possible, but it might be worth switching out a proprietary codec like aac entirely to avoid this headache for others, or build in some checks and different fall back codecs. I've worked with lots of different server applications that use ffmpeg under the hood and never had to look at trying to compile or acquire a version with convert-to-aac support. I guess at a minimum it should be considered for any installation instructions for Emissary (possibly Ubuntu Server doesn't have this issue, but I'm not sure).

I'm familiar with the opus format for web streaming of music from faircamp (https://codeberg.org/simonrepp/faircamp) which seems it is becoming a preferred format for web streaming music over .mp3 and others, maybe switching to that for audio files rather than something with patent/license issues would be an idea?

@benpate
Copy link
Collaborator

benpate commented Jan 9, 2025

Thank you. This is an interesting discussion. I could certainly use opus formats. I believe that FFmpeg includes that out of the box. I do like AAC as an option because it's supposed to be very efficient for both bandwidth and encoding, but it's probably more important to keep the server install as simple (with as few moving parts) as possible.

The larger issue is that there are optional codecs that are not included in all versions of FFmpeg, which makes sense but still kinda sucks.

And you're right, I'm starting from Homebrew, which automatically includes AAC. But I also didn't have any trouble with the Docker image of FFmpeg, so maybe there might be distribution restrictions on it, as well?

It looks like I need to do a bit of homework first, to get up to speed with where you are on this. In the meantime, I'll double-check that OGG encoding works and turn that on as an alternative.

@benpate
Copy link
Collaborator

benpate commented Jan 9, 2025

Okay, the latest code on master uses replaces AAC encoding with OGG, which seems to be comparable in size. Check it out and let me know that it looks good to you?

And, though OGG works great on Firefox, it doesn't work on Safari, leaving us to fall back to MP3s. So, there's always trade offs, I guess.

I'm going to keep this open for now, and a ticket to look for ways to enable AAC on servers that can (easily) support it, without causing tons of error messages on those that don't.

@biglifedecision
Copy link
Author

I recall faircamp having the same problem with Safari (because I ran into the bug and helped debug it). I think mp3 as the fallback for Safari there as the solution, but the dev may have figured out a more elegant solution since then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants