I am trying to hardcode subtitles into a new video. The original video contains a subtitle stream, i.e, in total there vide, audio and subtitles (among other streams):

Stream #0:0(eng): Video: h264 (High 10), yuv420p10le(progressive), 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 4534142.86 tbc (default)
Stream #0:1(jpn): Audio: aac (HE-AAC), 48000 Hz, stereo, fltp
  title           : 2.0 AAC
Stream #0:2(eng): Subtitle: ass (default)
  title           : FFF
Stream #0:3: Attachment: ttf
  filename        : DFKanTeiRyu-XB.ttf
  mimetype        : application/x-truetype-font

I used the following command

ffmpeg -i input.mkv -c:v libx264  -c:a libmp3lame -c:s mov_text -map 0:0 -map 0:1 -map 0:2 output.mp4

which created an output file, but the subtitles were not hardcoded (and thus not shown/recognized by the stupid TV set).

How do I convert the video with the subtitles put into the video?


2 Answers 2


You can burn in subtitles directly from mkv using "subtitles" filter.

Just add -vf "subtitles='$PATH_TO_MKV':stream_index=$SUBTITLE_ID"


ffmpeg -i input.mkv -c:v libx264 -vf "subtitles=input.mkv:stream_index=0" output.mkv

stream_index parameter is optional. It starts with zero, so stream_index=1 would select the 2nd subtitle stream in the container.

For more info, there's documentation for "subtitles" filter here http://ffmpeg.org/ffmpeg-filters.html#subtitles

And a general filtering guide at this link https://trac.ffmpeg.org/wiki/FilteringGuide

  • on macos this worked great ffmpeg -i input.mkv -c:v libx264 -vf "subtitles=input.mkv:stream_index=0" output.mkv, now I can actually play this through chromecast with subs, ty!
    – Jose V
    Aug 7, 2021 at 1:19

The way to do it is to extract the ass subtitles first:

ffmpeg -i input.mkv -c:s copy subtitle.ass

and then to 'burn' them into the video, as explained HERE:

ffmpeg -i video.avi -vf "ass=subtitle.ass" out.avi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.