This is what I have done so far:
Command to create a transparent PNG image:
convert -size 640x480 -background transparent -fill blue \
-gravity South label:ROCK image1-0.png
Command to create a transparent video:
ffmpeg -loop 1 -f image2 -i image1-0.png -r 20 -vframes 100 \
-vcodec png -pix_fmt bgra mov-1.mov
(as per this post) - I expect this video to be a transparent video.
Command to overlay a video with another:
ffmpeg -i final-video.mov -sameq -ar 44100 \
-vf "movie=mov-1.mov [logo];[in][logo] overlay=0:0 [out]" \
-strict experimental final-video.mov
Above commands works perfect and I have not faced any problem, but I don't get what I expect which is kinda watermarking effect, I want mov-1.mov to be transparent with final-video.mov.
Questions:
- Is there any way to verify if the generated video is transparent? other than merging?
- Not sure why the above mov-1.mov is not transparent when it is merged with final-video.mov, any info to solve this problem would be great.
Please help.
ImageMagick doesn't always produce transparent pngs in a way that FFmpeg understands. I was reduced to using GIMP to create indexed transparent images the last time I faced this problem. Nevermind, looking back at this answer I see that I was apparently able to make ImageMagick produce transparency in a way that FFmpeg liked by setting png:color-type
. Your convert command would become:
convert -size 640x480 -background transparent -fill blue \
-gravity South label:ROCK -define png:color-type=6 image1-0.png
That said, you don't need the turn the image into its own movie. The movie
video filter will accept a transparent png as input.
来源:https://stackoverflow.com/questions/10948714/black-overlay-appears-when-merging-a-transparent-video-to-another-video