FFmpeg - How to scale a video then apply a watermark?

后端 未结 3 1292
Happy的楠姐
Happy的楠姐 2020-12-13 16:30

Im trying to scale a video so that it is always 512 wide where the height changes in proportion to the original video. Once scaled, I then want to apply a watermark/overlay

3条回答
  •  萌比男神i
    2020-12-13 16:44

    Thank you to both @DiJuMx and @LordNeckbeard, you both got me closer to my solution. Ive not tried the filter_complex option yet but it certainly looks simpler.

    The solution I found to work is:

    -vf "movie=watermark.png [watermark]; [in]scale=512:trunc(ow/a/2)*2 [scale]; [scale][watermark] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2 [out]"
    

    Note that Ive replaced the -1 in the scale as that had the potential to cause an uneven number of pixels in the height of the video when scaling which would then cause encoding errors.

提交回复
热议问题