Discussion:
[FFmpeg-user] how to blend logo and video with transparent effect
qw
2015-06-26 16:18:43 UTC
Permalink
Hi,

I use the below command to blend logo image and video together with transparent effect:
ffmpeg -i ./file1.mp4 -i ./logo.jpg -filter_complex blend=all_mode=overlay ./file3.mp4



But the command requires the same resolution from logo image and video. If the size of logo image is different from or smaller than that of video, the command will report error.


How to blend image and video with different size? Could you provide some command examples?
Thanks!


B.R.


Andrew
Paul B Mahol
2015-06-26 16:21:20 UTC
Permalink
Post by qw
Hi,
ffmpeg -i ./file1.mp4 -i ./logo.jpg -filter_complex blend=all_mode=overlay ./file3.mp4
But the command requires the same resolution from logo image and video. If
the size of logo image is different from or smaller than that of video, the
command will report error.
How to blend image and video with different size? Could you provide some command examples?
You could crop logo and use expressions in blend filter to pick right
combination of pixels at any position of image.
Post by qw
Thanks!
B.R.
Andrew
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Paul B Mahol
2015-06-26 16:21:56 UTC
Permalink
Post by Paul B Mahol
Post by qw
Hi,
ffmpeg -i ./file1.mp4 -i ./logo.jpg -filter_complex
blend=all_mode=overlay
./file3.mp4
But the command requires the same resolution from logo image and video. If
the size of logo image is different from or smaller than that of video, the
command will report error.
How to blend image and video with different size? Could you provide some
command examples?
You could crop logo and use expressions in blend filter to pick right
Instead of crop I meant pad filter.
Post by Paul B Mahol
combination of pixels at any position of image.
qw
2015-06-27 16:40:44 UTC
Permalink
Post by Paul B Mahol
Post by Paul B Mahol
Post by qw
Hi,
ffmpeg -i ./file1.mp4 -i ./logo.jpg -filter_complex
blend=all_mode=overlay
./file3.mp4
But the command requires the same resolution from logo image and video. If
the size of logo image is different from or smaller than that of video, the
command will report error.
How to blend image and video with different size? Could you provide some
command examples?
You could crop logo and use expressions in blend filter to pick right
Instead of crop I meant pad filter.
Post by Paul B Mahol
combination of pixels at any position of image.
I try to use pad filter. If the logo image has no transparent background, I can make a video with transparent effect by using the below command:
ffmpeg -i ./video.mp4 -i ./logo.png -filter_complex "[1]pad=640:480:10:10:black[logo];[0][logo]blend=all_expr='A*(if(gte(X,10)*lt(X,256+10)*gte(Y,10)*lt(Y,256+10),0.5,1))+B*(1-(if(gte(X,10)*lt(X,256+10)*gte(Y,10)*lt(Y,256+10),0.5,1)))'" -strict -2 ./output.mp4
But if the background in the logo image is transparent, the resulting video is not good. I can see a clear rectangle around the logo in the resulting video. If the area around logo in resulting video is the pixel of input video, and no rectangle can be seen, the resulting video will be correct.


How to make a resulting video with a transparent logo image, in which:
1) the area around logo is the pixel of input video;
2) no rectangle around the logo can be seen;
3) the logo is transparent;


How to make it?
Post by Paul B Mahol
Post by Paul B Mahol
Post by qw
Hi,
ffmpeg -i ./file1.mp4 -i ./logo.jpg -filter_complex
blend=all_mode=overlay
./file3.mp4
But the command requires the same resolution from logo image and video. If
the size of logo image is different from or smaller than that of video, the
command will report error.
How to blend image and video with different size? Could you provide some
command examples?
You could crop logo and use expressions in blend filter to pick right
Instead of crop I meant pad filter.
Post by Paul B Mahol
combination of pixels at any position of image.
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Paul B Mahol
2015-06-27 16:50:30 UTC
Permalink
Post by qw
Post by Paul B Mahol
Post by Paul B Mahol
Post by qw
Hi,
I use the below command to blend logo image and video together with
ffmpeg -i ./file1.mp4 -i ./logo.jpg -filter_complex
blend=all_mode=overlay
./file3.mp4
But the command requires the same resolution from logo image and video. If
the size of logo image is different from or smaller than that of video, the
command will report error.
How to blend image and video with different size? Could you provide some
command examples?
You could crop logo and use expressions in blend filter to pick right
Instead of crop I meant pad filter.
Post by Paul B Mahol
combination of pixels at any position of image.
I try to use pad filter. If the logo image has no transparent background, I
ffmpeg -i ./video.mp4 -i ./logo.png -filter_complex
"[1]pad=640:480:10:10:black[logo];[0][logo]blend=all_expr='A*(if(gte(X,10)*lt(X,256+10)*gte(Y,10)*lt(Y,256+10),0.5,1))+B*(1-(if(gte(X,10)*lt(X,256+10)*gte(Y,10)*lt(Y,256+10),0.5,1)))'"
-strict -2 ./output.mp4
But if the background in the logo image is transparent, the resulting video
is not good. I can see a clear rectangle around the logo in the resulting
video. If the area around logo in resulting video is the pixel of input
video, and no rectangle can be seen, the resulting video will be correct.
1) the area around logo is the pixel of input video;
2) no rectangle around the logo can be seen;
3) the logo is transparent;
How to make it?
Can you provide link to logo.png ?
qw
2015-06-27 17:53:14 UTC
Permalink
Post by Paul B Mahol
Post by qw
Post by Paul B Mahol
Post by Paul B Mahol
Post by qw
Hi,
I use the below command to blend logo image and video together with
ffmpeg -i ./file1.mp4 -i ./logo.jpg -filter_complex
blend=all_mode=overlay
./file3.mp4
But the command requires the same resolution from logo image and video. If
the size of logo image is different from or smaller than that of video, the
command will report error.
How to blend image and video with different size? Could you provide some
command examples?
You could crop logo and use expressions in blend filter to pick right
Instead of crop I meant pad filter.
Post by Paul B Mahol
combination of pixels at any position of image.
I try to use pad filter. If the logo image has no transparent background, I
ffmpeg -i ./video.mp4 -i ./logo.png -filter_complex
"[1]pad=640:480:10:10:black[logo];[0][logo]blend=all_expr='A*(if(gte(X,10)*lt(X,256+10)*gte(Y,10)*lt(Y,256+10),0.5,1))+B*(1-(if(gte(X,10)*lt(X,256+10)*gte(Y,10)*lt(Y,256+10),0.5,1)))'"
-strict -2 ./output.mp4
But if the background in the logo image is transparent, the resulting video
is not good. I can see a clear rectangle around the logo in the resulting
video. If the area around logo in resulting video is the pixel of input
video, and no rectangle can be seen, the resulting video will be correct.
1) the area around logo is the pixel of input video;
2) no rectangle around the logo can be seen;
3) the logo is transparent;
How to make it?
Can you provide link to logo.png ?
Loading Image...&fromurl=ippr_z2C%24qAzdH3FAzdH3Fooo_z%26e3Bjh5555_z%26e3Bv54AzdH3Fp7ktw5xtwg2f7p7h7AzdH3Frg2AzdH3Fda8aa9AzdH3Fa9-9c9d89_z%26e3Bip4s
Post by Paul B Mahol
Post by qw
Post by Paul B Mahol
Post by Paul B Mahol
Post by qw
Hi,
I use the below command to blend logo image and video together with
ffmpeg -i ./file1.mp4 -i ./logo.jpg -filter_complex
blend=all_mode=overlay
./file3.mp4
But the command requires the same resolution from logo image and video. If
the size of logo image is different from or smaller than that of video, the
command will report error.
How to blend image and video with different size? Could you provide some
command examples?
You could crop logo and use expressions in blend filter to pick right
Instead of crop I meant pad filter.
Post by Paul B Mahol
combination of pixels at any position of image.
I try to use pad filter. If the logo image has no transparent background, I
ffmpeg -i ./video.mp4 -i ./logo.png -filter_complex
"[1]pad=640:480:10:10:black[logo];[0][logo]blend=all_expr='A*(if(gte(X,10)*lt(X,256+10)*gte(Y,10)*lt(Y,256+10),0.5,1))+B*(1-(if(gte(X,10)*lt(X,256+10)*gte(Y,10)*lt(Y,256+10),0.5,1)))'"
-strict -2 ./output.mp4
But if the background in the logo image is transparent, the resulting video
is not good. I can see a clear rectangle around the logo in the resulting
video. If the area around logo in resulting video is the pixel of input
video, and no rectangle can be seen, the resulting video will be correct.
1) the area around logo is the pixel of input video;
2) no rectangle around the logo can be seen;
3) the logo is transparent;
How to make it?
Can you provide link to logo.png ?
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Loading...