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.
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
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.
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. ;)
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.
Your question answers itself.
Add -strict -2 to it. That should be enough
Related
I've been using ffmpeg convert audio from one format to another and to change audio's bitrate. When I try to convert aac audio to mp3 audio using the command:
ffmpeg -i SomeAudio.aac -c:a mp3 -b:a 128k SomeOutputPath.mp3
everything works correctly and output audio is of the same length as the input audio (6 minutes, 15 seconds).
However, when I try converting it to aac audio using a similar command:
ffmpeg -i SomeAudio.aac -c:a aac -b:a 128k SomeOutputPath.aac
it makes the output audio longer (around 10 minutes). I have tried specifying output length but that still makes the video longer, it just cuts of part of the audio:
ffmpeg -i SomeAudio.aac -c:a aac -b:a 128k -t 00:06:15 SomeOutputPath.aac
Here is a link to the screenshot:
My suspicion is that message "Estimating duration from bitrate, this may be innacurate" (the one in the screenshot) is the root of my problem but I just haven't been able to find any useful information about it on the web.
Thanks a lot for any help in advance :)
The duration shown for raw AAC is a guess because it does not contain duration info. You can find the actual duration with:
ffmpeg -i input.aac -f null -
Or a faster, "close enough" method:
ffmpeg -i input.aac -c copy -f null -
Workaround is to remux to M4A:
ffmpeg -i input.aac -c copy output.m4a
I have a program generating a bunch of raw H264 frames and would like to place that into a mp4 container for streaming.
Anyone know how to do that?
I was thinking I'd use ffmpeg however, this needs to be used commercially and it seems like ffmpeg can only do this through it's x264 library... which uses a GPL license.
Thank you!
If you're looking for the FFMPEG command line to do that, then try the following:
ffmpeg -i "source.h264" -c:v copy -f mp4 "myOutputFile.mp4"
If you have a separate audio file you can add it too:
ffmpeg -i "source.h264" -i "myAudio" -c:v copy -c:a copy -f mp4 "myOutputFile.mp4"
If your audio needs to be encoded as well (for instance codec AAC-LC, bitrate 256kbps):
ffmpeg -i "source.h264" -i "myAudio" -c:v copy -c:a aac -b:a 256k -strict -2 -f mp4 "myOutputFile.mp4"
libmp4v2 is under the MPL and can be used as part of a larger work commercially. It is much lighter than libavformat also.
I have converted my video to mp4 x264 baseline format and it works fine with all pc/mobile phones , the problem is it takes long time to load the video while googling came to know that ffmpeg converts and sets the index file at the eof the video so it loads to the end to read and then plays the video, So any advices would be appreciatable to cut short the loading time.
Note:tryied out QT index swapper2 but dint give much difference , please advice .
this is the cmd i used to convert -
ffmpeg -i … -c:v libx264 -profile:v baseline -level 1 …
Thanks for your time .
You have several options to relocate the moov atom so the video can begin playback before it is completely downloaded by the client.
-movflags faststart
The easiest is the option -movflags faststart when re-encoding:
ffmpeg -i input -c:v libx264 -profile:v baseline -movflags faststart output.mp4
If you already encoded your .mp4 file, but simply want to move the atom:
ffmpeg -i input.mp4 -codec copy -movflags faststart output.mp4
You may need to get a more recent ffmpeg version to use this option. See the FFmpeg download page for links to ffmpeg builds for Linux, OS X, and Windows, or you can follow a step-by-step guide to compile ffmpeg.
qt-faststart
Alternatively you can use the qt-faststart tool that comes with the ffmpeg source:
cd ~/ffmpeg/tools
make qt-faststart
./qt-faststart input.mp4 output.mp4
MP4Box
Or you could use MP4Box (usually provided by the gpac package depending on your distro):
MP4Box -add input.mp4 output.mp4
Also See
FFmpeg and x264 Encoding Guide
FFmpeg and AAC Audio Encoding Guide
I'm trying to combine and encode some files from wav to m4a. I installed both ffmpeg and sox from source to make sure nothing was disabled. When I do the conversion with ffmpeg
ffmpeg -i input.wav -acodec aac -strict experimental output.m4a
it works fine. When I use SoX
sox input.wav output.m4a
I get the error
[NULL # 0x251b4e0] Codec is experimental but experimental codecs are not enabled, see -strict -2
sox FAIL ffmpeg: ffmpeg could not open CODEC
sox FAIL formats: can't open output file `output.m4a':
I need to way to get SoX to tell ffmpeg that its ok to use the experimental codecs.
Also I already tried using this guide http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide to install the fdk-acc encoder, but it didn't work. The experimental one works fine so I'd rather just use that.
I don't think sox supports m4a formats. you can do sox --help to see the audio file formats supported.
I'm trying to decode an FLV's audio to a playable format. I attempted to use this SO post: FMS FLV to mp3.. as an example, but my FLV is encoded in Speex.
I have compiled ffmpeg with --enable-libspeex on a Fedora 15 machine.
I believe this can be done with ffmpeg but I'm having a hard time figuring out how to do it.
Any thoughts? Thanks
Your ffmpeg needs to be configured with --enable-libspeex to support Speex decoding. Since you did not provide your OS I can not give any more specific instructions. Once you have a build of ffmpeg that can decode speex the most simple command would be:
ffmpeg -i input.flv output.wav
while reencoding flv file (speex to mp3) if you get sample rate error try this:
ffmpeg -i c:\in.flv -acodec libmp3lame -ar 44100 -vcodec copy c:\out.flv
It does not matter what your input. As long as you have the decoder and encoder enabled in your ffmpeg it will do it.
ffmpeg -i inputfile.flv -acodec libmp3lame any_other_parameters_you_want -vcodec copy out.flv
will do the trick.
run ffmpeg -codecs to see the codecs supported and ffmpeg -formats to see the formats supported in your install.