Convert .mp4 to .mp3 using pure PHP [closed]

狂风中的少年 提交于 2019-11-30 16:58:37

you can convert it by shell-command eg [*]

  <?php 
      exec('ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3');
  ?>
  • if your OS is unix and ffmpeg is installed

Pure PHP is not suitable for this task.

Let the user upload the file via PHP. Then direct PHP (via the exec() function) an external program like ffmpeg or gstreamer to convert the file. After the conversion you can make the mp3 available for downloading via PHP.

This is in my opinion the only suitable approach to this kind of problem, because programs like ffmpeg use much less resources than a PHP Script would need.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!