ffmpeg add watermark libx264 width not divisible b

2019-01-27 11:29发布

问题:

I want to add watermark for video. My code:

ffmpeg -i final_480p.mov \
-i watermark480p.png \
-filter_complex overlay=10:H-h-10 \
-y test.mov

with video size divisible by 2, command is good.

When i add watermark for video (853x480) don't work with error

[libx264 @ 075656e0] width not divisible by 2 (853x480)

How to fix this error? ( add more arguments, v.v..). Tks for reading

回答1:

Use

ffmpeg -i final_480p.mov \
-i watermark480p.png \
-filter_complex [0]scale='iw-mod(iw,2)':'ih-mod(ih,2)'[m];[m][1]overlay=10:H-h-10 \
-y test.mov

The scale filter will conform each odd dimension to an even number, and leave even dimensions alone.



标签: ffmpeg