[FFmpeg-user] How to associate a palette to DVD subtitle ?
thierry at lelegard.fr
Wed Sep 18 23:34:49 CEST 2013
I have been playing a lot with DVD subtitles and ffmpeg recently. When getting well-formed
MKV files, the subtitle palette seems to be part of the file as "codec private data" in the
S_VOBSUB stream. When the ffmpeg overlay filter processes the subtitles, the characters
are rendered with their expected appearance, most of the time white with a black outline.
With VOB files from DVD's, the palette is in the IFO file. When ffmpeg extracts the DVD
subtitle stream, it does not have the palette and the subtitles are displayed with ugly colors
(black with yellow outline for instance). The same effect is observed with ffplay.
My final goal is to hardcode the subtitles in the video but this is a general question about
palette handling in ffmpeg.
I am looking for a way to make ffmpeg use or guess the correct palette. Is there any?
There are several possibilities.
First, I know how to extract the palette information from the IFO file. Is there a way to
specify the explicit palette content to ffmpeg? In a data file? With some parameter or filter?
Second, VLC always displays the DVD subtitles with the right color. On a given file,
either a VOB file or an MKV which is produced by a command such as the following
one, VLC displays the DVD subtitle stream in white with black outline (correct) while
ffplay or ffmpeg/overlay displays them in black with yellow outline (not correct).
Command I used to extract part of a VOB file into a MKV:
ffmpeg -i VTS_01_1.VOB -map 0:1 -codec:v copy -map 0:4 -codec:a copy -map 0:15 -codec:s copy -t 200 -y cat.mkv
So, VLC knows a way to find or guess the palette. How can I make ffmpeg behave
the same way?
If there is currently no way to do that, would it be eligible as new feature?
At least a way to specify the explicit palette content? Some parameter with
the 16*4 bytes in hexadecimal can be sufficient. Or from a data file.
What could be the best way, a parameter to the overlay filter or a new
dedicated filter to add private codec data to a stream?
Thanks for your feedback.
More information about the ffmpeg-user