带有 yup420 输出问题的移动 FFMPEG 过滤器复杂

问题描述

我正在通过使用复杂过滤器和格式 yuv420 的移动 ffmpeg 通过图像创建视频,我遇到了宽度不能被 2(601*900) 整除的问题,像这样。 某些视频创作出现此错误,但许多工作正常。 我的过滤器复合体是缩放、旋转和覆盖输入图像。 这是 ffmpeg 命令:

ffmpeg -loop 1 -t 10 -i background.jpg -s 700x900 

-loop 1 -i img1.png -loop 1 -i img2.jpg 
-loop 1 -i img3.jpg

-filter_complex
[1]scale=eval=frame:w='72':h='72'[img1];
[2]scale=eval=frame:w='598':h='382',rotate=a=0*PI/180:c=black@0:oh='roth(0*PI/180)':ow='rotw(0*PI/180)':bilinear=1,fade=in:st=2:d=3:alpha=1[img2];
[3]scale=eval=frame:w='598':h='382',fade=in:st=3:d=4:alpha=1[img3];
[0][img1]overlay=W-w-5:5:format=auto:shortest=1:format=auto[bg1];
[bg1][img2]overlay=44:500:shortest=1:format=auto[bg2];
[bg2][img3]overlay=44:22:shortest=1:format=auto,format=yuv420p" 

output.mp4

搜索了一下,发现 -vf 过滤器可以调整宽度:高度,但限制不能与过滤器复合物一起使用...

我的错误日志:

 E/mobile-ffmpeg: [libx264 @ 0xbd8c8800] 
 E/mobile-ffmpeg: width not divisible by 2 (601x901)
 E/mobile-ffmpeg: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate,rate,width or height

解决方法

的格式之前添加的标度。

scale=w=bitand(iw,65534):h=bitand(ih,65534),format=yuv420p

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...