0
votes

I am creating video by images using mobile-ffmpeg using complex-filter and format yuv420, I am having problem width is not divisible by 2(601*900) like so. This error is occuring for some video creations for many it is working fine. My filter complex is scaling, rotating and overlaying the input images. Here is ffmpeg command:

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

Having some searches about it and found -vf filter can adjust the width:height but it is restricted not to use with filter-complex...

My error logs:

 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
1

1 Answers

0
votes

Add a scale before the format.

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