User Tools

Site Tools


ffmpeg:subtitles:add_subtitles_from_an_ass_file

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ffmpeg:subtitles:add_subtitles_from_an_ass_file [2024/12/30 21:08] peterffmpeg:subtitles:add_subtitles_from_an_ass_file [2024/12/30 22:08] (current) peter
Line 10: Line 10:
   * SRT is more popular than ASS.   * SRT is more popular than ASS.
  
 +ASS files have INI-style sections.
 +
 +  * Each section is preceded by a line containing the sections name, in square brackets.
 +  * Aside from this, each line is generally composed of: a line descriptor, which tells about what the line is about; a colon; and the line data itself.
 +  * Any whitespace between these parts are allowed.
 +  * Blank lines are also allowed.
 +  * Hard comment lines are preceded by either a semicolon or !: (with "!" as the line descriptor).
 +  * Unrecognized and incorrect line formats are ignored. 
  
 ---- ----
  
 +===== Adding Soft Subtitles =====
 +
 +<code bash>
 +ffmpeg -i input.mp4 -i subtitle.ass -c copy -c:s mov_text -metadata:s:s:0 language=eng output.mp4
 +
 +ffmpeg -i input.mp4 -i subtitle.ass -c copy -c:s srt -metadata:s:s:0 language=eng output.mkv
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  Different syntax is used for MP4 and MKV.
 +
 +  * **-c** copy specifies that the video is not to be re-encoded.
 +  * **-c:s mov_text** sets the ASS file to MOV_TEXT format for MP4.
 +  * **-c:s srt** sets the ASS file to SRT format for MKV.
 +  * **-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 [[https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes|ISO 639]] language code which consists of 3 letters for every language.
 +
 +</WRAP>
 +
 +----
 +
 +----
 +
 +===== Adding Hard Subtitles =====
  
 <code bash> <code bash>
 ffmpeg -i input.mp4 -vf ass=subtitle.ass output.mp4 ffmpeg -i input.mp4 -vf ass=subtitle.ass output.mp4
 </code> </code>
 +
 +<WRAP info>
 +**NOTE:**  The subtitles will be added to the video using the default font styles.
 +
 +  * **-vf** is an alias for **-filter:v**.
 +  * **ass=subtitle.ass** is the name of the filter followed by the name of the ASS subtitle file.
 +
 +</WRAP>
 +
 +----
 +
 +===== References =====
 +
 +https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
  
ffmpeg/subtitles/add_subtitles_from_an_ass_file.1735592895.txt.gz · Last modified: 2024/12/30 21:08 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki