What video encoding algorithm should I use for video with one static image and audio?

I am doing video processing tasks and one of the problems I need to solve is choosing the appropriate encoding algorithm for a video that has only one static image throughout the entire video.

I have currently tried several algorithms like DivX and XviD, but they produce 3MB of video for 1 minute video. The audio is 64kbps mp3, so the audio only takes 480KB. So the video is 2.5 MB!

Since the image in the video does not change, it can be compressed very efficiently as there is no movement. The size of the image itself (this is a jpg) is only 50 KB.

Ideally, I would expect this video to be around 550KB - 600KB, not 3MB.

Any ideas on how I could optimize the video so it isn't that huge?

I hope this is the correct stack forum to ask this question.

+3


source to share


2 answers


Set the frames per second to be very low. If you can do it in less than 1 frame per second. Your goal would be to get as close to two keyframes as possible (one at the beginning and one at the end).

Whether this can be done depends on the scheme / codec used as well as the encoder.

Many codecs will have parameters associated with keyframes. For example, here are some open source coders:

lavc (libavcodec):



keyint = <0-300> - maximum interval between keyframes in frames (default: 250 or one keyframe every ten seconds in a filter of 25 frames per second.

This is the recommended default for MPEG-4). Most codecs require regular keyframes to limit the accumulation of mismatch errors. Keyframes are also required for searches, since only keyframes are searchable, but keyframes require more space than other frames, so larger numbers here mean smaller files, but less accurate searches. 0 equals 1, which makes each frame a key frame. Values> 300 are not recommended as quality can be poor depending on decoder, encoder and luck. For MPEG-1/2, it is common to use values ​​<= 30.

xvidenc:

max_key_interval = - maximum interval between key frames (default: 10 * fps)

Interestingly, this solution can reduce the searchability of the file, so you'll want to check it out.

+2


source


I think this issue has to do with the video encoder implementation, not the video coding standard itself.

In fact, most video encoder implementations are not designed for still video, so it will not produce the ideal bitstream as we imagined when the still video is injected. Most video encoder implementations are designed to handle "natural" video.



If you really want a better encoding result for a still image video, you can hack an open source video encoder starting from the second frame, mark all MBs as "skip" ...

0


source







All Articles