Lag while streaming

Hi

I'm having these annoying lags on my Pi. I have those when watching shows, movies and even when listening to music. The video quality varies between 720p and 1080p with bitrates between 4mbit and I'd guess 18mbit, but mostly in the lower or mid sections. When it lags the picture or music freezes and then kinda fast forwards to where it was supposed to be without lag. So if it lags 10s the music just jumps to 10s ahead or the picture in movies moves really fast to 10s ahead. It happens quite irregularly, sometimes more, sometimes less.

I'm hooked up via WiFi, but the signal in my room is great. I didn't have this issue on LAN if I remember correctly, but the ethernet port makes my LEDs flicker which is why I switched to WiFi. 

My guess is that this issue either lays with the Pi or even with my modem. We have about 15 LAN devices and I'd guess 10-15 WiFi devices connected at peak times. The lags happen all the time though, when I'm alone or when everybody is at home. What would be a good way to find out where the issue lays? I'd need a way to make sure it ISN'T a Pi issue. If I can rule that out I know it's a modem issue. Any ideas?

If you have as many as 15 WiFi devices connected simultaneously then your connection for the RPi only gets a fraction of the available bandwidth, which can definitely cause problems, although the extent of those problems depends on the detailed activity of all those other devices. And remember that many devices can have intense transfer activity even when not consciously used by their owner. (eg: Automatic system and app updates, occurring when devices are supposedly idle.) To nail down the causes of your lag can be extremely difficult, especially if you don't have personal control of all these devices yourself.

There is also definite risk of other interference with your WiFi LAN than the normal load of other legitimate users of that LAN. All WiFi networks are subject to physical packet collision with other unrelated LANs using the same WiFi channel. You never see that traffic on your LAN, but the separation is only at high level thanks to the passworded encryption. At low level the physical packets still collide, often destroying each other's integrity. And each time that happens the device which sent that packet must resend it, often after a lengthy timeout (several milliseconds, which is a lot when applied per packet). And then there's the risk of other interference by physical processes that have side effects of high energy emissions including the WiFi band, such as microwave ovens etc.

All in all, it's no wonder that WiFi communication is plagued by problems absent from Ethernet. The great wonder is that WiFi can be used at all with any degree of reliability...

For some people it works very well, especially in LANs with few user devices and at some physical distance from other WiFi LANs.

But in densely populated areas and in LANs with a high number of connected devices, the problems often make fluent media streaming impossible.

Naturally there could be other causes for your media lag too, such as server issues or even some unfixed problems of RasPlex, but the clincher for me is that you didn't have those problems when using Ethernet, which nails it down to a WiFi issue as I see it. Note that this doesn't mean that there's anything wrong with your modem/router, as the many causes I mentioned above can cause such problems even with perfect equipment. The problem lies in the physical nature of WiFi connections, which are always inferior to wired Ethernet when it comes to signal integrity.

If it's only the irritation from the flickering LEDs that motivates your WiFi use, you could try covering them up somehow.

Some other guy suggested painting the LEDs with non-transparent nail lacquer, which probably would work well. (Though I never tried it myself.)

Best regards: dlanor

Hi

I'm having these annoying lags on my Pi. I have those when watching shows, movies and even when listening to music. The video quality varies between 720p and 1080p with bitrates between 4mbit and I'd guess 18mbit, but mostly in the lower or mid sections. When it lags the picture or music freezes and then kinda fast forwards to where it was supposed to be without lag. So if it lags 10s the music just jumps to 10s ahead or the picture in movies moves really fast to 10s ahead. It happens quite irregularly, sometimes more, sometimes less.

I'm hooked up via WiFi, but the signal in my room is great. I didn't have this issue on LAN if I remember correctly, but the ethernet port makes my LEDs flicker which is why I switched to WiFi. 

My guess is that this issue either lays with the Pi or even with my modem. We have about 15 LAN devices and I'd guess 10-15 WiFi devices connected at peak times. The lags happen all the time though, when I'm alone or when everybody is at home. What would be a good way to find out where the issue lays? I'd need a way to make sure it ISN'T a Pi issue. If I can rule that out I know it's a modem issue. Any ideas?

Hi 

I believe i had the same issue you are having, turned out to be the Wifi just isn't up to streaming higher bitrate videos and i have 100Mb internet speeds (UK). i invested in powerline adapters as i'm to far from my router to plug directly in, and my experience has been perfect so far compared to all issues i had over the Wifi.

please see my post and hopes this helps resolve the problems you are having: 

https://forums.plex.tv/topic/166889-filmstv-shows-freezing-on-rasplex/

Regards

Sean 

Ditch the wifi and reconnect via LAN.

Wifi is a convenience technology not a throughput technology.

Thanks dlanor for your detailed answer! Covering up my LEDs is not an option, the whole point of me buying the Pi in the first place was ambilight :D 

I think I narrowed down the issue to the modem/router. It was running really unsmoothly lately and we had to reboot it quite often, sometimes more than twice a day. My laptop was also having lags while streaming (locally) high bitrate content, so I figured it's the modem, not the pi.

I hooked up a 2nd router I had and set it up as an access point, so that it can handle the WiFi devices while the modem/router only handles the LAN devices. I know that the modem has still a high workload since everything runs through it, but I thought I'll give it a shot. Haven't had a chance to try out, but I'll def. report back.

@ TurboJailer: Obviously not an option since I don't want flickering LEDs (ambilight) in the background.