0

I want to cut a section of an MKV and encode it to MP4, while also burning the subtitles.
But I don't know how to do that all in 1 pass (related question), so I tried it step by step.

  • When I first cut the MKV, and then encode it to MP4, it won't hardcode the subtitles. The cut MKV container still retained the subtitles. I tried both internal and external subtitles.

    • test 1 (fail): subtitles directly from MKV
      ffmpeg -i konosuba.mkv -ss 180 -t 30 test.mkv
      ffmpeg -i test.mkv -vf subtitles=test.mkv test2.mp4

    • test 2 (fail): external subtitles
      ffmpeg -i konosuba.mkv -ss 180 -t 30 test.mkv
      ffmpeg -i test.mkv -map 0:s:0 subs.ass
      ffmpeg -i test.mkv -vf subtitles=subs.ass test2.mp4

  • It succesfully hardcodes the subtitles when I first encode the whole MKV to MP4, afterwards I can cut it. But this takes much longer with big source files :(

    • test 3 (success)
      ffmpeg -i konosuba.mkv -vf subtitles=konosuba.mkv test.mp4
      ffmpeg -i test.mp4 -ss 180 -t 30 test2.mp4

There seems to be a difference in the logs: test 1 vs test 3

Am I doing something wrong here? I really don't understand why I can't burn subtitles, unless when encoding the original MKV container without cutting it.

Edit: Just trying to burn subtitles by itself doesn't seem to work for me (log)
ffmpeg -i test2.mp4 -vf subtitles=subs.ass test3.mp4


Log: https://gist.github.com/anonymous/d2eb6f09fabba88afe86bd4607b048a4
Build: https://ffmpeg.zeranoe.com/builds/
OS: Windows 10 v1607

https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo
https://ffmpeg.org/ffmpeg-filters.html#subtitles-1

enter image description here

1

Just combine the two commands of test3:

ffmpeg -i konosuba.mkv -ss 180 -t 30 -vf subtitles=konosuba.mkv test.mp4

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.