"The encoder 'aac' is experimental but experimental codecs are not enabled"

34,869

Solution 1

Actually it is not enough to add -strict -2 to the command line. It is very important where the -strict -2 is added and unfortunately this is not explained in the error message. It should be just before the last argument, that is, as follows:

ffmpeg -i infile -strict -2 outfile

Solution 2

Like the message says, the native ffmpeg AAC audio encoder is experimental and you need to add -strict -2 or -strict experimental to your command use it. However, this encoder is no longer marked as experimental, so recent ffmpeg builds do not need to use this option.

For the best results use libfdk_aac instead. You need to compile ffmpeg with this lib, see the compilation guide.

To set the audio encoder use -c:a libfdk_aac.

Solution 3

Try following command :

ffmpeg -i Inputfile.flv -vcodec h264 -acodec aac -strict -2 Filename.mp4

You can use this command to convert any type of video file into mp4 with x264 and with same quality.

I have tried so many ways but this worked for me like a charm. ;)

Solution 4

You can add the -strict experimental in your C++ code by setting the codec-context strict_std_complaince variable to -2 before opening the codec.

AVCodecContext *c;
c->strict_std_compliance = -2;

/* open it */
ret = avcodec_open2(c, codec, NULL);

See the original author's explanation here.

Share:
34,869

Related videos on Youtube

Sandeep Nambiar
Author by

Sandeep Nambiar

web developer @ Designdays

Updated on September 01, 2021

Comments

  • Sandeep Nambiar
    Sandeep Nambiar almost 3 years

    While converting flv to mp4 conversion using FFMPEG it's showing following error

    [aac @ 0x2b4b640] The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.

    • llogan
      llogan over 6 years
      If you're seeing the "experimental" message then your ffmpeg is old. The FFmpeg AAC encoder is no longer experimental so you don't need to use -strict experimental/-strict -2 anymore. See the FFmpeg Download page for links to builds for Linux, macOS, and Windows.
    • Sebastian Iorga
      Sebastian Iorga over 5 years
      As of this comment Ubuntu 16.04 LTS is providing version 7:2.8.15-0ubuntu0.16.04.1 which still triggers the "experimental" error. Assuming you're just using the apt package.
  • llogan
    llogan over 8 years
    @SandeepNambiar "You need to compile ffmpeg with this lib, see the compilation guide." Also, you should accept one of these answers; the Unknown encoder 'libfdk_aac' is a different issue than what your question asks about.
  • Mike Versteeg
    Mike Versteeg over 8 years
    When making an advice like this it is good form to mention that codec is not GPL (basically that means you cannot use it without paying for it). See trac.ffmpeg.org/wiki/Encode/AAC
  • aergistal
    aergistal over 8 years
    @Mike Versteeg In this case there is nothing in the question that indicates the asker wants to distribute the code and there are no license fees for distributing AAC content. Plus it's not an advice. See: vialicensing.com/licensing/aac-faq.aspx
  • Brian FitzGerald
    Brian FitzGerald about 8 years
    Thanks a lot for this, these zero byte files (because of incorrect flag order) had me baffled.
  • coderMe
    coderMe over 7 years
    As @freeseek mentioned, this is not enough - it is very important exactly where you place the -strict -2 flags.
  • Akhil Gupta
    Akhil Gupta over 7 years
    I felt that would be obvious, like freeseek mentioned, before the output file name
  • coderMe
    coderMe over 7 years
    If it's so obvious, why the original question at all?
  • Kalob Taulien
    Kalob Taulien over 6 years
    I was encoding videos from mp4 to hls and kept getting the aac/strict 2 error message. freeseek's answer was the only one that worked.
  • brillout
    brillout over 6 years
    You saved my file/life. Goddamn ffmpeg should get their params fixed
  • Mitya
    Mitya over 5 years
    Crazy that they don't point this out in the logs. Thanks, @freeseek, really helped me out.
  • YTZ
    YTZ over 3 years
    "It should be just before the last argument" is incorrect. You can do something like this ffmpeg -i infile -c:a aac -strict 2 -ab 192k outfile without any problems.
  • Navin
    Navin about 2 years
    @brillout ffmpeg is known for its insane/idiosyncratic syntax. This hasn't been fixed in 2022 and I doubt it ever will be.