i tried to convert any video type to mp4 on the server because the html video tag dose not support any type except mp4. so i used exec function to convert the video on the server but it is not working. note : exec function is not in the disabled function in php.ini
my code :
<?php
if(isset($_POST['submit']))
{
$vidname=$_FILES["vid"]["name"];
$videotype=$_FILES["vid"]["type"];
$time = time();
$vidname2=$time.$_FILES["vid"]["name"];
move_uploaded_file($_FILES["vid"]["tmp_name"], 'videos/' . $time.$_FILES["vid"]["name"]);
if($videotype!="video/mp4")
{
exec("ffmpeg -i videos/$vidname2 -an videos/$vidname2.mp4"); // Convert .avi to mp4
unlink("videos/$vidname2");
}
}
else
{
?>
<form method="post" action="" enctype="multipart/form-data">
<input type="file" name="vid">
<input type="submit" name="submit" value="upload">
</form>
<?php
}
?>