[mythtv-users] transcoding HD material to ease playback

Dan Christensen jdc at uwo.ca
Thu Jan 17 01:40:35 UTC 2008

[Replying to myself in case others are interested in the results.]

Dan Christensen <jdc at uwo.ca> writes:

> I've got a frontend/backend that is just barely able to play some HD
> material:  it's a 32-bit single-core mobile Athlon at 1.9GHz, with an
> FX5200 video card.  I was surprised that it can play HD material at all,
> but it does fine on most of the sample clips I've downloaded, using
> 60-80% cpu.  (I'm not using xvmc.)  However, in a few cases it is not
> able to play the HD sample.  So I thought that I could transcode such
> material into a format that requires less cpu to play:

I've done some tests and the results are good.  Summary:  transcoding
ahead of time does greatly reduce the cpu usage required for playback.
Interestingly, this is true even if I transcode using the same codec,
bitrate and resolution!  Cpu usage went down by up to a factor of 2 in
some cases in my tests with mplayer and xv.

> 1) The most obvious thing is to do the scaling ahead of time.  My
> HDTV has non-square pixels, so almost all material needs scaling,
> and I'm guessing that this will help a lot.  Or does the video card
> do all of that work??

A small amount of downscaling helps a lot.  

But I don't understand the scaling that happens using mplayer with xv.
My test material is 16:9 1280x720, and since my HDTV has 4:3 pixels,
this ultimately needs to be scaled to 1024x768.  However, if I transcode
it to 1024x768, then mplayer prescales it to 1366x768:

VDec: vo config request - 1024 x 768 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 1024x768 => 1366x768 Planar YV12  [fs] [zoom]

It shows up with the right aspect ratio, so it looks like the video card
does it's own scaling.  So instead of eliminating scaling, it looks like
I've caused double-scaling.  mplayer knows the pixel aspect ratio
(otherwise it wouldn't show up right at all), so I don't know why this

> 2) I wonder if lowering the bitrate a bit might help?

It has a minor effect on the cpu usage, but doesn't seem too important.

> 3) What codec should I use?  I'm not too concerned about disk space,
> as these are just short clips I'm playing with to see how my HDTV
> looks.

The codec had a big effect on cpu usage, with h264 playback taking
about twice as much cpu as MPEG2 using mplayer and xv.

The h264 cpu usage varied a lot during playback of a single recording,
depending on the scene. 


The only problem I had is getting good quality video.  Even with fairly
high bitrates and h264, I wasn't able to get the quality nearly as good
as the original.  I was using ffmpeg for the conversion, but didn't
experiment with too many variations.  It seems like there exist some
very good encoders out there...


More information about the mythtv-users mailing list