| Q | A
| -------------- | ---
| Bug? | no
| New Feature? | no
| Version Used | Specific tag or commit sha
| FFmpeg Version | FFmpeg or AVConv and version
| OS | Ubuntu 16.04
Unable to load FFmpeg. my ffmpeg is not detected :/
my ffmpeg is located at
# which ffmpeg
/usr/bin/ffmpeg
# which ffprobe
/usr/bin/ffprobe
# ffmpeg -version
ffmpeg version 3.4.2-1~16.04.york0.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
configuration: --prefix=/usr --extra-version='1~16.04.york0.2' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
@kavin-90 what you have in config or .env?
/config/laravel-ffmpeg.php
I don't use laravel so i don't have .env file but when i manual give path it works .
I'll need to check whether we can improve the binary guessing location. Could you please share where your binaries are located, exactly?
@jens1o they're located in /usr/bin/
# which ffmpeg
/usr/bin/ffmpeg
# which ffprobe
/usr/bin/ffprobe
Thanks, I'll check what we can do :)
Same issue here but only with Nginx !
It works with Apache 2.4
@Broutard May I ask you how you configured it? Do you use mod_php in apache and php_fpm with nginx?
@jens1o It works with apache/php-fpm but we have recently switch to nginx/php-fpm and it failed.
My nginx configuration :
server {
listen 80;
server_name app.dev;
root "/var/www/app/public";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.html /index.php?$query_string;
}
access_log off;
error_log /var/log/nginx/error.log error;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
location ~ /\.ht {
deny all;
}
}
Please help me with this problem, it's been 3 days now and it's still not working...
I use CentOS 7 and used composer to install the library.
PHP 7.1
I also get:
which ffmpeg
/usr/bin/ffmpeg
which ffprobe
/usr/bin/ffprobe
and can list all version info etc. for both of them.
Tried many things I found on the internet about this issue including changing paths manually but nothing seems to work.
This is the error I get:
Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutableNotFoundException: Executable not found, proposed : avprobe, ffprobe in /home/admin/domains/public_html/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php:160 Stack trace: #0 /home/admin/domains/public_html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php(48): Alchemy\BinaryDriver\AbstractBinary::load(Array, NULL, Object(Alchemy\BinaryDriver\Configuration)) #1 /home/admin/domains/public_html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFProbe.php(226): FFMpeg\Driver\FFProbeDriver::create(Object(Alchemy\BinaryDriver\Configuration), NULL) #2 /home/admin/domains/public_html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php(118): FFMpeg\FFProbe::create(Array, NULL, Object(Doctrine\Common\Cache\ArrayCache)) #3 /home/admin/domains/public_html/index.php(38): FFMpeg\FFMpeg::create() #4 {main} Next FFMpeg\Exception\ExecutableNotFoundEx in /home/admin/domains/public_html/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Driver/FFProbeDriver.php on line 50
I really need this library to work for a big project so I hope somebody can help me out...
@dmfusionVTF use this code
$ffmpeg = FFMpeg\FFMpeg::create(array(
'ffmpeg.binaries' => '/usr/bin/ffmpeg',
'ffprobe.binaries' => '/usr/bin/ffprobe'
));
@kavin-90
thanks for your reply.
I tried this code but get the same error with an extra error:
Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/ffprobe) is not within the allowed path(s): (/home/admin/:/tmp/:/var/tmp/:/usr/local/php71/lib/:/usr/local/php54/lib/:/usr/local/php55/lib/:/usr/local/php56/lib/:/usr/local/php70/lib/:/usr/local/php71/lib/:/usr/local/php72/lib/:/usr/local/lib/php/) in /home/admin/domains/public_html/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php on line 150
Found some things to get rid of that such as turning open_basedir off in DirectAdmin for all domains, and php safe_mode=off in php.ini but nothing... (also after server restart, have my own VPS and full control)
as error says there is no /user/bin path in that list :P
@kavin-90
Ok, I found where to ad it to the list :P (php-fpm71.conf) and it fixed that, but now I have:
Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutionFailureException: ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i' 'video.mp4' '-async' '1' '-metadata:s:v:0' 'start_time=0' '-vcodec' 'libx264' '-acodec' 'libfaac' '-b:v' '1000k' '-refs' '6' '-coder' '1' '-sc_threshold' '40' '-flags' '+loop' '-me_range' '16' '-subq' '7' '-i_qfactor' '0.71' '-qcomp' '0.6' '-qdiff' '4' '-trellis' '1' '-b:a' '128k' '-vf' '[in]scale=320:240 [out]' '-pass' '1' '-passlogfile' '/tmp/ffmpeg-passes5b7539f4b26dacd4vh/pass-5b7539f4b2864' 'export-x264.mp4'
Sorry if i'm being stupid...
/usr/bin/ffmpeg -y -i video.mp4 -async 1 -metadata:s:v:0 start_time=0 -vcodec libx264 -acodec libfaac -b:v 1000k -refs 6 -coder 1 -sc_threshold 40 -flags +loop -me_range 16 -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -trellis 1 -b:a 128k -vf [in]scale=320:240 [out] export-x264.mp4
What happens if you execute this command?
@jens1o
I get:
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.24.2
Duration: 00:00:05.31, start: 0.000000, bitrate: 1589 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1205 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
[NULL @ 0x157bb80] Unable to find a suitable output format for '[out]'
[out]: Invalid argument
pardon me, I forgot a part of the command. I updated the comment of me. Could you try again, please?
/usr/bin/ffmpeg -y -i video.mp4 -async 1 -metadata:s:v:0 start_time=0 -vcodec libx264 -acodec libfaac -b:v 1000k -refs 6 -coder 1 -sc_threshold 40 -flags +loop -me_range 16 -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -trellis 1 -b:a 128k -vf scale=320:240 export-x264.mp4
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.24.2
Duration: 00:00:05.31, start: 0.000000, bitrate: 1589 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1205 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Unknown encoder 'libfaac'
I need to finish the 1.x version..
Change $format = new \FFMpeg\Format\Video\X264();
to
$format = new \FFMpeg\Format\Video\X264();
$format->setAudioCodec("aac");
@jens1o
This works but only with libmp3lame, every option with aac gives the 'ffmpeg failed to execute' error.
(tried aac, libvo_aacenc, libfaac, libfdk_aac)
I do get an output file now (with mp3 audio)
do u have those packages?
because to make them work u need those packages in system
run command yum install libfaac or sudo apt-get install libfacc something like that. I'm not sure tho :/
yes I did a yum search aac and installed every library I could find
fdk-aac.x86_64 : Fraunhofer FDK AAC Codec Library
fdk-aac-devel.x86_64 : Development files for fdk-aac
faac.x86_64 : Encoder and encoding library for MPEG2/4 AAC
faac-devel.x86_64 : Development libraries of the FAAC AAC encoder
So I think at least one of them should work ? (Or are this the wrong libraries ?)
https://centos.pkgs.org/6/linuxtech/libfaac-1.28-3.el6.x86_64.rpm.html
i found that one
libfdk_aac installed by ffmpeg iirc
i can't help much because it not related to this package but related to ffmpeg :/
Installed them (libaacs, libfaac +devel's) but not yet working (also after server reboot, if that is even necessary)
If I input a wrong codec name it suggests me the codecs that are available:
Fatal error: Uncaught FFMpeg\Exception\InvalidArgumentException: Wrong audiocodec value for libaacs, available formats are aac, libvo_aacenc, libfaac, libmp3lame, libfdk_aac
Only the mp3 one works so far...lame :P
it suggests me the codecs that are available
No, that would be a feature of v1.x. It only compares whether the codec you entered is in a list of codecs that we know this format is working with.
Ok, I will try to get it to work myself, at least I get some output now
@kavin-90, @jens1o Thanks for your help so far! :)
I'm having the initial issue on a Windows 10 x64 machine, using PHP 7. I downloaded latest FFMpeg build and installed it both on system and user environment paths (D:\environment\ffmpeg\bin). I'm serving my project locally with Laravel Artisan.
I found the solution so i'm closing the issue.
i un comment it from www.conf of php-fpm it fixed issue.
env[PATH] = /usr/local/bin:/usr/bin:/bin
Most helpful comment
@jens1o they're located in /usr/bin/