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

Kimio Miyamura xanadu at apost.plala.or.jp
Sun Oct 12 16:43:11 CEST 2014


2014/10/12 23:03、Nicholas Robbins <nickrobbins-at-yahoo.com at ffmpeg.org> wrote: 

>> 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:
>> 
>>> 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.

Thanks for procedure.  I don't tried it yet.  But this procedure is based on changing color of original dvd-vobsub.  Am I right?

Do I need this procedure even if original dvd-vobsub is white bordered in black when watching original DVD with player?

I heard that the color is intentionally changed by ffmpeg.  Am I wrong?


// Miya


More information about the ffmpeg-user mailing list