Black overlay appears when merging a transparent video to another video
Asked Answered
T

1

2

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.

Tress answered 8/6, 2012 at 12:17 Comment(0)
E
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.

Eward answered 12/6, 2012 at 2:35 Comment(7)
thanks for reply, BTW, I have verified the image with GIMP and like you said that image is indexed transparent. Do you have more info or it would be good if you share your commands and I can run through it.Tress
When I try to pass image to movie attribute, I can only see image but video in the final output, I see a black overlay and that hides my video in the back but I am sure the input image is a transparent image.Tress
Looks like there is a problem with image creation - may be I am missing something. Reason? when I used Photoshop and created a transparent image which did not had any problem and I got the final output as I expected, means transparent.Tress
I'm glad you got it sorted out?Eward
Yeah, I found the problem but I am not sure what is missing in image processing, do you have any answer for that????Tress
Sorry, never figured out how to get things right with ImageMagick.Eward
Do you have any idea about the PHP-imagick equivalent for setting png:color-type=6 ?Atwater

© 2022 - 2024 — McMap. All rights reserved.