Skip to content

Instantly share code, notes, and snippets.

@michelmelo
Created July 20, 2020 13:06
Show Gist options
  • Save michelmelo/525d6820e9de85cfdcf1a91c2922f6bb to your computer and use it in GitHub Desktop.
Save michelmelo/525d6820e9de85cfdcf1a91c2922f6bb to your computer and use it in GitHub Desktop.
merge mp4 and mp3
$filename_tmp = [];
$filename_tmp[0] = base_path() . "/000.mp4";
$filename_tmp[2] = base_path() . '/audio.mp3';
$ffmpeg = FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => config('pilot.PATH_FFMPEG'),
'ffprobe.binaries' => config('pilot.PATH_FFPROBE'),
]);
$video = $ffmpeg->open($filename_tmp[0]);
$video
->concat($filename_tmp)
->saveFromSameCodecs(base_path() . "/" . time() . '_save.mp4', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment