Go Back   CodingForums.com > :: Server side development > PHP > Post a PHP snippet

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-24-2012, 02:13 PM   PM User | #241
umang.goyal
New Coder

 
Join Date: Feb 2012
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
umang.goyal is an unknown quantity at this point
its all correct in the config.class file, what i meant with ffmpeg-64.exe is that i am using 64bit version :P

can you shed some light on ffmpeg-php please...
umang.goyal is offline   Reply With Quote
Old 02-24-2012, 03:50 PM   PM User | #242
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by umang.goyal View Post
Hi,
i have been trying to run this script on my laptop with xampp for windows.
i have done everything(latest ffmpeg.exe, latest php script of your app) and have setup it as said in instructions but still i am not getting it work for me..when ever i try to convert a youtube video it stuck on the page where is shows downloading video, it never progress. i have even checked in the video folder video size is always zero kb and process freezes there only. No error is shown neither any log. Please can you help me sort out the problem.

Thanks & Regards,
Umang Goyal
Sounds like a cURL problem...make sure cURL is enabled in php.ini...check to make sure cURL is listed in your phpinfo()
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Web Conversion Software on Facebook !! :)
chump2877 is offline   Reply With Quote
Users who have thanked chump2877 for this post:
umang.goyal (02-24-2012)
Old 02-24-2012, 03:51 PM   PM User | #243
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by umang.goyal View Post
its all correct in the config.class file, what i meant with ffmpeg-64.exe is that i am using 64bit version :P

can you shed some light on ffmpeg-php please...
You don't need ffmpeg-php if you are running XAMPP for Windows. Only ffmpeg.exe is required.

I'm still using the 32-bit version of ffmpeg.exe on my Windows 7 Pro 64-bit OS and it works fine.
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Web Conversion Software on Facebook !! :)

Last edited by chump2877; 02-24-2012 at 03:53 PM..
chump2877 is offline   Reply With Quote
Old 02-24-2012, 07:23 PM   PM User | #244
umang.goyal
New Coder

 
Join Date: Feb 2012
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
umang.goyal is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
Sounds like a cURL problem...make sure cURL is enabled in php.ini...check to make sure cURL is listed in your phpinfo()
hi, thanks for pointing that out. i just enabled the cURL and it worked like charm. the only thing is that the progress bar doesn't show progress while converting the video into mp3.
and thanks for the script i loved it
umang.goyal is offline   Reply With Quote
Old 02-24-2012, 07:57 PM   PM User | #245
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by umang.goyal View Post
the only thing is that the progress bar doesn't show progress while converting the video into mp3.
I've posted all kinds of ways to troubleshoot this issue in this thread, so please try some of those things...if you still can't get it to work, come back here, update me with what you were able to find out, and I'll see if I can help you further...
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Web Conversion Software on Facebook !! :)
chump2877 is offline   Reply With Quote
Old 02-24-2012, 08:59 PM   PM User | #246
bedo1975
New Coder

 
Join Date: Feb 2012
Posts: 29
Thanks: 1
Thanked 0 Times in 0 Posts
bedo1975 is an unknown quantity at this point
Quote:
Originally Posted by umang.goyal View Post
hi, thanks for pointing that out. i just enabled the cURL and it worked like charm. the only thing is that the progress bar doesn't show progress while converting the video into mp3.
and thanks for the script i loved it
I've the same problem, no progress bar on conversion problem ... I search why !
bedo1975 is offline   Reply With Quote
Old 02-24-2012, 11:18 PM   PM User | #247
cana888
New Coder

 
Join Date: Feb 2012
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
cana888 is an unknown quantity at this point
Can anybaddy check this url if you can download that: http://www.youtube.com/watch?v=XeqcEhrOM7s

I become "Error downloading video!"
cana888 is offline   Reply With Quote
Old 02-25-2012, 08:04 AM   PM User | #248
umang.goyal
New Coder

 
Join Date: Feb 2012
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
umang.goyal is an unknown quantity at this point
Well i am thinking of putting it up on a linux server. can we do that? i will need to do the needful changes in php.ini like extensions and maybe some other changes...can someone help me with this??

Thanks & Regards,
Umang Goyal
umang.goyal is offline   Reply With Quote
Old 02-25-2012, 09:04 AM   PM User | #249
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by cana888 View Post
Can anybaddy check this url if you can download that: http://www.youtube.com/watch?v=XeqcEhrOM7s

I become "Error downloading video!"
I can confirm that I had the same problem for that video. Other videos download/convert fine though, so this appears to be an isolated incident -- an anomaly. However, if you find that the code is "choking" on other videos as well, please let know. In that case, I may have to modify the code accordingly. Keep me posted.
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Web Conversion Software on Facebook !! :)
chump2877 is offline   Reply With Quote
Old 02-25-2012, 09:11 AM   PM User | #250
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by umang.goyal View Post
Well i am thinking of putting it up on a linux server. can we do that? i will need to do the needful changes in php.ini like extensions and maybe some other changes...can someone help me with this??

Thanks & Regards,
Umang Goyal
The code will work on Linux. See this post: http://www.codingforums.com/showpost...&postcount=153. If you need help with this, let me know and I'll do my best.
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Web Conversion Software on Facebook !! :)
chump2877 is offline   Reply With Quote
Old 02-26-2012, 08:48 AM   PM User | #251
bedo1975
New Coder

 
Join Date: Feb 2012
Posts: 29
Thanks: 1
Thanked 0 Times in 0 Posts
bedo1975 is an unknown quantity at this point
For everything those who have a problem with the conversion progress bar, I've modified the script of chump, to resolve this problem

it's not a very good modification but it's works fine

in fact with the original script I've a problem with this line :

PHP Code:
  $currentTime = (float)end($times[2]); 
why no idear , so I wrote a modification :

original script by chump :

PHP Code:
  if (preg_match('/(Duration: )(\d\d):(\d\d):(\d\d\.\d\d)/i'$log$matches) == 1)
        {
            
$totalTime = ((int)$matches[2] * 60 60) + ((int)$matches[3] * 60) + (float)$matches[4];
            
$numTimes preg_match_all('/(time=)(.+?)(\s)/i'$log$times);
            if (
$numTimes 0)
            {
                
$currentTime = (float)end($times[2]);
                
$progress round(($currentTime $totalTime) * 100);
                if (
$progress 100)
                {
                    
$newLogLength $file_size;
                } 

Modification by me :

PHP Code:
 if (preg_match('/(Duration: )(\d\d):(\d\d):(\d\d\.\d\d)/i'$log$matches) == 1)
        {
              
$totalTime = ((int)$matches[2] * 60 60) + ((int)$matches[3] * 60) + (float)$matches[4];
              
$numTimes preg_match_all('/(time=)(.+?)(\s)/i'$log$times);


              if (
$numTimes  ) {
                             
$count=count($times[0]);
                             for(
$i=0;$i<$count;$i++)
                             { 
                             
$numTimes $times[0][$i];
                             
$parse_numTimes =  list($hours,$minutes,$seconds,$mili) = split(':',$numTimes);
                             
$seconds_numTimes  $hours 3600 $minutes 60 $seconds;
                             
$progress round(($seconds_numTimes $totalTime) * 100);
                             } 
              if (
$progress 100 )
                {
                    
$newLogLength $file_size;
                } 
I hope this help you if you've some problem with the original script !

Last edited by chump2877; 02-26-2012 at 09:18 AM.. Reason: Added PHP forum post tags
bedo1975 is offline   Reply With Quote
Old 02-26-2012, 09:30 AM   PM User | #252
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
bedo1974, your issue appears to be with preg_match_all()...so in fact, your issue is with this line:

PHP Code:
$numTimes preg_match_all('/(time=)(.+?)(\s)/i'$log$times); 
For you, it does not seem to be capturing matches of parenthesized (sub)patterns -- only matches of the entire regex pattern...

Did you try adding a flag to preg_match_all, like so:

PHP Code:
$numTimes preg_match_all('/(time=)(.+?)(\s)/i'$log$timesPREG_PATTERN_ORDER); 
If that doesn't do it, then perhaps there is some strange configuration/compilation error in PHP as it pertains to PCRE.
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Web Conversion Software on Facebook !! :)
chump2877 is offline   Reply With Quote
Old 02-26-2012, 09:33 AM   PM User | #253
bedo1975
New Coder

 
Join Date: Feb 2012
Posts: 29
Thanks: 1
Thanked 0 Times in 0 Posts
bedo1975 is an unknown quantity at this point
hi chump, I test now with you'r suggestion
bedo1975 is offline   Reply With Quote
Old 02-26-2012, 09:36 AM   PM User | #254
bedo1975
New Coder

 
Join Date: Feb 2012
Posts: 29
Thanks: 1
Thanked 0 Times in 0 Posts
bedo1975 is an unknown quantity at this point
Quote:
$numTimes = preg_match_all('/(time=)(.+?)(\s)/i', $log, $times, PREG_PATTERN_ORDER);
don't work on my server chump, I think it's right, configuration/compilation error in my php I will see
bedo1975 is offline   Reply With Quote
Old 02-26-2012, 05:55 PM   PM User | #255
orditeck
New to the CF scene

 
Join Date: Feb 2012
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
orditeck is an unknown quantity at this point
Hi,

I'm having an issue: the video doesn't seem to get downloaded by the server. It creates a 0ko file and then try to convert it. As you might guess, I get a convert error in the log.
cURL, ffmpeg and ffmpeg-php are installed and working.
PHP Version 5.3.2-1 ubuntu 4.14

For this video:
http://www.youtube.com/watch?v=do23sTe4dhA
it gives me this GetFlvUrl():
http://o-o.preferred.par08s01.v5.lsc...8db7b137b87610

I think the problem may be that link (it doesn't seem to be a FLV!)
so the problem may come from SetFlvUrl(), which is at the very moment:

PHP Code:
        private function SetFlvUrl($file_contents)
        {
            
$vidUrl '';
            if (
eregi('"url_encoded_fmt_stream_map": "url=',$file_contents))
            {
                
$vidUrl end(explode('"url_encoded_fmt_stream_map": "url=',$file_contents));
                
$vidUrl urldecode(urldecode(current(explode('\u0026',$vidUrl))));
            }
            
//die($vidUrl);
            
$this->_flvUrl $vidUrl;
        } 
Any idea?
Thanks in advance!

P.S: Sorry for my english I'm doing my best

Last edited by orditeck; 02-26-2012 at 06:18 PM..
orditeck is offline   Reply With Quote
Reply

Bookmarks

Tags
audio, class, conversion, dailymotion, ffmpeg, mp3, php, script, video, youtube

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:29 PM.


Advertisement
Log in to turn off these ads.