iPhone - 从视频文件中的音频分离并将其保存到一个单独的文件 [英] iPhone - Separating audio from a video file and saving it to a separate file
问题描述
没有人知道它是否可能从一个视频文件中的音频分离,如H.264连接code MPEG(或其它这样的格式),并比音频数据到一个单独的文件中保存,如mp3文件?
这涉及到iPhone的SDK。
Does anyone know if it is possible 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.
在正确的方向任何指针将是非常美联社preciated。
谢谢你。
Any pointers in the right direction would be much appreciated. Thanks.
推荐答案
听起来像是AVFoundation工作。我不能告诉你细节,但打开一个视频文件到 AVURLAsset
应该给你访问它的曲目
。标识其轨道 mediaType的
是 AVMediaTypeAudio
。
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
.
不知道的输出部分,但我会尝试创建一个 AVMutableComposition
对象到我然后添加你要导出的轨道。然后使用 AVAssetExportSession
或 AVAssetWriter
来写结果到一个新文件。
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.
这篇关于iPhone - 从视频文件中的音频分离并将其保存到一个单独的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!