php 如何将任何类型的视频转换为 mp4?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20580370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to convert any type of video to mp4?
提问by user3076412
how can i let users upload video to mp4 using php code? I've been trying to find a code that converts video to mp4 automatically no mater what type of video format it is this possible?
我怎样才能让用户使用 php 代码将视频上传到 mp4?我一直在试图找到一个代码,无论是什么类型的视频格式,它都可以自动将视频转换为 mp4 吗?
回答by Aditya
If you are trying this at your server/ not using any online tool. You can use FFmpegfor this. Sample code for conversion:
如果您在服务器上尝试此操作/不使用任何在线工具。您可以为此使用FFmpeg。转换示例代码:
ffmpeg -i {input}.mov -vcodec h264 -acodec aac -strict -2 {output}.mp4
FFmpeg is most widely used tool for this purpose and you can download the same here.
FFmpeg 是用于此目的的最广泛使用的工具,您可以在此处下载相同的工具。
回答by Tom J Muthirenthi
//This code convert video to mp4 format.
//for that you have to install HandBrakeCLI on your linux server
system("HandBrakeCLI -i ".$currfileName." -o ".$new_convertedvideo.".mp4 -v -m -E aac,ac3 -e x264");

