'FFMPEG: create a transparent background with lavfi?

I can create a transparent background using lavfi by setting colorkey - but that gives problems with edges around fonts, etc.

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

How can I set the background to just transparent without resorting to colorkey?



Solution 1:[1]

Actually, @aergistal was almost there, but everything needed to be wrapped in one filter line, instead of two.

In other words, if you want to generate a transparent background, you have to specify the format filter already during the creation of the input – you cannot add it later.

So my winning combination was:

ffmpeg.exe -y -f lavfi -i 
"[email protected]:size=1920x1080,format=rgba,
subtitles=test.ass:alpha=1" -c:v png 
-t "00:01:00.000" -threads 0 "video.mov" -stats

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 slhck