Jump to content

Enable CoreAudio AAC encoder


satelli

Recommended Posts

satelli

Hi Devs,

Please consider enable additional AAC encoders, so that the Transcoding page in the server management lists all available AAC encoders and allows user to choose from. 

The reason for such request is that I, and many other music listeners who choose to self-host their library, or maybe you can easily tell the difference between the output from FFmpeg built-in AAC encoder and CoreAudio encoder. Try it here https://satellitemx.github.io/static/aac-py/ (80 Kbps). 

As transcoding for music happens when the client cannot DirectPlay (Safari doesn't directly play Opus/Vorbis without hacks, or FLAC in high bitrate), or the client has slow internet connection (3G), or client has specified slower speed (to lower internet usage), a better encoder really helps.

As far as I know, ffmpeg bundled with Emby Server for macOS is built with CoreAudio support. Similar to macOS/iOS video acceleration layer VideoToolbox, the AudioToolbox is the audio counterpart and uses CoreAudio AAC encoder. 

user@mac Downloads % ./EmbyServer.app/Contents/MacOS/ffmpeg -encoders | grep aac
ffmpeg version 4.3.0-emby_2021_02_21 Copyright (c) 2000-2021 the FFmpeg developers and softworkz for Emby LLC
  built with clang version 11.0.0
Execution Date: 2022-04-06 09:27:40
 A..... aac                  AAC (Advanced Audio Coding)
 A....D aac_at               aac (AudioToolbox) (codec aac)

On Windows, OBS is able to use the CoreAudio encoder if user has non-Microsoft Store version of iTunes installed.

https://github.com/obsproject/obs-studio/tree/master/plugins/coreaudio-encoder

 

Much appreciated.

satelli

  • Agree 1
Link to comment
Share on other sites

rbjtech

You can just specify the aac encoder library you wish to use in the ffmpeg command line (assuming it uses the same syntax of course)

-c:a aac_at

You can probably easily test this out if you use the diagnostics plugin and do a text substitution. 

However, it appears this is an optional library, so introducing the possibility of not using the default library adds complexity (and support) ..

Just out of curiosity, how does the aac_mf encoder stack up ? - as that appears to be already in the emby ffmpeg anyway but not necessarily in the Mac version .. ?

ffmpeg version 4.5.0-emby_2021_12_10-g463c71b3b3+1170 Copyright (c) 2000-2021 the FFmpeg developers and softworkz for Emby LLC
  built with gcc 10.3.0 (Rev5, Built by MSYS2 project)
Execution Date: 2022-04-06 08:45:37
 A..... aac                  AAC (Advanced Audio Coding)
 A....D aac_mf               AAC via MediaFoundation (codec aac)

 

 

Edited by rbjtech
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

satelli
2 hours ago, rbjtech said:

You can probably easily test this out if you use the diagnostics plugin and do a text substitution.

Thanks for the info!

2 hours ago, rbjtech said:

However, it appears this is an optional library, so introducing the possibility of not using the default library adds complexity (and support) ..

Yes! I would be very grateful for having such feature implemented.

2 hours ago, rbjtech said:

Just out of curiosity, how does the aac_mf encoder stack up ?

aac_mf is Windows only, via MediaFoundation https://docs.microsoft.com/en-us/windows/win32/medfound/aac-encoder

I can't use aac_mf to convert the file.

  Stream #0:0: Audio: aac, 44100 Hz, stereo, s16, 256 kb/s
    Metadata:
      encoder         : Lavc59.18.100 aac_mf
[aac_mf @ 000001b643104b40] nb_samples (4608) != frame_size (0)
Audio encoding failed
Conversion failed!

But I managed to use the Windows built-in Video Editor to convert WAV file to an empty MP4. I assume it would use the Windows built-in encoder. The audio is encoded in 128 Kbps aac. It is clearer than the result from FFmpeg's built-in encoder and has less water-y artefacts (I don't know how to describe such in English, apologies) as per my listening experience. 

Edited by satelli
additional information
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...