[英]Wordpress upload video convert MP4 format
Create custom video convert plugin - MP4 format 创建自定义视频转换插件-MP4格式
Bellow upload code work fine but how to convert MP4 format after insert media library. 波纹管上传代码工作正常,但如何在插入媒体库后转换MP4格式。
media_handle_upload('upload_video_file', 0)
exec("ffmpeg -i $fullsize_path -ar 22050 -ab 32 -f mp4 -s 320x240 $value");
<form method="post" enctype="multipart/form-data">
<input type='file' id='upload_video_file' name='upload_video_file'></input>
<?php submit_button('Upload') ?>
</form>
If you are using ffmpeg to convert video,first make sure its installed properly on your server and running. 如果您使用ffmpeg转换视频,请首先确保将其正确安装在服务器上并正在运行。 Check ffmpeg installed or not on your server. 检查服务器上是否已安装ffmpeg。
$ffmpeg = shell_exec('which ffmpeg'));
$ffmpeg = shell_exec('type -P ffmpeg');
If $ffmpeg
return empty then it means its not installed on your server, if its return absolute path it means installed on your server. 如果$ffmpeg
返回空,则表示它未安装在您的服务器上;如果返回绝对路径,则表示已安装在您的服务器上。
Then you can execute exec
commond Just like below 然后您可以执行exec
commond,如下所示
exec("ffmpeg -i {input}.mov -vcodec h264 -acodec aac -strict -2 {output}.mp4");
-vcodec
parameter to specify the encoding format to be used for the output video. -vcodec
参数指定用于输出视频的编码格式。
-acodec
codec (input/output) Set the audio codec. -acodec
编解码器(输入/输出)设置音频编解码器。 This is an alias for -codec:a
这是-codec:a
的别名
For more commond check ffmpeg link https://ffmpeg.org/ffmpeg.html 有关更常见的信息,请检查ffmpeg链接https://ffmpeg.org/ffmpeg.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.