ffmpeg FLAC to AAC encoding

9,726

FFmpeg supports two AAC-LC encoders:

  • Native FFmpeg AAC encoder (aac)
  • Fraunhofer FDK AAC (libfdk_aac)

FFmpeg supports one HE-AAC encoder:

  • Fraunhofer FDK AAC (libfdk_aac)

libfdk_aac

libfdk_aac is still the best AAC-LC encoder supported by FFmpeg, and is the only HE-AAC encoder supported by FFmpeg. However, its license is problematic when it comes to distribution, so you'll need to compile ffmpeg to be able to use it.

Native FFmpeg AAC encoder

This encoder has seen many improvements since the answer you refer to. It is no longer considered experimental, but it is not yet as good as libfdk_aac. However, if you give it enough bits it should be acceptable. The advantage of this encoder is that it is always available and comes with FFmpeg.

Pipe

Not always practical, but you can pipe to your favorite, standalone encoder:

ffmpeg -i input -f wav - | fdkaac -I -m 5 - -o output.m4a

Also see

Share:
9,726

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I wanted to make sure that I'm not shooting myself in the foot and ask about this.
    So currently I have an audio file in a .mkv container that looks like this

    Audio: FLAC (framed) 48000Hz stereo 1536kbps [A: Audio (flac, 48000 Hz, stereo, s16) [default]]

    ID : 2
    Format : FLAC
    Format/Info : Free Lossless Audio Codec
    Codec ID : A_FLAC
    Duration : 39mn 50s
    Bit rate mode : Variable
    Channel(s) : 2 channels
    Sampling rate : 48.0 KHz
    Bit depth : 16 bits
    Title : Audio
    Writing library : libFLAC 1.2.1 (UTC 2007-09-17)

    And I would like to convert it to AAC, preferably without losing the quality too much.
    I did find a similar question asked on this forum.
    But the method that was described there is about 3 years old.

    In short:

    "compile your own ffmpeg for fdk_aac
    follow the AAC encoding guide and use fdk_aac's -vbr option - with a setting of 3"

    Resulting in:

    ffmpeg -i input.flac -c:a libfdk_aac -vbr 3 output.m4a".

    By evilsoup. - taken from here.

    So I was wondering if this will work for my situation, or if it won't work for me.
    If that's all it takes then no need to answer, and thanks!

  • AkselA
    AkselA over 7 years
    Just to flesh out your comment that the native encoder is not quite as good as Fraunhofer's, but acceptable at higher bit rates; listening test supporting that: hydrogenaud.io/index.php/topic,111085.0.html
  • tripulse
    tripulse about 4 years
    Native encoder may be much enriched as of today, it might yield similar quality as fdk-aac.
  • Elisa Cha Cha
    Elisa Cha Cha about 4 years
    @Quadcubic Not according to kamedo2, a known ABX tester, but regardless I personally usually still use -c:a aac.
  • tripulse
    tripulse over 3 years
    @llogan What about vanilla AAC codec + -aac_coder twoloop?
  • Elisa Cha Cha
    Elisa Cha Cha over 3 years
    @tripulse I am not aware of any ABX tests involving anmr, twoloop, and fast. Would be interesting to see results. I can only suggest to give it a try.
  • tripulse
    tripulse over 3 years
    TBH, FDK is kinda better than Vanilla. Also I'm recommending AAC with twoloop according to FFmpeg documentation that it uses a better algorithm than standard.