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-23-2012, 08:08 AM   PM User | #211
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
Your AJAX response text indicates that you are getting an error in ffmpeg_progress.php -- most likely your FFMPEG command is not generating a log file. Without a log file, no conversion progress bar can be generated, and the entire process will stall (as it's doing).

The log file is generated by the code in red:

Code:
$exec_string = parent::_FFMPEG.' -i '.$this->GetTempVidFileName().' -y -acodec libmp3lame -ab '.$quality.'k '.$this->GetSongFileName() . ' 2> logs/' . $this->_uniqueID . '.txt';
Few things to try:

1) Check that 'logs/' and 'mp3/' directories have write privileges

2) Check to make sure cURL is not "hanging up" on exec_ffmpeg.php before the full FFMPEG command can be executed. Try increasing the number of seconds in this line in YouTubeToMp3Converter::GenerateMP3():

PHP Code:
curl_setopt($chCURLOPT_TIMEOUT1); 
3) Check your 'logs/' directory. Are there text files in there?

4) Check your 'mp3/' directory. Are there mp3 files in there?
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 02-23-2012, 08:13 AM   PM User | #212
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
Log file are correctly located in logs folder, mp3 file in mp3 folder, permissions on folder 777

curl_setopt($ch, CURLOPT_TIMEOUT, 1); tested

same things

no error on error_log from apache

don't undertand
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 08:16 AM   PM User | #213
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
Paste the contents of the log file that is generated.
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 02-23-2012, 08:17 AM   PM User | #214
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
this is the log file chum

Quote:
ffmpeg version N-38046-g278d6ab-syslint Copyright (c) 2000-2012 the FFmpeg developers
built on Feb 20 2012 18:29:26 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint
libavutil 51. 39.100 / 51. 39.100
libavcodec 54. 3.101 / 54. 3.101
libavformat 54. 1.100 / 54. 1.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 62.101 / 2. 62.101
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, matroska,webm, from 'videos/1329984973_4f45f5cd7d95c6.82276514.flv':
Duration: 00:07:45.23, start: 0.000000, bitrate: 194 kb/s
Stream #0:0: Video: vp8, yuv420p, 480x360, SAR 1:1 DAR 4:3, 30 fps, 59.94 tbr, 1k tbn, 1k tbc (default)
Stream #0:1: Audio: vorbis, 44100 Hz, stereo, s16 (default)
Output #0, mp3, to 'mp3/Autechre_-_Puch.mp3':
Metadata:
TSSE : Lavf54.1.100
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s (default)
Stream mapping:
Stream #0:1 -> #0:0 (vorbis -> libmp3lame)
Press [q] to stop, [?] for help
size= 325kB time=00:00:20.74 bitrate= 128.2kbits/s
size= 683kB time=00:00:43.70 bitrate= 128.1kbits/s
size= 1038kB time=00:01:06.42 bitrate= 128.1kbits/s
size= 1391kB time=00:01:28.97 bitrate= 128.0kbits/s
size= 1736kB time=00:01:51.09 bitrate= 128.0kbits/s
size= 2089kB time=00:02:13.69 bitrate= 128.0kbits/s
size= 2433kB time=00:02:35.68 bitrate= 128.0kbits/s
size= 2782kB time=00:02:58.05 bitrate= 128.0kbits/s
size= 3126kB time=00:03:20.04 bitrate= 128.0kbits/s
size= 3471kB time=00:03:42.14 bitrate= 128.0kbits/s
size= 3819kB time=00:04:04.37 bitrate= 128.0kbits/s
size= 4167kB time=00:04:26.63 bitrate= 128.0kbits/s
size= 4517kB time=00:04:49.07 bitrate= 128.0kbits/s
size= 4868kB time=00:05:11.51 bitrate= 128.0kbits/s
size= 5215kB time=00:05:33.71 bitrate= 128.0kbits/s
size= 5562kB time=00:05:55.97 bitrate= 128.0kbits/s
size= 5913kB time=00:06:18.38 bitrate= 128.0kbits/s
size= 6262kB time=00:06:40.71 bitrate= 128.0kbits/s
size= 6611kB time=00:07:03.05 bitrate= 128.0kbits/s
size= 6960kB time=00:07:25.38 bitrate= 128.0kbits/s
size= 7266kB time=00:07:45.00 bitrate= 128.0kbits/s

video:0kB audio:7266kB global headers:0kB muxing overhead 0.006062%
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 08:35 AM   PM User | #215
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
I don't see any problems in the log file.

Try to debug different PHP variables inside of ffmpeg_progress.php (that are causing $error == 1).

For example, to debug $logFile in ffmpeg_progress.php, change the last line of that file to read:

PHP Code:
echo $newLogLength "|" $progress "|" $conversionSuccess "|" $error "|" $logFile
(Additional variables must appear at the end of the echo statement separated by pipe characters.)

Then check the AJAX response text in FireBug (in Firefox) to see what those variables are. Post the values of those variables here.
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 02-23-2012, 08:49 AM   PM User | #216
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
chump, I've modified the file, and add your command line to see variables error, but nothing appears on the web page, in firebug I've this :

Paramètresapplication/x-www-form-urlencoded
logLength 5002851
mp3File Autechre_-_Puch.mp3
uniqueId 1329986805_4f45fcf5d35210.45294660
Source
uniqueId=1329986805_4f45fcf5d35210.45294660&logLength=5002851&mp3File=Autechre_-_Puch.mp3

I think it's correct no ?
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 08:50 AM   PM User | #217
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:
Paramètresapplication/x-www-form-urlencoded
logLength 5002851
mp3File Autechre_-_Puch.mp3
uniqueId 1329986805_4f45fcf5d35210.45294660
Source
uniqueId=1329986805_4f45fcf5d35210.45294660&logLength=5002851&mp3File=Autechre_-_Puch.mp3
is uniqueId = xxxxx must be :

Quote:
Paramètresapplication/x-www-form-urlencoded
logLength 5002851
mp3File Autechre_-_Puch.mp3
uniqueId 1329986805_4f45fcf5d35210.45294660
Source
uniqueId=1329986805_4f45fcf5d35210.45294660.txt&logLength=5002851&mp3File=mp3/Autechre_-_Puch.mp3
?
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 08:53 AM   PM User | #218
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
I've this in post ffmeg_progress in firebug :

2851|0|2|2|465.23|02851|0|2|2|/home/online/public_html/Dev3/phptube2/logs/1329987125_4f45fe351c6e65.65354386.txt
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 08:59 AM   PM User | #219
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 jobsabammz View Post
It is a free script just using Curl and PHP. It gives three options MP4, 3gp and flv. I want to try and get it to work with mp3, and was wondering if someone can take a look. I think just a little change similar to what you have done before with 3gp conversion could achieve this. I tried myself but I am just learning.

you can change the ffmpeg command line in :

Quote:
$exec_string = 'ffmpeg -i '.$this->GetTempVidFileName().' -y -acodec libmp3lame -ab '.$quality.'k '.$this->GetSongFileName() . ' 2> logs/' . $this->_uniqueID . '.txt';
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 08:59 AM   PM User | #220
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:
2851|0|2|2|465.23|02851|0|2|2|/home/online/public_html/Dev3/phptube2/logs/1329987125_4f45fe351c6e65.65354386.txt
I don't know exactly which variables you are outputting there...time for bed for me....I'll take another look tomorrow
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Users who have thanked chump2877 for this post:
bedo1975 (02-23-2012)
Old 02-23-2012, 10:07 AM   PM User | #221
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
okay, I've reuploaded a fresh script without any modification, and I think that I have throught the error :

Quote:
200 OK
148ms
jquery.min.js (ligne 4)
POST http://onlinemyclip.com/Dev3/phptube...g_progress.php

200 OK
71ms
jquery.min.js (ligne 4)
En-têtesPostRéponseHTML
Paramètresapplication/x-www-form-urlencoded
logLength 0
mp3File Autechre_-_Puch.mp3
uniqueId 1329990808_4f460c98d5f726.97547783
Source
uniqueId=1329990808_4f460c98d5f726.97547783&logLength=0&mp3File=Autechre_-_Puch.mp3
you can see with the fresh script, the variable logLength in the post ffmpeg_progress is empty egals to " 0 " so I think it's the error

Wait for you see !
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 10:55 AM   PM User | #222
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
Again me

Quote:
2792|0|2|2

I looked at this, the first number is le length of log file => ok

but the second number is normaly the % progresse

so in firebug he was always at 0 and jquery process are loop infinity
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 01:27 PM   PM User | #223
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
Ok, $progress is determined in ffmpeg_progress.php as follows:

PHP Code:
$progress round(($currentTime $totalTime) * 100); 
So adjust your echo line in the same file as follows:

PHP Code:
echo $newLogLength "|" $progress "|" $conversionSuccess "|" $error "|" $currentTime "|" $totalTime
Run the script and check the various AJAX responses in FireBug to see what those variables are evaluating as. That could give you a hint as to what the problem is.
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Old 02-23-2012, 03:06 PM   PM User | #224
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
okay it's do :

result :

Quote:
$newLogLength . "|" . $progress . "|" . $conversionSuccess . "|" . $error . "|" .
2428 | 0 | 2 | 2 |

$currentTime . "|" . $totalTime;
0 | 465.23
I see the $currentTime variable are always eguals to ' 0 ' it's the coz i think
bedo1975 is offline   Reply With Quote
Old 02-23-2012, 03:32 PM   PM User | #225
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
$currentTime = (float)end($times[1]);

this is my problem with the float instruction
bedo1975 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 08:29 AM.


Advertisement
Log in to turn off these ads.