Make a Website

How to Make a Video Website Like YouTube

Run your own video site with PeerTube, MediaCMS or a PHP script. The bandwidth maths that decides everything, transcoding, storage costs and honest advice on what is realistic.

A self-hosted video website playing a video in a browser

Building a video website is not hard. The software is free and installs in an afternoon. What catches people out is the running cost, because video is the one thing on the internet that is genuinely expensive to serve.

So we start with the maths. If the numbers work for your project, the rest of this guide gets you running.

The bandwidth maths, before anything else

Serving a video means sending the whole file to every viewer, every time.

A 10-minute video at 720p is roughly 150 MB. So:

Views per monthBandwidth usedTypical cost
1,000150 GBIncluded in most VPS plans
10,0001.5 TBAt the edge of a $10 plan
100,00015 TB$50–150 / month
1,000,000150 TB$500–1,500 / month

This is why YouTube is free and your site will not be. Google absorbs this cost with advertising at a scale you cannot match.

Self-hosted video makes sense for a course platform, a company video library, a community with a few thousand viewers, or anything where you cannot use YouTube for policy reasons. It does not make sense as an open public YouTube competitor.

Pick a host with generous bandwidth

Providers differ enormously here. Some include 20 TB on a $10 plan; others charge per gigabyte after 1 TB and the bill arrives as a shock. Check the bandwidth allowance and the overage price before you buy anything.

Which software?

SoftwareBest forCostNotes
PeerTubePublic video sitesFreeViewers share bandwidth with each other, which genuinely cuts your bill
MediaCMSCourse and library sitesFreePython. Clean admin, simple to run
Open Video CMS / PHP scriptsShared hostingFree–paidLighter, but you handle transcoding yourself
WordPress + a video themeFew videos, mostly a blogFree–paidFine only if videos are hosted elsewhere

PeerTube is the interesting one. It uses peer-to-peer streaming, so when several people watch the same video at once they send pieces to each other instead of all pulling from your server. On a popular video that can cut your bandwidth bill substantially — the only self-hosted option where scale actually helps you.

What your server needs

  • 4 GB RAM minimum. Transcoding is the heaviest thing your server will ever do.
  • 2+ CPU cores. More cores means faster processing after upload.
  • Storage for the originals and every converted version. Budget roughly 3× the raw upload size.
  • Lots of bandwidth. See above.
  • FFmpeg installed — every one of these tools uses it to convert video.

Shared hosting cannot do this. It blocks the long-running processes transcoding needs, and the disk and bandwidth limits are far too low.

Understanding transcoding

This is the concept that makes everything else make sense.

When someone uploads a video it arrives in one size and format — often a 2 GB phone recording. Your server must convert it into several smaller versions: 1080p, 720p, 480p, 360p. That is transcoding.

It matters for three reasons:

  1. It is slow. A 10-minute video can take 10 to 30 minutes to process. Users need to see a "processing" message, not a broken page.
  2. It uses the whole CPU. While transcoding runs, the rest of your site slows down. Limit how many run at once.
  3. It multiplies storage. One upload becomes four or five files.

You can switch transcoding off and serve the original file, but then someone on a phone downloads a 2 GB file to watch a short clip. Do not do that.

Step 1: Get the server ready

Start with a clean Ubuntu VPS. If you have not set one up before, how to install a LAMP server on Ubuntu covers the basics.

Then point your domain at the server and get SSL in place — see how to install a free SSL certificate on Ubuntu. Browsers restrict video features on plain HTTP, and no viewer trusts a "Not secure" warning.

Step 2: Install the platform

Both recommended options publish Docker installs, which is by far the easiest route — Docker bundles FFmpeg, the database and the web server so you are not assembling them by hand.

Both ask for your domain, an admin email and a password. Both are running in under an hour on a prepared server.

Step 3: Configure before you invite anyone

  • Maximum upload size. Cap it. One person uploading a 20 GB raw file will fill the disk and jam the transcode queue.
  • Transcoding resolutions. 480p and 720p are enough to start. Adding 1080p and 4K multiplies both processing time and storage.
  • Concurrent transcodes. Set this to one or two. Leave it unlimited and five uploads will freeze the server.
  • Who can upload. Open uploads on a public video site attract piracy and worse, quickly. Start invite-only.
  • Email. Configure SMTP so sign-up and "your video is ready" notifications actually arrive.

Step 4: Cut the bandwidth bill

Three things make a real difference:

  1. Put a CDN in front. Cloudflare's free tier does not allow heavy video, but their paid Stream product or Bunny CDN will serve video far more cheaply than your VPS.
  2. Serve lower resolutions by default. 480p looks fine on a phone and uses a third of the data of 1080p.
  3. Use PeerTube's peer-to-peer mode if your audience watches the same videos at the same time.

Common problems

Uploads fail on large files

Raise the web server and PHP limits — client_max_body_size in Nginx, or upload_max_filesize and post_max_size in PHP. Also raise the timeout, because a long upload can exceed it.

Videos upload but never finish processing

The transcode queue is stuck or FFmpeg is missing. Check the worker logs. On a small server, several simultaneous transcodes can exhaust the memory and kill the process.

Playback stutters

Either bandwidth or transcoding. If only some viewers are affected it is their connection, so offer a lower resolution. If everyone is affected, your server is saturated.

The server slows to a crawl after an upload

Transcoding is taking all the CPU. Limit concurrent jobs, or give FFmpeg a lower priority so the website stays responsive.

The bandwidth bill is far higher than expected

Check whether anyone is hotlinking your videos on another site. Block that in the server configuration, and consider requiring a signed URL for playback.

The honest summary

Self-hosted video works well when the audience is known and limited: a course platform, a company library, a club, a paid membership site. In those cases you control the cost and the numbers make sense.

As an open public video site, the bandwidth will outpace you long before the software does. If that is the goal, look seriously at embedding video hosted elsewhere and keeping only the website on your server.

For something far lighter to run, a file sharing site gives people a way to share media without the transcoding and streaming load.

Questions people ask

How much does it cost to run a video website?
Bandwidth decides it. A 10-minute 720p video is about 150 MB, so 10,000 views uses around 1.5 TB and sits at the edge of a $10 VPS plan. A hundred thousand views is 15 TB and costs $50 to $150 a month. Check the bandwidth allowance and the overage price before buying any hosting.
Can I make a website like YouTube for free?
The software is free — PeerTube and MediaCMS both cost nothing. Hosting is not, and video is the most expensive thing to serve. Expect at least $20 to $40 a month for a small site, rising sharply with viewers.
What is transcoding and do I need it?
Transcoding converts each uploaded video into several smaller versions so people on phones do not download a 2 GB file. You need it. It is slow, uses the whole CPU, and roughly triples your storage, so limit how many jobs run at once.
Can I host a video website on shared hosting?
No. Transcoding needs long-running processes that shared hosting blocks, and the disk and bandwidth limits are far too low. You need a VPS with at least 4 GB of RAM and two CPU cores.
What is the best software for a video sharing site?
PeerTube for a public site, because its peer-to-peer streaming genuinely reduces your bandwidth bill when many people watch the same video. MediaCMS for a course or library site, because the admin is simpler. Both are free.
How much storage do I need?
Around three times the size of the raw uploads, because each video is kept as the original plus several transcoded versions. A hundred ten-minute videos at 720p needs roughly 50 GB once processed.
Why do my videos upload but never play?
The transcode queue has stalled or FFmpeg is missing. Check the worker logs. On a small server, several simultaneous transcodes can run out of memory and the process gets killed silently.
How can I reduce video bandwidth costs?
Put a CDN such as Bunny or Cloudflare Stream in front, default to 480p instead of 1080p, and use PeerTube peer-to-peer mode if your viewers watch the same videos at the same time. Also block hotlinking from other sites.
Should I allow anyone to upload videos?
Not at the start. Open uploads on a public video site attract piracy and illegal content quickly, and it is your server and your legal exposure. Begin invite-only and open up only when you have moderation in place.
Is self-hosted video realistic as a YouTube competitor?
Not as an open public site — bandwidth costs will outpace you long before the software does. It works well for a known, limited audience: a course platform, a company video library, a club or a paid membership site.

Written by Habib Baloch

I build Android apps, websites and Ubuntu servers, and write down exactly how I did it.

Ask me about this guide →