John Galea's Blog

My blog on Gadgets and the like

Video Encoding

One of the things that you often need to do is to re-encode movies. For iPodsiPhones for example they always need to be MPEG4. I’ve played with a number of encoders in the past and few support multi processors. Leaving a single core to sit and be a spectator while you wait. In the past I used but it only supported the single thread.

It seemed to me that re-encoding ought to easily be a multi threading app given key frames. Then Sean Liu pointed me in the direction of and open source encoder. Low and behold it supports multi threading. I’ve also wondered the difference in encoding speeds of between say an Xeon (server processor) and a Pentium 4 (desktop processor).

So I have two machines, one is a Pentium 4 based 3.2GHZ processor running Windows 2008. The other machine is a vmware ESX 4.0 based Xeon dual quad core 1.6GHZ. I ran some testing encoding a 340MB DIVX video file and converted it to MPG4. I constrained the number of processors simply by using the task manager affinity control. Here are the results


2 processors took 1232 seconds 51% (vs 50% theoretical)

1 processor took 2399 seconds

Xeon VM .16GHZ

4 processors took 648 seconds 27% (vs 25% theoretical)

3 processors took 826 seconds 35% (vs 33% theoretical)

2 processors took 1191 seconds 50% (vs 50% theoretical)

1 processor took 2394 seconds

As you can see it scales REALLY well!

As you can also see in spite of being a 3.2 G P4 Vs a 1.6 G Xeon there is only a 3% difference in encoding times proving the old adage GHZ is not everything!

You can also see that vmware is excellent at passing the CPU through to the guest. It’s a pitty there is a limit at 4 CPUs to the free version. I’d love to have all 8!

UPDATE: I have been able to redo the testing on this with all 8 VCPUs now. The results are VERY interesting: Here’s the raw data for encode time of a 1 hour 41 min XVID movie. For details of the movie and the encode see below:

1 CPU 6604 sec
2 CPU 3296 2.0
3 CPU 2314 2.9
4 CPU 1710 3.9
5 CPU 1426 4.6
6 CPU 1246 5.3
7 CPU 1155 5.7
8 CPU 1119 5.9

It really is quite stunning to see how well this actually tracks. You can see though, adding more and more processors starts to yield less and less results.

As an interesting test I also ran the same movie through a 64 bit version of the code (all the rest of the tests were done with a 32 bit host/client). The host had 4 processor. The same movie encoded in 1861 (Vs. 1710) seconds meaning no benefit (and some penalty in fact) to 64 bit.

The graph of actual performance Vs the number of CPUs looks like this:


August 31, 2009 - Posted by | Other reviews, Video Encoding

1 Comment »

  1. […] Even on the Rogers build there is no movie player. Odd given the codecs are there. I downloaded Cinema again. Great program and free. Simply drag on the movie to FF and RWD. Brilliant. Amazed Apple didn’t think of that! Now if your in the Gallery Ap and it finds a video it can play it from there. It just seems there is no program icon to start a movie player. Odd. The phone plays H264 MP4 formatted for iPod movies, but DIVX movies are not supported out of the box. A found a program in the marketplace called yxflash that will play DIVX’s but either the processor would not keep up of the flash interface is too slow because it was not smooth at all. Totally unwatchable. So it seems conversion is a necessary evil. Be sure and check out my post on encoding for how to do that free and fast. […]

    Pingback by Android G1 review (take 2) « John Galea's Blog | November 12, 2009 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: