开发者

iPhone - Separating audio from a video file and saving it to a separate file

开发者 https://www.devze.com 2023-03-27 22:25 出处:网络
Does anyone know if it is 开发者_StackOverflowpossible to separate the audio from a video file such as h.264 encode mpeg (or other such formats) and than save that audio data to a separate file such a

Does anyone know if it is 开发者_StackOverflowpossible to separate the audio from a video file such as h.264 encode mpeg (or other such formats) and than save that audio data to a separate file such as an mp3 file? This relates to the iPhone SDK.

Any pointers in the right direction would be much appreciated. Thanks.


Sounds like a job for AVFoundation. I can't tell you the details, but opening a video file into an AVURLAsset should give you access to its tracks. Identify the tracks whose mediaType is AVMediaTypeAudio.

Not sure about the output part, but I would try creating an AVMutableComposition object to which I'd then add the tracks you want to export. Then use AVAssetExportSession or AVAssetWriter to write the result to a new file.

0

精彩评论

暂无评论...
验证码 换一张
取 消