•  
      CommentAuthorSpode
    • CommentTimeAug 3rd 2008 edited
     

    Now that I finally have a stable wireless Link to Karlson's house, it's been nice to be able to play SD content directly from his server over the Linksys/DD-WRT powered wireless bridge. However, as our projector is kicking out 1024x768, there is some benefit to be had in playing HD content.

    Initial performance was less than admirable, making it completely unwatchable. On my bedroom computer, I found VLC to give me much better performance than Mplayer - to the point of Mplayer not being able to play SD properly. Knowing this, I decided to see if I had the same luck with VLC, on my 1.6GHz Pentium M powered living room machine. So in MythTV, I replaced the video command in the preferences to see how things looked. For those who don't want to google the command, replace it with the following:

    vlc file://%s vlc:quit

    Straight away, HD content became almost watchable, with pauses every 15 seconds or so. My initial thought was that I needed to adjust buffering settings in VLC. Googling this, turned up very little, as the buffer is dynamic. In fact, it's a PRE buffer that we need, and this is referred to in VLC as caching. In your home folder you should find a ".vlc" folder with a file "vlcrc" in it. Inside this file, you'll find several settings to do with caching. There appears to be settings depending on the transport. I did a search for "cach" and just upped every value that I could find that I felt was relevant.

    rtsp-caching=1000 udp-caching=1000 tcp-caching=1000 file-caching=1000 smb-caching=1000

    The default, for pretty much everything is a lowly 300ms of caching. Taking the wireless connection into account, I felt increasing this might help. I went a little extreme and jumped it up to 3000ms, and low and behold the wireless stuttering stopped. However, the downside to this much caching, is that fast-forward and rewind were deadly slow. I then reduced it to 1000ms, where fast-forward was no longer laggy, and it still solved the stuttering.

    However, things aren't fixed just yet. Watching an Episode of Stargate Atlantis, there were portions - such as the introduction where Atlantis pops out of the water, where it pauses (at exactly the same point) for a good few seconds. By pause, I mean the music carries on but the frame stays still, before eventually taking is to a frame further down the line. Upon a little investigation using top via SSH, CPU utilization was maxing out at this point. I tested my theory by running the same file locally, instead of over wireless, and found exactly the same problem. So it would seem my computer isn't quite fast enough to cope with the strain of HD playback.

    I vaguely recall the CPU in my machine will overclock somewhat. But would an extra 10% make that much difference? Maybe there are some VLC tweaks I can try (such as a different rendering method). However, for most people this caching tweak could make all the difference!

    Update

    Karlson had previously mentioned to me that he felt mplayer usually performed better than VLC, with all content. I had a Google and many people were complaining of poor HD performance, even on faster machines. Using my dual-core 3.0GHz Pentium 4, I decided to try HD playback with both MPlayer and VLC. He was right. The same spots in the video that my living room machine was struggling on, my computer was struggling on too - yet Mplayer didn't have any trouble with even lower CPU usage.

    However, I do feel my approach of increasing cache could have been answer - so I looked into the Mplayer parameters. I came up with the following command for use in MythTV:

    mplayer -fs -zoom -quiet -vo xv -cache 8192 %s

    This is almost identical to the default, but with an increased cache size. Using this, HD playback was silky smooth, over wireless and locally! I had slight audio sync issues occasionally when first loading the file, where simply skipping backwards put everything back into sync - a common problem.

    • CommentAuthorSirkent
    • CommentTimeAug 4th 2008
     

    And the morale of this story is: You should always listen to me when I'm right!

    Seriously though - after watching some more HD content on your setup last night it looks like the video is struggling to keep up which is why the audio is moving ahead. It does catch up later on, but it can take a while. It could be that the CPU usage is still quite heavy when there's a lot of activity in the picture?

    But it does look very, very good projected :D

    •  
      CommentAuthorSpode
    • CommentTimeAug 4th 2008
     

    I think I just need to enable frame skipping - it's obviously having a few issues with some of the bits that is causing sync issues.

    •  
      CommentAuthorClubBarf
    • CommentTimeAug 4th 2008
     

    How much bandwith are you getting on your wireless connection? It might be worthwhile thinking of Pringle can yagi's - the skipping is likely to be being caused by dropped packets...

    If you can get yourself a pair of old sky dishes (freecycle.com might help you there) they make superawesome alternatives (or upgrades) to pringles cans.

    •  
      CommentAuthorSpode
    • CommentTimeAug 4th 2008
     

    About 2.5MB/sec.

    We're using high gain aerials, and I found focussed aerials didn't help much. We have an SNR of around 33.

    •  
      CommentAuthorClubBarf
    • CommentTimeAug 4th 2008
     

    Have you measured actual packet loss? 2.5Mb/sec should be enough for HD (depending on how it's encoded)...

    Ping is your friend, although ethereal might give you more a more accurate look at what's going on - chatty boxes might be spamming your network with (usually benign, but in low bandwith links pretty nasty) broadcast traffic that does little or nothing for you. "I just got switched on - better tell everyone about it 20 times!" or "Printer's out of paper - really aught to let everyone and everything know about that repeatedly..."

    •  
      CommentAuthorSpode
    • CommentTimeAug 4th 2008
     

    Yeah, I get 1-4ms pinging Karl's server.

    As I say, it's working pretty well now. The only struggle I'm having is CPU bound I believe.

    •  
      CommentAuthorClubBarf
    • CommentTimeAug 4th 2008 edited
     

    The thing with the 3Ghz P4 struggling at the same points suggests to me a network lag issue or packet drop issue...

    Is the P4 hitting 100% at the point where stuttering in the video occurs?

    *edit* - the ping thing was more to monitor packet loss than response time - does it report much packet loss?

 
Copyright Andrew Miller (Spode), 2008