To add two audio tracks into sample.mp4 (without any audio track):
ffmpeg \
-i sample.mp4 \
-i chi.mp3 \
-i eng.mp3 \
-c:v copy \
-map 0:v \
-map 1:a \
-map 2:a \
-metadata:s:a:0 title="chinese" \
-metadata:s:a:1 title="english" \
-metadata:s:a:0 language="chi" \
-metadata:s:a:1 language="eng" \
-y \
video_with_multi_audio.mp4
Show all the streams in video_with_multi_audio.mp4:
ffprobe -i video_with_multi_audio.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_with_multi_audio.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.27.100
Duration: 00:00:28.03, start: 0.000000, bitrate: 1118 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1280x720, 879 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
Metadata:
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : Lavc59.37.100 libx264
Stream #0:1[0x2](chi): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 121 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Stream #0:2[0x3](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 124 kb/s
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
I want to add two subtitles chi.ass, eng.ass into video_with_multi_audio.mp4.
My try:
ffmpeg -i video_with_multi_audio.mp4 \
-i chi.ass \
-i eng.ass \
-map 0:v:0 \
-map 1:s:0 \
-map 2:s:1 \
-c copy -c:s ass \
-metadata:s:s:0 language=chi -metadata:s:s:1 language=eng \
video_sub.mp4
Error info:
Stream map '2:s:1' matches no streams.
To ignore this, add a trailing '?' to the map.
To add ? :
ffmpeg -i video_with_multi_audio.mp4 \
-i chi.ass \
-i eng.ass \
-map 0:v:0 \
-map 0:s:0? \
-map 0:s:1? \
-c copy -c:s ass \
-metadata:s:s:0 language=chi -metadata:s:s:1 language=eng \
video_sub.mp4
No error info ,and no audio tracks and subtitles in the video_sub.mp4.The ffmpeg command can't work.
How can add multiple ass file as soft multiple subtitles with ffmpeg?
No error info for the command:
ffmpeg -i video_with_multi_audio.mp4 \
-i chi.ass \
-i eng.ass \
-map 0:v:0 \
-map 0:s:0? \
-map 0:s:1? \
-metadata:s:s:0 language=chi \
-metadata:s:s:1 language=eng \
-c:s copy video.mkv
The video.mkv contains no audio track and no subtitle!
video_sub.mkv..liquid_ass"?