In one of my projects for quite a long time I used XVID as an internal intermediate encoder for data exchange in a common format between servers. Excellent implementation of MPEG4 compatible codec. Recently, more and more often, I began to find articles on the Internet about the relatively new, revolutionary codec Theora, which is predicted for the future as a standard for the Web.
It is understandable. It has a great advantage in the form of open source and no licensing. Plus the ability to use in any projects. Including closed.
After reading many articles, I saw a retrospective of the development of this codec. From its inception to the day when money was allocated for the development and improvement of Theora, so that it could be embedded in the browser and view the video in the absence of plug-ins like Flash. There was even an article that this codec exceeded H264 in quality (though I didn’t see any objective assessments on this subject. Only PSNR).
But as I did not try, I did not notice in the articles the quantitative characteristics of Theora’s speed with respect to other codecs. I was thinking about replacing the new codec Theora in the XVID project. Suddenly, he will allow you to get better results? And the critical point for me was just the speed of work.
And in order not to guess which of them works faster, I wrote a simple test, which consisted in the fact that the same video fragment was encoded in turn first at Theora, and then at XVID. At the same time, the compression time of each frame was measured separately and in the sum of all together. Two computers with different processors were used as a test platform. True, both from Intel. But in total, the result was about the same for both. OS - Ubuntu.
A video containing 782 frames with a resolution of 704x576 was used as a video fragment.
I almost forgot. Theora version: 1.1.1. XVID: 1.2.2 The quantization coefficient in the maximum quality of both codecs. Optimization of work with the use of ASM - maximum. We assume that codecs will work on modern processors with the presence of SSE and other co-processors, which they use to accelerate.
Also, calls to encoding functions will occur directly through the use of codec APIs to ensure measurement of the speed of the compression algorithm only, and not additional pre and post processing filters that may be present in various assemblies of the corresponding codecs for use in home video compression and so on.
Theora:

The average encoding time of one frame was approximately 64.5 ms.
XVID

The average encoding time of one frame was 13.3 ms.
')
Resum
We get the difference in performance XVID compared to Theora about 5 times! That is, in my case, when the codec performance is important, switching to Theora is still a bit early. Or carry out work on the transfer of critical parts of the algorithm on the assembler. Another good solution is to use the Nvidia Tesla platform based on CUDA technology. Or development of PCI-X hardware encoding cards based on DSP. Fortunately, there is an excellent experience with the transfer of Theora to DSP:
www.elphel.com/articles/AT3888835064_eng.htmlIn the meantime, XVID + SSE + MMX gives the best speed results.
Ps. What is interesting in terms of compression XVID gave the best results more than twice! But this is not an adequate test, since it is necessary to select the compression parameters so that the output quality is approximately the same. That is another story and other tests.
Update: Frosty and others who are familiar with codecs solely by using them to encode home videos (which is not so bad)) I want to note that the number of parameters that he mentioned (though not listed) is actually in the comments at the level of work with the Theora codec (just like for XVID) it can be programmatically reduced to 2 options: This is either an indication of the desired bit rate. Or, an indication of quality (which affects or is a quantization coefficient). At the same time, the parameters themselves are mutually exclusive. Either one or the other. If there are doubts about this, see the codec API description:
theora.org/doc/libtheora-1.1/group__encfuncs.html (Hint: Settings are done in the th_encode_alloc () function. Transmitted as a th_info structure. Where you can see these two described fields : target_bitrate and quality). Absolutely the same applies to XVID.
Other possible “top level” settings are the use of processor / video card optimization, etc. The article mentions that optimization is used as much as possible. Just like the quality.
The essence of this post is the definition of the relative coding rate of one codec compared to another on the same sequence of frames. And not a comparison of the quality of the video after transcoding the DVD. ) I solved a specific problem and got a specific result. I am fully aware that with decreasing resolution the encoding time will decrease significantly. But this does not significantly affect the result of measuring the relative velocity. Thank!)