Home >Backend Development >PHP Tutorial >Video upload - php uses ffmpeg to transcode mp4 which takes too long

Video upload - php uses ffmpeg to transcode mp4 which takes too long

WBOY
WBOYOriginal
2016-07-06 13:52:132070browse

I found an ffmpeg that supports h264 encoding. It takes too long for PHP to call exec to use ffmpeg to transcode, and the CPU usage exceeds 80%. I want to ask how to solve it.
Transcoding command Also, I don’t know what the meaning of the parameters here is?

<code>$command='..\ffmpeg\bin\ffmpeg.exe -i ' .  $file . '.' . $ext . ' -vcodec libx264 -vprofile main -preset slow -b:v 400k -maxrate 400k -bufsize 800k -vf scale=-1:480 -threads 0 -acodec libvo_aacenc -ab 128k ' .$file . '.mp4';</code>

Reply content:

I found an ffmpeg that supports h264 encoding. It takes too long for PHP to call exec to use ffmpeg to transcode, and the CPU usage exceeds 80%. I want to ask how to solve it.
Transcoding command Also, I don’t know what the meaning of the parameters here is?

<code>$command='..\ffmpeg\bin\ffmpeg.exe -i ' .  $file . '.' . $ext . ' -vcodec libx264 -vprofile main -preset slow -b:v 400k -maxrate 400k -bufsize 800k -vf scale=-1:480 -threads 0 -acodec libvo_aacenc -ab 128k ' .$file . '.mp4';</code>

Use Qiniu to transfer, or use queue to do it asynchronously

Specific command man ffmpeg

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn