iPhone - 从视频文件中分离音频并将其保存到单独的文件中
有谁知道是否可以将音频从视频文件(例如 h.264 编码 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.
Any pointers in the right direction would be much appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来像是 AVFoundation 的工作。我无法告诉您详细信息,但将视频文件打开到
AVURLAsset
中应该可以让您访问其曲目
。识别mediaType
为AVMediaTypeAudio
的轨道。不确定输出部分,但我会尝试创建一个
AVMutableComposition
对象,然后向其中添加要导出的曲目。然后使用AVAssetExportSession
或AVAssetWriter
将结果写入新文件。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 itstracks
. Identify the tracks whosemediaType
isAVMediaTypeAudio
.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 useAVAssetExportSession
orAVAssetWriter
to write the result to a new file.