Hello,
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
Edit: to be more specific, I have a MP4 and I want it to be a MP3.
views:
433answers:
2Mplayer should do this for you, and there are libraries and codecs that you can call (PHP supports C libraries) which will strip the video from the AV stream on the fly.
Given that you're targeting youttube your job is a bit easier because they use a very small subset of file encodings.
If you take the time to learn the format, you can very easily remove the video stream on the fly and return only the audio stream.
If you give a little more information, such as what you're encoding it to, or where it's going to end up we may be able to help more specifically.
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.