Animation

For recent animations it has been necessary to produce MP4s as well as GIFs for a couple of diferent purposes. There is a useful online GIF to MP4 convertor, but I think ffmpeg might produce better results.

To create an MP4 from a collection of PNG frames, run a command like this in the directory with the frames:

ffmpeg -framerate 10 -pattern_type glob -i "*.png" -c:v libx264 -profile:v high -crf 20 -pix_fmt yuv420p -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" ../OutputFile.mp4

Adjust the framerate as necessary of course. This will not work if there are different frame durations.

Another useful MP4 to produce is a looped version of the GIF. This is easier to work with in KDENLive, which doesn’t like GIfs at all and doesn’t like to loop clips.

First, create a single loop MP4 using the command above. Then, create a text file with a line ike this repeated as many times as you want it to loop:

file 'InputFile.mp4'

Finally, run a concat command to create the looped MP4:

ffmpeg -f concat -i looplist.txt -c copy OutputFile.mp4

This could also be used to concatenate clips of an aniimation that had to be created in sections, if I ever have a need for that…