1

I'm creating audio tracks from movies that can be direct played on Roku and iOS devices. Handbrake can downmix 5.1 audio to stereo with Pro Logic II matrix encoding, but it cannot re-encode just the audio; Handbrake also re-encodes the video, resulting in poorer quality and longer encode durations. How can I do this with Ffmpeg?

I found this post from 2013 detailing this process, but Ffmpeg has changed since then:

  • "libfdk_aac" AAC encoder doesn't work anymore. The native "-aac" encoder is the default.

This is the command I'm entering:

ffmpeg -i input.mkv -map 0:v -c:v copy -map 0:1 -c:a:0 copy -map 0:1 -c:a:1 aac -b:a:1 256k -ac 2 -af aresample=matrix_encoding=dplii -map 0:7 -c:s:0 copy -map 0:6 -c:s:1 copy output.mkv

I'm trying to stream copy the video, stream copy the EAC3 audio, and create a new, 256kbps, Dolby Pro Logic II-encoded AAC track (and stream copy English and English SDH subtitle tracks).

But I run into this error:

Filtergraph 'aresample=matrix_encoding=dplii' was defined for audio output stream 0:1 but codec copy was selected. Filtering and streamcopy cannot be used together.

I guess Ffmpeg can't both streamcopy (-map 0:1 -c:a:0 copy) and filter (-map 0:1 -c:a:1 aac -b:a:1 256k -ac 2 -af aresample=matrix_encoding=dplii) the same source audio track into two destination audio tracks. If I remove the streamcopy track, the command runs, but I don't want to abandon the original, high quality EAC3 audio track.

Is there any way to execute this command so I get my two audio tracks?

1

0

Browse other questions tagged .