Site speed tips for faster video loading
This can lead some unseasoned web developers and SEOs to look at a waterfall chart from a site speed measuring tool and declare that “video is bad for site speed”. While this is not true in its broad application, there are certain best practices you need to be aware of. The right set up will ensure that video doesn’t slow your site down, and that your site doesn’t slow your video down.
The goal is to ensure seamless video playback, without buffering, and blisteringly-fast load times with all assets across your website. In this endeavour, you should be keeping an eye on your core web vitals – Largest Contentful Paint (LCP), First Input Delay (FID) and Cumulative Layout Shift (CLS).
Tip 1: Serve your videos through a CDN
The simplest way to get videos on your WordPress website is to just upload one to your media library. After that you can include it within a page or post using the Gutenberg Video Block.
This is also probably the worst way to add videos. It’s a recipe for guaranteed buffering as soon as a user hits the play button. And that negatively affects First Input Delay (FID). Such a setup requires the browser to load up a full (non-optimized) video file directly from your server on click, with no fallbacks for server issues, user location, or poor connection speed.
Check out the Yoast guide to CDNs for full details on a better way of setting this up. Note that if you’re embedding videos from services like YouTube or Wistia, they manage the delivery of the video assets from their own network of CDNs.
Tip 2: Utilize adaptive streaming
The HTML5 <video> tag is an excellent and elegant piece of foundational piece of web technology. But on its own, it can cause problems. The tag simply loads up a video file in a default neutral video player and lets the browser do all of the work.
The problem here for site-speed is when you want to load a large or high-resolution video file. With a less-than-stellar connection, all that happens is a huge amount of buffering, while the browser attempts to load enough of the file to start playback. It’s very bad for FID.
The best way to deal with this problem is to utilize something called adaptive streaming. Adaptive streaming is when several different variations of a single video, all at different resolutions and bitrates, are made available to a server. The server then provides the best quality version of the video any given connection can handle. With adaptive streaming, if your user is on a mobile device on top of a remote hill and only working with a 500kbps connection, the server will provide an SD video with a bitrate of something like 300kbps, rather than the ideal 4K variation at 35mbps.
How can you do this? Well, you can set it up yourself using MPEG-DASH. Or move to a third-party video hosting platform like YouTube or Wistia; these use adaptive streaming as part of the video delivery tech stack.
Tip 3: Export video files with a variable bitrate
Another tip for improving playback speed is to reduce the video file(s) as much as possible during the export process. A Variable Bitrate (VBR) is a means of compression which adapts the bitrate of the video file based on the complexity of colors and movement at any given point in the video. The goal of this is keeping it as low as possible without noticeable degradation in quality. For instance, fast-moving action sequences with a lot of complex colors require a much higher bitrate. But a more static talking head shot over a simple background works fine with a lower bitrate. A VBR will allow your video compressor to intelligently make decisions about appropriate bitrates during export that will reduce the video filesize.
VBR can be used with the most common web video codecs, such as VP9 and h.264.
Tip 3: Avoid looping autoplaying videos (or at least keep them short and silent)
Autoplaying videos remain popular, particularly as backgrounds on home pages. But implemented poorly they can cause all manner of site-speed issues.
If you must have looping autoplaying videos, keep them as short as possible (ideally less than 10 seconds). Also export the files with no audio, so as to keep the file size as small as possible.
Tip 4: Load video content asynchronously
If you use AJAX to load your video player, once the client renders the core initial script (typically only a few hundred kilobytes), everything else can be loaded speedily in the background. Meanwhile the client renders the rest of the page elements. In addition, the video player frame and thumbnail – those elements which are visible in advance of a user clicking play – can be prioritized and loaded immediately, in order to positively impact the core web vitals.
This is precisely what the Yoast Video SEO for WordPress Plugin does to speed up video delivery, ensuring even the largest video files don’t negatively impact the user experience or search performance.
Tip 5: Don’t put videos behind render-blocking JS
Sometimes scrollers or carousels contain videos, as an alternative to images.
This hampers site speed and First Input Delay, but not only that. It can also harm SEO, since Googlebot is unable to find and index the video.
To sense check whether Googlebot can parse your video implementation, you can check out the new Video Pages report in Google Search Console.
With video and site speed, the core principles to remember are:
- Use a server set-up specifically to deal with large media files (CDN)
- Ensure the video file being loaded is adapted to the connection speed of the client (Adaptive streaming)
- Keep your video files as small as possible without sacrificing quality (Variable bitrate)
- Load the core visual elements before loading the actual video file (Asynchronous delivery)
For more information on site speed, check out the rest of our posts and guides!
Read more: How to make YouTube videos responsive »
Coming up next!
WordCamp EuropeJune 08 - 10, 2023 Team Yoast is Attending, Organizing, Speaking, Sponsoring WordCamp Europe. Click through to see who we'll be there, what we'll do there and more! See where you can find us next »
Yoast SEO news webinar - May 30, 202330 May 2023 Our head of SEO, Jono Alderson, will keep you up-to-date about everything that happens in the world of SEO and WordPress. All Yoast SEO webinars »
6 Responses to Site speed tips for faster video loading
Amazing! I wonder if any of these would work on cloudflare streaming service?
You can certainly achieve all of this using Cloudflare streaming – it just will require development work.
Great points, but I don’t think they are feasible for practical purposes.
Thank you for your comment. Would you care to elaborate on what you think are not feasible?