Normalizing PNG frames for FFmpeg
Fixing existing broken frames and avoiding this problem in the future
15 April 2017
FFmpeg has a hard time using collections of PNG images as the input frames for
video if the internal PNG format of some of the files differ from one another.
This can be problem if you’re using ImageMagick’s convert
command to create
your PNG frames, since to save space convert
will use the smallest bit depth
which still accurately represents your image.
To fix this, you can modify the PNG files in place to have the bit depth you want, which is usually images with bit depth 8 and without transparency:
mogrify -define png:color-type=2 -define png:bit-depth=8 *.png
If the color type and bit depth above aren’t right for your use case, you may
find more information about the possible color types and bit depths for
convert
in the ImageMagick documentation for “Writing PNG Image
Controls”.