Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ffprobe error on php exec #7863

Closed
barisyesilcimen opened this issue Dec 14, 2015 · 8 comments
Closed

Ffprobe error on php exec #7863

barisyesilcimen opened this issue Dec 14, 2015 · 8 comments

Comments

@barisyesilcimen
Copy link

@barisyesilcimen barisyesilcimen commented Dec 14, 2015

ffprobe or avprobe not found

Php command: exec('youtube-dl -4 https://www.youtube.com/watch?v=JP4kValjHmw --extract-audio --audio-format mp3 -o deneme.mp3');

Same with shell_exec.

But no problem in user or root ssh.

Ffmpeg, youtube-dl, ffprobe, libav-tools installed.

ffprobe not found problem is in PHP exec/shell_exec only.

ffprobe version git-2015-12-13-906c0b7 Copyright (c) 2007-2015 the FFmpeg developers

built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
libavutil 55. 10.100 / 55. 10.100
libavcodec 57. 17.100 / 57. 17.100
libavformat 57. 20.100 / 57. 20.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 21.100 / 6. 21.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Simple multimedia streams analyzer
usage: ffprobe [OPTIONS] [INPUT_FILE]

You have to specify one input file.
Use -h to get full help or, even better, run 'man ffprobe'.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Dec 14, 2015

Here's a similar case: #7278

@barisyesilcimen
Copy link
Author

@barisyesilcimen barisyesilcimen commented Dec 14, 2015

my ffmpeg in /usr/local/bin
this is very spesific problem. i tried all search tips on google. Not found true solution for this.

@barisyesilcimen
Copy link
Author

@barisyesilcimen barisyesilcimen commented Dec 14, 2015

and user's shell command running correctly. No problem on shell/shh commands. Problem is in PHP exec command only.

@barisyesilcimen
Copy link
Author

@barisyesilcimen barisyesilcimen commented Dec 14, 2015

exec("/usr/local/bin/ffprobe -version 2>&1", $output);
var_dump($output);

array(11) { [0]=> string(84) "ffprobe version git-2015-12-13-906c0b7 Copyright (c) 2007-2015 the FFmpeg developers" [1]=> string(54) "built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)" [2]=> string(356) "configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265" [3]=> string(38) "libavutil 55. 10.100 / 55. 10.100" [4]=> string(38) "libavcodec 57. 17.100 / 57. 17.100" [5]=> string(38) "libavformat 57. 20.100 / 57. 20.100" [6]=> string(38) "libavdevice 57. 0.100 / 57. 0.100" [7]=> string(38) "libavfilter 6. 21.100 / 6. 21.100" [8]=> string(38) "libswscale 4. 0.100 / 4. 0.100" [9]=> string(38) "libswresample 2. 0.101 / 2. 0.101" [10]=> string(38) "libpostproc 54. 0.100 / 54. 0.100" }


$url = 'https://www.youtube.com/watch?v=JP4kValjHmw';
$template = '%(id)s.mp3';
$string = ("youtube-dl -4 " . escapeshellarg($url) . " --extract-audio --audio-format mp3 -o " .
escapeshellarg($template));

$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w"), // stderr
);
$process = proc_open($string, $descriptorspec, $pipes);
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$ret = proc_close($process);
echo json_encode(array('status' => $ret, 'errors' => $stderr,
'url_orginal'=>$url, 'output' => $stdout,
'command' => $string));

output: {"status":1,"errors":"WARNING: JP4kValjHmw: writing DASH m4a. Only some players support this container. Install ffmpeg or avconv to fix this automatically.\nERROR: ffprobe or avprobe not found. Please install one.\n","url_orginal":"https://www.youtube.com/watch?v=JP4kValjHmw","output":"[youtube] JP4kValjHmw: Downloading webpage\n[youtube] JP4kValjHmw: Downloading video info webpage\n[youtube] JP4kValjHmw: Extracting video information\n[youtube] JP4kValjHmw: Downloading DASH manifest\n[download] Destination: JP4kValjHmw.mp3\n\r[download] 0.0% of 8.48MiB at 66.31KiB/s ETA 02:11\r[download] 0.0% of 8.48MiB at 197.16KiB/s ETA 00:44\r[download] 0.1% of 8.48MiB at 457.19KiB/s ETA 00:18\r[download] 0.2% of 8.48MiB at 973.52KiB/s ETA 00:08\r[download] 0.4% of 8.48MiB at 1.53MiB/s ETA 00:05\r[download] 0.7% of 8.48MiB at 1.74MiB/s ETA 00:04\r[download] 1.5% of 8.48MiB at 2.42MiB/s ETA 00:03\r[download] 2.9% of 8.48MiB at 3.60MiB/s ETA 00:02\r[download] 5.9% of 8.48MiB at 5.05MiB/s ETA 00:01\r[download] 11.8% of 8.48MiB at 7.74MiB/s ETA 00:00\r[download] 23.6% of 8.48MiB at 12.38MiB/s ETA 00:00\r[download] 47.2% of 8.48MiB at 20.48MiB/s ETA 00:00\r[download] 94.4% of 8.48MiB at 28.31MiB/s ETA 00:00\r[download] 100.0% of 8.48MiB at 29.32MiB/s ETA 00:00\r[download] 100% of 8.48MiB in 00:00\n","command":"youtube-dl -4 'https://www.youtube.com/watch?v=JP4kValjHmw' --extract-audio --audio-format mp3 -o '%(id)s.mp3'"}

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Dec 14, 2015

What's the output of:

exec("ffprobe -version 2>&1", $output);

If the command listed above fails on PHP, you should either set correct $PATH or append the following parameters to youtube-dl:

--ffmpeg-location /usr/local/bin/

See Post-Processing options for more information.

@barisyesilcimen
Copy link
Author

@barisyesilcimen barisyesilcimen commented Dec 14, 2015

exec("ffprobe -version 2>&1", $output);
var_dump($output);

array(11) { [0]=> string(84) "ffprobe version git-2015-12-13-906c0b7 Copyright (c) 2007-2015 the FFmpeg developers" [1]=> string(54) "built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)" [2]=> string(356) "configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265" [3]=> string(38) "libavutil 55. 10.100 / 55. 10.100" [4]=> string(38) "libavcodec 57. 17.100 / 57. 17.100" [5]=> string(38) "libavformat 57. 20.100 / 57. 20.100" [6]=> string(38) "libavdevice 57. 0.100 / 57. 0.100" [7]=> string(38) "libavfilter 6. 21.100 / 6. 21.100" [8]=> string(38) "libswscale 4. 0.100 / 4. 0.100" [9]=> string(38) "libswresample 2. 0.101 / 2. 0.101" [10]=> string(38) "libpostproc 54. 0.100 / 54. 0.100" }

@barisyesilcimen
Copy link
Author

@barisyesilcimen barisyesilcimen commented Dec 14, 2015

Yesssss! Finally!

exec ("youtube-dl -4 " . escapeshellarg($url) . " --extract-audio --audio-format mp3 -o " .
escapeshellarg($template).' --ffmpeg-location /usr/local/bin/');

resolved my problem. Thank you very much.

Best wishes from Turkey.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Dec 14, 2015

Glad to see it's solved. Closing.

@yan12125 yan12125 closed this Dec 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.