mercredi 29 avril 2015

Merging Video Files with PHP

I have two mp4 files and i want to merge them.

$media1 = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/dir/media1.mp4');
$media2 = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/dir/media2.mp4');

file_put_contents($_SERVER['DOCUMENT_ROOT'].'/dir/combined.mp4', $media1.$media2);

media1.mp4 : 1 Megabyte, 10 second

media2.mp4 : 2 Megabyte, 20 second

combined.mp4 : 3 Megabyte but 10 second (There is only media1.mp4)

How can i merge these two files?

Aucun commentaire:

Enregistrer un commentaire