5

I'm transcoding my video using ffmpeg but I am unable to figure out how I can get both a 2 channel aac option (downmuxed) and a surround AC3 option in one go. My current command is:

ffmpeg -i input.mp4 \
-c:v libx265 -preset medium -crf 21 -pix_fmt yuv420p10le \
-tag:v hvc1 \
-c:a libfdk_aac -b:a 320k \
-c:a ac3 -b:a 512k \
movie_10bit.m4v

But I only get surround out of this. All help is much appreciated.

IanBauters
  • 123
  • 1
  • 2
  • 8

1 Answers1

11

Go with the -map option to ffmpeg. Suppose input stream 0:0 is the video stream and 0:1 is the audio stream (find out by ffmpeg -i input.mp4). Use -map to create one video stream and two audio streams in the output:

ffmpeg -i input.mp4 \
-map 0:0 -map 0:1 -map 0:1 \
-c:v libx265 -preset medium -crf 21 -pix_fmt yuv420p10le \
-tag:v hvc1 \
-c:a:0 libfdk_aac -b:a:0 320k \
-c:a:1 ac3 -b:a:1 512k \
movie_10bit.m4v

-c:a:0 and -c:a:1 describe the codec for the two audio streams.

Gyan
  • 85,394
  • 9
  • 169
  • 201
tuntap
  • 401
  • 2
  • 6
  • Thank you! This was very useful but now I notice that I get AAC and AC3 both in stereo. How can I get AAC to be stereo and AC3 to be surround (5.1-6ch)? – IanBauters Dec 26 '17 at 18:21
  • @IanBauters I have limited experience with surround but I think you should try with `-ac:1 6`. – tuntap Dec 26 '17 at 20:14