FFmpeg Downmix – How to Downmix 5.1 DTS HD MA or Dolby TrueHD to Stereo AAC

audioffmpeghandbrake

I'm creating audio tracks from movies that can be played on Apple TV and iOS devices. Handbrake could downmix 5.1 audio to stereo with Pro Logic II matrix encoding. How can I do that with ffmpeg?

I found this link on ffmpeg Trac mentioning that I could do matrix encoding with libswresample, but further searching doesn't show how to actually use this in command line.

I tried

ffmpeg -i test.mkv -map 0:1 -c libfdk_aac -ac 2 -af aresample  -matrix_encoding dplii  out.aac

where the only audio track in the source file test.mkv is a 5.1ch DTS HD MA, but the generated AAC audio does not seem to be matrix encoded.

Best Answer

According to the manual entry on aresample, you have to supply the resampler options in a different format:

The filter accepts the syntax [sample_rate:]resampler_options, where sample_rate expresses a sample rate and resampler_options is a list of key=value pairs, separated by ":".

That means you'd need to call it like this:

-af "aresample=matrix_encoding=dplii"
Related Question