Theora VS XVID Encoding Speed

    In one of my projects, for quite a long time, I used XVID as an internal intermediate encoder for exchanging data in a common format between servers. A great implementation of an MPEG4 compatible codec. Recently, more and more often, I began to find articles on the Internet about the relatively new, revolutionary Theora codec, which is prophesied for the future as a standard for the Web. It is understandable. It has a great advantage in the form of open source and lack of 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 the inception to the day when money was allocated to develop and improve Theora so that it can be embedded in the browser and watch videos in the absence of plugins like Flash. There was even an article stating that this codec was superior in quality to H264 (though I haven’t seen any objective estimates on this subject. Only PSNR).
    But as I tried, I did not notice in the articles the quantitative characteristics of the speed of Theora in relation to other codecs. I thought about replacing the XVID project with the new Theora codec. Suddenly, he will get better results? But the critical moment for me was 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 by Theora, and then XVID. In this case, the compression time of each frame was measured separately and in the sum of all together. As a test platform, two computers with different processors were used. True, both are from Intel. But in total, the result was approximately the same on 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 maximum quality for both codecs. Optimization using ASM - maximum. We assume that the codecs will run on modern processors with the presence of SSE and other coprocessors, which they use to accelerate.
    Also, encoding functions will be called directly through the use of API codecs to ensure that only the compression algorithm measures the speed of the compression, and not additional filters before and after processing, which may be present in various assemblies of the corresponding codecs for use in compressing "home video" and other things.

    Theora:


    image
    The average encoding time per frame was approximately 64.5 ms.

    Xvid


    image
    The average encoding time per frame was 13.3 ms.

    Resume


    We get about 5 times the difference in XVID performance compared to Theora! That is, in my case, when the performance of the codec is important, it’s too early to switch to Theora. Or, carry out work on transferring critical parts of the algorithm to assembler. Another good solution would be to use the Nvidia Tesla platform based on CUDA technology. Or the development of PCI-X DSP-based hardware encoding cards. Fortunately, there is an excellent experience in porting Theora to DSP: www.elphel.com/articles/AT3888835064_eng.html
    In the meantime, XVID + SSE + MMX gives the best results in speed.

    PS. What is interesting in terms of compression level 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, this is another story and other tests.

    Update:Frosty and others who are familiar with codecs exclusively for their use in encoding home videos (which is not so bad)) I want to note that the number of parameters that he mentioned (though he didn’t list) in the comments is actually at the level working with Theora codec (just like for XVID) programmatically comes down to 2 possible options: This is either an indication of the desired bitrate. Or, an indication of quality (which affects the quantization coefficient or is it). Moreover, the parameters themselves are mutually exclusive. Either one or the other. If in doubt, see the codec API description: theora.org/doc/libtheora-1.1/group__encfuncs.html(Hint: Settings are made in the th_encode_alloc () function. Passed in the form of the th_info structure. Where you can notice these two described fields: target_bitrate and quality). Absolutely the same applies to XVID.
    Other possible settings of the “upper” level are the use of processor / video card optimization, etc. The article mentions that optimization uses the maximum possible. Just like quality.
    The essence of this post is precisely the determination of the relative coding rate of one codec compared to another on the same sequence of frames. Instead of comparing the quality of the resulting video after recoding the DVD. ) I solved a specific problem and got a specific result. I am fully aware that with a decrease in resolution, the encoding time will significantly decrease. But this does not significantly affect the result of measuring the relative velocity. Thanks!)

    Also popular now: