How to upload and stream videos?

Reply

Join Date: Dec 2007
Posts: 609
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 8
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

How to upload and stream videos?

 
0
  #1
May 21st, 2009
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?
Last edited by OmniX; May 21st, 2009 at 1:17 am.
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 28
Reputation: lamiv007 is an unknown quantity at this point 
Solved Threads: 0
lamiv007 lamiv007 is offline Offline
Light Poster

Re: How to upload and stream videos?

 
0
  #2
May 21st, 2009
Originally Posted by OmniX View Post
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?
Hi,

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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 609
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 8
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: How to upload and stream videos?

 
0
  #3
May 21st, 2009
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
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 9
Reputation: koolhq is an unknown quantity at this point 
Solved Threads: 1
koolhq koolhq is offline Offline
Newbie Poster

Re: How to upload and stream videos?

 
0
  #4
May 21st, 2009
I have a simple php upload script, but it does not play the movie. koolhq.com/upload.zip
Last edited by koolhq; May 21st, 2009 at 12:27 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,352
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: How to upload and stream videos?

 
0
  #5
May 21st, 2009
  1. <?php ob_start("ob_gzhandler"); ?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html xmlns="http://www.w3.org/TR/REC-html40">
  3. <head>
  4. <meta http-equiv="content-type" content="text/html;charset=utf-8"><meta name="distribution" content="global">
  5. <meta http-equiv="content-Script-Type" content="text/javascript"><meta name="author" content="Rob Dockrey 2004">
  6. <style type='text/css'>
  7. <!--
  8. .logo {
  9. background-color: #eeeeee;
  10. color: #000000;
  11. text-align: right;
  12. font-family: verdana, geneva, arial, serif;
  13. font-size: 8pt;
  14. top: expression(document.body.scrollTop +
  15. document.body.clientHeight -
  16. offsetHeight );
  17. left: expression(document.body.scrollLeft +
  18. document.body.clientWidth -
  19. offsetWidth - 1 );
  20. position: absolute;
  21. }
  22. -->
  23. </style>
  24. <script type="text/javascript">
  25. <!--//
  26. function shrink(){
  27. document.getElementById("MediaPlayer1").style.width=384;
  28. document.getElementById("MediaPlayer1").style.height=300;
  29. }
  30. function enLarge(){
  31. document.getElementById("MediaPlayer1").style.width=480;
  32. document.getElementById("MediaPlayer1").style.height=402;
  33. }
  34. //-->
  35. </script>
  36. <title>video - Entertainment - Dockrey Apartments</title>
  37. </head><body><a name='top'></a>
  38. <p class='logo'>
  39. <button onclick="enLarge()">large</button>
  40. <button onclick="shrink()">small</button>
  41. <a class='button' href='..'>Main Menu</a>
  42. <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>
  43. <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">
  44. <PARAM NAME="fileName" VALUE="">
  45. <PARAM NAME="showControls" VALUE="true">
  46. <PARAM NAME="PlayCount" VALUE="0">
  47. <PARAM NAME="animationatStart" VALUE="true">
  48. <PARAM NAME="transparentatStart" VALUE="true">
  49. <PARAM NAME="autoStart" VALUE="true">
  50. <EMBED type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" SRC="" name="MediaPlayer1" width=360 height=260 AutoStart=true></EMBED></object></p>
  51. <p>Videos<div style='float:left; text-align:left;'>
  52. <?php $p = split('/', $_SERVER['SCRIPT_FILENAME']);
  53. $script_name = $p[count($p)-1];
  54. $path = str_replace($script_name, '', $_SERVER['SCRIPT_FILENAME']);
  55. $dir_handle = @opendir($path) or die("Unable to open $path");
  56. Function get_Extension($m_FileName){
  57. $path_parts = pathinfo($m_FileName);
  58. if ($path_parts["extension"]) {
  59. $m_Extension = strtolower($path_parts["extension"]);
  60. return(strtoupper($m_Extension));
  61. }
  62. else { return "unbekannt"; }
  63. }
  64. function check_image($filename){
  65. $temp=strtoupper(get_Extension($filename));
  66. if(($temp=="WMV")||($temp=="ASF"))
  67. return (true);
  68. else
  69. return (false);
  70. }
  71. Function get_Files($path) {
  72. if ($handle = opendir($path)) {
  73. while (false !== ($file = readdir($handle))) {
  74. if(!is_dir($file) && substr($file,O,1) != "."){
  75. $m_Files[]=$file;
  76. }
  77. }
  78. closedir($handle);
  79. }
  80. if(sizeof($m_Files)>1)
  81. asort($m_Files);
  82. return $m_Files;
  83. }
  84. $files=get_Files($path);
  85. $filter_files=array_filter($files,"check_image");
  86. $maxnr=sizeof($filter_files)-1;
  87. sort($filter_files);
  88. for ($i=0;$i<sizeof($filter_files);$i++){
  89. echo "<a class='button' onclick=\"MediaPlayer1.SRC='$filter_files[$i]';MediaPlayer1.fileName='$filter_files[$i]';\">";
  90. echo substr($filter_files[$i], 0, strlen($filter_files[$i])-4);
  91. echo "</a><br>";
  92. }
  93. closedir($dir_handle); ?>
  94. </p>
  95. </body></html>
  96. <?php ob_flush(); ?>
serves wmv asf files, without flash overhead
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 609
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 8
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: How to upload and stream videos?

 
0
  #6
May 22nd, 2009
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
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,352
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: How to upload and stream videos?

 
0
  #7
May 22nd, 2009
google, utube clone script
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 609
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 8
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: How to upload and stream videos?

 
0
  #8
May 22nd, 2009
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
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 28
Reputation: lamiv007 is an unknown quantity at this point 
Solved Threads: 0
lamiv007 lamiv007 is offline Offline
Light Poster

Re: How to upload and stream videos?

 
0
  #9
May 29th, 2009
Hei,

I think this tutorial will be helpful. http://www.tutorialhero.com/tutorial...eg_and_php.php
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,079
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is online now Online
Veteran Poster

Re: How to upload and stream videos?

 
1
  #10
May 31st, 2009
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.
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!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC