我正在尝试使用ffmpeg将mp4转换为mp3。
我想从用户上传mp4文件,然后将其转换为mp3
if(isset($_POST['uploadimage'])){
$file_name = $_FILES['image']['name'];
$file_size = $_FILES['image']['size'];
$file_tmp = $_FILES['image']['tmp_name'];
$file_type = $_FILES['image']['type'];
$file_ext=strtolower(@end(explode('.',$_FILES['image']['name'])));
$extensions= array("mp4");
if(in_array($file_ext,$extensions)=== false){
$errors[]="extension not allowed, please choose a JPEG file.";
}
else if($file_size > 2097100) {
$errors[]="larger size";
}
else if(empty($errors)==true) {
move_uploaded_file($file_tmp,"input/".$file_name);
echo"moved";
$a= "input/".$file_name;
echo $input_file;
$b= "output/audio2.mp3";
exec("ffmpeg.exe");
exec("ffmpeg -i $a -vn $b", $output, $return);
if (!$return) {
echo " Success";
}
else {
echo " <br>failed";
}
}
}
<form method="post" enctype="multipart/form-data">
<input type='file' name="image" />
<input type="submit" name="uploadimage" value="Submit">
</form>
会话未创建 以上是我遇到的错误。