Tube Site Script
Getting started

What is a tube script? How a PHP tube site script turns video files into a working video site

A tube script is self-hosted software that runs a video site: uploads, ffmpeg encoding, thumbnails, player, categories, members, ads and SEO. How it works.

Updated 4 minute read The Tube Site Script team

A tube script is software you install on your own web server to run a video sharing website, often called a tube site. It handles everything between a raw video file and a page someone can watch: uploads and imports, encoding with ffmpeg, thumbnails, the video player, categories and search, member accounts, ad slots and the SEO output search engines read. Most are written in PHP with a MySQL database, which is why people search for a "PHP tube script" or "tube site script" when they want one.

What a tube script actually does

Under the hood, a tube site is a database of videos plus a set of page templates. The script is the layer that fills the database, processes the files and builds the pages. A typical one covers these jobs:

  • Getting videos in. Admin and member uploads, plus bulk imports from CSV or XML files, RSS feeds, FTP folders, remote URLs, hotlinked MP4 files or embed codes from partner sites.
  • Encoding. A background worker runs ffmpeg to convert each upload into web-friendly H.264 MP4 files at one or more qualities, so videos play on phones, tablets and desktops. The encoding settings guide explains the choices.
  • Thumbnails and previews. Still images taken from the video, short animated previews that play on hover, and timeline thumbnails for the player's scrub bar.
  • Playback. An HTML5 player with a quality switcher, usually with places for video ads.
  • Organising. Categories, tags, model or channel pages, search, sorting by newest, most viewed or top rated, and related videos.
  • Members. Registration, favourites, ratings, comments and, optionally, member uploads with moderation.
  • Making money. Ad zones in the page layout and in the player.
  • Being found. Clean URLs, editable titles and descriptions, video sitemaps, RSS, Open Graph tags and structured data.

Self-hosted tube script vs a hosted video platform

There are two broad ways to put video online. A hosted platform stores and serves your videos for you and gives you an embed code or a channel page. A self-hosted tube script runs on a server you rent, on a domain you own, with files you control.

Self-hosted tube scriptHosted video platform
Who owns the site and trafficYouThe platform, with you as a user
Content rulesYours, within the law and your host's termsThe platform's, which can change
Ads and revenueAny ad network you choose, all revenue yoursLimited to the platform's programme, if any
Design and SEOFull control over templates, URLs and metadataFixed layouts and URLs
Technical workYou run the server, updates and backupsHandled for you
CostsServer, storage and bandwidth grow with your library and trafficOften free or a monthly plan

The trade is control for responsibility. With a tube script, the site, the audience and the income are yours, and so is the job of keeping the server running.

Who uses tube site software

  • Niche publishers who build sites around one topic, such as a sport, a hobby, a game or a genre, and earn from ads.
  • Network operators who run several themed sites from the same video library, a model covered in running multiple tube sites.
  • Content owners and studios who want their own showcase site rather than relying on someone else's platform.
  • Communities where members upload and share their own clips.
  • Adult site owners, a large share of the market, who need extra compliance features. The adult tube script guide covers those.

What it costs to run a tube site

The licence is usually the smallest long-term cost. The ongoing ones are:

  • Server. Encoding is CPU heavy, so shared hosting rarely works. A VPS is the practical minimum, and busy sites move to dedicated servers. See tube site hosting requirements.
  • Storage. Every video is kept at each quality you encode, plus thumbnails and previews, so disk needs grow steadily with the library.
  • Bandwidth. Video delivery is the biggest variable cost once traffic arrives. A CDN in front of the media folder spreads the load and often lowers the cost per gigabyte.
  • Domains and SSL. Cheap per domain, but they add up across a network.
  • Content. Your own production, licensed content, or partner embeds and hotlinks, which save storage and bandwidth.

Embedding or hotlinking partner videos keeps costs low at the start. Encoding your own files gives you more control and a better player experience, at the price of more storage and bandwidth.

How to choose a tube script

Start from your plan rather than a feature list. Decide where your content will come from, whether you will run one site or several, and how much you want to customise the code. Then check the script's server requirements against your host, read the licence terms carefully and try it on a development machine if you can. The PHP tube script buyer's guide walks through licensing, code and support, and the tube script features checklist lists what to test. When you are ready to build, how to start a tube site takes you from niche to launch.

How Tube Site Script works

Tube Site Script is a self-hosted PHP and MySQL tube script. You install it once on your main domain, and it can run that site alone or as many tube sites as you like from the same install, each with its own domain, template, settings, ads, pages and release schedule, all fed from one shared library and one encoder. It encodes with ffmpeg to the H.264 qualities you choose, creates 10 thumbnails, hover previews and timeline thumbnails, imports from CSV, XML/RSS, FTP folders, URLs, hotlinked MP4s and embeds, and plays video in Video.js with a quality switcher and pre-roll and pause ads.

It needs PHP 8.1+, MySQL 8 or MariaDB 10.5+, ffmpeg with libx264, Apache or nginx and two cron lines. The code is plain, unencoded PHP with no framework, sold as a one-time licence with free updates. See the full feature list or pricing.

Frequently asked questions

Is a tube script the same as a video hosting platform?

No. A tube script is software you install on your own server and domain, so you control the content rules, design, ads and revenue. A hosted platform stores and serves the videos for you but sets its own rules.

Do I need to know PHP to run a tube script?

Not for day-to-day running, which happens in the admin area. Basic server skills help with installation, cron jobs and ffmpeg, and readable PHP source lets a developer customise the site later.

Can a tube script run without encoding videos?

Yes. Many sites start by importing embed codes or hotlinked MP4 files from partners, which needs no encoding and little storage. Encoding your own files gives you more control over quality and playback.

Get three guides like this every month, plus software update notices.Subscribe →