0

我正在使用 mobile-ffmpeg 使用复杂过滤器和格式 yuv420 通过图像创建视频,我遇到的问题宽度不能被 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',rotate=a=0*PI/180:c=black@0:oh='roth(0*PI/180)':ow='rotw(0*PI/180)':bilinear=1,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 filter 可以调整宽度:高度,但仅限于不与 filter-complex 一起使用...

我的错误日志:

 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
4

1 回答 1

0

在格式之前添加一个比例。

scale=w=bitand(iw,65534):h=bitand(ih,65534),format=yuv420p
于 2021-04-09T07:06:07.480 回答