A fast tube site on mobile comes down to three things: small, correctly sized thumbnails, cached pages, and video files that start playing quickly from a server or CDN close to the visitor. Most slow tube sites are slow because each listing page loads dozens of oversized images and every request hits PHP and the database. Fix those first, then tune the server.
Why speed matters more on video sites
Visitors on phones browse quickly, often on mobile data. A listing page that takes several seconds to show thumbnails loses people before they reach a video, and a video that takes a long time to start loses them again. Page speed also feeds into search performance, so it affects both SEO and revenue per visit.
Thumbnails: the biggest win
A typical listing page shows 24 to 60 thumbnails. If each one is 150 KB, that page weighs several megabytes before any video loads. Aim for:
- Thumbnails sized for the card, roughly 320 to 480 pixels wide for 16:9 cards. Larger images rarely look better on a phone screen.
- Sensible compression: JPEG quality around 70 to 80 usually looks fine at card size. Newer formats such as WebP can be smaller still if your setup supports them.
- Fixed width and height on images, or an aspect-ratio box in CSS, so the layout does not jump as images arrive.
- Hover previews loaded only on demand, when a visitor hovers or taps, not for every card on page load.
Our guide to thumbnails and previews covers how to generate them.
Lazy loading
Lazy loading delays images until they are about to scroll into view. The simplest method is the native loading="lazy" attribute on image tags, supported by current browsers. Leave the first row or two of thumbnails loading normally so the top of the page appears immediately, and lazy load the rest. Avoid heavy JavaScript lazy loading libraries when the native attribute does the job.
Caching pages and assets
Tube site traffic is mostly anonymous visitors looking at the same pages. That makes caching very effective:
- Page caching for anonymous visitors serves listing and video pages without rebuilding them on every request.
- Browser caching: send long cache lifetimes for thumbnails, CSS, JavaScript and fonts. Use versioned file names or query strings so updates still reach visitors.
- Opcode caching: make sure PHP OPcache is enabled. It is one of the cheapest performance gains available.
- Database: give MySQL or MariaDB enough memory for its buffer pool so common queries run from RAM.
A CDN in front of media
Video and thumbnails are most of your bandwidth. A pull CDN in front of your media folder serves those files from locations near the visitor and takes load off your origin server. With a pull CDN you point the CDN at your media URL and change the media hostname on your site; files are fetched from your server the first time and cached after that. Check that the CDN allows the type of content you host before signing up.
Faststart MP4 and sensible bitrates
An MP4 file has an index (the "moov atom") that the player needs before it can start. If the index is at the end of the file, the browser may have to fetch much more data before playback begins. Encoding with the -movflags +faststart option in ffmpeg moves it to the front so playback can start almost immediately and seeking works well. You can check where the index sits with tools such as ffprobe or MediaInfo.
Bitrate matters as much as resolution. A phone on mobile data will struggle with a high-bitrate 1080p stream, so offer a lower quality such as 480p or 720p and let the player switch. See video encoding settings for the web for typical values.
Server tuning
- Use HTTP/2 or HTTP/3 so many small thumbnail requests share one connection.
- Enable compression (gzip or Brotli) for HTML, CSS and JavaScript. Do not compress video or JPEG files again; it wastes CPU.
- Serve static files from the web server, not through PHP. nginx is particularly efficient at serving large files.
- Size PHP-FPM workers to your RAM so the server does not swap under load.
- Keep encoding off the web path: ffmpeg jobs should run in a background worker, ideally with limits on how many run at once, so encoding does not slow page loads.
Our hosting requirements guide covers choosing a server with enough CPU, disk and bandwidth.
Measuring the results
Test on a real phone over mobile data as well as with browser developer tools. Look at total page weight, the number of requests, the time until the first row of thumbnails is visible, and the time from pressing play to the first frame. Re-test after each change so you know what actually helped.
How Tube Site Script helps
Tube Site Script encodes videos with ffmpeg in a background worker, to the H.264 qualities you choose, and the Video.js player includes a quality switcher so visitors on slow connections can pick a lower one. Templates let each site set its own thumbnail size and shape. For busy networks the worker can run permanently as a systemd service, with several slots at once.
You can put a pull CDN in front of the media folder by entering its address in the CDN URL setting, and enable signed, expiring MP4 links with the included nginx example. Sites on other servers run through the connector, which caches pages for anonymous visitors and loads video and images straight from the main install or your CDN. See the tube site software features and pricing.
Frequently asked questions
What slows tube sites down the most?
Usually oversized thumbnails on listing pages and pages rebuilt by PHP on every request. Resizing images and caching pages for anonymous visitors often gives the biggest improvement.
What does faststart do for MP4 files?
It moves the file's index to the beginning so the browser can start playback before downloading much of the file. In ffmpeg it is the -movflags +faststart option.
Do I need a CDN for a tube site?
Not on day one, but once video bandwidth grows a pull CDN in front of your media takes load off the server and speeds up delivery for distant visitors.
