I have been digging around here and on the ffmpeg site trying to find some commands to use to generate a movie from a set of images. The command I tried that gives me a video I can watch on my MacBook is

ffmpeg -framerate 20 -i slice%04d.png test.mp4

This produces a video but the problem is it smooths out some of the features. I need to capture the sharp features of these images. To give a sense, a single frame from this video is shown below.

time slicing sample image

The video is smoothing out some of the details, especially from frame to frame. I assume this is a compression issue, so I would like to just avoid compressing the video. Unfortunately, everything I have tried from other help sites and the ffmpeg site do not produce a video file I can actually visualize on my mac. Can anyone provide me with a better command line call to solve this problem?

1 Answer 1


Since you're asking for "uncompressed" I assume you don't care about file size. If so, I suggest rendering to mjpeg. This smoothing issue is because your command is defaulting to h.264. The difference between h.264 and mjpeg is that mjpeg is intra-frame compression only, but h.264 is intra- and inter-frame compression. As such, mjpeg is a massive file by comparison, but each frame is unique and not dependent on previous frames like in h.264. One benefit is frame fidelity, enough should fix your issue. Mjpeg is also pretty universal. You won't need a codec pack to play it.

To make your images into an mjpeg video run:

 ffmpeg -framerate 20 -i slice%04d.png c:v mjpeg -q:v 3 -an output.mov
  • c:v mjpeg means video codec
  • -q:v 3 is a quality control factor. Range is a linear 2-31, lower is better. Tune the number to your tastes.
  • -an means no audio channel included. This is good to run if that's your goal, as some codecs confuse players if you don't.
  • Output is mov but I'm pretty sure you can wrap mp4 or avi too. Mp4 seems mostly likely to work for your users on windows as well as mac.

Before you try this, maybe don't quite give up on h.264 yet. Run your original command with the crf flag.

 ffmpeg -framerate 20 -i slice%04d.png -crf 18 -an test.mp4
  • crf is "constant rate factor", and is a quality control. Range is exponential 0-60something. Lower is better and 18 is considered functionally lossless.
  • This was a really insightful answer, even disregarding the commands you came up with, so thank you for that! The first option worked when I outputted to .mov and the result looks great! It actually failed to run as an .mp4 for the same command, which is interesting. The latter command failed for me with the latest ffmpeg that I downloaded and compiled on my system today (version 4.1.4) because it claimed it did not recognize the -crf command. Not sure what's up with that.
    – spektr
    Jul 31, 2019 at 2:51
  • @spektr Probably have to add -c:v libx264 to get the crf flag to work. Let me know.
    – user3643
    Jul 31, 2019 at 14:55
  • Optionally, run the h264 command on your mjpeg output if you want a smaller file size.
    – user3643
    Jul 31, 2019 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.