0

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 Answers1

0

Add a scale before the format.

scale=w=bitand(iw,65534):h=bitand(ih,65534),format=yuv420p
Gyan
  • 85,394
  • 9
  • 169
  • 201
  • I am finiding this error in logcat:: Unable to find a suitable output format for 'scale=w=bitand(iw,65534):h=bitand(ih,65534),format=yuv420p', can you please where this scale is to be added in my command... within filter complex. kindly edit the given command. Thanks – najam ulhassan Apr 09 '21 at 07:57
  • Insert the scale filter before the `format=yuv420p` in your command. – Gyan Apr 09 '21 at 08:58
  • hi sir, I want some knowledge could I use a gif to start of command previously I had done with -loop 1 -t 10 -i background.jpg now want replacement with -y -ignore_loop 0 -t 30 -i background.gif.... I had tried it but it not scalling or overlaying properly... images going out od -s 600, 700... – najam ulhassan Jul 03 '21 at 10:25