An ASS (Advanced SubStation Alpha) file is a subtitle format that supports text styling, animation, and karaoke-like graphics.
ASS is a more advanced subtitle format than SRT since ASS allows for more advanced display features such as text positioning, fonts, animation, and graphics besides the plain text styling.
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.
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
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
ISO 639 language code which consists of 3 letters for every language.