Convert image sequence to lossless movie

astrofrog picture astrofrog · Jan 29, 2011 · Viewed 51.2k times · Source

I have a sequence of images in TIF format, and I would like to create a movie at a fixed FPS (say 10 images per second) and that is lossless. Is there an easy way to do that? I've been trying with convert from Imagemagick, and ffmpeg, but I just can't figure out what settings to use to avoid any compression.

Answer

mpenkov picture mpenkov · Jan 30, 2011

Try using a lossless codec, e.g. HuffYUV or FFV1:

  • ffmpeg -i frame%04d.png -c:v huffyuv test.avi
  • ffmpeg -i frame%04d.png -c:v ffv1 -qscale:v 0 test.avi

Both codecs look portable. HuffYUV appears to be the more popular, but for some reason, huffyuv encoding seems broken on my system, and I get weird colors and black horizontal banding. It could have something to do with the input being RGB (from PNG) and not YUV (input from a raw YUV420 video file works OK). So here are some alternatives (not completely lossless, but visually quite good):

  • ffmpeg -i frame%04d.png -qscale:v 0 test.avi
  • ffmpeg -i frame%04d.png -c:v mjpeg -qscale:v 0 test.avi