Cropping Videos

Today, for the second time, I've published something on Dribbble: a demostration of the previously mentioned scrollable calendar. And, as I encoutered the same problems occourred at the first time, here I take some note for the next one.

As I've not (yet?) received an invite to the platform, I'm limited to upload static images or animated GIFs. So I had to record a screencast (I use this Gnome extension) and convert it into a GIF, adjusting the size of the video to fit the rigid sizes allowed in Dribbble.

Starting from a 1142 x 578 pixels WebM video, I produced another one fitting the strict 1600 x 1200 pixels size using

ffmpeg -i screencast.webm -vf "pad=width=1600:height=1200:x=229:y=311:color=white" padded.webm

The X and Y offsets have been previously calculated, of course as (final width - initial width) / 2 and (final height - initial height) / 2.

Then, to convert into a GIF:

ffmpeg -y -i padded.webm -vf palettegen palette.png
ffmpeg -y -i padded.webm -i palette.png -filter_complex paletteuse -r 10 final.gif

The double step is required to obtain a decent final result, due limitations with colors in GIFs.