1

I have 2 input files:

  • cover.jpg
  • audio.dts (6 channel)

My target file will be a mp4 with 1 video and 3 audio:

  • audio 1 is 2 channel aac
  • audio 2 is 6 channel ac3
  • audio 3 is 6 channel dts

Here is the command I've tried. Picture Image to Video with audio multichannel:

ffmpeg -loop 1 -i cover.jpg -i audio.dts \
-map 0:0 -map 1:0 -map 1:0 -map 1:0 \
-f mp4 \
-codec:v:0 libx264 -r:0 1 -profile:v:0 main -level 3.1 -pix_fmt:0 yuv420p -qmax:0 19 -qmin:0 18 \
-codec:a:0 libfaac -ac:0 2 -ar:0 44100 -q:a:0 640 -af:0 "pan=stereo| FL = FL + 0.5*FC + 1.0*BL + 1.0*SL + 0.8*LFE | FR = FR + 0.5*FC + 1.0*BR + 1.0*SR + 0.8*LFE" \
-codec:a:1 ac3 -ac:1 6 -ab:a:1 640 \
-codec:a:2 copy \
-threads 0 -y \
-shortest -t 00:00:39.000 out.mp4

But it seems those audio option I applied to audio #1 also applied to audio #2 and audio #3.

How I could make those option work for only one track?

llogan
  • 63,280

1 Answers1

1

As always, there are multiple ways of performing tasks like this within FFmpeg.

The one I am most familiar with is using the channelsplit filter to separate your audio streams and define labels for each of them. That way you can perform various filters to any one of the channels individually, and map the output to include any combination of channels you want.

The filter will look something like this:

ffmpeg -i [INPUT_video] -i [INPUT_3channel_audio] -filter_complex "[1:a]channelsplit[1][2][3];...."

In this example, we've split each of the 3 channels into new labels: [1] [2] and [3]. These labels can now be called latter on and pushed through other filters and/or mapped to the final output.

Hope this helps!

occvtech
  • 1,920