1

I am trying to make a video out of an image sequence - Where each frame lasts for a second.

The image sequence contains the same object shot from different distances. I'm guessing most default video converters optimize for motion, but in this scenario, I need to get the least file size without changing the frame rate.

Which codec (H.264, VP8, VP9) can give me the best size to quality ratio?

Also are there any flags for H.264 which I can enable to optimize for this case?

2
  • What software are you using and what format are your files? Apr 22, 2017 at 19:11
  • @LetTheWritersWrite I'm using VirtualDub to make a .avi out of the video, and then handbrake to encode .avi to .mp4 currently. As for format, I'll need either mp4 or webm Apr 23, 2017 at 2:24

2 Answers 2

1

I occasionally make a video from slide images. I find I get the best quality and compression by putting the images in the timeline in your preferred video editor (I use Vegas Pro 13), saving as a motion jpeg*, then use ffmpeg to convert that to H264. I use -crf 28, which is probably called "constant quality" in Handbrake. At 1024x768 resolution I easily get bitrates under 100 kbps and they look great. You can increase the crf value to get more compression or decrease it to get better quality, so you can fine tune to your tastes.

With this method above, I would bet H264 and VP8 are comparable. VP9 will probably be better, but it doesn't work on everything and takes a lot longer to encode.

My theory why this works:

Motion jpeg is intra-frame compression only. Each individual frame is compressed as an image, then added to the stream; there is no inter-frame compression (compression between frames). It doesn't have I-frames or any of that complicated stuff. So for a full second in your video all the frames are identical, not just "look the same". They are technically identical.

H264 then has a lot of power to compress the motion jpeg. It sees a string of identical frames then does the equivalent of saving the first frame completely then uses nearly dataless "reference frames" for the rest.


*Motion jpeg will be a relatively big file. Coincidentally, when I record a slides presentation, I initially encode as motion jpeg because most of the presentation will be static slides.

0

VP9 will give you the best quality-to-size ratio, but you can also get pretty good results out of H.264 as well.

In order to maximize the efficiency of compression, if each image is up for exactly one second (or exactly two seconds, or exactly three seconds, or exactly etc.) then you make the frame rate 1.00 FPS and tell the encoder not to use P-frames or B-frames (AKA "reference frames") and set your GoP to 1. After that run with Constant Quality encoding and use a rate factor that gets you an acceptable level of quality with an acceptable file size.

2
  • 1
    tell the encoder not to use P-frames or B-frames (AKA "reference frames") --> I-frames are the canonical reference frames. P and B frames are predicted frames and in modern codecs, also can serve as reference for other P and B frames. With a GOP of 1, there's no motion estimation/compensation and compression will be worse. Also, some players can't handle a video with 1 FPS. 5 tends to be the safe minimum. With x264, at least, identical predicted frames take very little space, So upping the framerate isn't a big issue.
    – Gyan
    Apr 25, 2017 at 6:26
  • An FPS of 1 is likely to not play, as already said, then would also not provide much benefit over something like 15. If 15 frames are identical, the right setting can compress very well.
    – user3643
    Jul 24, 2017 at 1:10

Your Answer

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

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