I want to use ffmpeg to add English audio and subtitle tracks (eng.mp3 and eng.srt) to a video (call it 3.mp4) that already has Italian, French and German. The crucial thing is that the final video allows switching between language audio and subtitle tracks. To summarize, I want:
want: 3.mp4 + eng.mp3 + eng.srt → 3plus1.mp4
I’ve tried this but it does not work:
ffmpeg -i 3.mp4 -i eng.mp3 -i eng.srt
-map 0:v -map 0:a -map 1:a -map 2:s:0
-metadata:s:a:0 language=eng -metadata:s:s:0 language=eng
-c:s:0 mov_text -shortest 3plus1.mp4
I can make video from scratch with 3 languages (3.mp4) or 4 languages (4.mp4) starting from all the .mp3 and .srt files as follows (notice that the video part is produced on the fly as just a black background; this keeps files small for testing and video is not the point here):
this works: ita.mp3 + fre.mp3 + ger.mp3 + ita.srt + fre.srt + ger.srt → 3.mp4
ffmpeg -f lavfi -i "color=color=black:s=1280x720"
-i ita.mp3 -i fre.mp3 -i ger.mp3
-i ita.srt -i fre.srt -i ger.srt
-map 0:v -map 1:a:0 -map 2:a:0 -map 3:a:0
-map 4:s:0 -map 5:s:0 -map 6:s:0
-metadata:s:a:0 language=ita -metadata:s:a:1 language=fra -metadata:s:a:2 language=ger
-metadata:s:s:0 language=ita -metadata:s:s:1 language=fra -metadata:s:s:2 language=ger
-c:s:0 mov_text -c:s:1 mov_text -c:s:2 mov_text
-shortest 3.mp4
this works: ita.mp3 + fre.mp3 + ger.mp3 + eng.mp3 + ita.srt + fre.srt + ger.srt + eng.srt → 4.mp4
ffmpeg -f lavfi -i "color=color=black:s=1280x720"
-i ita.mp3 -i fre.mp3 -i ger.mp3 -i eng.mp3
-i ita.srt -i fre.srt -i ger.srt -i eng.srt
-map 0:v -map 1:a:0 -map 2:a:0 -map 3:a:0 -map 4:a:0
-map 5:s:0 -map 6:s:0 -map 7:s:0 -map 8:s:0
-metadata:s:a:0 language=ita -metadata:s:a:1 language=fra -metadata:s:a:2 language=ger -metadata:s:a:3 language=eng
-metadata:s:s:0 language=ita -metadata:s:s:1 language=fra -metadata:s:s:2 language=ger -metadata:s:s:3 language=eng
-c:s:0 mov_text -c:s:1 mov_text -c:s:2 mov_text -c:s:3 mov_text
-shortest 4.mp4
I don’t see how to upload the files I’m using for testing here but I found a site called disroot that looks like it allows file sharing. This link is to a count.zip archive I made with all the files I’ve been using for testing. I also really don’t understand how ffmpeg works — that’s why I’m here. I have always just pieced together ffmpeg commands from others smarter than me.