[FFmpeg-user] Can I change overlay color of subtitle?

Nicholas Robbins nickrobbins at yahoo.com
Sun Oct 12 16:03:59 CEST 2014

> On Sunday, October 12, 2014 9:47 AM, James Darnley <james.darnley at gmail.com> wrote:

> > On 2014-10-12 14:17, Kimio Miyamura wrote:
>>  Hello, 
>>  I am trying to hardcode dvd subtitle into video referring the link below 
>>  https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo
>>  The command line I tried is the following.
>>  $ ffmpeg -analyzeduration 60M -probesize 60M \
>>  -i /Volumes/DVD_VIDEO/VIDEO_TS/VTS_01_1.VOB \
>>  -filter_complex "[0:v][0:s]overlay[v]" \
>>  -map [v] -map 0:a -t 00:05:00 test.mp4
>>  The command line works fine and I can get a mp4 movie with subtitle.  But I 
> got yellow colored subtitle.  I'd like to change subtitle color into yellow 
> to white if I can.
>>  Is there any way to change overlay color of subtitle?
> Only of text subtitles.  DVDs have vobsub subtitles which are bitmaps.
> This means it can't be as easy as setting "color=white".  There 
> might be
> some complicated way of altering the colours of the bitmaps by
> saturation, brightness, or just a lut.

If they are vobsubs, you could split them out into a track.idx/track.sub pair with, for instance mkvextract.

Looking at the .idx file, I see it has a line at the start:

palette: 000000, 0000ff, 00ff00, ff0000, ffff00, ff00ff, 00ffff, ffffff, 808000, 8080ff, 800080, 80ff80, 008080, ff8080, 555555, aaaaaa

Changing that would presumably change the color of the subtitles.

mkvmerge can pull the subtitles back in.

So what i would suggest is

#remux subtitles
ffmpeg -analyzeduration 60M -probesize 60M -i /Volumes/DVD_VIDEO/VIDEO_TS/VTS_01_1.VOB  -vn -an subtitles.mkv

#pull out .idx/.sub pair
mkvextract tracks subtitles.mkv 0:subtitles.idx

$??edit that line to change the colors??

#put the .idx/.sub pair back together
mkvmerge -o newsubs.mkv subtitles.idx

#use that new subtitle stream
ffmpeg -analyzeduration 60M -probesize 60M \
-i /Volumes/DVD_VIDEO/VIDEO_TS/VTS_01_1.VOB \
-i newsubs.mkv \
-filter_complex "[0:v][1:s]overlay[v]" \
-map [v] -map 0:a -t 00:05:00 test.mp4

I have no idea if changing the palette line will work.

More information about the ffmpeg-user mailing list