Change GIF size generated by FFMPEG

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

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

To generate a pallet, 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 has 640px wide) because the gif is always presented at most with 120px wide. How do I specify the size? I tried putting -s alturaXlargura but it gives error.

Author: ihavenokia, 2018-02-05

1 answers

You have to make a filter crop or stairs to set the size you want. Types like this:

Com Scale :

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

With 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 the X and Y according to this example.

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

Official scale documentation: https://ffmpeg.org/ffmpeg-filters.html#scale-1

Official Crop documentation: https://ffmpeg.org/ffmpeg-filters.html#crop

Reference video? https://www.youtube.com/watch?v=MPV7JXTWPWI

insert the description of the image here

Http://www.nerdfirst.net/getting-started-with-ffmpeg /

 1
Author: hugocsl, 2018-02-05 19:29:24