Reputation: 61
PHP FFMPEG not working when combining videos of 2 different qualities in respect of quality, length.
I am trying to merge 2 videos having different links and save the merged video link in a folder using php ffmpeg. The code is working when providing same video links, but not working when providing 2 seperate video links. I am getting error as :
Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutionFailureException: ffmpeg failed to execute command '/bin/ffmpeg' '-i' 'https://checkout.spiritualsociety.co/windsor_test/medium.mp4' '-i' 'https://checkout.spiritualsociety.co/windsor_test/low.mp4' '-filter_complex' '[0:v:0] [0:a:0] [1:v:0] [1:a:0] concat=n=2:v=1:a=1 [v] [a]' '-map' '[v]' '-map' '[a]' '-b:a' '128k' 'videos/1684954817.mp4': Error Output: 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-36) 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 -- in /home/spiritualsociety/public_html/windsor_test/mergevedio/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Concat.php on line 259
<?php
require 'vendor/autoload.php';
$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('https://checkout.spiritualsociety.co/windsor_test/medium.mp4');
$format = new FFMpeg\Format\Video\X264('libmp3lame', 'libx264');
$format->setAudioCodec("libmp3lame", "libx264");
$video
->concat(array('https://checkout.spiritualsociety.co/windsor_test/medium.mp4', 'https://checkout.spiritualsociety.co/windsor_test/low.mp4'))
->saveFromDifferentCodecs($format, 'videos/'.time() . '.mp4');
Upvotes: 1
Views: 122