Change the size of the GIF generated by FFMPEG

1

I am generating gifs using ffmpeg, in its latest version (at the time of this question), using the following lines of code:

ffmpeg -y  10  -i in.mp4 -vf fps=10,scale=-1:340:flags=lanczos,palettegen palette.png

to generate a palette, and

ffmpeg -y 10 -i palette.png -fs 8000000 -filter_complex 'fps=10,scale=-1:340:flags=lanczos[x];[x][1:v]paletteuse=dither=bayer:bayer_scale=5' out.gif

to generate the gif. Everything works fine, only I wanted to decrease the size (it is 640px wide) because the gif is always presented at most with 120px width. How do I specify the size? I tried putting -s alturaXlargura but it gives error.

    
asked by anonymous 05.02.2018 / 19:45

1 answer

1

You have to make a filter crop Types like this:

scale :

ffmpeg -i input -filter:v "scale=w=120:h=120" outFile

crop :

ffmpeg -i input -filter:v "crop=w=120:h-120" outFile

To determine where this Crop will start in the original image, you have to determine X and Y in this example.

ffmpeg -i input -filter:v "crop=w=120:h-120:x-100:y=100" outFile

Official Scale Documentation: link

Crop Official Documentation: link

Reference video? link

link

    
05.02.2018 / 20:29