Untertitel hinzufügen
6. Januar 2025
Mit ffmpeg lassen sich mit der nachfolgenden Zeile Untertitel zu einem bestehenden Video hinzufügen.
$ ffmpeg -i input.mp4 -i english.srt -i german.srt -map 0 -map 1 -map 2 -c copy -c:s mov_text -metadata:s:s:0 language=eng -metadata:s:s:1 language=deu output.mp4
Dabei bedeuten die jeweiligen Parameter folgendes.
-i input.mp4
: Specifies your input video file.-i english.srt
: Specifies your English subtitle file.-i german.srt
: Specifies your German subtitle file.-map 0
: Maps the video and audio from the first input file (input.mp4).-map 1
: Maps the subtitles from the second input file (english.srt).-map 2
: Maps the subtitles from the third input file (german.srt).-c copy
: Copies the video and audio streams without re-encoding.-c:s mov_text
: Specifies the codec for subtitles (for MP4 containers, mov_text is commonly used).-metadata:s:s:0 language=eng
: Sets the language metadata for the first subtitle track to English.-metadata:s:s:1 language=deu
: Sets the language metadata for the second subtitle track to German.output.mp4
: The name of your output file with the embedded subtitles.