php 视频上传 FFMpeg 视频格式转码
生活随笔
收集整理的這篇文章主要介紹了
php 视频上传 FFMpeg 视频格式转码
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
啥也不說先上源碼,安裝不會的可以看我的另一篇文章或者查看專欄https://blog.csdn.net/qq_29099209/article/details/79720723
<?phpnamespace App\Http\Controllers;use FFMpeg\Format\Video\X264; use FFMpeg\Format\Video\WMV; use FFMpeg\Format\Video\WebM; use FFMpeg\FFMpeg;class Home extends Controller {//public function upload(){$ffmpeg = FFMpeg::create(array('ffmpeg.binaries' => 'D:\phpStudy\php\php-7.0.12-nts\ffmpeg\bin\ffmpeg.exe','ffprobe.binaries' => 'D:\phpStudy\php\php-7.0.12-nts\ffmpeg\bin\ffprobe.exe','timeout' => 0,'ffmpeg.threads' => 12));$video = $ffmpeg->open('source/movie.MP4');$video->save(new X264(), 'export-x264.mp4')->save(new WMV(), 'export-wmv.wmv')->save(new WebM(), 'export-webm.webm');return true;} }進行視頻操作的時候遇到了如下兩個錯誤,查了N多也沒找到
ProcessBuilder class is deprecated since Symfony 3.4 and will be removed in.......... Type error: Return value of Symfony\Component\Filesystem\Filesystem::toIterable() must be an instance of Symfony\Component\Filesystem\iterable, array returned最后看了看源碼后,查了查 iterable
草發現PHP版本要大于7.1才行,以前我一直用的7.0
修改了版本之后,再次進行格式轉換發現OK啦
不過視頻大一點就轉換的比較慢
總結
以上是生活随笔為你收集整理的php 视频上传 FFMpeg 视频格式转码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 谈一谈 蓝牙防丢器
- 下一篇: 安卓外挂红外触摸屏的软件设计