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 07-31-2012, 05:42 AM   PM User | #421
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by bbrog View Post
Hi, yes all mp3's show up with 0kbps. I used windows 7.

Just sent you the email.

Thanks!
Hi, I received your mp3 file, and I can verify that the bitrate displays as 0k in Windows 7. However, when I open the mp3 file in VLC media player it shows 32K bitrate.

I tried to reproduce the problem here. I accessed my software (running on an Ubuntu server, over the internet) on my Windows 7 machine using FireFox. The downloaded mp3 was 320k bitrate, just like I requested.

I can't explain why this is happening to you, and I can't reproduce the problem.

If others start to have this problem, then I will reassess the situation at that time. At this point, though, my guess is the problem is isolated to your installation on your server. Sorry I couldn't help more.

Quote:
Edit: One last thing to try: Paste a copy of the log file generated by FFmpeg when converting your mp3's, and I will take a quick look to see if something funny is going on...
__________________
Regards, R.J.

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

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]

Last edited by chump2877; 07-31-2012 at 05:46 AM..
chump2877 is offline   Reply With Quote
Old 07-31-2012, 06:12 AM   PM User | #422
bbrog
New Coder

 
Join Date: Jun 2012
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
bbrog is an unknown quantity at this point
Hi, thanks. On other players such as realplayer it shows 320kbps as bitrate. Below is my log file

Code:
ffmpeg version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jun 12 2012 16:52:09 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[matroska,webm @ 0x13109c0] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 23.98 (24000/1001)
Input #0, matroska,webm, from 'videos/1343690527_5017171faa34e3.89176466.flv':
  Duration: 00:03:46.82, start: 0.000000, bitrate: N/A
    Stream #0.0(eng): Video: vp8, yuv420p, 1920x1080, PAR 1:1 DAR 16:9, 1k fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0.1: Audio: vorbis, 44100 Hz, stereo, s16 (default)
Output #0, mp3, to 'mp3/We_Are_Young_-_Fun_Ft_Janelle_Monae_Alvin_Risk_Remix_Part_2.mp3':
  Metadata:
    TSSE            : Lavf53.21.0
    Stream #0.0: Audio: libmp3lame, 44100 Hz, stereo, s16, 327 kb/s (default)
Stream mapping:
  Stream #0.1 -> #0.0
Press ctrl-c to stop encoding
size=     455kB time=11.65 bitrate= 320.1kbits/s    
size=     925kB time=23.67 bitrate= 320.0kbits/s    
size=    1407kB time=36.02 bitrate= 320.0kbits/s    
size=    1878kB time=48.07 bitrate= 320.0kbits/s    
size=    2344kB time=60.00 bitrate= 320.0kbits/s    
size=    2807kB time=71.86 bitrate= 320.0kbits/s    
size=    3263kB time=83.54 bitrate= 320.0kbits/s    
size=    3716kB time=95.14 bitrate= 320.0kbits/s    
size=    4093kB time=104.78 bitrate= 320.0kbits/s    
size=    4544kB time=116.32 bitrate= 320.0kbits/s    
size=    5011kB time=128.29 bitrate= 320.0kbits/s    
size=    5464kB time=139.89 bitrate= 320.0kbits/s    
size=    5929kB time=151.77 bitrate= 320.0kbits/s    
size=    6387kB time=163.50 bitrate= 320.0kbits/s    
size=    6846kB time=175.26 bitrate= 320.0kbits/s    
size=    7307kB time=187.06 bitrate= 320.0kbits/s    
size=    7716kB time=197.54 bitrate= 320.0kbits/s    
size=    8122kB time=207.91 bitrate= 320.0kbits/s    
size=    8553kB time=218.96 bitrate= 320.0kbits/s    
size=    8862kB time=226.87 bitrate= 320.0kbits/s    
video:0kB audio:8862kB global headers:0kB muxing overhead 0.001510%
bbrog is offline   Reply With Quote
Old 08-01-2012, 03:17 AM   PM User | #423
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
What happens when you modify the existing FFmpeg command in YouTubeToMp3Converter.class.php:

PHP Code:
$exec_string parent::_FFMPEG.' -i '.$this->GetTempVidFileName().' -vol '.parent::_VOLUME.' -y -acodec libmp3lame -ab '.$quality.'k '.$this->GetSongFileName() . ' 2> logs/' $this->_uniqueID '.txt'
...and change:

PHP Code:
-ab '.$quality.'k  
to one of the following:

PHP Code:
-'.$quality.'k  
PHP Code:
-b:'.$quality.'k  
PHP Code:
-b:a:'.$quality.'k  
PHP Code:
-b:a:'.$quality.'k  
What I'm reading is that Libav (what you and I are both running under the guise of FFmpeg) is actually a fork of FFmpeg that has become the standard package installed for Debian/Ubuntu machines (when you do an apt-get install ffmpeg)....

Libav and FFmpeg are being developed in parallel and are very, very similar...but there are some nuances between the two projects, and I expect they are more evident as the projects continue to diverge...

You are using a later version of Libav...I am running the following:

Code:
ffmpeg version 0.7.6-4:0.7.6-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers
  built on Jun 12 2012 16:28:10 with gcc 4.6.1
So perhaps the old FFmpeg audio bitrate flag -ab is behaving strangely in your version of Libav, and instead, the Libav implementation of audio bitrate should be used instead:

http://libav.org/avconv.html#Stream-specifiers-1
http://libav.org/avconv.html#Codec-AVOptions

Let me know if implementing any of my suggestions helps, and if so, I will make adjustments to my code accordingly. Perhaps I can put the FFmpeg command in the config file, and provide different FFmpeg command options depending on the version of FFmpeg and/or Linux platform being used. We'll see...
__________________
Regards, R.J.

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

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Old 08-02-2012, 01:28 AM   PM User | #424
bbrog
New Coder

 
Join Date: Jun 2012
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
bbrog is an unknown quantity at this point
Hi, I tried all 4 alternatives that you posted and they did not solve the issue.

Do let me know.

Thanks!
bbrog is offline   Reply With Quote
Old 08-02-2012, 02:02 AM   PM User | #425
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by bbrog View Post
Hi, I tried all 4 alternatives that you posted and they did not solve the issue.

Do let me know.

Thanks!
That was my best guess as to how to fix your problem. If it's still not working for you, then I do not know what your issue is, and I will assume that the problem is exclusive to your installation on your server.
__________________
Regards, R.J.

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

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Old 08-03-2012, 09:26 PM   PM User | #426
appletown
New to the CF scene

 
Join Date: Aug 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
appletown is an unknown quantity at this point
This is a total noob question, but I wanted to make sure before I started. If I wanted to use this for personal use only, I could set up an apache server and do all the set-up, and still use the app connected to
Code:
localhost
only correct?
appletown is offline   Reply With Quote
Old 08-03-2012, 09:46 PM   PM User | #427
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by appletown View Post
This is a total noob question, but I wanted to make sure before I started. If I wanted to use this for personal use only, I could set up an apache server and do all the set-up, and still use the app connected to
Code:
localhost
only correct?
Yup, if the index.php resides in the web root directory of your server, then you only need to type "localhost" in browser address bar...Of course, I'm assuming that you are using the app on the same machine where it is installed..If you're on a network, and accessing a remote (network) installation, then you would put the IP address of the machine where the app is installed in the address bar...
__________________
Regards, R.J.

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

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]

Last edited by chump2877; 08-03-2012 at 09:51 PM..
chump2877 is offline   Reply With Quote
Users who have thanked chump2877 for this post:
appletown (08-03-2012)
Old 08-03-2012, 09:56 PM   PM User | #428
appletown
New to the CF scene

 
Join Date: Aug 2012
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
appletown is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
Yup, if the index.php resides in the web root directory of your server, then you only need to type "localhost" in browser address bar...Of course, I'm assuming that you are using the app on the same machine where it is installed..If you're on a network, and accessing a remote (network) installation, then you would put the IP address of the machine where the app is installed in the address bar...
Super, just as i suspected/hoped. Thanks so much for the source as well man. <internetHighFive />!
appletown is offline   Reply With Quote
Old 08-17-2012, 03:05 AM   PM User | #429
bbrog
New Coder

 
Join Date: Jun 2012
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
bbrog is an unknown quantity at this point
Hi, today my script all of the sudden just stopped working. It downloads the video and when it gets to converting nothing happens at all.

Please do let me know asap thanks!
bbrog is offline   Reply With Quote
Old 08-17-2012, 03:22 AM   PM User | #430
bbrog
New Coder

 
Join Date: Jun 2012
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
bbrog is an unknown quantity at this point
hmm strange it started working again. Get a lot of complaints from my users that at times the script does not work the way its suppose to below are the problems that we have run into so far incase it helps you in your future release:

1.) Video downloads and converts to 100% and nothing happens
2.) Video downloads and converting part does nothing.
3.) video does not download and does not convert

This stuff happens randomly but then automatically starts working.

Do let me know thanks!
bbrog is offline   Reply With Quote
Old 08-17-2012, 05:00 AM   PM User | #431
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by bbrog View Post
hmm strange it started working again. Get a lot of complaints from my users that at times the script does not work the way its suppose to below are the problems that we have run into so far incase it helps you in your future release:

1.) Video downloads and converts to 100% and nothing happens
2.) Video downloads and converting part does nothing.
3.) video does not download and does not convert

This stuff happens randomly but then automatically starts working.

Do let me know thanks!
I'm not having any of these problems. Everything is working ok for me. If I can't reproduce the problem, then I can't fix the problem.

What specific video (or videos) are you trying to convert? If you enable error reporting with PHP, do you see any errors in the browser? In the server error log? Can you paste the AJAX response text(s) that you are receiving during conversion? (hint: Check the Console tab of Firebug in Firefox.) Can you paste the FFmpeg log or logs? What software and version numbers do you have installed on your server? Are directories set to the correct permissions? If your code is publicly available, what is the URL of your web site?

Again, it's entirely possible that all of these problems you are having are isolated to your installation on your server. So instead of troubleshooting the code (which is working elsewhere), we may need to troubleshoot your installation and server configuration.
__________________
Regards, R.J.

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

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Old 08-24-2012, 05:38 PM   PM User | #432
blacktiger786
New Coder

 
Join Date: May 2012
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
blacktiger786 is an unknown quantity at this point
hi chump i want add some limit on my script like i want when video increase 10 min lenght
or 10mb size its not convert what i do? please fast reply
blacktiger786 is offline   Reply With Quote
Old 08-24-2012, 05:56 PM   PM User | #433
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by blacktiger786 View Post
hi chump i want add some limit on my script like i want when video increase 10 min lenght
or 10mb size its not convert what i do? please fast reply
Someone else was wanting a way to do this earlier, and I sent the following message to him/her at that time. Perhaps it will help you:

Quote:
I see 2 ways to get remote file size and cancel the download/conversion if the file is too big (per some predefined MAX_FILE_SIZE constant in your script):

1) Try the solution suggested here: http://www.codingforums.com/showpost...&postcount=112. That post links to some example code here: http://www.php.net/manual/en/functio...size.php#92462. This method allows you to gauge file size before actually downloading the file (by only downloading the HTTP headers).

2) Another way to do this is to leverage the CURLOPT_WRITEFUNCTION callback to gauge file size as the download is in progress. See these links:

http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
http://curl.haxx.se/libcurl/php/examples/callbacks.html

The CURLOPT_WRITEFUNCTION callback receives the number of bytes written -- either since the last time the callback fired, or the total number of bytes received during the cURL session -- i'm not sure which.

If the CURLOPT_WRITEFUNCTION receives the total number of bytes received for the current download, then it's just a matter of returning something other than the number of bytes received inside the callback function -- when the total bytes received exceeds the maximum download size -- to force the cURL download to abort with an error. (This callback must return the number of bytes received in order to sustain the cURL process.)

If the CURLOPT_WRITEFUNCTION receives the number of bytes received since the last time the callback was executed, then the strategy is a little more complex. You'll need to set up a class field/variable to store the growing number of bytes downloaded. And every time the callback fires, you'll need to increment this class variable by the current number of bytes received by the callback -- and then check to see if the class variable exceeds your maximum download size. When your class variable exceeds maximum download size, after many calls to the callback function, then in the final call to the callback function you can return something other than the number of bytes received to cause the cURL process to abort.

Once you have determined that the downloaded file is too large, and you have aborted the cURL process, then you can delete the partially downloaded file off the server. And serve an error message to the user.
The person said he/she tried the above, but couldn't get it to work. (I haven't tried any of the above solutions, but in theory, it seems like they could work.) Instead, he/she offered the following alternative:

Quote:
I came up with a simple solution by using the duration of the video

Here is my code: http://pastie.org/private/t2tsxrxfd351ohbfd9njka

The first part extracts the video ID and the second part gets the length of it.
Once the length has been fetched it multiplies it with 23 which is the average size for 1 second on a medium quality FLV video. If the size then is larger than the limit it will echo an error.
I'm just quickly regurgitating an old conversation here and hoping you can glean some benefit from it. It seems like it applies to your situation...
__________________
Regards, R.J.

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

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]

Last edited by chump2877; 08-24-2012 at 06:04 PM.. Reason: fixed links
chump2877 is offline   Reply With Quote
Old 08-24-2012, 06:19 PM   PM User | #434
blacktiger786
New Coder

 
Join Date: May 2012
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
blacktiger786 is an unknown quantity at this point
Code:
Here is my code: http://pastie.org/private/t2tsxrxfd351ohbfd9njka
maybe its code working fine but i don't know where i put this code file name and fuction name etc
blacktiger786 is offline   Reply With Quote
Old 08-24-2012, 08:19 PM   PM User | #435
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,548
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by blacktiger786 View Post
Code:
Here is my code: http://pastie.org/private/t2tsxrxfd351ohbfd9njka
maybe its code working fine but i don't know where i put this code file name and fuction name etc
If you want me to write the code for you, then I am available to do so at my hourly rate/fee. I simply don't have the time at the moment to do this for free.

In lieu of paying me or someone else to do the work, I would hope that you would take the suggestions that I've provided you here and try to run with them. Let me know how it goes, and you can return here if you need further assistance during the process.
__________________
Regards, R.J.

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

Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
[Related videos and tutorials are also available at my YouTube channel]
chump2877 is offline   Reply With Quote
Reply

Bookmarks

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

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 05:56 AM.


Advertisement
Log in to turn off these ads.