AVS › AVS Forum › Video Components › Home Theater Computers › HTPC - Linux Chat › Linux media HTPC video playback CPU utilization and optimization
New Posts  All Forums:Forum Nav:

Linux media HTPC video playback CPU utilization and optimization

post #1 of 40
Thread Starter 
This subject comes up often, but I've run into a 1080i LiveTV (Watch TV) playback issue on another MythBuntu 8.04 build.

It has a 7300GS PCIe, Biostar Nvidia chipset S939 mobo, 1GB DDR3200 and a single core A64 3500.

At first I thought the issue was the QAM demodulation with the Kworld 115 card, but I noticed the image in "Watch TV" only broke up and hesitated/jerked on 1080i channels- no issue with 720p channels.

I tried using the "Slim" setting (vs CPU+) in the Front End Setup->TV->Playback options, and it helped on the 1080i channels, but the System Monitor would still peg at 100% and jerk the image occasionally.

Since others here have stated good ATSC playback with as little as a Duron 1600, I thought an A64 3500 would be home free for 1080i ATSC/QAM.

Any other ideas for settings or tweaks?

...I may have to put an X2 in there
post #2 of 40
Have you installed/enabled the nvidia driver (not the default nv driver)?
post #3 of 40
Thread Starter 
Quote:
Originally Posted by wnewell View Post

Have you installed/enabled the nvidia driver (not the default nv driver)?

Yes, from EnvyNG
post #4 of 40
Thread Starter 
Any more hints on the "secret sauce" to reduce CPU utilization on live ATSC 1080i on Mythbuntu?
post #5 of 40
Although I have a beefier machine I've struggled with jittery video as well, but I believe it's primarily due to my ATI graphics card and driver. I have been able to clean it up a lot and maybe something here will work....

Make sure graphics drivers are installed (which you did).
Research and set appropriate driver configs (such as "VideoOverlay" "on" etc - card dependent).
Select the best-working playback profile within myth (either slim or cpu+) and then modify individual deinterlacers to get a bit better performance and reduce CPU load.

My CPU went from 105% during 1080 playback to ~55% (yeah, 105% is from running "top") with just changing some of the deinterlacers. That wasn't enough tho as it still required some video driver parameters to clean up the video.

I have been able to remove (nearly all of) the jitters but I still get video artifacts and anomalies that I'm starting to think are from the vid card driver (ATI Catalyst 8.5).

R

---
AMD 64 5000+ BE
Gigabyte GA-MA78G-__ (ATX) (ATI HD 3200 Graphics)
2GB Ram.
post #6 of 40
Thread Starter 
Quote:
Originally Posted by netslacker View Post

then modify individual deinterlacers to get a bit better performance and reduce CPU load.

My CPU went from 105% during 1080 playback to ~55% (yeah, 105% is from running "top") with just changing some of the deinterlacers. That wasn't enough tho as it still required some video driver parameters to clean up the video.

Where are the deinterlacing parameters in Myth?

I think the Mythbuntu guys need to do a better job of auto-setting the CPU intensive parameters related to video processing during the install wizard, checking the CPU and GPU/video driver for performance and then setting some video parameters for you.
post #7 of 40
Quote:
Originally Posted by Rgb View Post

Any more hints on the "secret sauce" to reduce CPU utilization on live ATSC 1080i on Mythbuntu?

Did you enable XvMC (shudder)? Is UseEvents set to true in your xorg.conf?

X2's are so cheap now, it's an easy fix to pop one in.
post #8 of 40
Thread Starter 
Quote:
Originally Posted by slowbiscuit View Post

Did you enable XvMC (shudder)? Is UseEvents set to true in your xorg.conf?

X2's are so cheap now, it's an easy fix to pop one in.

Unfortunately, socket 939 X2's are much harder to find. Anyone got a lead for retail boxed new S939 X2's? There's always ebay....
post #9 of 40
Use the XvMC setting for deinterlacing in playback. Your CPU should be good for that. I had a X2 3800 that ran @ 20%or so with XvMC and bobint. Try that and let us know.
post #10 of 40
Quote:


Where are the deinterlacing parameters in Myth?

Settings->Settings->Tv Settings->Playback

Then hit next until you get the playback profiles where you select either Normal / CPU+ / CPU++ / CPU- etc...

Under each of those hit on the "edit" buttons and you will see the deinterlacer setup for that rule.

R
post #11 of 40
Thread Starter 
I assume the numbers on the rules are priorities?

THe first 3 rules were for 720p or below, and the last two appeared the same for res >0,0 -> xvMC, so I assume 1920x1080 would be covered by rules 4 and 5 since 1-3 were for 1280x720 or less.

I changed rules 4 and 5 to explicitly cover >1280x720, used standard xvMC and Bob deint- no change on 1080i channels

I still get flashes of small sqares every other second or so- different from the breakup you see with low signal strength.
post #12 of 40
Thread Starter 
I found this at mythtv.org

http://www.mythtv.org/docs/mythtv-HOWTO-3.html

"To playback HDTV content, plan on a powerful CPU. "How powerful?" depends on a number of factors, such as the capture resolution, whether the video is progressive or interlaced, and whether your display card has hardware-assist support for Linux.

The Simple Answer: Once you are in the 3.2 Ghz P4-class of CPU you should have no issues with viewing HDTV.

The Complicated Answer:

For 720p content (1280x720), a 2.4GHz P4 should be sufficient.

For 1920x1080i->1920x1080p with the better deinterlacing methods done in real time a 2.4GHz CPU is taxed, but should work if you use "Bob and Weave" deinterlacing, or if you have an NVIDIA card with MPEG-2 hardware acceleration. If you enable the hardware acceleration, you may be able to use a 1.8GHz processor."

Does XvMC being enabled with the current proprietary Nvidia driver installed guarantee MPEG2 GPU assist on FX5xxx, 6xxx and 7xxx series Nvidia cards?

I was also suspecting the DMA setting on the hard drive assigned to Myth recording- what is the simplest way to check/verify DMA setting on a hard disk?
post #13 of 40
Rgb,

hdparm should give you the information you need on DMA access and drive speed.

hdparm -i /dev/hdX or /dev/sdX will give you drive capabilities and current settings.

You can use hdparm to test drive transfer throughput, and offers a host of tweaks for IDE drives. It can't do much for SATA, but sdparm may help. Here's a few good links:

Gentoo Wiki page - very good hdparm primer
Old but decent hdparm primer
sdparm primer w/ section on SATA
post #14 of 40
Quote:
Originally Posted by Rgb View Post

Does XvMC being enabled with the current proprietary Nvidia driver installed guarantee MPEG2 GPU assist on FX5xxx, 6xxx and 7xxx series Nvidia cards?

It's supposed to with the drawbacks being that the OSD is in greyscale on anything but 5xxx cards, and the video stuttering that accompanies OSD popups on some systems. It can help a lot with CPU usage, but it's often problematic.

I don't have it enabled for Myth TV playback because of these probs but I do have it enabled for mplayer and xine. It does make a noticeable diff with my onboard 6150.

Don't forget to make sure that "UseEvents" is set to "true" in the Device section for your card in xorg.conf. Makes a huge diff in X display usage in many cases.
post #15 of 40
Late to the party, sorry (updated my gentoo box on a celeron after about 2 years, lol), but I experience the same pauses and "squares" even on my dual-core opty.

The issue is clearly caused by hard drive usage (I only have a single-drive system for now). We all know that mythtv uses the hard drive 100% of the time while watching live tv. The solution is RAID0 and an external drive for backups. I'm planning a HOWTO on this, but the cost of getting my car out of the shop has escalated to $1800 (restoring a classic ) so my extra cash for drives is temporarily tied up.
post #16 of 40
Thread Starter 
Quote:
Originally Posted by slowbiscuit View Post

Don't forget to make sure that "UseEvents" is set to "true" in the Device section for your card in xorg.conf. Makes a huge diff in X display usage in many cases.
BINGO!

You win the thread prize!

The SECRET SAUCE for this thread is:

\tOption \t\t"UseEvents"\t"True"

However, I added the line to *Screen* section of xorg.conf, NOT the Device section per:
http://www.debianhelp.org/node/3146

Section "Screen"
\tIdentifier\t"Default Screen"
\tMonitor\t\t"Configured Monitor"
\tDevice\t\t"Configured Video Device"
\tOption\t\t"AddARGBGLXVisuals"\t"True"
\tOption \t\t"UseEvents"\t"True"
\tDefaultdepth\t24
EndSection

I attached my xorg.conf file.

Another link says to put it in the Devices section, but I didn't try it-
http://www.redhatmagazine.com/2007/1...vidias-driver/

I don't know if there's any difference between the Devices and Screen sections for the UseEvents parameter

1080i channels are now butter smooth, using ~70% CPU +/- 5%, and about 50% with 720p channels.

Why EnvyNG and/or the Nvidia driver doesn't add this important line to the xorg.conf file is unknown...

 

xorgConf.txt 1.3564453125k . file
post #17 of 40
Thread Starter 
Quote:
Originally Posted by jimsiff View Post

Rgb,

hdparm should give you the information you need on DMA access and drive speed.

hdparm -i /dev/hdX or /dev/sdX will give you drive capabilities and current settings.

You can use hdparm to test drive transfer throughput, and offers a host of tweaks for IDE drives. It can't do much for SATA, but sdparm may help. Here's a few good links:

Gentoo Wiki page - very good hdparm primer
Old but decent hdparm primer
sdparm primer w/ section on SATA

I had used hdparm before- should have googled, but thanks. It returned:

sudo hdparm -i /dev/sda1

/dev/sda1:

Model=WDC WD800JB-00FMA0 , FwRev=13.03G13, SerialNo=WD-WMAJ91071310
Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=58
BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=?16?
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156301488
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
AdvancedPM=no WriteCache=enabled
Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6

* signifies the current active mode


So I am good to go re: dma on the recording hard drive, which appears to be set to udma5.

The hard drive had nothing to do with the hesitating 1080i and flashes of small squares, apparently.

And this is with the Myth Back End record directories set to /home/$user on the same drive as / (i.e using a single hard disk, the WDC WD800JB above)

I intend to add a separate 200G drive dedicated to video recording anyways...

As always, the AVS braintrust saves the day
post #18 of 40
Thread Starter 
I deleted the Kworld 115 in the Myth backend, re-added it, then did a fresh channel scan on WoW basic analog cable to pick up the unencrypted OTA stations sent as QAM-256 digital.

After removing the music channels that don't work in the Front End, I exited, did a mythfilldatabase from schedulesdirect, then ran the Front End again.

I tested 1080i on NBC-HD (Today show) this morning- the CPU usage varied a consistent 60%-70%, rarely higher. This is with XVMC, bob deint, and the UseEvents=True option. Looks awesome, no hiccups for 1080i.

Based on these results, I feel comfortable with the single core A64 3500+ (2.2Ghz). I think you'd be good down to an A64 3200 or 3000, but wouldn't go lower, as you want some headroom. Nice to know a single core can still do OTA MPEG2 HD 1080i.

If someone tests a single core using a 64 bit Linux and Myth, please report CPU usage.
post #19 of 40
Quote:
Originally Posted by Rgb View Post

Based on these results, I feel comfortable with the single core A64 3500+ (2.2Ghz). I think you'd be good down to an A64 3200 or 3000, but wouldn't go lower, as you want some headroom. Nice to know a single core can still do the job.

If someone tests a single core using a 64 bit Linux and Myth, please report CPU usage.

That's the CPU I upgraded from. I don't think I tried the "UseEvents" option, but it used ~90+% CPU in 64-bit Linux watching HD via firewire. Don't even think about 264 HD, though...seconds per frame, lol. That's with 8500GT + 2GB RAM, btw.
post #20 of 40
Thread Starter 
Quote:
Originally Posted by mythmaster View Post

That's the CPU I upgraded from. I don't think I tried the "UseEvents" option, but it used ~90+% CPU in 64-bit Linux watching HD via firewire. Don't even think about 264 HD, though...seconds per frame, lol. That's with 8500GT + 2GB RAM, btw.

To clarify for others, I *don't* recommend using anything less than an X2 4600-5000 for x264 1080p, x2 6000 even better.

This thread discussed the low end CPU "hard stop" for MPEG2 1080i from over the air or cable sources.

CPU requirements for video playback depends on both resolution (480p, 540p, 720p, 1080i, 1080p) and codec (MPEG2 vs x/h264 vs VC1 vs Xvid). A lot of people only need SD with any codec, and occasional HD MPEG2 from over the air sources only, which dramatically reduces CPU requirements. Others may want these plus x/h264 720p only, which also needs significantly less CPU than 1080p x/h264. I don't know exactly where the CPU low end "hard stop" is for 720p x264- I suspect any X2 would do it fine, plus the higher speed single cores (A64 4000-4600?)
post #21 of 40
Quote:
Originally Posted by Rgb View Post

To clarify for others, I *don't* recommend using anything less than an X2 4600-5000 for x264 1080p, x2 6000 even better.

This thread discussed the low end CPU "hard stop" for MPEG2 1080i from over the air or cable sources.

CPU requirements for video playback depends on both resolution (480p, 540p, 720p, 1080i, 1080p) and codec (MPEG2 vs x/h264 vs VC1 vs Xvid). A lot of people only need SD with any codec, and occasional HD MPEG2 from over the air sources only, which dramatically reduces CPU requirements. Others may want these plus x/h264 720p only, which also needs significantly less CPU than 1080p x/h264. I don't know exactly where the CPU low end "hard stop" is for 720p x264- I suspect any X2 would do it fine, plus the higher speed single cores (A64 4000-4600?)

Come on now. I've been using MythTV for about 4 years now and all I ever watch is ATSC mpeg2. The screen resolution never affected my cpu usage. What did affect it was the type signal sent form the stations. Until upgrading I watched 1080i on an old Duron 1600 clocked at 2GHz using XvMC with an old AGP FX5200 card at 1600x1200. Changing the screen resolution didn't make one bit of difference for CPU usage. It was about 60% IIRC and I could clock it down to 1.2GHz and still watch a 1080i signal at about 90% cou usage using XvMC. Without XvMC, it took 80%+ when clocked at 2GHz. Using OSD did affect the picture somewhat without XvMC, but not with it. I used deinterlacing with Bob. I did have some problem til I found the right settings for the video card. As for H264, I don't use it, but I did test my X2-3800+ from some clips someone pointed me to and it played them on this machine using onboard Geforce 6100 video. The changes for the best performance was to turn off sync to vblank in a couple of places. ymmv

0/SyncToVBlank=0
0/AllowFlipping=1
0/ForceGenericCpu=0
0/GammaCorrectedAALines=1
0/FSAAAppControlled=1
0/OpenGLImageSettings=2
0/XVideoTextureSyncToVBlank=0
0/XVideoBlitterSyncToVBlank=1
0/XVideoSyncToDisplay=1
post #22 of 40
Thread Starter 
Quote:
Originally Posted by wnewell View Post

Come on now. I've been using MythTV for about 4 years now and all I ever watch is ATSC mpeg2. The screen resolution never affected my cpu usage.

I meant the resolution of the source (mkv file, avi file, feed from antenna, etc), not the resolution the video card is set to. Sorry for the confusion.

Thanks for the tweak settings, though. Your results at 2Ghz with ATSC MPEG2 appear to agree with mine.
post #23 of 40
Thread Starter 
Bump to keep this active- good info for noobs or a new build.
post #24 of 40
Thread Starter 
Bump- prolly should be sticky...
post #25 of 40
Quote:
Originally Posted by Rgb View Post

I deleted the Kworld 115 in the Myth backend, re-added it, then did a fresh channel scan on WoW basic analog cable to pick up the unencrypted OTA stations sent as QAM-256 digital.

After removing the music channels that don't work in the Front End, I exited, did a mythfilldatabase from schedulesdirect, then ran the Front End again.

I tested 1080i on NBC-HD (Today show) this morning- the CPU usage varied a consistent 60%-70%, rarely higher. This is with XVMC, bob deint, and the UseEvents=True option. Looks awesome, no hiccups for 1080i.

Based on these results, I feel comfortable with the single core A64 3500+ (2.2Ghz). I think you'd be good down to an A64 3200 or 3000, but wouldn't go lower, as you want some headroom. Nice to know a single core can still do OTA MPEG2 HD 1080i.

If someone tests a single core using a 64 bit Linux and Myth, please report CPU usage.

Glad you were able to fix it. But I'm still wondering why your CPUs are very high. I've been doing 1080i either QAM or ATSC since 2005. I'm still using the machine. It's an athlon 64 3000 with 512mb. CPU max is 42%.

This machine can also do 1080p without framedrop but of course, the ones that were only encoded at 5mbits. I've downloaded a 1080p video clip with 25mbits encoding, it was slow and cpu was 95%. I should upgrade next year.

EDIT:
Sorry, adding Xorg's usage, cpu usage total was at 49%-58%. I was only looking at mplayer's cpu usage.
post #26 of 40
Thread Starter 
Quote:
Originally Posted by v1rtu0s1ty View Post


EDIT:
Sorry, adding Xorg's usage, cpu usage total was at 49%-58%. I was only looking at mplayer's cpu usage.

My CPU usage numbers are all *total* CPU- not per process.

Based on total CPU, it appears our numbers agree.
post #27 of 40
Cool!

Do you think if we want to play high bit rate rips like 25mbits smoothly, we should go with quad core or maybe just get a high-end nvidia card(8800s and above) now that Nvidia has released(still buggy though) VDPAU?
post #28 of 40
Thread Starter 
Quote:
Originally Posted by v1rtu0s1ty View Post

Cool!

Do you think if we want to play high bit rate rips like 25mbits smoothly, we should go with quad core or maybe just get a high-end nvidia card(8800s and above) now that Nvidia has released(still buggy though) VDPAU?

I think the safest route in the short run on Linux is to go with the most CPU cores and most CPU Ghz you can afford, as Linux currently needs to do more in software vs the proprietary hardware acceleration on Windows. The money you save on more expensive GPU's can go into more CPU cores/GHz, which helps your overall system more anyways.

Until AMD/ATI and Nvidia get XvBA and VDPAU up and running to enable hardware acceleration of video decoding in their Linux drivers with common media apps in Linux, we need to protect ourselves with ample cores and GHz to cover for CPU utilization for software decoding/post processing- no big deal, as Moore's Law is on our side. Until XvBA and VDPAU are working in an easy fashion (i.e. no special patches/compiling needed) with the mplayers, VLC's, Geexbox's, XBMC's and MythTV's of the world, just use Nvidia FX5xxx, 6xxx or 7xxx GPU's for the time being, which are practically free now. A side benefit for media PC use is that these are easy to find passively cooled- you don't want fans on your GPU.

Besides, software decoding is more flexible in the long run, and long time avsforum members know that the pendulum has swung several times back and forth between hardware and software decoding of video, with the consensus among avsforum members over which is "better/preferred" shifting every few years. At the moment, Linux and Windows are simply "out of sync" on what is preferred
post #29 of 40
so much thanks for all the Myth/Linux info.

First time Mythbuntu builder here and it sure helps to have a better idea knowing what I'm in for :-) ... and all your explanations about CPU horsepower/HD playback for various file types/resolutions are very helpful, I would think even for Linux vets doing an HTPC for the first time.

Something I'm still a bit confused on. What is the ideal O/S & storage drive setup if I have 2 medium size drives, (around 200GB each)? Should I keep archived video files (.mpg, .mkx, avi) and also do live TV recordings to the same drive or make the new recordings on the O/S drive? Sorry for the weak questions, but I gotta start somewhere.


I vote yes to make this thread stick!
post #30 of 40
what is Myth/Linux ?
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: HTPC - Linux Chat
AVS › AVS Forum › Video Components › Home Theater Computers › HTPC - Linux Chat › Linux media HTPC video playback CPU utilization and optimization