Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: Choppy Video & ALSA buffer underruns, Myth .24

  1. #11
    Join Date
    May 2005
    Beans
    40

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    Final analysis:
    After reinstalling maverick the problem was gone. I then reinstalled the database using mythconverg_restore.pl and the problem returned. All the choppy video and alsa buffer underruns and the missing choices in the audio configuration were back, so the problem is apparently in the database and the way it sets up the internal player. It would probably be a good idea to add some sanity checks to the settings table in mythconverg. Luckily, mythconverg_restore has a partial restore option which allowed me to get the irrecoverable stuff back after I wiped the db again.

  2. #12
    Join Date
    May 2005
    Beans
    40

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    I can reproduce and suppress this problem at will now.
    I'm not getting AC3 or DTS passthrough to my receiver so, at the risk of the wrath of jyavenard, I changed the Audio Output Device setting to "ALSA:iec958:CARD=Live,DEV=0."
    That single change brought back the stuttering video and ALSA buffer underruns.
    I went back to the audio settings and attempted to set the audio device back to "ALSA:default" but that was no longer a choice. That's apparently why I could never make my upgraded installation work. The only setting that works isn't a choice in the list after scanning for audio devices.
    The only way I could get the setting back to ALSA:default was to edit the entry manually. This is a fresh installation. I shouldn't have problems like that. There's something squirrelly about the audio code in MythTV 0.24-fixes.
    I still don't have passthrough working again and I don't have any confidence that jyavenard's much-smarter-than-me code is going to figure it all out automatically.

  3. #13
    Join Date
    May 2005
    Beans
    40

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    TrackBack: Another user with the same problem --
    http://www.gossamer-threads.com/list...v/users/463105

  4. #14
    Join Date
    May 2005
    Beans
    40

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    Problem has resurfaced.
    While trying to correct the "motor boating" caused by playing my 44.1 KHz music into my 48 KHz audio card from MythMusic I tried several settings in an .asoundrc file combined with different settings of the audio device in Myth setup. Nothing worked so I removed the .asoundrc file and set the audio device back to ALSA:default -- no sound in any MythTV app (other apps work fine.)
    Set the audio device to ALSA:hw:CARD=Live,DEV=2 and returned to the alsa buffer underruns and choppy video (same result for ALSA:iec958:CARD=Live,DEV=0 and ALSA: plughw:CARD=Live,DEV=2)
    Set the audio device back to ALSA:default -- no sound.
    Can anyone at all confirm that there is a SB Live card out there working with Maverick and MythTV 0.24? (or anything else using the EMU10K1 driver?)
    Last edited by Chunk of Earth; January 9th, 2011 at 02:50 AM.

  5. #15
    Join Date
    Sep 2006
    Beans
    13

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    I just spent an hour or two working with JYA on IRC trying to troubleshoot this exact issue.... no resolution.

    I wonder if it has something to do with the older SB cards (EMU10k1)?

  6. #16
    Join Date
    Sep 2006
    Beans
    13

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    I have done some additional research on my own. All of my videos play fine on mplayer, so I am confident that it is something with the audio code and my card.

    I ran
    Code:
    mplayer -ao alsa:device=iec958 -ac hwac3 idch_AviaSurroundTest-AC3.avi -msglevel all=6
    And noticed this in the output (emphisis mine):
    Code:
    Trying preferred audio driver 'alsa', options 'device=iec958'
    alsa-init: requested format: 48000 Hz, 2 channels, 108
    alsa-init: using ALSA 1.0.23
    alsa-spdif-init: playing AC3, 2 channels
    alsa-init: using device iec958
    alsa-init: pcm opened in blocking mode
    [AO_ALSA] Format ac3be is not supported by hardware, trying default.
    alsa-init: got buffersize=65536
    alsa-init: got period size 1024
    alsa: 48000 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little Endian
    AO: [alsa] 48000Hz 2ch ac3le (2 bytes per sample)

    Playing the same video in mythtv gives this:
    Code:
    2011-03-05 21:31:44.738 AO: Original codec was AC3, signed 16 bit, 48 kHz, 6 channels
    2011-03-05 21:31:44.738 AO: enc(0), passthru(1), canAC3(1), canDTS(1), canLPCM(0), configured_channels(6), 6 channels supported(1)
    2011-03-05 21:31:44.738 AO: Opening audio device 'iec958:CARD=Live,DEV=0' ch 2(6) sr 48000 sf signed 16 bit reenc 0
    2011-03-05 21:31:44.740 ALSA: SetParameters(format=2, channels=2, rate=48000, buffer_time=200000, period_time=50000)
    2011-03-05 21:31:44.740 ALSA: Buffer time = 200000 us
    2011-03-05 21:31:44.740 ALSA: Period time = 50000 us
    2011-03-05 21:31:44.740 ALSA: Buffer size = 9600 | Period size = 2400
    2011-03-05 21:31:44.740 AO: Audio fragment size: 4800
    2011-03-05 21:31:44.741 AO: Audio Stretch Factor: 1
    2011-03-05 21:31:44.741 AO: Ending Reconfigure()
    It appears that perhaps mythtv is calculating much too small a buffer size? I read through this thread (http://www.gossamer-threads.com/list...v/users/464964), and it appears that a similar issue existed on another device. To put it in JYA's own words:

    Interesting...

    We asked for a 200ms length buffer, yet ALSA gives us 110ms.

    To get 200ms of audio, we need:
    48000 * 2 (channels) * 2 (bytes per channel) * .2 = 38400 bytes = 37kB.

    So a 64kB buffer should be plenty.

    I had made some assumptions on how ALSA worked, seems it's not the
    case for everyone.. bugger..

    JY
    Now if I can only figure out how to force an alsa buffer size on mythtv.

  7. #17
    Join Date
    Nov 2005
    Location
    Mountain View, CA, USA
    Beans
    261
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    I too have an SB Live card with Maverick and MythTV 0.24 (updated with autobuilds) and am having this problem. I actually gave up on trying to fix this problem since I could not previously corroborate this issue.

  8. #18
    Join Date
    Sep 2006
    Beans
    13

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    I have spent several hours working with JYA on this issue and he was able to resolve it and now I get flawless playback on my EMU10k1 card with SPDIF and AC3/DTS passthrough.

    The issue was indeed related to ALSA buffer sizes (if I understood it all correctly), so he worked some magic and has it all working.

    If you are following JYA's repos, it should be in tonights build. Once he has tested it further and confirmed the fix with others he says he will backport it to 0.24-fixes in the near future.

    Thank you JYA!!!

  9. #19
    Join Date
    Feb 2008
    Beans
    207

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    Note that I have committed those changes to fixes/0.24 now so make sure you upgrade to very recent (e.g. made in the past 12 hours) version of mythtv.

  10. #20
    Join Date
    Feb 2008
    Beans
    207

    Re: Choppy Video & ALSA buffer underruns, Myth .24

    Quote Originally Posted by Chunk of Earth View Post
    I changed the Audio Output Device setting to "ALSA:iec958:CARD=Live,DEV=0."
    if you want passthrough to properly work; this is the device you must use (or hdmi something). Using a device like "default" will never 100% work: it's just a matter of luck if it does.

    That single change brought back the stuttering video and ALSA buffer underruns.
    I went back to the audio settings and attempted to set the audio device back to "ALSA:default" but that was no longer a choice. That's apparently why I could never make my upgraded installation work. The only setting that works isn't a choice in the list after scanning for audio devices.
    Myth will show ALSA:default if when you run aplay -L, the device "default" exists. The code scanning for audio devices is virtually identical to what aplay does when listing audio devices.

    The only way I could get the setting back to ALSA:default was to edit the entry manually. This is a fresh installation. I shouldn't have problems like that. There's something squirrelly about the audio code in MythTV 0.24-fixes.
    I still don't have passthrough working again and I don't have any confidence that jyavenard's much-smarter-than-me code is going to figure it all out automatically.
    It seems that with Live audio card; the 200ms of buffer allocated by default in mythtv isn't sufficient.
    Unfortunately, those cards only have 64kB of hardware buffer; which for playing AC3 or DTS passthrough only gives you about 300ms.
    Unfortunately, there are bugs in the current alsa-lib; where not all card can be configured to use 300ms.
    So I've upped the buffer size to 500ms : if 500ms can't be allocated, it will reserve as much as it can, but in the logs you will now always get a message that underruns are likely.

    Hopefully upgrading mythtv to a package built in the past 12 hours will fix your problem permanently.

    Make sure you edit your audio config and select ALSA:iec958 from the list, do not use ALSA:default

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •