Live data from Hacker News

Ask HN: What would be involved in building your own YouTube clone?

news.ycombinator.com

1–10 of 26 posts

Ask HN: What would be involved in building your own YouTube clone?

#1
I don't exactly want to clone youtube. But let's say I wanted to make a website where people can upload videos and others can play them in their browser. What would be actually involved in doing this?

I know quite a bit about backend and devops, but I have to admit I have no idea how to do this, if I was tasked to do this.

Also would this even be possible without flash or third party video players? I know youtube used to have an html5 version, but I can't recall what happened to that.

My question is more on the programming level of what you would use to build the actual video player and the how the video player would connect to the backend.

Not so much an infrastructure question.

Re: Ask HN: What would be involved in building your own YouTube clone?

#2
Funny enough, this is a system design question asked in many interviews:

https://www.educative.io/courses/grokking-modern-system-desi... https://leetcode.com/discuss/interview-question/system-desig...

I've never designed such a system, but these are "baseline" solutions. It'd be interesting to see if anyone's actually implemented some of these canonical system design solutions and saw how well they actually scaled.

Re: Ask HN: What would be involved in building your own YouTube clone?

#3
Google :) https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_v...

Lets say rails.

1. add devise so users are users

2. add Video controller/model

3. connect data field as active_storage, backed by amazon

4. have video tag with link to uploaded file stored on amazon.

Re: Ask HN: What would be involved in building your own YouTube clone?

#5

Google :) https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_v... Lets say rails. 1. add devise so users are users 2. add Video controller/model 3. connect data field as active_storage, backed by amazon 4. have video tag with link to uploaded file stored on amazon.

Wow that's crazy. Feels a bit overly simple. So why do people use third party video players on their website then?

Re: Ask HN: What would be involved in building your own YouTube clone?

#6
> website where people can upload videos and others can play them in their browser. What would be actually involved in doing this?

The minimum would be a stateless server handling , storing it in the file system and responding with the path exposed by nginx or something. The user agent will take care of the playback, be it Firefox, VLC or mpv.

Now if your average users upload high bitrate videos but have shitty bandwidth, you'll need to transcode them down to lower resolution or higher compression to save them from rebuffering. Still, no client-side scripting needed.

In case their connection quality is unstable, HLS is finally necessary for on-the-fly adjustment of playback bitrate. This is the secondary purpose of JS viewers around the web these day (the primary one being DRM). The other possibility with custom viewer is to lighten the server load by enabling P2P transfering, e.g. in case of PeerTube. Realistically, you'd either deploy the barebone one I mentioned in the beginning or set up a PeerTube instance; anything in between is probably a waste of engineering effort.

Re: Ask HN: What would be involved in building your own YouTube clone?

#7

Google :) https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_v... Lets say rails. 1. add devise so users are users 2. add Video controller/model 3. connect data field as active_storage, backed by amazon 4. have video tag with link to uploaded file stored on amazon.

Wow that's crazy. Feels a bit overly simple. So why do people use third party video players on their website then?

To embed advertising, avoid simple downloading of video content, and add bells and whistles like timeline preview thumbs, custom context menus, etc.. I guess.

Re: Ask HN: What would be involved in building your own YouTube clone?

#8
post #6

> website where people can upload videos and others can play them in their browser. What would be actually involved in doing this? The minimum would be a stateless server handling , storing it in the file system and responding with the path exposed by nginx or something. The user agent will take care of the playback, be it Firefox, VLC or mpv. Now if your average users upload high bitrate videos but have shitty bandw…

Thanks this is a very good repl!

Re: Ask HN: What would be involved in building your own YouTube clone?

#9
post #6

> website where people can upload videos and others can play them in their browser. What would be actually involved in doing this? The minimum would be a stateless server handling , storing it in the file system and responding with the path exposed by nginx or something. The user agent will take care of the playback, be it Firefox, VLC or mpv. Now if your average users upload high bitrate videos but have shitty bandw…

Thanks this is a very good reply!

Re: Ask HN: What would be involved in building your own YouTube clone?

#10
post #2

Funny enough, this is a system design question asked in many interviews: https://www.educative.io/courses/grokking-modern-system-desi... https://leetcode.com/discuss/interview-question/system-desig... I've never designed such a system, but these are "baseline" solutions. It'd be interesting to see if anyone's actually implemented some of these canonical system design solutions and saw how well they actually scaled.

Thanks for your answer!
Post reply on HN