I want to merge multiple videos side by side in one video with PHP-FFmpeg, is there anyone help me about that?
public function GENERATE_VIDEO()
{
require_once APPPATH . '/third_party/vendor/autoload.php';
$ffmpeg = FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => APPPATH . '/third_party/ffmpeg',
'ffprobe.binaries' => APPPATH . '/third_party/ffprobe',
]);;
$inputs = array(
'../output/01.webm',
'../output/02.webm',
);
$advancedMedia = $ffmpeg->openAdvanced($inputs);
$ffmpeg->getFFMpegDriver()->listen(new \Alchemy\BinaryDriver\Listeners\DebugListener());
$ffmpeg->getFFMpegDriver()->on('debug', function ($message) {
echo $message . "\n";
});
$advancedMedia = $ffmpeg->openAdvanced($inputs);
$advancedMedia->filters()
->custom('[0]', 'overlay=:x=000:y=000', '[output0]')
->custom('[output0][1]', 'overlay=:x=058:y=000', '[output1]');
$advancedMedia
->map(array('[output1]'), new FFMpeg\Format\Video\WebM(), '../output/output.webm')
->save();
}
Above code is working actually, but there is something wrong with custom filters, it's saving only one input.