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 03-03-2013, 09:35 PM   PM User | #646
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by staticking29 View Post
I was having problems converting the videos so on my vps running ubuntu in the the logs it said that ffmpeg was no longer supported and it told me to use avconv instead found at http://libav.org/avconv.html so using my vps control panel webmin i was able to install the apt avconv pointed the directory to it and got the converstions working.I am new to all this but digging around the internet i found that as a solution
What version of Ubuntu are you using?

I am aware that FFmpeg is "deprecated" on at least Ubuntu systems. (I don't know if this affects other Linux versions as well.)

For example, when I enter just 'ffmpeg' in a command line prompt, I see the following output:

Code:
user@ubuntu:~$ ffmpeg
ffmpeg version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 18:03:14 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.
But, in general, and in my experience thus far, deprecated does not mean "non-functional".

I am currently using Ubuntu 12.04, and the FFmpeg package, while clearly deprecated, is still completely functional. All of my packages are up to date. So you must be using a higher version of Ubuntu? Or a different combination of packages?

Can you list all relevant packages that you are running on your machine and their version numbers? To do this, please run the following commands:

Code:
sudo apt-get install apt-show-versions
sudo apt-show-versions > /tmp/packages
Then attach the resulting 'packages' file to your next post in this thread.

In any case, as you have no doubt already discovered, 'avconv' is the replacement package for 'ffmpeg' (at least on Ubuntu). If you enter 'avconv' in a command prompt, you get:

Code:
user@ubuntu:~$ avconv
avconv version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 18:03:14 with gcc 4.6.3
The version of avconv is identical to the ffmpeg package version.

(I wonder if you now try to run ffmpeg, with avconv now installed, if ffmpeg will work? Because I have both running on my system. I did not explicitly install avconv, but I'm thinking perhaps avconv was automatically installed as a dependency when I installed the ffmpeg -- or some related -- package?)

Anyway, in the end, and at some point in the future, it can be reasonably assumed that the ffmpeg package will no longer work, and instead the avconv package will be required to handle media file conversions (at least on Ubuntu).

avconv uses the same syntax as ffmpeg. For example, the following command converts a FLV file to MP3:

Code:
sudo /usr/bin/avconv -i /home/user/public_html/VideoConverter-Linux-SVN/videos/1362345187_5133bce3ba3367.27400342.flv -vol 256 -y -acodec libmp3lame -ab 128k /home/user/public_html/VideoConverter-Linux-SVN/output/myNewMp3File.mp3
So, if you substitute the ffmpeg location with the avconv location (in the config.class.php file), then my app will continue to work as expected, i.e.:

PHP Code:
const _FFMPEG '/usr/bin/avconv'
This applies to both the paid-for, Linux version of my app as well as the free, Linux version of my app. Windows and XAMPP users will not be affected by this, for either the free or paid-for versions.

To reiterate, a simple modification to the _FFMPEG constant value (as indicated above) is all that is required to use avconv for conversions.

If there are any further issues regarding ffmpeg and avconv, please do let me know. I will facilitate the transition from ffmpeg to avconv in the next release of both the free and paid-for versions of my software.

Edit: Please also check out this forum thread: http://superuser.com/questions/50738...v-avconv-today

An excerpt from that thread:

Quote:
Some time ago ffmpeg split into two forks under the name of ffmpeg and libav.

Debian is following the libav fork in it's distribution and in an upcoming upload the binary /usr/bin/ffmpeg will be replaced by /usr/bin/avconf.
(Please note that, in Ubuntu, the binary location is '/usr/bin/avconv' and NOT '/usr/bin/avconf' -- as the excerpt states.)

So it would seem that, for now, only Debian and Ubuntu are experiencing this migration from ffmpeg to avconv. FFmpeg is still very much alive and implemented by other Linux OS versions.
__________________
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; 03-03-2013 at 10:26 PM..
chump2877 is online now   Reply With Quote
Old 03-04-2013, 03:24 AM   PM User | #647
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by belgin fish View Post
I'm having a small issue as well, I've searched the thread and can't seem to find a solution.

Everything is converted just fine, although the progress bar is not working. It just stays at Converting video. . . and shows no progress. The video file also isn't deleted after the conversion is done so I'm assuming I'm running into an issue with ffmpeg_progress.php being executed, any ideas?

Thanks
I can confirm that there is an issue here with the free version of my software. After discussing this with you via Skype, it is apparent that some Linux OS's and/or different versions/variations of FFmpeg can cause FFmpeg log files (produced during media file conversions) to be formatted in different ways.

My app's conversion progress bar relies on repeatedly reading and parsing FFmpeg log files in order to determine conversion progress. So, if the code used to parse the log files comes across a new log file format, then this will confuse code that was not programmed to recognize the additional format.

Thus, I will update the free version of my app to recognize variations in FFmpeg log file formatting. The only code to change is in ffmpeg_progress.php, and the relevant excerpt of code is as follows:

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)
            {
                
$lastTime end($times[2]);
                if (
preg_match('/(\d\d):(\d\d):(\d\d\.\d\d)/'$lastTime$timeParts) == 1)
                {
                    
$lastTime = ((int)$timeParts[1] * 60 60) + ((int)$timeParts[2] * 60) + (float)$timeParts[3];
                }
                
$currentTime = (float)$lastTime;
                
$progress round(($currentTime $totalTime) * 100);
                if (
$progress 100 && preg_match('/muxing overhead/i'$log) != 1)
                {
                    
$newLogLength $file_size;
                }
                else
                {
                    
$progress 100;
                    
unlink($logFile);
                    if (
is_file(realpath(Config::_TEMPVIDDIR $uniqueId .'.flv')))
                    {
                        
unlink(realpath(Config::_TEMPVIDDIR $uniqueId .'.flv'));
                    }
                    if (
is_file(realpath(Config::_SONGFILEDIR $mp3File)))
                    {
                        
$conversionSuccess 1;
                    }
                }
            } 
I will post the latest files distribution for the free version of my app shortly. Stay tuned....
__________________
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; 03-04-2013 at 03:28 AM..
chump2877 is online now   Reply With Quote
Old 03-04-2013, 03:36 AM   PM User | #648
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
The new (updated and hopefully stable) distribution of files is located at the bottom of this post.

Quote:
PLEASE SEE THIS POST FOR IMPORTANT INFO REGARDING THE USE AND INSTALLATION OF THIS SCRIPT.

DO NOT USE THE ZIP DISTRIBUTION LOCATED AT THE ABOVE LINKED PAGE. USE ONLY THE ZIP FILE ATTACHED TO THE BOTTOM OF THIS POST.
New in this release:

1) Code now accommodates variations in FFmpeg log file formatting, which is required for building the conversion progress bar.

The paid-for version of the app is not affected by this issue because it already recognizes variations in FFmpeg log formats. Thus, the full version of the software will continue to function as before -- perfectly!!

As always, please let me know if you have any questions/concerns regarding the above and/or the code.
Attached Files
File Type: zip 3-3-13.zip (7.2 KB, 75 views)
__________________
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; 03-04-2013 at 03:38 AM..
chump2877 is online now   Reply With Quote
Old 03-04-2013, 03:54 AM   PM User | #649
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Shenita574 View Post
i used your code and translated it to Hebrew..
Well done!

Maybe in a future release I will include language files, so that your app users/site visitors can change the default language of the software on the fly.

Of course, to do that, I will need people to contribute language files. I don't know when exactly I will get around to implementing such functionality, but there's no time like the present to start submitting your language files for future inclusion in the software! (Hint, hint)
__________________
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 online now   Reply With Quote
Old 03-05-2013, 03:56 PM   PM User | #650
Nylan
New to the CF scene

 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Nylan is an unknown quantity at this point
Hi,

I really don't understand what's going on with the script on my server.
I've just extracted it, but it's not even downloading anything... Actually, I think it's trying to download the video directly with the web browser. ( with chrome ) IE and Firefox are crashing.

Can you please have a look ? http://nylan.info/video2mp3/
Many thanks.
Nylan is offline   Reply With Quote
Old 03-06-2013, 04:28 AM   PM User | #651
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by Nylan View Post
Hi,

I really don't understand what's going on with the script on my server.
I've just extracted it, but it's not even downloading anything... Actually, I think it's trying to download the video directly with the web browser. ( with chrome ) IE and Firefox are crashing.

Can you please have a look ? http://nylan.info/video2mp3/
Many thanks.
That URL gives me a 404 Not Found error. Is your site online?

Is this regarding the free or paid-for version?

Can you describe in more detail exactly what is happening?
__________________
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 online now   Reply With Quote
Old 03-06-2013, 06:03 AM   PM User | #652
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
I wanted to point out a few common pitfalls that users of the paid-for version of my software have reported when trying to set up and configure the browser bookmarklet/plugin:
  1. Please review what a bookmarklet is.
  2. The bookmarklet is designed to be launched on either a YouTube or Dailymotion.com video page, and allows your users to initiate video conversions directly from the video hosting site. The bookmarklet will not convert videos if launched and run on your own website!
  3. The provided bookmarklet link in bookmarklet.php must be dragged to the browser's bookmarks bar/menu in order to be installed in the browser (as a new button or link).
  4. Please review bookmarklet.php as well as related settings in config.class.php to learn more about bookmarklet configuration and customization.
  5. The bookmarklet submits a POST request from the video hosting site to your site. Thus, for the sake of simplicity, I recommend that you do not change conversion form element name attributes in index.php. If you do, the bookmarklet will not be able to "talk" to your site and initiate a remote conversion. However, if you must change name attribute values for form elements in your index.php, then you should also edit the same values in bookmarkletContent['bookmarklet-container-div-content'] in Bookmarklet "class" in bookmarklet.js AND/OR in $output variable in getFileTypes.php.

Hope it helps!
__________________
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 online now   Reply With Quote
Old 03-21-2013, 03:29 AM   PM User | #653
zhanly
New to the CF scene

 
Join Date: Jul 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
zhanly is an unknown quantity at this point
did youtube just changed something? I tried the free version but it can't convert any video.
zhanly is offline   Reply With Quote
Old 03-21-2013, 03:55 AM   PM User | #654
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by zhanly View Post
did youtube just changed something? I tried the free version but it can't convert any video.
I can confirm that something seems to have changed on YouTube's end of things. Both free and paid-for versions are currently not working due to this.

I will provide a fix for both versions as soon as possible. Thanks for your patience.
__________________
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 online now   Reply With Quote
Users who have thanked chump2877 for this post:
rbisconti97 (03-21-2013)
Old 03-21-2013, 05:16 AM   PM User | #655
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Here is the preliminary fix for YouTube's recent changes to their site:

--- Free Version ---

In YouTubeToMp3Converter.class.php, in the SetFlvUrls() method, change this line:

PHP Code:
if (preg_match('/(yt\.playerConfig =)([^\r\n]+)/'$file_contents$matches) == 1
...to:

PHP Code:
if (preg_match('/(ytplayer\.config = )([^\r\n]+?)(;<\/script>)/'$file_contents$matches) == 1
--- Paid Version ---

In VideoConverter.class.php, in the SetVidSourceUrls() method, change this line:

PHP Code:
if (preg_match('/(yt\.playerConfig =)([^\r\n]+)/'$file_contents$matches) == 1
...to:

PHP Code:
if (preg_match('/(ytplayer\.config = )([^\r\n]+?)(;<\/script>)/'$file_contents$matches) == 1
--- Stay tuned. . . ---

Essentially, the same fix for both free and paid-for versions. Seems to be a very minor change to the format in which the YouTube video URLs are provided.

Shortly, I will post a new, fixed/patched copy of the free version to this forum thread. I will also e-mail an updated copy to all existing customers/users of the paid-for version of my software, via the email addresses that you provided at Tradebit.com. Both updates will be accompanied by new posts to this thread.

Please let me know if there are any questions or concerns about this new update to the software.
__________________
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; 03-21-2013 at 06:50 AM..
chump2877 is online now   Reply With Quote
Users who have thanked chump2877 for this post:
zhanly (03-21-2013)
Old 03-21-2013, 07:18 AM   PM User | #656
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
The new (updated and hopefully stable) distribution of files is located at the bottom of this post.

Quote:
PLEASE SEE THIS POST FOR IMPORTANT INFO REGARDING THE USE AND INSTALLATION OF THIS SCRIPT.

DO NOT USE THE ZIP DISTRIBUTION LOCATED AT THE ABOVE LINKED PAGE. USE ONLY THE ZIP FILE ATTACHED TO THE BOTTOM OF THIS POST.
New in this release:

1) There was a minor change to the format in which the YouTube video URLs are provided. This fix addresses that change.

I will soon be updating the paid-for version of the app as well, and I will email an updated (free) copy to all those who have already purchased the script. (Updates will be sent to your Tradebit email addresses only.)

As always, please let me know if you have any questions/concerns regarding the above and/or the code.
Attached Files
File Type: zip 3-21-13.zip (7.1 KB, 222 views)
__________________
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 online now   Reply With Quote
Old 03-21-2013, 07:38 AM   PM User | #657
ivink3aray
New to the CF scene

 
Join Date: Mar 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ivink3aray is an unknown quantity at this point
Hello chump2877,

I want to buy your script, but I can't get the settings linux server, can you support for server configuration ?
ivink3aray is offline   Reply With Quote
Old 03-21-2013, 07:48 AM   PM User | #658
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Quote:
Originally Posted by ivink3aray View Post
Hello chump2877,

I want to buy your script, but I can't get the settings linux server, can you support for server configuration ?
Are you asking if I can install the script for you on your server? I can install the script and all required dependencies on an Ubuntu Linux server. (For an extra fee...)

General instructions for server configuration and script installation are also included in the paid-for version.
__________________
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 online now   Reply With Quote
Old 03-21-2013, 08:08 AM   PM User | #659
ivink3aray
New to the CF scene

 
Join Date: Mar 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ivink3aray is an unknown quantity at this point
Quote:
Originally Posted by chump2877 View Post
Are you asking if I can install the script for you on your server? I can install the script and all required dependencies on an Ubuntu Linux server. (For an extra fee...)

General instructions for server configuration and script installation are also included in the paid-for version.

Yes install on my server.

How much your price (script + fee installation) ?
ivink3aray is offline   Reply With Quote
Old 03-21-2013, 08:35 AM   PM User | #660
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,549
Thanks: 15
Thanked 131 Times in 124 Posts
chump2877 is on a distinguished road
Hello everyone,

I have just finished updating the paid-for version of my software. New in this version:
  1. There was a minor change to the format in which the YouTube video URLs are provided. This fix addresses that change.

The following files/directories were changed/added:
  1. VideoConverter.class.php updated

All previous customers who have purchased the paid-for version of my app are receiving this new, updated version via the e-mail addresses that you provided at Tradebit.com.

Please report any issues with either the paid-for version or the free version in this forum thread. Your feedback is encouraged. Donations are welcome!

Thanks!
__________________
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 online now   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 02:21 PM.


Advertisement
Log in to turn off these ads.