[FFmpeg-user] MKV to MP4 subtitle issue
Steve Zemlicka
stevezemlicka at gmail.com
Wed Jan 11 03:23:33 EET 2023
The question I have is similar to the following post:
https://superuser.com/questions/932730/ffmpeg-mkv-to-mp4-conversion-loses-subtitles
I am using ffmpeg version n5.1.2. I have an mkv that has two subtitle
tracks. I am trying to convert it to mp4.
mkvmerge -i input.mkv
File 'input.mkv': container: Matroska
Track ID 0: video (HEVC/H.265/MPEG-H)
Track ID 1: audio (E-AC-3)
Track ID 2: subtitles (HDMV PGS)
Track ID 3: subtitles (HDMV PGS)
Chapters: 10 entries
I believe Track ID 2 is for foreign dialog only and is the one I would
prefer to use. I also prefer to use hardsubs but would take hard or soft
subs at this point. I've tried a number of approaches with little
success. The closest I've gotten is to issue the subtitle=input.mkv option.
ffmpeg -i input.mkv -c:v hecv_nvenc -crf 26 -preset fast -c:a aac -b:a
128k subtitles=input.mkv output.mp4
I expected this to burn the subs to the video but oddly enough, it seemed
to make an mp4 with a subtitle track to toggle. Unfortunately the
subtitles are just the chapter names and not the actual subtitles. I've
also tried to manually select different subtitle tracks by using
"subtitles=input.mkv:si=1" as per
http://ffmpeg.org/ffmpeg-filters.html#subtitles. Unfortunately this
results in an error:
"Unable to find a suitable output format for 'subtitles=input.mkv:si1'"
followed by:
"subtitles=input.mkv:si=1: Invalid argument"
I've also tried several other options including "-c:s copy" which didn't
work due to the nature of the original subtitles (PGS) I suspect.
Am I doing something wrong or missing something?
More information about the ffmpeg-user
mailing list