I've installed the files on Ubuntu and it's working. Just FYI. Will work on a tutorial. I mostly used the Synaptic Package Manager instead of the command line for installing packages. Will update this thread as soon as I can!
Announcement
Collapse
No announcement yet.
YouTube-to-MP3 conversion - PHP class and script
Collapse
X
-
Regards, R.J.
---------------------------------------------------------
Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
[Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
Explore all products and services, view demos, review documentation, check prices, and more!
♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪
-
-
OK, the new (updated and hopefully stable) distribution of files is located at the bottom of this post.
File system structure for XAMPP for Windows (you will need to download ffmpeg.exe from the FFMPEG site, as instructed earlier in this thread):
C:\xampp\htdocs\VideoToMp3Converter\logs
C:\xampp\htdocs\VideoToMp3Converter\mp3
C:\xampp\htdocs\VideoToMp3Converter\videos
C:\xampp\htdocs\VideoToMp3Converter\config.class.php
C:\xampp\htdocs\VideoToMp3Converter\exec_ffmpeg.php
C:\xampp\htdocs\VideoToMp3Converter\ffmpeg.exe
C:\xampp\htdocs\VideoToMp3Converter\ffmpeg_progress.php
C:\xampp\htdocs\VideoToMp3Converter\index.php
C:\xampp\htdocs\VideoToMp3Converter\YouTubeToMp3Converter.class.php
File system structure for Apache on Ubuntu 11.10 (Linux):
/home/user/public_html/youtube/logs
/home/user/public_html/youtube/mp3
/home/user/public_html/youtube/videos
/home/user/public_html/youtube/config.class.php
/home/user/public_html/youtube/exec_ffmpeg.php
/home/user/public_html/youtube/ffmpeg_progress.php
/home/user/public_html/youtube/index.php
/home/user/public_html/youtube/YouTubeToMp3Converter.class.php
In Config class in config.class.php, set _FFMPEG constant to:
1) For XAMPP for Windows:
PHP Code:const _FFMPEG = 'ffmpeg.exe';
PHP Code:const _FFMPEG = '/usr/bin/ffmpeg';
For Ubuntu (Linux) users, I will try to explain the additional steps required to configure this application. Warning: I am not a Linux expert nor am I a command line expert! Also, I installed the application on a full, desktop version of Ubuntu on my development machine. Thus, the burden falls on you to adapt these instructions for a commercially hosted VPS (that may only provide a command line interface):
1) Move the web root to /home/user/public_html/ from /var/www/ if you haven't already (if it's not already done for you) by following directions here (scroll to the "Changing the default localhost folder" subhead): http://maketecheasier.com/install-an...ntu/2011/03/09. (Doing this helped me solve all kinds of file permissions headaches when not operating as the 'root' user.)
2) A history of the packages I installed:
Installed the following packages:
apache2 (2.2.20-1ubuntu1.1)
apache2-mpm-worker (2.2.20-1ubuntu1.1)
apache2-utils (2.2.20-1ubuntu1.1)
apache2.2-bin (2.2.20-1ubuntu1.1)
apache2.2-common (2.2.20-1ubuntu1.1)
libapr1 (1.4.5-1)
libaprutil1 (1.3.12+dfsg-2)
libaprutil1-dbd-sqlite3 (1.3.12+dfsg-2)
libaprutil1-ldap (1.3.12+dfsg-2)
Removed the following packages:
apache2-mpm-worker
Installed the following packages:
apache2-mpm-itk (2.2.20-1ubuntu1.1)
libapache2-mod-php5filter (5.3.6-13ubuntu3.5)
php5 (5.3.6-13ubuntu3.5)
php5-cli (5.3.6-13ubuntu3.5)
php5-common (5.3.6-13ubuntu3.5)
Installed the following packages:
curl (7.21.6-3ubuntu3.2)
libcurl3 (7.21.6-3ubuntu3.2)
Installed the following packages:
ffmpeg (4:0.7.3-0ubuntu0.11.10.1)
libavcodec53 (4:0.7.3-0ubuntu0.11.10.1)
libavdevice53 (4:0.7.3-0ubuntu0.11.10.1)
libavfilter2 (4:0.7.3-0ubuntu0.11.10.1)
libavformat53 (4:0.7.3-0ubuntu0.11.10.1)
libavutil51 (4:0.7.3-0ubuntu0.11.10.1)
libdc1394-22 (2.1.3-4)
libgsm1 (1.0.13-3)
libpostproc52 (4:0.7.3-0ubuntu0.11.10.1)
libschroedinger-1.0-0 (1.0.10-2.1)
libswscale2 (4:0.7.3-0ubuntu0.11.10.1)
libva1 (1.0.12-2)
libvpx0 (0.9.6-1)
Installed the following packages:
php5-curl (5.3.6-13ubuntu3.5)
Installed the following packages:
php5-ffmpeg (0.6.0-2ubuntu2)
php5-gd (5.3.6-13ubuntu3.5)
Installed the following packages:
libmp3lame0 (3.98.4-0ubuntu1)
Removed the following packages:
libavcodec53
libavutil51
Installed the following packages:
libavcodec-extra-53 (4:0.7.3ubuntu0.11.10.1)
libavutil-extra-51 (4:0.7.3ubuntu0.11.10.1)
libdirac-encoder0 (1.0.2-4)
libopenjpeg2 (1.3+dfsg-4)
libvo-aacenc0 (0.1.1-1)
libvo-amrwbenc0 (0.1.1-1)
libx264-116 (2:0.116.2042+git178455c-1ubuntu1)
libxvidcore4 (2:1.3.2-3)
3) You may need to restart Apache after all packages have been installed (or in between installations?) via the command line:
$sudo service apache2 stop
$sudo service apache2 start
4) Make sure the following lines appear in your php.ini:
extension=curl.so
extension=ffmpeg.so
5) Set write permissions on the following directories: chmod 777 mp3, chmod 777 videos, chmod 777 logs
6) software.xml should be set to chmod 0777, or the lowest permissions possible that still enable programmatic modification of this file. There should be no need to edit software.xml, and thus modifying this file is strongly discouraged.
7) The root directory where my software is installed should also be set to the lowest permissions possible that still enable programmatic creation, opening, and modification of the containing files. In the example file system structures above, those directories are 'C:\xampp\htdocs\VideoToMp3Converter' and '/home/user/public_html/youtube/'.
Finally, zemaitis, or anyone else familiar with the Linux command line interface, it would be great if you could adapt all of this for the command line and publish the result here! It would certainly help me and any others using this script on commercially hosted servers.
As always, please let me know if you have any questions/concerns regarding the above and/or the code.
See the new zip file below:
. . . !! ALERT !!- Windows and XAMPP users, you MUST read this post first (before installing/configuring my app)! The latest static builds of ffmpeg.exe will not work with my code!
- Please download the older build of ffmpeg.exe required for my app HERE.
- (Because the file is over 4 MB and this forum doesn't allow large file attachments, the file is being hosted at MEGA instead.)
- This does NOT affect Linux users.
Attached FilesLast edited by chump2877; Oct 29, 2014, 09:37 PM.Regards, R.J.
---------------------------------------------------------
Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
[Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
Explore all products and services, view demos, review documentation, check prices, and more!
♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪
Comment
-
Now im searching for a commercial vps, cause i sold mine because of script not working properly ;D
Also there exists one problem, if video is with symbol ž, in the final name of the file, there aren't any replacement for it. It would need to be z... I dont know how is there with letters ąčęėįšųūLast edited by zemaitis; Feb 12, 2012, 06:18 AM.
Comment
-
-
Originally posted by zemaitis View PostNow im searching for a commercial vps, cause i sold mine because of script not working properly ;D
Also there exists one problem, if video is with symbol , in the final name of the file, there aren't any replacement for it. It would need to be z... I dont know how is there with letters ąčęėį?ųūRegards, R.J.
---------------------------------------------------------
Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
[Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
Explore all products and services, view demos, review documentation, check prices, and more!
♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪
Comment
-
-
Originally posted by chump2877 View PostCan you give me a link to a YouTube video with characters like those in the title....I suspect there is a PHP extension that exposes functions capable of making the conversion...
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
That letters dissapear while converting, should be
ą -> a
č -> c
ę -> e
ė -> e
į -> i
? -> s
ų -> u
ū -> u
Also would be great if you do that compatible for all ur plugin versions.
Comment
-
-
Talking about dedicated host, the start should look like this (not all lines included..)
sudo apt-get update
sudo apt-get install apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
sudo apt-get remove apache2-mpm-worker
sudo apt-get install apache2-mpm-itk libapache2-mod-php5filter php5 php5-cli php5-common
Further i was unable to install nothing, for example it said that it is unable to find package libavcodec53
Comment
-
-
Originally posted by zemaitis View Posthttp://www.youtube.com/watch?v=5bbZRMf2zzE
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
That letters dissapear while converting, should be
ą -> a
č -> c
ę -> e
ė -> e
į -> i
? -> s
ų -> u
ū -> u
Also would be great if you do that compatible for all ur plugin versions.
PHP Code:function ExtractSongTrackName($vidSrc, $srcType)
{
$name = '';
$vidSrcTypes = $this->GetVidSrcTypes();
if (in_array($srcType, $vidSrcTypes))
{
$vidSrc = ($srcType == $vidSrcTypes[1]) ? file_get_contents($vidSrc) : $vidSrc;
if ($vidSrc !== false && eregi('eow-title',$vidSrc))
{
$name = end(explode('eow-title',$vidSrc));
$name = current(explode('">',$name));
$name = ereg_replace('[^-_a-zA-Z,"\' :0-9]', "", iconv("UTF-8", "ISO-8859-1//TRANSLIT", end(explode('title="', $name))));
}
}
return $name;
}
Regards, R.J.
---------------------------------------------------------
Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
[Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
Explore all products and services, view demos, review documentation, check prices, and more!
♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪
Comment
-
-
Originally posted by zemaitis View PostTalking about dedicated host, the start should look like this (not all lines included..)
sudo apt-get update
sudo apt-get install apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
sudo apt-get remove apache2-mpm-worker
sudo apt-get install apache2-mpm-itk libapache2-mod-php5filter php5 php5-cli php5-common
Further i was unable to install nothing, for example it said that it is unable to find package libavcodec53Regards, R.J.
---------------------------------------------------------
Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
[Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
Explore all products and services, view demos, review documentation, check prices, and more!
♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪
Comment
-
-
Thank you for the file name fixes, working very well!
Well, i decided to buy Windows VPS and to forget problems about linux
In my opinion, i have last question about the file names, how to fix the quotes, periods, brackets problem? For example, video
http://www.youtube.com/watch?v=nvmlr89qTTs called as „Žas- "Ji suka (gyvenimo ratu)" Gyvai 1997.“
extracts as „Zas- quotJi suka gyvenimo ratuquot Gyvai 1997“ (quotes written as the word quot,periods,brackets disappeared)Last edited by zemaitis; Feb 12, 2012, 12:15 PM.
Comment
-
-
Originally posted by zemaitis View Post
In my opinion, i have last question about the file names, how to fix the quotes, periods, brackets problem? For example, video
http://www.youtube.com/watch?v=nvmlr89qTTs called as „Žas- "Ji suka (gyvenimo ratu)" Gyvai 1997.“
extracts as „Zas- quotJi suka gyvenimo ratuquot Gyvai 1997“ (quotes written as the word quot,periods,brackets disappeared)
PHP Code:function ExtractSongTrackName($vidSrc, $srcType)
{
$name = '';
$vidSrcTypes = $this->GetVidSrcTypes();
if (in_array($srcType, $vidSrcTypes))
{
$vidSrc = ($srcType == $vidSrcTypes[1]) ? file_get_contents($vidSrc) : $vidSrc;
if ($vidSrc !== false && eregi('eow-title',$vidSrc))
{
$name = end(explode('eow-title',$vidSrc));
$name = current(explode('">',$name));
$name = html_entity_decode(iconv("UTF-8", "ISO-8859-1//TRANSLIT", end(explode('title="', $name))));
}
}
return $name;
}
Regards, R.J.
---------------------------------------------------------
Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
[Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
Explore all products and services, view demos, review documentation, check prices, and more!
♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪
Comment
-
-
Are there any necessary ports required to run this service? i have rent my vps on http://77.241.193.246/index.php but the script doesnt download files. Opened ports 80, 3306
It creates a file, but doesn't download http://www.part.lt/img/2801508fc3110...3a9dc1e281.JPG
or are there programs necessary like redistributable or newer media player?Last edited by zemaitis; Feb 13, 2012, 12:09 PM.
Comment
-
-
Running the script in XAMPP on Windows and running the script on an actual Windows server with Apache/PHP installed are two different animals. I have not tested the script in the latter environment.
And if you are running XAMPP on a Windows server that already has Apache/PHP installed, then you will have 2 different web roots and only one can be assigned localhost. I imagine there might be additional conflicts as well.
Moral of the story: If you are aiming to publish this on the web, then don't use XAMPP for Windows. Use a regular Windows or Linux server.
To answer your question about the ports: I have no idea.
But if you run this on a Windows server with Apache and PHP installed (as it seems you are), you'll want to research the right way to install/configure cURL in that setup: https://www.google.com/search?client...hannel=suggestRegards, R.J.
---------------------------------------------------------
Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
[Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
Explore all products and services, view demos, review documentation, check prices, and more!
♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪
Comment
-
-
-
Originally posted by zemaitis View PostEnabled curl in php.ini, everything works like a charm
Thank you chump for supporting me this all time. Was unexpected from the script admin, started being developed before 2 yrs. If i will have some success, I will donate you......I needed to test this script in a Linux installation anyway, so we helped each other...
Regards, R.J.
---------------------------------------------------------
Help spread the word! Like our YouTube-to-Mp3 Conversion Script on Facebook !! :-)
[Instructional videos and tutorials are also available on YouTube, Dailymotion, and Vimeo]
Explore all products and services, view demos, review documentation, check prices, and more!
♪♪ …Need Web Hosting For Our YouTube-To-Mp3 Conversion Software? Check Here !!… ♪♪
Comment
-
Comment