LoginSignup
19
21

More than 5 years have passed since last update.

複数音声を持つmp4をffmpegで作る、もといmapオプションの説明

Posted at

いつも忘れるのでffmpeg で多言語とかのマルチトラックの作る方法と、その時に必要な map オプションの使い方の説明。

まずやり方

video.mp4(ビデオのみ)
audio-ja.m4a(音声のみ)
audio-en.m4a(音声のみ)

のファイルがあった時に複数言語の動画を作るには
ffmpeg -i video.mp4 -i audio-ja.m4a -i audio-en.m4a -c copy -map 0:0 -map 1:0 -map 2:0 output.mp4

でOKです。

map の使い方

ffmpeg は -iで指定したファイルの順番を0から数えます。
またそれぞれのファイルのストリームの順番も0から数えます。

なので-map 0:0 -map 1:0 -map 2:0 と言うのは、
0つ目のファイルの、0番目のストリームと
1つ目のファイルの、0番目のストリームと
2つ目のファイルの、0番目のストリームをマージするという意味になります。

ストリームの順番が知りたい時は

ffmpeg -i foo.mp4 とすると Stream #1:0: Audio みたいな所で見えます。

19
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
21