I was able to convert the video at that URL (the Maroon 5 song)...
So if the code is working for me, and I was able to convert a video that you are not able to convert, then I can only assume the problem is with your server setup...
If it was working for you before, then your server setup must have changed recently. I would:
1) Turn error handling on in the code (comment out ini_set('display_errors',0)
2) Check your server error logs
3) Make sure FFmpeg is functional within your server setup
4) Download a fresh copy of FFmpeg
5) Make sure that you can execute commands on the server with PHP's exec()
Also I saw a comment somewhere else in this thread about which PHP version can run this code. Since my code uses PHP 5 OOP, it should be run on PHP 5 or higher.
i found error in error log:
[22-Jul-2011 16:07:22] PHP Fatal error: Maximum execution time of 1 second exceeded in /home/user/public_html/YouTubeToMp3Converter.class.php on line 78
in my index.php....Or just comment that line out....I honestly can't remember why I set that to '0'...It might be some left over code that I never removed, and possibly an error on my part?
Hope it helps.
Quote:
Originally Posted by chump2877
I honestly can't remember why I set that to '0'...
The maximum execution time, in seconds. If set to zero, no time limit is imposed.
Whether or not the following 2 lines of code are equivalent in terms of what they accomplish, I'm not sure:
PHP Code:
set_time_limit(0); // or
ini_set('max_execution_time',0);
So you might also try replacing the existing ini_set() call with a set_time_limit() call, as illustrated above.
This seems to corroborate that the following lines of code do in fact do the same thing:
PHP Code:
set_time_limit(0); // or
ini_set('max_execution_time',0);
...even though this is not made abundantly clear in the PHP manual (at least per my understanding of it)...
Also, you could try adding either of those lines of code to the top of YouTubeToMp3Converter.class.php, since that is where the error occurred for you...
it's converting now but one more error found.
when i start ripping i got error Error downloading video!
can't download many videos but same videos can download & convert succesfully.
So why i geting Error downloading video! even videos are playing fine on youtube.
How experienced are you with PHP? With some knowledge of PHP programming, this shouldn't be that hard to troubleshoot...
The error you are receiving is due to the DownloadVideo() method failing:
PHP Code:
function DownloadVideo($youTubeUrl)
{
$file_contents = file_get_contents($youTubeUrl);
if ($file_contents !== false)
{
$this->SetSongFileName($file_contents);
$this->SetFlvUrl($file_contents);
if ($this->GetSongFileName() != '' && $this->GetFlvUrl() != '')
{
return $this->SaveVideo($this->GetFlvUrl());
}
}
return false;
}
Whch means any of the following could be an issue here:
1) You have entered an invalid YouTube URL into the application
2) The regex used to obtain the FLV file name is not working
3) The regex used to extract the song name is not working
But before you start investigating those possibilities, you should do as I said earlier for your previous problem:
1) Turn error handling on in the code (comment out ini_set('display_errors',0)
2) Check your server error logs
hey i just try this script on my another server & there working fine.
that means problem in my server,so can you give me server requirement then i can check,whats problem in server.
compare the php.ini of one server to the other...You could also download XAMPP and check the default PHP configuration there...I run the app inside XAMPP successfully