Reputation: 1762
Edit: Title altered to reflect that the answer and comments by @llogan cover switching between both audio and subtitle tracks.
I have an m.mp4
with English audio and want to add a second audio stream in Italian so that I can play either language using the iPhone. When I used this command:
ffmpeg -i m.mp4 -i ita.mp3 -c copy -map 0 -map 1 out.mp4
the output from ffmpeg -i out.mp4
(see below) shows that a new audio stream is added, and I can switch between audio streams using the VLC player. Yet when I transfer the video to the TV app and play it on either MacOS or iOS it only plays the original English and I see no options to play other languages.
How do I get it to be able to switch between either audio on iOS?
Here is the output from ffmpeg -i out.mp4:
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 400x300 [SAR 1:1 DAR 4:3], q=2-31, 482 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 102 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:2: Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 152 kb/s
Metadata:
encoder : LAME3.100
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #1:0 -> #0:2 (copy)
Upvotes: 0
Views: 276
Reputation: 134173
Some players don't support MP3 in MP4. Try AAC:
ffmpeg -i m.mp4 -i ita.mp3 -map 0 -map 1:a -c copy -c:2 aac -metadata:s:a:0 language=eng -metadata:s:a:1 language=ita -movflags +faststart out.mp4
Upvotes: 1