[FFmpeg-user] MKV to MP4 subtitle issue
Moritz Barsnick
barsnick at gmx.net
Mon Jan 16 12:47:36 EET 2023
On Tue, Jan 10, 2023 at 19:23:33 -0600, Steve Zemlicka wrote:
> The question I have is similar to the following post:
> https://superuser.com/questions/932730/ffmpeg-mkv-to-mp4-conversion-loses-subtitles
Those answers are not helpful, because you have HDMV PGS, which is a
bitmap format, that cannot be converted to ASS or SRT directly.
> 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
>
> "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"
If you use the "subtitles" filter, you must declare it after the
leading filter option "-vf".
But, that said, the subtitles filter is actually meant for handling
text-based subtitles. Which it what you presume here:
> 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.
MP4 cannot carry those HDMV PGS subtitles (or any other bitmap based
format, if I remember correctly).
Since you prefer hardsubs anyway, perhaps this method mentioned in
ffmpeg's own wiki can be of help:
https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo#Picture-basedsubtitles
BTW, here's a link on how to extract those bitmaps:
https://superuser.com/q/1748962
You would need OCR to convert them to text-based. ffmpeg has no
integration of such tools, but external tools are available. (I have
one myserlf attempted to convert bitmap subs to text-based subs. It was
a cumbersome process.)
Cheers,
Moritz
More information about the ffmpeg-user
mailing list