Add transparency image to video

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Add transparency image to video

kchandu5200
HI

I want add image with transparency/alpha/opacity to video. How to change the opacity off image and add to video.
This is the my command.
ffmpeg -i input_1.mp4  -i 1.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,1,4)'" -c:v libx264 -crf 23 output.mp4

Thanks,
Chandu
Reply | Threaded
Open this post in threaded view
|

Re: Add transparency image to video

Paul B Mahol
On 9/15/15, kchandu5200 <[hidden email]> wrote:
> HI
>
> I want add image with transparency/alpha/opacity to video. How to change the
> opacity off image and add to video.
> This is the my command.
> ffmpeg -i input_1.mp4  -i 1.png -filter_complex "[0:v][1:v]
> overlay=0:0:enable='between(t,1,4)'" -c:v libx264 -crf 23 output.mp4

With lutyuv you could add and change A plane of [1:v] depending on something....

>
> Thanks,
> Chandu
>
>
>
> --
> View this message in context:
> http://ffmpeg-users.933282.n4.nabble.com/Add-transparency-image-to-video-tp4672361.html
> Sent from the FFmpeg-users mailing list archive at Nabble.com.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Add transparency image to video

kchandu5200
Thanks for you response,
lutyuv not working. If i am running wrong command, please make me to write command.

ffmpeg -i input_1.mp4 -i 1.png -filter_complex "[0:v] setpts=PTS-STARTPTS [vid]; [1:v] setpts=PTS-STARTPTS, lutyuv=a=0.1, scale=100x100 [img1]; [vid][img1] overlay=200:166:enable='between(t,0,4)'" -c:v libx264 -r 24 -crf 25 -codec:a copy -y output.mp4
Reply | Threaded
Open this post in threaded view
|

Re: Add transparency image to video

Paul B Mahol
On 9/15/15, kchandu5200 <[hidden email]> wrote:
> Thanks for you response,
> lutyuv not working. If i am running wrong command, please make me to write
> command.
>
> ffmpeg -i input_1.mp4 -i 1.png -filter_complex "[0:v] setpts=PTS-STARTPTS
> [vid]; [1:v] setpts=PTS-STARTPTS, lutyuv=a=0.1, scale=100x100 [img1];
> [vid][img1] overlay=200:166:enable='between(t,0,4)'" -c:v libx264 -r 24 -crf
> 25 -codec:a copy -y output.mp4
>

alpha is not in float, it is integer from 0 to 255 for 8bit depth:

ffmpeg -i input_1.mp4 -i 1.png -filter_complex "[0:v]
setpts=PTS-STARTPTS [vid]; [1:v] setpts=PTS-STARTPTS,
lutyuv=y=val:u=val:v=val:a=25, scale=100x100 [img1]; [vid][img1]
overlay=200:166:enable='between(t,0,4)'" -c:v libx264 -r 24 -crf 25
-codec:a copy -y output.mp4


>
>
>
>
> --
> View this message in context:
> http://ffmpeg-users.933282.n4.nabble.com/Add-transparency-image-to-video-tp4672361p4672365.html
> Sent from the FFmpeg-users mailing list archive at Nabble.com.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Add transparency image to video

kchandu5200
its not working. I need to install something else? this is the my ffmpeg version:-

ffmpeg version N-74457-g21566b2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --bindir=/home/ubuntu/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil      54. 30.100 / 54. 30.100
libavcodec     56. 57.100 / 56. 57.100
libavformat    56. 40.101 / 56. 40.101
libavdevice    56.  4.100 / 56.  4.100
libavfilter     5. 34.100 /  5. 34.100
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  2.101 /  1.  2.101
libpostproc    53.  3.100 / 53.  3.100
Reply | Threaded
Open this post in threaded view
|

Re: Add transparency image to video

Moritz Barsnick
On Tue, Sep 15, 2015 at 05:04:02 -0700, kchandu5200 wrote:
> its not working.

You do need to be a bit more precise.

M
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Add transparency image to video

kchandu5200
Thanks for your response, and its working for png format. its my bad i was changed the extinction of image jpg to png(So its not worked). how can i make it for jpg as well.
Reply | Threaded
Open this post in threaded view
|

Re: Add transparency image to video

Paul B Mahol
On 9/16/15, kchandu5200 <[hidden email]> wrote:
> Thanks for your response, and its working for png format. its my bad i was
> changed the extinction of image jpg to png(So its not worked). how can i
> make it for jpg as well.

If jpg does not have alpha add it with 'format=yuva444p' filter before
lutyuv filter.

>
>
>
> --
> View this message in context:
> http://ffmpeg-users.933282.n4.nabble.com/Add-transparency-image-to-video-tp4672361p4672393.html
> Sent from the FFmpeg-users mailing list archive at Nabble.com.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Add transparency image to video

kchandu5200
Thank you Paul..