Tested: OS update solves Raspberry Piās age-old YouTube frame-rate problem.
With its quad-core processor, up to 8GB of RAM and a very lightweight and efficient Linux OS, the Raspberry Pi 5 is fast enough to serve as a low-end PC for web surfing, Python coding and light productivity. However, up until now, it has suffered from the same problem that all Pis have had: sluggish YouTube playback, particularly at 1080p (1920 x 1080) resolution.
This week, Raspberry Pi announced the latest release of its Raspberry Pi OS operating system, and so we had to give it a try to see how it fared against the previous releases. The key difference between the two? The new Labwc Wayland compositor, which dramatically improves YouTube viewing on the Raspberry Pi 5. When I tested the OS update on both the Pi 5 and Pi 4, I found that the newer board suddenly became a very-capable YouTube system, dropping a mere 1.8 percent of frames at 1080p, 60 fps.
I stumbled upon this by pure chance. I am in the process of writing a tutorial, covering how to upgrade to the latest Raspberry Pi OS, and I wanted to see how YouTube playback performed with the new Labwc compositor. It turns out that it is vastly improved over the previous Raspberry Pi OS releases which used Wayland and the Wayfire compositor.
Streaming and Local Video Playback
Youād think that streaming a YouTube video on your Raspberry Pi would see the video stream going straight to the GPU and then the compositor. But that is not the case. I spoke to Gordon Hollingworth, Raspberry Piās Chief Technology Officer for Software. Hollingworth told me that in the case of YouTube, Chromium will first decode the video using the CPU, then after converting from YUV to RGB it sends the data to the GPU. The data is then sent to the compositor (Wayfire or Labwc in this case) which sends it back to the GPU and finally to the frame buffer. All of those steps are what cause the frames to be dropped, as the Raspberry Pi tries to keep everything playing at an acceptable speed for the viewer.
Hollingworth is keen to say that work is ongoing to add more hardware support so that the frames are passed untouched from Chromium to the compositor. Labwc is a step along this journey, with the ultimate goal being for a Raspberry Pi 5 to display a 4K HDR video in a window with little or no processing from the CPU. I look forward to that day.
Local files played via VLC can send the frames directly from the decoded hardware to the composition (Wayfire / Labwc) and from there it will be sent to the GPU for inclusion in the final image. Thatās why local playback is vastly superior to streaming, for now at least.
The Testing!
The test devices are the āmid-rangeā Raspberry Pi 5 4GB and a Raspberry Pi 4 4GB. I chose those models as they offer good performance, while not breaking the bank. Both of the Pis are running the latest Raspberry Pi OS from a new Raspberry Pi branded A2 micro SD card (but only the Pi 5 can truly use the Command Queueing Host Controller Interface (CQCHCI) which buffers some of the underlying commands used by the micro SD card, effectively looking into the futureā of the command queue. The Raspberry Piās both ran at their stock speeds.
I tested YouTube streaming playback at 1080p 30, 1080p 60, 1440p 60 and 4K60 using the Chromium browser. Each video was played for one minute and the total number of played and dropped frames was recorded to a spreadsheet, and then converted to a percentage.
The videos used in this test were Reflections Japan by 8K and 4K Global and Costa Rica in 4K by Jacob and Katie Schwarz.
1080p 30 Playback
Wayfire (Pi 5) | 1.72% |
Labwc (Pi5) | 0.46% |
Wayfire (Pi 4) | 27.20% |
Labwc (Pi4) | 38% |
On the Raspberry Pi 5 running the Wayfire compositor I played the test video for one minute, and then recorded the data. Switching to Labwc I performed the same test. Wayfire did a great job, 1080p 30 playback only dropped 1.72% of the frames. Perfectly acceptable and hardly noticeable, but Labwc only dropped 0.46% of the frames, only a third of the dropped frames when compared to Wayfire.
On the Raspberry Pi 4, well, things didnāt go to plan. Wayfire dropped 27.2% of the frames, but Labwc dropped 38%, a trend that will follow the Pi 4 throughout these tests. Dropping over 25% of the frames, no matter the compositor, is a big deal and it makes YouTube playback basically unwatchable.
1080p 60 Playback
Wayfire (Pi 5) | 49.90% |
Labwc (Pi5) | 1.80% |
Wayfire (Pi 4) | 58.90% |
Labwc (Pi4) | 60.50% |
Hold on to your socks, because playing 1080p 60 on the Raspberry Pi 5 with Wayfire saw 49.9% of the frames being dropped. Ouch! But, Labwc streaks ahead with only 1.8% dropped frames on the Pi 5. This makes Raspberry Pi OS with the Labwc Wayland compositor the way to go for YouTube video playback on the Pi 5, from this point onwards we are going to see the dropped frame percentage rise considerably!
On the Raspberry Pi 4, both Wayfire and Labwc had a hard time with 1080p60 playback. Wayfire dropped 58.9% of the frames, and Labwc dropped 60.5%. This is a huge amount of frames and makes the watching experience truly awful.
1440p 60 Playback
Wayfire (Pi 5) | 72.50% |
Labwc (Pi5) | 34.30% |
Wayfire (Pi 4) | 67.60% |
Labwc (Pi4) | 69.40% |
Raspberry Pi 5 and Wayfire are not a great mix for 1440p 60 YouTube playback. Dropping 72.5% of the frames basically means that I was sitting watching a one minute slideshow rendered as a slideshow. Labwc did improve it, dropping just 34.3% of the frames, but even that makes the experience a test of patience.
Raspberry Pi 4 users, you know what I am going to say next. Both Wayfire and Labwc offer little incentive to watch 1440p60 videos on the Pi 4. Wayfire dropped 67.6% of the frames, Labwc 69.4%. Both tests were slideshows from the moment I pressed play.
4K 60 Playback
Wayfire (Pi 5) | 82.50% |
Labwc (Pi5) | 60% |
Wayfire (Pi 4) | FAIL |
Labwc (Pi4) | 86.10% |
The Raspberry Pi 5 can play 4K video, locally, but streaming from YouTube is a complete car crash. Wayfire dropped 82.5% of the frames served, and Labwc dropped 60%. There were moments when I thought that the stream had died and I almost restarted the test a few more times.
The Raspberry Pi 4ās 4K60 tests were not a success. Wayfire completely failed the test. The YouTube video started, but then it kept stalling, restarting and resetting the frame counter. This meant that I was unable to get an accurate number of frames played and dropped. With Labwc I did see the video play, but with 86.1% of the frames dropped, you can guess that it was a slideshow filled with jump cuts that moved me through the video at a disconcerting pace.
If you want 4K playback on the Raspberry Pi 5 or 4, use a local video file and ensure that it has been encoded to use the VideoCore GPUās hardware acceleration.
Conclusion
Streaming YouTube videos on the Raspberry Pi 5 with Labwc will see the best performance at 1080p 30 and great performance at 1080p 60. Going to higher resolutions and FPS will only bring disappointment. But as mentioned earlier, Raspberry Pi is working on improving performance, and Labwc is a step on a longer journey. But it looks like it has put āits best foot forwardā as Labwc really does improve the overall performance on the Raspberry Pi 5.
If you want to play higher resolution videos on your Raspberry Pi 4, then we would recommend local file playback for the best performance.
#Tested #update #solves #Raspberry #Pis #ageold #YouTube #framerate #problem