1

I have an MKV file with H.264 video and AAC audio. With FFmpeg the default audio codec for MKV is AC3, so if you run a command such as

ffmpeg -i infile.mkv -ac 2 outfile.mkv

it will transcode the audio to AC3. I can run this command and all is well

ffmpeg -i infile.mkv -ac 2 -c:a libfdk_aac outfile.mkv

However is a way available to say "use the input codec"? Note that copy will not work because I am making a change to the audio stream.

2

There is no such option as far as I know. You will have to be explicit, rely on the defaults, or perform additional scripting.

If you believe this should be implemented as a feature you can create a feature request on the FFmpeg Bug Tracker (search first to see if one already exists).

Note that the default encoder for your output container format can change depending on your supported external encoding libraries. For example, if your ffmpeg build supported libvorbis it would use that instead of ac3 for mkv outputs.

ffprobe may help:

$ ffprobe -v 0 -of flat=s=_ -select_streams a:0 -show_entries stream=codec_name input.mkv
streams_stream_0_codec_name="aac"

Of course this may be of limited usefulness since codec_name may not be the same name of the encoder you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.