2

I created a video using Final Cut Pro X (10.1.4) and added a commentary using the voiceover feature. I was surprised to discover that FCPX does not support outputting a file with multiple audio tracks.

I disabled the commentary track and saved the project in 1080p with just the regular audio (main.m4v).

I then re-enabled the commentary and adjusted the regular audio and exported a 720p version with just the commentary track (commentary.m4v).

How do I use ffmpeg to create final.m4v, which would be main.m4v but with the audio track from commentary.m4v as a secondary audio track?

2 Answers2

2

Use the mapping options:

ffmpeg -i main.m4v -i commentary.m4v -c copy -map 0:v -map 0:a -map 1:a final.m4v

With -map, the first number in the option refers to the index of the input file (i.e., 0 is the first). The options therefore mean:

  • Copy all bitstreams instead of re-encoding
  • Take the (first) video stream of the first input
  • Take the (first) audio stream of the first input
  • Take the (first) audio stream of the second input

All streams that have a map option are then copied over.

You could also explicitly refer to a numbered video/audio stream, e.g. 0:a:1, to refer to the second audio stream in the first file, in case there is any.

slhck
  • 235,242
0

If it's not specific to ffmpeg you could use this example

The MKVmerge or MP4Box tool could append a track on existing video.

Kokizzu
  • 1,807