[mythtv-users] [ATrpms-users] Confused: why did video performance DECREASE (up to 70%) after upgrading video? PARTIALLY SOLVED

Jeffrey J. Kosowsky mythtv-users at kosowsky.org
Tue Dec 9 08:41:02 UTC 2008


Doh.... I think I made some progress. On a lark, I tried again setting
"extra audio buffering" because I realized that I had been confused
between that setting and the "aggressive soundcard buffering" option
(perhaps this needs to be better documented or the names of the
options changed to be more understandable).

To my surprise, it made a big difference. Now I can watch SD and 720p
on both my old 4600 and my new 6200 card without video slowing or
audio pauses. This works even without XvMC.

On the 6200 with XvMC, I can now just about watch 1080 as long as
nothing else is running on the machine. During the first 10-30 seconds
of watching a channel, I still get a slew of "WriteAudio: buffer
underrun" and "NVP: prebuffering pause" (which I assume is due to
extra processing going on somewhere in myth). If nothing else is
running on the machine, I only get those error messages every 30-60
seconds or so thereafter but they are less obvious and annoying then
the longer pauses and slow video that I had before

Also, interestingly CPU usage for mythfrontend is up now after turning
on the "extra audio buffering" to 60-65% (from 40-45% before). I
assume that the audio buffering issue which was causing slowed video
had the unexpected side effect of decreasing the video load.

Now with 60-65% of CPU going to mythfrontend, 8-10% going to
pulseaudio, 8-10% for mythbackend, and 4-6% going to X, I can
understand why I don't have much margin.

(see below for more comments) 

George Mari wrote at about 19:50:18 -0600 on Monday, December 8, 2008:
 > Jeffrey J. Kosowsky wrote:
 > > George Mari wrote at about 08:17:52 -0600 on Monday, December 8, 2008:
 > >  > Jeffrey J. Kosowsky wrote:
 > >  > > George Mari wrote at about 21:55:00 -0600 on Sunday, December 7, 2008:
 > >  > >  > Jeffrey J. Kosowsky wrote:
 > 
 > [deleted]
 > > 
 > > I guess what frustrates me is that after DAYS of trying, I'm still not
 > > sure if this is an audio or video problem.
 > > 
 > > On the one hand, you might say it is an audio problem given that the
 > > audio pauses are most obvious and the error messages on the surface
 > > seem to be mostly audio-related "WriteAudio: buffer underruns".
 > > 
 > > On the other hand, a closer look shows that the video is playing back
 > > slightly slow while the audio sounds perfectly normal until it
 > > presumably gets too far ahead of the video and underruns the
 > > buffer, which leads to a pause while the stream catches up. So, I'm
 > > thinking that maybe it is more of a video problem.
 > > 
 > Hmmm...I agree it could be either audio or video, or the combination of 
 > trying to decode and playback both at the same time, while keeping the 
 > two in sync.  My next suggestion would be to try changing your audio 
 > output device to NULL, from the current ALSA:default.  I'm not 100% 
 > sure, but I believe this will disable all audio decoding by myth.  By 
 > taking that out of the picture (so to speak) maybe we can see what 
 > happens to the video quality.  If it still stutters and generates 
 > pre-buffering pauses, then the audio is not the issue.  If the video 
 > quality improves, and there are no more pre-buffering pauses, I'd say 
 > it's time to try installing a PCI sound card instead of using your 
 > built-in motherboard audio.
 > 

Interestingly, I didn't see a big difference in setting it to
NULL. Also, I'm not sure I understand exactly how the "extra audio
buffering" helped the problem.

 > BTW - anyone on the list, please jump in and correct me if my assumption 
 > about using NULL for the audio output device is wrong.
 > 
 > > But I can't figure out why the video is being slowed down even though
 > > I seem to have enough CPU (40% or so free) and given that others seem
 > > to have found the 6200 fast enough to play even 1080i.
 > > 
 > The logical conclusion would seem to be that video playback performance 
 > and quality is not completely dependent on available CPU power. :-)
 > 
I'm now thinking that CPU is indeed my primary limitation now since
1080 is so sensitive to other processes running.

 > Seriously, I feel your fixating on this a bit.  You have a bottleneck 
 > somewhere, it's just not with the CPU.  No amount of free CPU is going 
 > to fix it.  It lies somewhere that our normal Linux tools (top, free, 
 > etc.) cannot reach, so it's hard to identify.
 > 
 > > Also, interestingly, I get the same problems even when watching
 > > (digital) SD but NO problems when playing a live analog stream or
 > > playing back even 1080i after transcoding to mpeg4. Also, the problem
 > > occurs both when watching LiveTV and when watching previously recorded
 > > (but non transcoded) streams.
 > > 
 > Not sure what to make of this yet.
It was all at least partially solved by the "extra audio buffering".

 > 
 > > Also, mplayer does not have this problem either when directly viewing
 > > OTA broadcasts or even when viewing streams recorded by mythtv.
 > > 
 > That's good - you know the problem does not lie with your recording 
 > files themselves.
 > 
 > > So, it seems to me that there is something wrong with how mplayer
 > > (and/or my configuration of it) is playing back HD streams.
 > > 
 > I missed the bit where you said the problem occurs with mplayer on HD 
 > streams?
Ooops. I meant mythtv.
 > 
 > > I have tried seemingly every imaginable combination of playback
 > > configs, including:
 > > 	- With/without XvMC
 > > 	- With/without OpenGL
 > > 	- With/without interleaving
 > > 	- With different OSD rendering
 > > 	- With/without using video as timebase
 > > 	- With different nvidia drivers (96.xxx, 173.xxx, 177.xxx)
 > > 	- With different screen resolutions
 > > All of the above have NO EFFECT on the actual audio/visual performance
 > > other than to change CPU usage.
 > > 
 > > It really seems like either mplayer or I are missing one thing that is
 > > bottlenecking the decoding of digital streams.
 > > 
 > > 
 > > I was thinking first of returning the 6200 and buying a 7600gs board,
 > > but given the above, it is not at all clear to me that the problem is
 > > a video hardware one since the 6200 should be sufficient, particularly
 > > at SD ;)
 > > 
 > > I really want to fix this...
 > 
 > 
 > I think you can.  I think you just have to think outside the box a bit, 
 > beyond what you've already considered.  Seriously consider a good PCI 
 > audio card - they're not that much, cheaper than a new motherboard.
 > 
 > I'm on Fedora 9, main frontend is a 2.2Ghz Athlon 64 (single core) with 
 > 1GB RAM, and an AGP Nvidia 6200.  It plays back SD recorded from a 
 > PVR-350 and HD OTA flawlessly using the CPU++ playback profile.  My 
 > motherboard has Nvidia nforce3 built-in audio, though, not Intel like 
 > yours, but it is AC'97 as well.  So you can get perfectly fine 
 > performance with yesterday's hardware, and motherboard audio.  But not 
 > all motherboard audio is the same, apparently.
 > 
 > CPU is 30% idle on 1080i, 45% idle on 720p, and 65% idle on SD.  So the 
 > 6200 can do a fine job.

This is my typical CPU usage (from top):
Cpu(s): 61.6%us,  9.7%sy,  0.0%ni, 27.3%id,  0.5%wa,  0.5%hi,  0.5%si,
0.0%st

 20   0  326m 103m  34m S 62.0  5.1  14:52.29 mythfrontend
 20   0  364m  82m  11m S  9.0  4.1   1:58.87 mythbackend
 20   0 56312 5432 3688 S  6.0  0.3   1:57.03 pulseaudio
 20   0 59240  23m 9088 S  4.6  1.1   1:42.21 X


I'm curious now how you seem to be getting better performance. Could
it be that your 2.2Ghz Athlon 64 is just that much faster than my
2.8GHz P4? (and I am using XvMC).

Two questions that remain:
- Any other suggestions about things I can do to tweak my mythtv/video
  setup to grind out a few more marginal cpu or video points?
- Would upgrading further to a 7600gs card be likely to help or is
  this likely to be more of a CPU issue? (note: I clearly got some
  benefit in moving from the 4600 to the 6200 card and turning on XvMC)

Thanks again for all the help!!!


More information about the mythtv-users mailing list