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
  • 57,139
  • 15
  • 118
  • 145
Beterhans
  • 11
  • 2
  • Try to encode the audio before to separate files and then use `copy` codec for all audio streams when muxing the final mp4. – Marki555 May 19 '15 at 08:44
  • 1
    This helped me immensely when I was doing multichannel stuff. It might help you, it might not, but take a look: https://trac.ffmpeg.org/wiki/AudioChannelManipulation – Russell Uhl May 19 '15 at 15:49
  • You need to include the complete console output from your `ffmpeg` command. – llogan May 19 '15 at 16:34

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,700
  • 1
  • 14
  • 18
  • I do not have issue on audio channel's but audio tracks. I have 1 audio have 6 channels, and based on that I want to create 3 version of the original audio track as you see in my example. and the 1st video seems like called v:0 and 1st audio called a:0 and 2nd a:1. if I address a parameter like "-ac:a:1 2" re-encode the 2nd audio into 2 channel track. but ffmpeg didn't go my way. – Beterhans May 22 '15 at 08:44