A
A
Alexey Konovalov2021-09-28 22:50:10
linux
Alexey Konovalov, 2021-09-28 22:50:10

How to fix ffmpeg runtime error?

Hello. I try to convert an audio file in the root of the site through the php-ffmpeg library and always get an error (I'll paste it below).
The simplified call code looks like this:

$file_src = $_SERVER['DOCUMENT_ROOT'].'/banan.ogg';
$file_dst = $_SERVER['DOCUMENT_ROOT'].'/banan.wav';

$ffmpeg = FFMpeg::create();
$ffmpeg->open($file_src)->save(new Wav(), $file_dst);


At the same time, if you copy the command from here and execute it directly in the console, the command is executed and the file is converted. I tried to execute the same command through system () or exec () like this:
system('ffmpeg -y -i /var/www/html/servv.ru/banan.ogg' '-acodec' 'pcm_s16le' '-b:a' '128k' '/var/www/html/servv.ru/banan.wav, $ret);

in the $ret variable I always get 1, but the file is not converted.
Tell me where to dig, maybe there are not enough rights in apache or php? how to find out which ones?

Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutionFailureException: ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i' '/var/www/html/servv.ru/banan.ogg' '-acodec' 'pcm_s16le' '-b:a' '128k' '/var/www/html/servv.ru/banan.wav': Error Output: ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-lib in /var/www/html/servv.ru/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Audio.php on line 74

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question