| | |
How to upload and stream videos?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I assuming it is unefficent to upload and stream a video with php.
So this is a 2 part question (1. using php to upload the contents, 2. using php? flash? etc? to convert and play the video file).
1. How would I upload a video file? - Like a normal file?
2. Now If I converted to a fla format, I would do this before or after the video file is uploaded?
3. How do I stream a live video?
4. How much bandwidth am I looking at consuming?
In short im looking for video tutorials that can be used to upload and play your own videos (something similar to youtube - on a very small scale). What is the best way to do this?
Thankyou, Regards X
PS: The same concept for the video would be used for a powerpoint presentation?
So this is a 2 part question (1. using php to upload the contents, 2. using php? flash? etc? to convert and play the video file).
1. How would I upload a video file? - Like a normal file?
2. Now If I converted to a fla format, I would do this before or after the video file is uploaded?
3. How do I stream a live video?
4. How much bandwidth am I looking at consuming?
In short im looking for video tutorials that can be used to upload and play your own videos (something similar to youtube - on a very small scale). What is the best way to do this?
Thankyou, Regards X
PS: The same concept for the video would be used for a powerpoint presentation?
Last edited by OmniX; May 21st, 2009 at 1:17 am.
"You never stop learning." - OmniX
•
•
Join Date: May 2009
Posts: 28
Reputation:
Solved Threads: 0
•
•
•
•
I assuming it is unefficent to upload and stream a video with php.
So this is a 2 part question (1. using php to upload the contents, 2. using php? flash? etc? to convert and play the video file).
1. How would I upload a video file? - Like a normal file?
2. Now If I converted to a fla format, I would do this before or after the video file is uploaded?
3. How do I stream a live video?
4. How much bandwidth am I looking at consuming?
In short im looking for video tutorials that can be used to upload and play your own videos (something similar to youtube - on a very small scale). What is the best way to do this?
Thankyou, Regards X
PS: The same concept for the video would be used for a powerpoint presentation?
Acco'd to my knowledge uploading of any file can be done by PHP. And videos are converted on the fly to flv format from any format using FFMPEG. Basically to start a site like youtube or any thing which streams videos requires FFMPEG modules installed. And secondly the bandwidth issue is it depends on the file size. Say the video is of 1mb, you upload it, and is viewed 10 times. So the bandwidth used is 1+1*10=11mb used. I hope you understood.
Ya I gather most of that and I have uploaded files to a server before, details to a database, etc just never video.
When a person uploads a video the 'FFMPEG ' would convert it to fla and store it on the server and then would be avaliable to all to see? How would I code that? Would I need to make sure my server supports x, y and z?
I was thinking when you upload it FFMPEG converts it to fla and stores it and then you could easily make a webpage with basic html to play the file?
Let me know your ideas, more importantly example code but ideally some sort of website with a tutorial (I have searched and nothing but youtube this and youtube that tutorials).
Thanks, Regards X
When a person uploads a video the 'FFMPEG ' would convert it to fla and store it on the server and then would be avaliable to all to see? How would I code that? Would I need to make sure my server supports x, y and z?
I was thinking when you upload it FFMPEG converts it to fla and stores it and then you could easily make a webpage with basic html to play the file?
Let me know your ideas, more importantly example code but ideally some sort of website with a tutorial (I have searched and nothing but youtube this and youtube that tutorials).
Thanks, Regards X
"You never stop learning." - OmniX
php Syntax (Toggle Plain Text)
<?php ob_start("ob_gzhandler"); ?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"><meta name="distribution" content="global"> <meta http-equiv="content-Script-Type" content="text/javascript"><meta name="author" content="Rob Dockrey 2004"> <style type='text/css'> <!-- .logo { background-color: #eeeeee; color: #000000; text-align: right; font-family: verdana, geneva, arial, serif; font-size: 8pt; top: expression(document.body.scrollTop + document.body.clientHeight - offsetHeight ); left: expression(document.body.scrollLeft + document.body.clientWidth - offsetWidth - 1 ); position: absolute; } --> </style> <script type="text/javascript"> <!--// function shrink(){ document.getElementById("MediaPlayer1").style.width=384; document.getElementById("MediaPlayer1").style.height=300; } function enLarge(){ document.getElementById("MediaPlayer1").style.width=480; document.getElementById("MediaPlayer1").style.height=402; } //--> </script> <title>video - Entertainment - Dockrey Apartments</title> </head><body><a name='top'></a> <p class='logo'> <button onclick="enLarge()">large</button> <button onclick="shrink()">small</button> <a class='button' href='..'>Main Menu</a> <A href="http://www.microsoft.com/windows/windowsmedia/player/download/"><IMG ALT="Get Windows Media Player" SRC="http://www.microsoft.com/windows/windowsmedia/images/logos/getwm/mp11_88x31_static.gif" WIDTH="88" HEIGHT="31" BORDER="0"></A><br> <OBJECT ID="MediaPlayer1" width=384 height=300 classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"> <PARAM NAME="fileName" VALUE=""> <PARAM NAME="showControls" VALUE="true"> <PARAM NAME="PlayCount" VALUE="0"> <PARAM NAME="animationatStart" VALUE="true"> <PARAM NAME="transparentatStart" VALUE="true"> <PARAM NAME="autoStart" VALUE="true"> <EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="" name="MediaPlayer1" width=360 height=260 AutoStart=true></EMBED></object></p> <p>Videos<div style='float:left; text-align:left;'> <?php $p = split('/', $_SERVER['SCRIPT_FILENAME']); $script_name = $p[count($p)-1]; $path = str_replace($script_name, '', $_SERVER['SCRIPT_FILENAME']); $dir_handle = @opendir($path) or die("Unable to open $path"); Function get_Extension($m_FileName){ $path_parts = pathinfo($m_FileName); if ($path_parts["extension"]) { $m_Extension = strtolower($path_parts["extension"]); return(strtoupper($m_Extension)); } else { return "unbekannt"; } } function check_image($filename){ $temp=strtoupper(get_Extension($filename)); if(($temp=="WMV")||($temp=="ASF")) return (true); else return (false); } Function get_Files($path) { if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { if(!is_dir($file) && substr($file,O,1) != "."){ $m_Files[]=$file; } } closedir($handle); } if(sizeof($m_Files)>1) asort($m_Files); return $m_Files; } $files=get_Files($path); $filter_files=array_filter($files,"check_image"); $maxnr=sizeof($filter_files)-1; sort($filter_files); for ($i=0;$i<sizeof($filter_files);$i++){ echo "<a class='button' onclick=\"MediaPlayer1.SRC='$filter_files[$i]';MediaPlayer1.fileName='$filter_files[$i]';\">"; echo substr($filter_files[$i], 0, strlen($filter_files[$i])-4); echo "</a><br>"; } closedir($dir_handle); ?> </p> </body></html> <?php ob_flush(); ?>
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
The code looks good but when I tried to run it, there was only an out of area media player available, no upload, no movie and also required active x.
Is there something more like you tube script available or something?
Thanks
Is there something more like you tube script available or something?
Thanks
"You never stop learning." - OmniX
google, utube clone script
upload and serve scripts are always separate
often in the same package, but separate
upload and serve scripts are always separate
often in the same package, but separate
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
almostbob - Will do so now, thanks.
I have been doing some research with php and video and the "FFMPEG" has come up several times, which will allow me to covnert and play my videos like youtube does but I havent found anything accurate yet.
So pretty much looking for a php video script that will lead to a mini website of youtube.
Thanks, Regards X
I have been doing some research with php and video and the "FFMPEG" has come up several times, which will allow me to covnert and play my videos like youtube does but I havent found anything accurate yet.
So pretty much looking for a php video script that will lead to a mini website of youtube.
Thanks, Regards X
"You never stop learning." - OmniX
Here is a bit on uploading files in PHP:
http://www.php.net/manual/en/feature...ost-method.php
You can convert the file to flv after uploading using FFMPEG and FLVTool2 for the metadata.
FFMPEG-PHP can help with this: http://ffmpeg-php.sourceforge.net/
It's probably easier to use FFMPEG and FLVTool2 in the command line first and when you're successful, try doing it from PHP with exec().
The tutorial given previously explains this well.
You'll need root access to install FFMPEG and FLVTool2. If you don't have this, you could probably get away with uploading the video file to a site such as google video or youtube, and then downloading the converted FLV through their API.
Basically there are 2 ways of streaming the FLV to the flash player.
1) using HTTP
2) using a streaming protocols such as RTMP (Real Time Messaging Protocol)
http://en.wikipedia.org/wiki/Flash_V...livery_options
Using RTMP requires a streaming server, such as Red5 (open source).
If you won't want to use a special server, just using your HTTP server would allow you to progressively download the FLV without any special setup. Just giving your choice of flash player (eg: http://www.longtailvideo.com/players/jw-flv-player/) the URL of the flv and it should "stream". The only thing it won't be able to do is seek (seek to a position not yet downloaded).
You can stream the FLV, and allow seeking using HTTP by having PHP control the HTTP stream:
http://www.flashcomguru.com/index.cf...a-PHP-take-two
Here is a PHP class based on this:
http://xmoov.com/xmoov-php/
There is a server implementation in Lighty based on the same:
http://blog.lighttpd.net/articles/20...-with-lighttpd
http://jan.kneschke.de/projects/flv-streaming/
This is better then using PHP, since PHP has a greater overhead, but it isn't a problem with just a few simultaneous downloads.
http://www.php.net/manual/en/feature...ost-method.php
You can convert the file to flv after uploading using FFMPEG and FLVTool2 for the metadata.
FFMPEG-PHP can help with this: http://ffmpeg-php.sourceforge.net/
It's probably easier to use FFMPEG and FLVTool2 in the command line first and when you're successful, try doing it from PHP with exec().
The tutorial given previously explains this well.
You'll need root access to install FFMPEG and FLVTool2. If you don't have this, you could probably get away with uploading the video file to a site such as google video or youtube, and then downloading the converted FLV through their API.
Basically there are 2 ways of streaming the FLV to the flash player.
1) using HTTP
2) using a streaming protocols such as RTMP (Real Time Messaging Protocol)
http://en.wikipedia.org/wiki/Flash_V...livery_options
Using RTMP requires a streaming server, such as Red5 (open source).
If you won't want to use a special server, just using your HTTP server would allow you to progressively download the FLV without any special setup. Just giving your choice of flash player (eg: http://www.longtailvideo.com/players/jw-flv-player/) the URL of the flv and it should "stream". The only thing it won't be able to do is seek (seek to a position not yet downloaded).
You can stream the FLV, and allow seeking using HTTP by having PHP control the HTTP stream:
http://www.flashcomguru.com/index.cf...a-PHP-take-two
Here is a PHP class based on this:
http://xmoov.com/xmoov-php/
There is a server implementation in Lighty based on the same:
http://blog.lighttpd.net/articles/20...-with-lighttpd
http://jan.kneschke.de/projects/flv-streaming/
This is better then using PHP, since PHP has a greater overhead, but it isn't a problem with just a few simultaneous downloads.
Last edited by digital-ether; May 31st, 2009 at 1:06 am.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
Similar Threads
- Blog newbie's question (Graphics and Multimedia)
- Vista & IE7 (Web Browsers)
- which one? (Monitors, Displays and Video Cards)
- PHP CMS tweaking (Software Development Job Offers)
- Windows media player wont stream videos when SLI is enabled? can i fix this? (Windows NT / 2000 / XP)
- catn get any streaming of videos? any ideas? (Windows NT / 2000 / XP)
- Premiership, NBA, NFL, NHL News by SMS (Websites for Sale)
- Macromedia refusal to open a new window (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: Newbee... SSL works for .html pages but not .php pages
- Next Thread: zipcodes packages
| Thread Tools | Search this Thread |
ajax apache api array back basic beginner binary broken cakephp checkbox class cms code computing cron curl database date delete display dynamic echo email error external file files filter folder form forms function functions gc_maxlifetime google host href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm multiple mysql navigation oop parsing paypal pdf php problem query question radio random recursion regex remote script search server sessions sms snippet soap source space sql syntax system table thesishelp trouble tutorial update upload url validation validator variable video web xml youtube






