Thursday, March 22, 2007

Simple performance boost for TivoDecode Manager

With the release of AppleTV I started playing around with the TivoDecode Manager again tonight and started converting content from my Tivo. While playing around with the latest version of TDM (2.1), I noticed that the version of mencoder bundled with TDM was completely unoptimized. Here is the output from their build of mencoder

$ /Applications/TiVoDecode\ Manager.app/Contents/Resources/mencoder
MEncoder dev-SVN-r21629-4.0.1 (C) 2000-2006 MPlayer Team
CPU: Intel(R) Core(TM)2 CPU T7600 @ 2.33GHz (Family: 6, Model: 15, Stepping: 6)
MMX supported but disabled
MMX2 supported but disabled
SSE supported but disabled
SSE2 supported but disabled
CPUflags: Type: 6 MMX: 0 MMX2: 0 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions:


Now compare this output to the version recommended by ffmpegX from the sourceforge build

$ /Applications/ffmpegX.app/Contents/Resources/mencoder
MEncoder dev-CVS-060307-04:23-4.0.1 (C) 2000-2006 MPlayer Team
Mac OSX static build for ffmpegX
CPU: Intel (Family: 6, Stepping: 6)
FIXME:Hardenabling SSE and SSE2 without detection
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2


Notice anything missing? Yeah. TDM is completely ignoring the MMX and SSE registers!

So a quick timing on a 87 second video clip yielded the following with TDM's mencoder

real 1m10.966s
user 1m8.981s
sys 0m0.565s


The same timing with identical options on ffmpeg's mencoder yielded a result of

real 0m24.834s
user 0m23.379s
sys 0m0.443s


That's about a 50% reduction in encoding time!

Of course the -lavfdopts probesize=128 -lavcopts aglobal:1:acodec:aac options did not work and had to be stripped or changed to compatible options in both, but the data is somewhat clear that TDM needs to recompile their mencoder with SSE and MMX extensions enabled.

So last night I decided to undertake the task of doing all that and BLEH. It's harder than it sounds. Apparently I'm missing the faac library among other things and compiling the libfaac on the Mac isn't the most straight-forward task. It looks like I'll be pushing this task to another day, but the findings so far are interesting to say the least.

No comments: