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.
Asked
Active
Viewed 5.4k times
46

astrofrog
- 32,883
- 32
- 90
- 131
-
If you have a Mac, you can use apple script and quicktime. Do you have access to a Mac? – JoshRoss Jan 30 '11 at 04:18
-
See also http://superuser.com/questions/347433/how-to-create-an-uncompressed-avi-from-a-series-of-1000s-of-png-images-using-ff – Hugues Oct 21 '16 at 23:53
-
related: http://stackoverflow.com/questions/24961127/ffmpeg-create-video-from-images – Ciro Santilli OurBigBook.com Feb 07 '17 at 17:31
-
`ffmpeg -r 15 -i img%04d.jpg -vcodec libx264 -b 800k -filter minterpolate='fps=120' out.mp4")` works quite well for me – Peter Jan 16 '19 at 21:28
-
Another hint: also check different `fps=` settings. Lower/higher fps may be better contingent on the problem at hand. – Peter Jan 16 '19 at 21:45
1 Answers
55
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
-
1HuffYUV does have support for RGB, so I'm not sure it thats the issue. – Todd Partridge 'Gen2ly' Aug 23 '12 at 08:18
-
4I think almost by definition mjpeg will NOT be lossless. HuffYUV is, but it might introduce rounding errors due to color conversion. I cannot state anything about FFV1. However, I would like to draw attention to the lossless H264 option: http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide#LosslessH.264 – P.R. Apr 15 '13 at 23:14
-
How can I make each image to be exactly 1 frame and make the output file have FPS of 1 (Without replicating the images, just play slowly)? Thank You. – Royi Mar 17 '17 at 07:42
-
@Royi what I do is `ffmpeg -r
-f image2 -s – Will Brickner Dec 07 '17 at 20:07x -i ./frames/frame_%d.png -vcodec libx264 -pix_fmt yuv420p ./output.mp4` The part you're interested in is the `-r ` flag.