Jump to content

Creating A Streaming Video Website


Recommended Posts

Hello, I have a good idea and it involves creating a streaming video website, that users can submit videos(Sounds a lot like YouTube?). I tried to decipher the code on youtube, but its all generated, and is confusing for me. I plan on creating it in PHP, and I wanted to make sure that it is okay to create the website in that. I have some familiarity in it, so It would be best for me to just complete my education in it. So long as PHP is good for the website itself, I would like to know my best bet of delivering the video. I know that YouTube converts all videos to a .flv file and then plays the file through an .flv media player, but I would like to try to make it accessible on all devices, including the iPhone. I'm an apple developer, so I have an idea about the limitations, especially with flash.... I am then thinking about just posting all the videos in h.264, so long as I can find a converter. If anyone can offer me any help on this topic, it would be greatly appreciated. I've been searching for a few days, and I have gotten no solid info about doing this kind of thing. I would like to know about the implementation of a streaming server also, because I know that if i get a significant amount of visitors, that http streaming will not be sufficient. Thanks for everyone's help in advanceZach Russell

  • Like 5
Link to post
Share on other sites

Youtube and most other video-sharing sites don't actually stream video, they just download it as fast as possible while playing it back to the user at the same time. If you display a H.264 video (through the HTML 5 video tag, for example), it will use the same mechanism. This is perfectly feasible to do through HTTP — you just need enough servers / bandwidth to cope with the amount of visitors you get. And yes, you can create any type of website in PHP.

Link to post
Share on other sites
Youtube and most other video-sharing sites don't actually stream video, they just download it as fast as possible while playing it back to the user at the same time. If you display a H.264 video (through the HTML 5 video tag, for example), it will use the same mechanism. This is perfectly feasible to do through HTTP — you just need enough servers / bandwidth to cope with the amount of visitors you get. And yes, you can create any type of website in PHP.
Thank you for your response.So just to clarify, websites like youtube use http streaming to send videos. So it would be feasible for me to use http streaming. If this is so, how do I deal with the issue of bandwidth, i know the server im renting now limits me to 2000 GBS a month(I know it's a lot but what if I exceed it), the other thing is network speed. The host i'm using now, 1&1, obviously uses a datacenter to place my server, issue is that i know that my server has a limit of 100 megabits/second. If I am streaming videos to more than a few people at a time, I know that the 100 megabits/second will be used up very quickly. How, (or more or less where can I learn) to set this up so it can be scalable if my website does become big.I ask this because I am speaking with my college professor about this idea. He is my business professor, but is a huge marketing guy who did the marketing for linkedin and twitter, and worked directly under one of the CEOs of eBay(i only remember her first name) (needless to say cashed in big time). When speaking with him, one of the big things he stressed was scalability, so I do not want to have to completely redo the backend, server arrangement if my website actually does become big. I really appreciate your helpZach
Link to post
Share on other sites

Also, I know that h.264 is compatible with the video tag with html5, but what if I have a video file of a different format, can i have a php script that automatically converts the video, and if so what converter should I use. If not, what is the best video type for me to use for a video site Thanks,Zach

Link to post
Share on other sites

As I said, Youtube doesn't use video streaming, just a simultaneous download-playback mechanism (streaming is where the data is immediately displayed as it is received and not stored at all). HTTP can't do actual streaming, you need a protocol like MMS for that (though, you probably don't need/want actual streaming, as that is much, much more complicated to set up). If you need scalable bandwidth then you may want to look at a service like Amazon S3, which will give you as much bandwidth as you need at a cost per-data-unit-transferred. The geographically diverse CDNs of such services will also ensure that your content doesn't come out of a single data centre but instead from somewhere close to the client, reducing latency. While I am sure it is possible to transcode video on-demand using PHP (or at least, by hooking into a system utility through PHP), I do not recommend this at all. Transcoding takes a long, long, long time, and uses a LOT of computing power — the average quad-core desktop PC will have its entire processing power consumed for, say, about ten minutes to convert a three minute video to H.264. You are much better of transcoding videos as they arrive — if you want to do this remotely then some other services, such as Amazon EC2, may help (though it may get expensive). As for what video format is "best", you can see a compatibility chart on Wikipedia. Note that iOS only supports H.264 so if your majority target audience are going to be using iOS then you'd better just use that. If you really want, you can have multiple formats available, but that would of course increase your transcoding cost.

  • Like 1
Link to post
Share on other sites

You are being a HUGE help to clarify! I understand. I think I misworded though. As per your recommendation, and it makes sense, I am not going to use video streaming, instead use HTTP streaming, which was my goal from the beginning, I was under the impression, previously, that sites like youtube streamed, not http streamed. I just want to make sure I am getting this right. I should (hypothetically) Build my web site completely on amazon S3(Meaning the web content, databases, & videos)? The same thing with transcoding. My understanding is that I should use amazon EC2, and install a transcoder on that. When a video is uploaded to the site, it will be automatically sent to the ec2 server, which will transcode the video, then installing it to the s3 server and connecting it accordingly to the website? I know, at first, I will not be getting a lot of videos, and I could just manually do this, but, I would like to have a method to automatically do it once the website becomes too immense for me(or my employees) to handle it. If worse comes to worse, I could buy the mac pro I always dreamed of and use that(maybe if i can afford it) I am also concerned a bit about pricing of the S3 for the data transfer. I am a bit concerned with HTTP steaming (saying that the average 10-minute video in h.264 is about 1.1 GB, in actual file size, i dont know if it is reduced in HTTP streaming) which at S3 pricing, would cost me .12 per 10 mins. Would I be able to make up that cost in Ads.( that is the ultimate goal of the website to make ad profits). I would plan on having both video ads, and textual/picture ads on the site. I hope i'm not making this too confusing to answer, I am just trying to get all my ducks in a row before I spend a year of my life and who knows how much initial funds to start this thing up before I can make a profit Your help is greatly appreciatedZach

Link to post
Share on other sites

You can tell Youtube doesn't actually stream — when you watch a video, you will see two bars in the bit where it tells you how long the video is — the red bar represents how much you've watched, but there is another light-grey bar that shows how much of the video is actually downloaded (you can click anywhere in this area and have the video immediately play) — so Youtube just downloads the video in the background, but plays it back at the same time. Interestingly enough, Youtube also has an alternative HTML 5 video player. You don't need to have your entire site on Amazon S3, as it is just a storage service, and doesn't come with things like server-side language support, database servers, etc. (at least, not that I am aware of). You can host most of your site on a regular web server, then just request the videos from S3. I doubt a 10-minute video will be that big — if you encode it, for example, at 500 kb/s (VCD quality), then it will only be 37.5 MB. As for whether you'd be able to make a profit with ads, it probably depends on your audience. Also, you shouldn't take my advice incautiously — I have never set up such a site before and am just using my general knowledge; some of what I said may not end up working :P.

Link to post
Share on other sites

I really cant say how much of a help you are. An I know to take caution, I am just gathering information at this point, and starting to learn PHP. I am the kind of person who will go "all out" once I have gathered all the information I need. As far as advertising goes, I think I have a pretty good Idea on how it works, an how It can become profitable, so long as I can do a lower rate. AdSense even offers video ads now, so if I had both video and texual ads I am sure I can make a profit, based on what i've seen off other medium traffic sites ive made. A VCD is a video cd, im guessing, so that would not be what I would want, though I could incorporate like what youtube did with like the 320p, 500p and so on(im not sure if they used those exact compression rates, but you get the point). Do you know anything about actually having a video player? I know html 5 has one standard, but what about one that isnt html5 (i.e. if they are using an older web browser). Im just trying to capture the biggest audience. Thanks again

Link to post
Share on other sites

If you want, you can have a fallback Flash-based video player. You could also make that the default and only display the HTML 5 one if the user doesn't have Flash installed (like what Youtube does now).

Link to post
Share on other sites

Flowplayer is a good Flash-based player to use, I set that up recently. For the first time I set up a site with a video where I did everything from shoot the video through editing and encoding. Encoding definitely takes a while, but I ended up with something that is reasonably high-def and plays well over a shared server for a small audience. I used Flowplayer for the player, which worked well.

Link to post
Share on other sites

It will appear to you as a normal web server, and you just request files off it (according to the S3 manual, you use a URL of the form https://s3.amazonaws.com/Bucket/Object). You can embed the videos in your site using the <video> tag as before, or hyperlink if you want people to be able to download them easily. P.S. I've noticed you seem to be replying to some old topics on this forum — if there has been no activity in a thread for a while, it's probably not worth it to respond.

Link to post
Share on other sites

You can probably use some Javascript to make it play an ad, then load the actual video.

Link to post
Share on other sites

Ah, that makes total sense. Thanks. I think i now know that this is achievable. My other thing would be with PHP is SEO, do you know anything about it, if you could just point me to a good source I would be very happy. I am quite familiar with traditional SEO, I just know that PHP kind of complicates things. Thanks

Link to post
Share on other sites

PHP operates on the server-side, and is completely transparent to clients (except for the .php extension, I suppose, but search engines don't care about that). The main issue, I suppose, though not restricted to PHP, is that if you have a complicated querystrings (the bit after the ? in URLs), search engines can get confused when trying to differentiate between different pages. To solve this, you can use URL rewriting (though the use, for example, of mod_rewrite on Apache) to rewrite your URLs from something more pleasant. Or just try not to have complicated querystrings :P.

Link to post
Share on other sites
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...