[FFmpeg-user] Create transparent movie with subtitles

Frank @ Taapo info at taapo.com
Wed Sep 20 13:52:49 EEST 2017


I'm at a loss at the moment. I have been testing and posting questions @
SO, VideoHelp, Doom9 -- nobody seems to have an answer. Maybe I have better
luck here.

I'm trying to generate a transparent movie with ASS subtitles burnt in. The
only way to do this correctly seems to be using AviSynth as an
intermediate, but I'm sure there is another way.

I can use colorkey, like below - and it'll create a usable transparent
movie - but the edges of the subtitles are not smooth anymore:

ffmpeg.exe -y -f lavfi -i color=s=1920x1080:color=0xff0000 -an -vf
"ass=test.ass,colorkey=0xff0000:0.5:0.5,format=yuva420p" -c:v png -t
"00:01:40.544" -threads 0 "video.mov" -stats

It's clear that this is not the way to go.

So my second way of thinking was creating a virtual background using lavfi,
and setting this to a transparent color -- but I have not found a way to
set a color and make it transparent using ffmpeg filters.

Third try was to create a transparent png, loop it and overlay the
subtitles:

ffmpeg.exe -y -loop 1 -i transparent-1920x1080.png -vf
"ass=test-normal.ass,format=rgba" -c:v png -t "00:00:10.000" -threads 4
"video-transparent.mov" -stats

While I preview the resulting movie in a media player, it shows the
subtitles on a white background, but when I import in Premiere or After
Effects, the full movie is transparent. Like if the alpha channel is
applied on top of the subtitles.

Is there a way to get this done properly in ffmpeg?
ᐧ


More information about the ffmpeg-user mailing list