Black overlay appears when merging a transparent video to another video

拟墨画扇 提交于 2019-12-22 17:39:25

问题


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:

  1. Is there any way to verify if the generated video is transparent? other than merging?
  2. 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.


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!