Note for how to embed .srt subtitle into .mkv video file.


ffmpeg -i ${MKV_FILE_PATH} -vf "subtitles='${SRT_FILE_PATH}'" ${OUTPUT_FILE_PATH}


Your ffmpeg need --enable-libass configuration. Use ffmpeg to check the output, it should be like:

ffmpeg version 4.0.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.1.0 (clang-902.0.39.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libass --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --enable-openssl --disable-lzma
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

If you see --enable-libass in the output, you don't have to do anything.

Otherwise, you have to reinstall your ffmpeg with --enable-libass

If you are using macOS with homebrew, you can do it by the command below:

brew install ffmpeg --with-libass


I have one .mkv and one .srt file, and I want to play it on my Chromecast with subtitles.

Unfortunately, Chromecast doesn't support adding subtitle track while playing.

So, I came up with embedding subtitles into video files with ffmpeg.


ffmpeg -i ${MKV_FILE_PATH} -vf "subtitles='${SRT_FILE_PATH}'" ${OUTPUT_FILE_PATH}

(With --enable-libass ffmpeg)

If the font size of the embedded subtitles is too small. You can also change the font size with force_style option (even change the font and the color):

ffmpeg -i ${MKV_FILE_PATH} -vf \
"subtitles='${SRT_FILE_PATH}':force_style='FontName=${FONT_NAME},FontSize=24,PrimaryColour=&HAA00FF00'" \




如果覺得這篇文章對你有幫助, 除了留言讓我知道外, 或許也可以考慮請我喝杯咖啡, 不論金額多寡我都會非常感激且能鼓勵我繼續寫出對你有幫助的文章。

If this blog post happens to be helpful to you, besides of leaving a reply, you may consider buy me a cup of coffee to support me. It would help me write more articles helpful to you in the future and I would really appreciate it.

Related Posts