1

I need to add a little shadow at the bottom of the video.

Initial video

enter image description here

Expected result

enter image description here

The one version for doing this is to have the shadow (.png) image which will be added to the video as an overlay. But I thought, is there any way to do it without a shadow image?

ArmKh
  • 435
  • 9
  • 31

1 Answers1

4

enter image description here

Using the split, format, geq, and overlay filters:

ffmpeg -i input.jpg -filter_complex "[0]split[v0][v1];[v0]format=rgba,geq=r=0:g=0:b=0:a=255*(Y/H)[fg];[v1][fg]overlay=format=auto" -frames:v 1 -q:v 2 out.jpg
  • split - make two copies of the input: one for geq and the other for overlay
  • format - make the input have alpha channel
  • geq - create a gradient with alpha
  • overlay - place gradient over original image

enter image description here

Another example but this adds the crop filter to halve the gradient so it stops in the middle:

ffmpeg -i input.jpg -filter_complex "[0]split[v0][v1];[v0]crop=iw:ih/2,format=rgba,geq=r=0:g=0:b=0:a=255*(Y/H)[fg];[v1][fg]overlay=0:H-h:format=auto" -frames:v 1 -q:v 2 out.jpg

There is probably a more efficient way to do this, but it works. See filter documentation.

llogan
  • 121,796
  • 28
  • 232
  • 243