With the overlay filter you don't need the movie=
format. It's easier, so use this format instead:
ffmpeg -y -i inputmovie -i inputpicture.png -filter_complex 'overlay=0:0' -s 1280x720 ...other parameters... outputfile.mp4
The size I put in is as an example only- yours will be different. Note that the size is the same for the picture as well as the movie frame, and no scaling is actually being done here. The 0:0
is for alignment of the picture to the top left of the movie frame- this is logical since they are both the same size.
H.264, which is what libx264
encodes to, does not support transparency. Neither does mpeg4
, the default codec for AVI. MOV output defaults to libx264
as well.
You can do this in one command:
ffmpeg -i original.mp4 -framerate 60 -pattern_type glob -i images/*.png \
-filter_complex "[0:v]scale=1920x960,setdar=16:9[base];[1:v]scale=1920x960,setdar=16:9[ovr];\
[ovr][base]blend=all_mode='overlay':all_opacity=0.7[v]"
-map [v] result.mp4
You don't need to scale both videos.If you just want the PNGs to scale the same as the base video, you can use scale2ref
:
ffmpeg -i original.mp4 -framerate 60 -pattern_type glob -i images/*.png \
-filter_complex "[1:v][0:v]scale2ref=iw:ih[ovr][base]; \
[ovr][base]blend=all_mode='overlay':all_opacity=0.7[v]"
-map [v] result.mp4
Now, you have specified a custom DAR (1920x960
is not 16:9
). If that needs to be set, use
[1:v][0:v]scale2ref=iw:ih,setdar=16:9[ovr][base];
This uses a different method to apply the overlay.
ffmpeg -i original.mp4 -framerate 60 -pattern_type glob -i "images/*.png" \
-filter_complex "[1:v][0:v]scale2ref=iw:ih[ovr][base]; \
[ovr]colorchannelmixer=aa=0.7[ovrl]; [base][ovrl]overlay[v]"
-map [v] result.mp4
Best Answer
Use
Set
aa
to the opacity value needed.