0

Is there a way to concatenate file1.mp4 add xfade file2.mp4 add fade out? The first file usually has 30 seconds while the second is 10 seconds long.

Also, is it possible to make the above merging work with multiple inputs/outputs? I know there's a way using the input using List.txt, but it would need some more clarification to get the above concatenation and fades work with the file paths instead of each file for input.

FileA.mp4+FileA2.mp4 = FileA.mp4 FileB.mp4+FileB2.mp4 = FileB.mp4

Robert
  • 1
  • 1

1 Answers1

0

You can do it as follows

$video = FFMpeg::fromDisk('uploads')->open(["video1.mp4","video2.mp4","video3.mp4"]); 
 $format = new FFMpeg\Format\Video\WebM();
 $format->setAudioCodec("libvorbis");
 $format->setVideoCodec("libvpx-vp9");

 $video->export()
       ->toDisk('s3')
       ->inFormat($format)
      ->concatWithTranscoding($hasVideo = true, $hasAudio = true)
      ->save('output.webm');
Deepak
  • 185
  • 2
  • 9
  • Thanks, I'll try to be more specific, I read my first post and it's not that clear. I have a bunch of videos that are main (30s) and the second (10s) They are usually MKV and I need to make them MP4. Examples: Street1+stree2 House1+house2 Car1+car2 I'd need a script that could possibly detect the 1 and 2 numbers and merge these to form a single video with a fade in between, for example, Street1+Street2=Street (with a fade out). So I could run it without having to do each combination manually. Is it possible? – Robert Dec 09 '20 at 02:03