overlay transparent animation over video with ffmpeg
The problem arises due to 64bit png.
Use this to solve the problem in method 1:
convert -size 1280x720 xc:transparent -background transparent \
-channel RGBA -fill '#0FF8' \
-draw 'polygon 200, 600, 200, 20, 600, 50, 600, 50' \
-fill '#0008' -draw 'polygon 200, 660, 200, 40, 660, 70, 660, 70' \
-fill '#fFF8' -draw 'polygon 200, 500, 200, 00, 500, 30, 500, 30' \
-channel RGBA -depth 8 -blur '10x5' test.png
Here I added -depth 8
to restrict the png to 32 bits rather than 64.
If you check the pngs you created, size of test.png is 318.8kb and that of cyan.png is 17.3kb. Also, testing with ffmpeg:
ffmpeg -i cyan.png
...
Input #0, png_pipe, from 'cyan.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba, 1280x720 [SAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
But for the multiple overlay png it is:
ffmpeg -i test.png
...
Input #0, png_pipe, from 'test.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba64be, 1280x720 [SAR 72:72 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
You see that the codecs are different- one is rgba64be
and the other is rgba
. The 64bit png may be a problem for ffmpeg for now.
So your flow becomes:
Step 1- create the overlay png.
convert -size 1280x720 xc:transparent -background transparent \
-channel RGBA -fill '#0FF8' \
-draw 'polygon 200, 600, 200, 20, 600, 50, 600, 50' -fill '#0008' \
-draw 'polygon 200, 660, 200, 40, 660, 70, 660, 70' -fill '#fFF8' \
-draw 'polygon 200, 500, 200, 00, 500, 30, 500, 30' -channel RGBA \
-depth 8 -blur '10x5' test.png
Step 2- create the background image.
convert -size 1280x720 xc:yellow -background yellow -channel RGBA gnd.png
Step 3- create the overlay movie.
ffmpeg -loop 1 -i test.png -t 1 -pix_fmt argb -vcodec qtrle z.mov
Step 4- create the background movie.
ffmpeg -loop 1 -i gnd.png -t 1 -pix_fmt argb -vcodec qtrle gnd.mov
Step 5 - overlay the overlay movie.
ffmpeg -vcodec qtrle -i gnd.mov -vcodec qtrle -i z.mov \
-filter_complex "[0:0][1:0]overlay=format=rgb[out]" -shortest \
-map [out] -vcodec qtrle test.mov
The movie should be fine now.
However I would also suggest that it is possible to skip the creation of an overlay movie. Just use:
ffmpeg -i gnd.mov -i test.png \
-filter_complex "[0:0][1:0]overlay=format=rgb[out]" \
-map [out] -vcodec qtrle test.mov