Thanks for all of the suggestions to use green as a bootleg alpha channel. This is what I did:
Code: Select all
// Convert all images to have a green background instead of transparent. This works by creating a green flag image and overlaying the input frame on top.
ffmpeg.exe -start_number 1000 -i mika_%04d.png -filter_complex "color=0x00FF00,format=rgb24[c];[c][0]scale2ref[c][i];[c][i]overlay=format=auto:shortest=1,setsar=1" out_%04d.png
// Convert the images into a video.
ffmpeg -framerate 50 -i out_%4d.png -c:v libtheora -pix_fmt yuv420p -vb 20M out.ogg
Code: Select all
vec3 key = vec3(0.,1.,0.);
float threshold = 0.5;
vec4 effect(vec4 pxColor, Image tex, vec2 texture_coords, vec2 screen_coords) {
vec4 videoColor = VideoTexel(texture_coords);
if (length(videoColor.rgb - key) < threshold) videoColor.a = 0.0;
return videoColor;
}
If I increase the threshold to 0.8, the green outline is almost gone but then some parts of the characters start becoming transparent like the eyes.
I'll try to play around some more with the shader to see if this can be improved, although I've never touched shaders before really.
This might work, although it might be hard to get the mask lined up with the video and it might get choppy. Although, don't know until you try. I might try after playing around some more with the shader.I don't know how well this would work, if at all, but how about using two ogv files - one with the RGB info, and one with just the alpha (stored in one of the RGB channels) and then using a shader to combine everything when drawing.