[mythtv-users] SPDIF, Stutter and Query for where to look for more help

Michael T. Dean mtdean at thirdcontact.com
Wed May 4 14:51:01 UTC 2005


Jeff Wormsley wrote:

> I found out why my SPDIF wasn't working on my D865GBF (duh, bad 
> cable), but now am running into other problems.

:)  We've all been there...

> No matter what buffering I use (I've tried all four combinations of 
> the two different audio buffering settings - why there are two and 
> what the difference is I don't know, but one is in General and the 
> other in Playback) I am getting audio buffering issues, which is 
> causing the video output to stutter.

Extra audio buffering:
Enable this setting if MythTV is playing "crackly" audio and you are 
using hardware encoding.  This setting will have no effect on MPEG-4 or 
RTJPEG video. MythTV will keep extra audio data in its internal buffers 
to workaround this bug.

(Has no effect unless you're using a PVR-x50 and similar, and would only 
make a difference on dark scenes.)

Aggressive Soundcard Buffering:
If enabled, MythTV will pretend to have a smaller soundcard buffer than 
is really present.  This may speed up seeking, but can also cause 
playback problems.

(Is almost defintely not what you--or anyone else--want.)

Therefore, these are unlikely to be the problem.

> At least I am fairly certain that is the problem, as xine does the 
> same thing, and with  --verbose=99 on the command line, it has a very 
> similar "extending video to stay in sync with audio (paraphrase)" that 
> myth puts out when using -v playback.  I am thinking that the root 
> problem may be in the sample rate.  When I got the SPDIF working and 
> send sound to it, my Sony receiver always says it is in PCM 48K mode.

...

> I think the solution is somewhere in the .asoundrc as I have found 
> examples of bitrate conversion, but I can't find any examples of one 
> for my Intel board (all the ones I have seen have had specific tweaks 
> for boards with nforce or SiS chipsets, which makes me think they 
> would not be appropriate for my Intel board).  So, here are my questions:
>
> 1. Does the above make any sense, or am I completely off base?

You seem to be exactly right.

> 2. If this could explain my stutters, and the .asoundrc file is the 
> place to fix it, where should I turn for help?

The .asoundrc in general has very little specific to your sound card.  
For the most part, it describes how the ALSA drivers help process the 
audio stream *before* passing it off to your sound card.  The most basic 
.asoundrc simply passes the stream to your sound card.  This works well 
for those using "smart" sound cards (i.e. SoundBlaster Live! and Audigy 
cards and others that do not need to use the CPU for any audio process), 
but those using "software" sound cards--whose Windows drivers 
pre-process the stream using the CPU before handing it off to the 
card--generally end up with the exact problems you describe (audio/video 
playback speed is incorrect).  And, even "high-end" sound solutions like 
the nVidia SoundStorm APU are now software-based.  True hardware-based 
sound cards are becoming as rare as hardware-based modems...

So, you do need to fix your .asoundrc.  I recommend starting with: 
http://www.mythtv.info/moin.cgi/DigitalSoundHowTo#head-b318f22131b4a59eef5f28edfac9160204e13719 
.  Read the entire post and you should find the information you need to 
modify it.  You'll need to verify/change the device for your digital 
output, and you might as well change the "nForce" in the comments--but I 
highly recommend you read the entire post to help you understand *why* 
you're making these changes.

The only reason the info given is specific to the nForce is because the 
thread in which I posted the information was centered around getting 
digital audio to work with the nForce2.

> 3. (Mostly OT, but I'm sure others uses xine in mythvideo) In xine, I 
> had to go to Expert mode and change the the mono and stereo audio 
> settings from default to spdif to get playback when called from 
> mythvideo, but there were several other settings for various 
> multichannel modes.  Where does one find info on that?  Are they alsa 
> things, or xine things?  I tried to use xine's help, but apparently 
> that isn't installed by the RPM, as it told me it couldn't find the 
> help files (installed from Axel's RPMs stable branch).  I ask, because 
> I plan to rip my DVD's, and would like to keep the multichannel audio.

The multichannel audio settings are only used by xine if you have your 
sound card outputting the sound directly to the speakers.  If you're 
using digital output, all the channels are output using the digital 
sound format in the source (i.e. AC3, AAC, etc.).  If you're using 
digital output, you're never pulling apart the channels, so xine doesn't 
even know that the sound is multi-channel.

> P.S. I suppose there are four other possibilities for stutter.  One, I 
> used Jarod's guide suggestion to make mythfrontend run as root, but 
> for some reason mythfrontend still says I need to SUID as root for 
> smoother playback.

as root:
chmod a+s /usr/local/bin/mythfrontend
 
(In section "Enabling real-time scheduling of the display thread." at 
http://www.mythtv.org/docs/mythtv-HOWTO-5.html#ss5.4 )

> Two, my video sync is still USleep, as I can't run 7174 (see previous 
> post about "split-screen" effect) and can't get OpenGL to run on 6629 
> (crashes X when I run glxgears).

Shouldn't make that big of a difference (although I recommend fixing 
your driver installation, anyway).

> Three, related to two, I also tried setting the permissions on 
> /dev/rtc but mythfrontend still says I don't have permission.

Only root should have write permission to /dev/rtc.  Regardless of 
device permissions, though, the kernel will limit access to 
high-resolution timing information requests by non-root users to the 
value compiled into the kernel (usually 64Hz--which is not enough for 
good audio/video playback).  Root can override the "max-user-freq" of a 
running kernel with:

echo 1024 > /proc/sys/dev/rtc/max-user-freq

To allow (non-root) users to read timing data from /dev/rtc at 1024 Hz.

You can find out if this is already being done by doing a

cat /proc/sys/dev/rtc/max-user-freq

immediately after boot.  If you get 1024, you're done.  If not, put the 
echo line into your startup scripts (if you're using udev or devfs, make 
sure it executes after the device has been created).

> Four, I am running a 3.0 P4 with 1G 800Mhz dual channel ram, which I 
> am led to believe is fast enough for 1920x1080i decoding, but perhaps 
> it really isn't.

Sounds like it should, but I don't have any P4's and am not yet doing 
HD, so I can't say for sure.

> Still, xine behaving just like myth makes me think that it is the 
> audio that is the root cause, based on the verbose output of both.

Regardless, you'll want to fix your audio, anyway.

HTH.
Mike


More information about the mythtv-users mailing list