[MPlayer-users] Optimize video output from tv card

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Aug 26 10:28:32 CEST 2009


On Wed, Aug 26, 2009 at 09:43:44AM +0200, Michael wrote:
> Reimar Döffinger wrote:
> 
> > On Tue, Aug 25, 2009 at 01:50:42PM +0200, Michael wrote:
> >> I want to output external video from a tv encoder card (USB) to the
> >> screen. It works, but it uses too much CPU power. If the stream is played
> >> back at 25fps it uses 100% CPU. With 15fps it is about 50%.
> > 
> > What kind of CPU usage? In "top"/"time"/whatever program, user or sys?
> I use the column "CPU usage" in "top" or "htop". I think it shows user CPU 
> usage.

Look at the "Cpu(s):" line in top, the 3rd line. It splits overall CPU
usage up.
The one you were looking at is all of those summed up as far as they can
be associated to MPlayer - which might include whatever e.g. the USB
driver is doing on MPlayer's behalf.
Of course, using oprofile would give you more precise results, but I am
not sure if there is an actually working simple Gui for it (haven't
found one so far).

> > What values does the MPlayer command line show for CPU usage?
> > 
> 
> I only have ??% there, e.g.
> V:   0.0 170/170 ??% ??% ??,?% 0 0

That shouldn't stay at 0.0 at least...

> >> When I instead use a webcam, I can reach 25fps with about 50% only. So I
> >> guess it is somehow the internal processing. Is there a way to optimize
> >> it?
> > 
> > What internal processing? There isn't any serious amount of processing
> > for that case, though using something suitable for video output like
> > -vo xv or -vo gl:yuv=2 should be somewhat better.
> 
> Unfortunately, I am pretty much fixed on a small embedded hardware system 
> (GeodeLX), which seems to only support fbdev and directfb. (directfb, 
> however, uses more CPU).

Those aren't particularly optimized unfortunately.

> I have to admit, that I nearly know nothing about video processing at all.
> I guess, that the external video capturing card/TV card/webcam encodes the 
> video somehow, e.g. MJPEG or other type of streams? Furthermore I guess it 
> needs to use some type of colorspace, which might need a conversion?

No, they both don't encode by default, and the TV card doesn't even
offer encoding, at least not via the v4l API.
Also the CPU usage for decoding 

> The resolution and the framerate, however, is the same between the webcam 
> and the TV card (604x480, 25fps). So, I thought, if displaying the webcam 
> takes app. 50% of CPU usage, while displaying the TV card take 100%, mplayer 
> seems to be doing more stuff ("internal processing") on the video data it 
> gets from the TV card than from the webcam.

Well, you have specified 25 fps, but that doesn't mean that either of
them actually delivers 25 fps.

> I hoped that there is some special command line option, maybe to the driver 
> to maybe switch to a different colorspace that is less time consuming for 
> mplayer to use. Or maybe mplayer is using some redundant conversions that I 
> may reduce via some command line option.

Both devices use the same colourspace and it's a simple yuv->rgb
transformation. It is hard to imagine it should show any relevant CPU
usage.
Maybe you should first try on "proper" hardware.
Also if your kernel is as ancient as MPlayer I'd suggest trying a newer
version, too, TV drivers often are in an unusable state and suddenly
start working rather well (my USB thing has been working barely with
2.6.20, not working at all with 2.6.24 and is now working fairly well
with 2.6.29 - well, or something like that I never remember the exact
details).


More information about the MPlayer-users mailing list