PHP 从视频中提取音频

2022-01-06 00:00:00 youtube audio streaming php video

我需要一种方法来从一些视频中提取音频(在 PHP 中).我有来自 YouTube 的视频流,所以如果它是实时流媒体,我真的很喜欢它,而不是我必须将它保存到临时目录并在那里处理它(尽管这是可以接受的.)谢谢,艾萨克沃勒
更具体地说,我有一个 MP4,我希望它是 MP3.

I need a way to extract the audio from some video (in PHP). I have the video streaming in from YouTube, so I would really like it if it were on the fly streaming, not I have to save it to a temp directory and process it there (though that is acceptable.) Thanks, Isaac Waller
to be more specific, I have a MP4 and I want it to be a MP3.

推荐答案

你会想要使用类似 ffmpeg 并使用 php 的 exec 命令调用它.如果您在文档中环顾四周,我相信您可以找出仅用于获取音频的标志.

You're going to want to use something like ffmpeg and call it using php's exec command. If you look around in the docs, I'm sure you can figure out what flag to use to only get the audio.

我之前在一个视频实时转码项目中使用过这个应用程序,效果非常好.只需确保您的服务器已正确安装.

I've used this app before on a project for live transcoding of video, works like a charm. Just make sure your server has it correctly installed.

相关文章