lundi 1 octobre 2018

PHP-FFMpeg: How to properly concatenate two videos?

THE SITUATION:

I am using the library PHP-FFMpeg. I need it to concatenate multiple videos into one single video. But I don't manage to make it working.

THE CODE:

I am following the docs. The code is pretty straightforward:

$video = $ffmpeg->open( $path1 );
$video
    ->concat([$path1, $path2])
    ->saveFromSameCodecs($path_output, TRUE);

THE PATHS:

I have checked the paths and they should be correct:

array:3 [▼
  0 => "/Users/francescomussi/Desktop/Apps/cameraProject/back-end/camera-laravel/storage/app/public/videos/test1.mp4"
  1 => "/Users/francescomussi/Desktop/Apps/cameraProject/back-end/camera-laravel/storage/app/public/videos/test2.mp4"
  2 => "/Users/francescomussi/Desktop/Apps/cameraProject/back-end/camera-laravel/storage/app/public/videos/output.mp4"
]

THE ERROR MESSAGE:

This is the general error message: Unable to save concatenated video.

This is the specific error message:

ffmpeg failed to execute command '/usr/local/bin/ffmpeg' '-f' 'concat' '-safe' '0' '-i' '/private/var/folders/dw/919v2nds7s78pz_qhp7z9rcm0000gn/T/ffmpeg-concateaHp0L' '-c' 'copy' '/Users/francescomussi/Desktop/Apps/cameraProject/back-end/camera-laravel/storage/app/public/videos/output.mp4'

THE COMMANDS ARRAY:

This is the dump of the commands array:

enter image description here

FFMPEG:

ffmpeg is properly installed in the system. Version 4.0.2

THE QUESTION:

Do you know what could be the problem?

Did somebody managed to concat two videos using PHP-FFMpeg?

Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire