Aggressive h.264 compression settings specifically for very long scenes with very little scene changes

Assuming I have a video stream with very few scene changes over very long periods of time (from a few minutes to several hours) and I use something like FFmpeg to transcode the raw video to h.264, what settings can I play in order to take advantage of mega redundancy?

Is it as simple as setting the minimum keyframe interval to max (whatever that is)?

Is there a place in the h.264 specification to improve FFmpeg to make even more use of very long periods of time without changing the scene?

+4
source share
1 answer

First, note that FFmpeg itself does not encode h264, but rather x264 .

Yes, the definition of an unusually long keyframe should significantly reduce the size of the video with long periods of little or no movement. What for? Because the "key frame" is a frame with all the video data - a snapshot if you want. All other frames will be different from the keyframe. One caveat is that if there is any damage to the intermediate frame, the video will be damaged until the next key frame appears.

To explicitly set the keyframe spacing when encoding with FFmpeg, use the -g switch. If your video is 25 frames per second and you want the keyframe to be displayed once a minute, add -g 1500 to your FFmpeg command line. (25 f / sx 60 s = 1500 f)

There are other interesting aspects that you can control regarding key frames that may interest you, many of which are described here: x264 ffmpeg mapping and options guide

+4
source

All Articles