Author Topic: Any PHP / MySql / Database types here? Need a spot of quick advice!  (Read 1002 times)

0 Members and 1 Guest are viewing this topic.

Offline Fineus

  • ...But you *have* heard of me.
  • Administrator
  • 212
    • Hard Light Productions
Any PHP / MySql / Database types here? Need a spot of quick advice!
Hey all,

Having left some coursework a little bit late I find myself in a bit of a bind. I was wondering if anyone from HLP might have insight into what I could do about this:

My coursework is:

Quote
1. Reflectively report on the current programming techniques used within the streaming media industry.

2. Critically analyze programming techniques used within the streaming media industry.

3. Reflectively use current programming techniques for designing and implementing an interactive streaming media application.

There's a report an artifact and a presentation to turn in. The first two are worth 50% overall and the second is worth 50% as well.

It's the coursework that I'm unclear on. From what I can tell, we're to create a website to which a user can upload a video, which will then be added to a database of some sort, selected from the website and can be streamed back to the user.... much like a simplified YouTube?

I'm not asking anyone to do this for me, I want to make that clear right now! But I'm unsure of the process one might go through to achieve this. I have the basic website but with none of the upload/database/streaming download code in place.

If anyone understands this process, I'd love a "...first you need to do this, then this, then this..." sort of thing telling me what I need to do at each step - not the actual code - just break down what is needed to make it work. Forget the word report and the presentation - I can deal with that after the artifact is done.

Cheers in advance!

 

Offline Fury

  • The Curmudgeon
  • 213
Re: Any PHP / MySql / Database types here? Need a spot of quick advice!
Oh, picked something difficult didn't you. Never done anything like this so can't do much to help you, but there is one question that comes to mind; how exactly are you planning the streaming part to work?

Do you intend to have the webserver re-encode whatever video the user is uploading into an flv video, and then stream the flv? Or do you want the websever to stream videos in their original format, or re-encode into other than flv? The server-side encoding might be a bit iffy, you probably don't have your own server and re-encoding may use quite a bit of CPU time and RAM, depending on video lenght and quality of course. Unless you have another server doing the re-encoding. Easiest way would be to leave it to the user to encode their videos into formats the webserver is able to stream, as opposed to downloading it as a file.

 

Offline Fineus

  • ...But you *have* heard of me.
  • Administrator
  • 212
    • Hard Light Productions
Re: Any PHP / MySql / Database types here? Need a spot of quick advice!
Actually it looks like the encoding won't be a problem.

We're allowed to stream from the site in .WMV format and I already have the code for that put into the site along with a trial .WMV so it does stream video without issues.

What I need, then, is a way for users to upload a WMV video to the site (some sort of javascript form? SQL query?) have it added to a list of videos on a webpage (database? php?) and allow the user to stream that video back to their computer. As I say - the streaming back bit is complete but it must be presented in such a way that as additional videos are uploaded, they too are automatically put on the page for display and streaming back to the user.

  
Re: Any PHP / MySql / Database types here? Need a spot of quick advice!
You need a streaming server if you want to start playing without the whole file being downloaded. For WMV this means Microsoft rubbish which I won't go into.

Uploading is easy - just stick an upload field on a web page form which is driven by a PHP script. When the file is received, add any metadata about the file into your DB, and move the file to somewhere which can be computed backreferenced from the data.

When you want to retrieve the file (usually through a script request so you can update DB statistics, visitor IDs and so on), you'd get your PHP script to query the database for the requested file, and then redirect the end-user to a copy of the file served by the streaming server. If mid-download display of the video isn't necessary you could just redirect them to an accessible location on your web server containing a copy of the file, or set the HTTP Content-type header to the file's format and print the file's contents verbatim.

I'm not sure how complex you need to be here but there's nothing stopping you from just copying the videos to a directory served by the web server (renaming to avoid name conflicts, perhaps) and just making a script to iterate over the contents of the directory to generate an HTML page with all the videos on. The DB would only be useful for storing metadata and usage statistics. One last tip: don't EVER store binary files in a database field. :)