User Tools

Site Tools


ffmpeg:subtitles:add_subtitles_from_a_srt_file

This is an old revision of the document!


ffmpeg - Subtitles - Add subtitles from a SRT file

Adding Soft Subtitles

ffmpeg -i input.mp4 -i subtitle.srt -c copy -c:s mov_text -metadata:s:s:0 language=eng output.mp4

NOTE:

  • -c copy specifies that the video is not to be re-encoded.
  • -c:s mov_text sets the SRT file to MOV_TEXT format.
  • -metadata:s:s:0 means to set the metadata for Stream:Subtitle:Number of stream, starting with 0.
  • language=eng sets the subtitle language to English.
    • The value for this option uses the ISO 639 language code which consists of 3 letters for every language.

Adding Hard Subtitles

ffmpeg -i input.mp4 -vf subtitles=subtitle.srt output.mp4

NOTE: The subtitles will be added to the video using the default font styles.

  • -vf is an alias for -filter:v.
  • subtitles=subtitle.srt is the name of the filter followed by the name of the SRT subtitle file.

References

ffmpeg/subtitles/add_subtitles_from_a_srt_file.1735591928.txt.gz · Last modified: 2024/12/30 20:52 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki