C
C
CaptainJustness2021-05-04 12:20:22
PHP
CaptainJustness, 2021-05-04 12:20:22

How to fix this ffmpeg PHP error?

What is the error and how to fix it? I use the library https://github.com/aminyazdanpanah/PHP-FFmpeg-vide... And installed FFmpeg on the server.

Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutionFailureException: ffmpeg failed to execute command '/usr/bin/ffmpeg' '-y' '-i' '/var/www/www-root/data/www/site.ru /converter/input/video.mp4' '-c:v' 'libx264' '-c:a' 'aac' '-bf' '1' '-keyint_min' '25' '-g' '250' '- sc_threshold' '40' '-use_timeline' '1' '-use_template' '1' '-init_seg_name' 'video_init_$RepresentationID$.$ext$' '-media_seg_name' 'video_chunk_$RepresentationID$_$Number%05d$.$ ext$' '-seg_duration' '10' '-hls_playlist' '0' '-f' 'dash' '-map' '0' '-s:v:0' '256x144' '-b:v:0' '6852k' '-map' '0' '-s:v:1' '426x240' '-b:v:1' '7994k' '-map' '0' '-s:v:2' '640x360' '-b: v:2' '9593k' '-map' '0' '-s:v:3' '854x480' '-b:v:3' '11992k' '-map' '0' '-s:v:4 ' '1280x720' '-b:v:4' '15989k' '-map' '0' '-s:v:5' '1920x1080' '-b:v:5' '23984k' '-strict' '- 2' '-threads' '3' '/var/www/www-root/data/www/site.ru/converter/input/video.mpd': Error Output: ffmpeg version 3.4.8-0ubuntu0.2 Copyright ( c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubu in /var/www/www-root/data/www/site.ru/converter/vendor/alchemy/binary-driver/src/Alchemy /BinaryDriver/ProcessRunner.php on line 95

PHP code:

require_once __DIR__ . '/vendor/autoload.php';

use Streaming\Representation;

$config = [
    'ffmpeg.binaries'  => '/usr/bin/ffmpeg',
    'ffprobe.binaries' => '/usr/bin/ffprobe',
    'timeout'          => 3600,
    'ffmpeg.threads'   => 3,
];

$ffmpeg = Streaming\FFMpeg::create($config);

$video = $ffmpeg->open(__DIR__ . '/input/video.mp4');

$format = new Streaming\Format\X264();
$format->on('progress', function ($video, $format, $percentage){
    // You can update a field in your database or can log it to a file
    // You can also create a socket connection and show a progress bar to users
    echo sprintf("\rTranscoding...(%s%%) [%s%s]", $percentage, str_repeat('#', $percentage), str_repeat('-', (100 - $percentage)));
});

$video->dash()
    ->setFormat($format)
    ->autoGenerateRepresentations()
    ->save();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AUser0, 2021-05-04
@AUser0

Specify an empty " hide_banner " option. So at least the error will get into OUTPUT, and not information about the version and compilation options.
And add an empty option " y " to overwrite an existing file, otherwise you suddenly have such a file already exists ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question