1. My development environment is ubuntu14.04,php version 7.1
2. I have installed php-ffmpeg, on composer. Here is my test code:
$save_path = DOCROOT . "upload/anquanwuyouwang/professional/resource/learning/";
$path = [
"ffmpeg.binaries" => "/usr/local/bin/ffmpeg",
"ffprobe.binaries" => "/usr/local/bin/ffprobe"
];
$ffmpeg = FFMpeg\FFMpeg::create($path);
$video = $ffmpeg->open($save_path . "cz.flv");
$format = new FFMpeg\Format\Video\X264();
$format->on("progress", function ($video, $format, $percentage) {
echo "$percentage % transcoded";
});
$video->save($format, $save_path . "test.mp4");
when executing, an error is reported:
error message: Encoding failed
File: / home/ljg/workspace/tools.51safety/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/AbstractVideo.php, Line 104
is my local ffmpeg installation. Is there a problem? I searched a lot of information on the Internet, there are all kinds of dependent packages, such as what xh264,libfaac, etc., I installed better, but still reported an error, looking for the correct installation method to meet my need to convert video to mp4 format.
Please give detailed steps, if there is an installation package, please give the download link, thank you!