473,387 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP Video Uploading

24
Hello everyone...Can someone please, please help me solve a problem I am facing in my project......Basically the project is about uploading videos and viewing them.....When users upload a video (avi, wmv, mov or mpg format) the video will be coverted into .flv format...But I am getting an error....

I am using WAMP server

My converting code:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. /***************Load FFMPEG *********************************/
  3.  
  4.  
  5.  
  6. $extension = "ffmpeg";
  7.  
  8. $extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
  9.  
  10. $extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;
  11.  
  12.  
  13.  
  14.  
  15.  
  16. // load extension
  17.  
  18. if (!extension_loaded($extension)) {
  19.  
  20. dl($extension_soname) or die("Can't load extension $extension_fullname\n");
  21.  
  22. }
  23.  
  24.  
  25.  
  26. /***********************************************************/
  27.  
  28.  
  29.  
  30. /*****************Get the path to Extention ****************/
  31.  
  32.  
  33.  
  34. $array_path = explode("/",$_SERVER['SCRIPT_FILENAME']);
  35.  
  36. $dynamic_path = "";
  37.  
  38. for ($i=0;$i<sizeof($array_path)-1;$i++)
  39.  
  40. if($array_path[$i]!="")
  41.  
  42. $dynamic_path =$dynamic_path."/".$array_path[$i];
  43.  
  44. /**********************************************************/
  45.  
  46.  
  47.  
  48. /******************set folders*****************************/
  49.  
  50. $flvpath = "flvfiles/";
  51.  
  52. $moviepath = "movies/" ;
  53.  
  54. chmod($moviepath,0777);
  55.  
  56. chmod($flvpath,0777);
  57.  
  58. /*********************************************************/
  59.  
  60.  
  61.  
  62. /******************Upload and convert video *****************************/
  63.  
  64.  
  65.  
  66. if(isset($_FILES["x_URL"]))
  67.  
  68. {
  69.  
  70. $fileName = $_FILES["x_URL"]["name"];
  71.  
  72. $fileNameParts = explode( ".", $fileName );
  73.  
  74. $fileExtension = end( $fileNameParts );
  75.  
  76. $fileExtension = strtolower( $fileExtension );
  77.  
  78. if($fileExtension=="avi" || $fileExtension=="wmv" || $fileExtension=="mpeg"
  79. || $fileExtension=="mpg" || $fileExtension=="mov" )
  80.  
  81. {
  82.  
  83. if ( move_uploaded_file($_FILES["x_URL"]["tmp_name"],$moviepath.$_FILES["x_URL"]["name"])
  84. )
  85.  
  86. {
  87.  
  88.  
  89.  
  90. if( $fileExtension == "wmv" ) {
  91.  
  92. exec("ffmpeg -i ".$dynamic_path."/".$moviepath."".$fileName."
  93. -sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv");
  94.  
  95. }
  96.  
  97. if( $fileExtension == "avi" || $fileExtension=="mpg" ||
  98. $fileExtension=="mpeg" || $fileExtension=="mov" ) {
  99.  
  100. exec("ffmpeg -i ".$dynamic_path."/".$moviepath."".$fileName."
  101. -sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv");
  102.  
  103. }
  104.  
  105. /******************create thumbnail***************/
  106.  
  107. exec("ffmpeg -y -i ".$dynamic_path."/".$moviepath."".$fileName."
  108. -vframes 1 -ss 00:00:03 -an -vcodec png -f rawvideo -s 110x90 ".$dynamic_path."/".$flvpath."myflv.png");
  109.  
  110.  
  111.  
  112. }
  113.  
  114. else
  115.  
  116. {
  117.  
  118. die("The file was not uploaded");
  119.  
  120. }
  121.  
  122. }
  123.  
  124.  
  125.  
  126. else
  127.  
  128. {
  129.  
  130. die("Please upload file only with avi, wmv, mov or mpg extension!");
  131.  
  132. }
  133.  
  134. }
  135.  
  136. else
  137.  
  138. {
  139.  
  140. die("File not found");
  141.  
  142. }
  143.  
  144. ?>

The error I am getting:

Expand|Select|Wrap|Line Numbers
  1. Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension=ffmpeg.dll in your php.ini in C:\wamp\www\Test\uploadvideopro.php on line 31
  2. Can't load extension C:\php5/ffmpeg.dll 
Please, please someone help me. Thanks in advance.
Sep 22 '08 #1
4 4566
Markus
6,050 Expert 4TB
Sounds like you don't have the ffmpeg dll installed.

Have you?
Sep 22 '08 #2
Atli
5,058 Expert 4TB
The error really says it all, doesn't it.

You can not use this function on multithreaded Web servers, which pretty much all modern servers are.

You will instead have to load the DLL as an extension in your php.ini configuration file.
Sep 22 '08 #3
scan87
24
The error really says it all, doesn't it.

You can not use this function on multithreaded Web servers, which pretty much all modern servers are.

You will instead have to load the DLL as an extension in your php.ini configuration file.

Hello Atli,

I checked the php.ini file and there is an extension called: extension=php_ffmpeg.dll

If I need a different extension, which one is it and where can I get it from.

Thanks.
Sep 22 '08 #4
Atli
5,058 Expert 4TB
This actually doesn't make sense...

You are trying to load this extension into PHP, and then you try to execute "ffmpeg" via a shell command.

What are you trying to do here?
Load a PHP extension to do this or use a external application?

This ffmepg extension you are trying to use doesn't seem to be an official PHP extension so I can't really say how it is supposed to work. You will have to find out how to use it from wherever you got it.

But, like I said in you other thread, if you plan on using a shell command, the application you are trying to execute has be be installed and working properly outside PHP first.
A good way to test this to try to command in your OS's CLI first to see if it works.
Sep 23 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: SStory | last post by:
I just saw an intro video on Whidbey Alpha from http://www.learnvisualstudio.net/shortcut/0806c.htm. I am sort of aggravated with Microsoft in that no one can ever become proficient with your...
8
by: poorna | last post by:
hi all i want to upload the video files to the server.. then i encode all the video files into flv files ... and then i am go to streaming ... in the mean while i create the thumbnail image...
6
by: poorna | last post by:
hi all, Can any body guide me please how to upload video files using php and how to maintain it? Is there any thing diffrent way to upload a video files? Regards, poorna
5
Nert
by: Nert | last post by:
hi, I've created a website, uhhmmn something like posting/uploading images and videos.., i made my site working well, i save images on database but the videos are just copied from the client...
8
by: scriptee | last post by:
Hi guys ! I have a form, in which I want users to upload either video or image . What I want to ask is how I can set it up so, that when a user tries to upload a image when there is already a video...
3
by: lukemack | last post by:
Hi, Can anyone recommend a class/script which handles video file uploads, preferably with Flash integration? I'm looking to have a video upload / library section in my cake app. I considered...
0
by: beary | last post by:
When uploading video and audio files to a mysql table, what sort of limitations are there, if any? Should the table be a particular type? Are there any catches I need to know about?
2
by: lokeshyourfriend | last post by:
i wanna a idle script for uploading vdeo files with php
2
by: ravi kiran kanneganti | last post by:
i'm doing a project which includes the video uploading.....i can upload a photogragh but i'm not able to upload a video...can anyone help me...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.