Ffmpeg Fix Watermark Size or Percentage

Adjusting watermark according to video resolution using ffmpeg

Use the scale2ref filter as follows:

ffmpeg -i video.mp4 -i watermark.png -filter_complex "[1][0]scale2ref=w='iw*5/100':h='ow/mdar'[wm][vid];[vid][wm]overlay=10:10" output.mp4

This will proprortionally scale the watermark width to 5% of the video width, and then overlay the resized watermark.

Combine filters for watermark and video speed using FFmpeg

Combined command:

ffmpeg -i input.mp4 -i watermark.png -filter_complex "[1][0]scale2ref=w=oh*mdar:h=ih*0.1[logo][video];[video][logo]overlay=5:H-h-5,setpts=0.5*PTS;[0:a]atempo=2.0" output.mp4

Connect linear filters with a comma. Connect filterchains with a semicolon. See FFmpeg Filtering Intro.

How to reduce the size of watermark using FFMPEG

Add the scale filter:

ffmpeg -i thumb-168pa-usrao.jpg -i evercam-logo-white.png -filter_complex '[1]scale=iw/2:-1[wm];[0][wm]overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10' test.jpg

This will "reduce the size of watermark to half of its size".

ffmpeg how to upscale video 2x but only if resulting size is smaller than 720 height?

Yes. Use scale filter with expression:

scale=-1:'if(lte(ih,360),2*ih,ih)'

The width will be automatically set proportional to the height.

[edit] Thanks @anonymous for spotting the inaccuracy in the original solution. The original solution:

scale='if(lt(iw,720)*lt(ih,720),2*iw,iw)':-1

This one doubles the frame size if either dimension is less than 720px, which is not accurate to the OP's need.



Related Topics



Leave a reply



Submit