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

后端 未结 1 1880
再見小時候
再見小時候 2021-01-05 16:25

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

相关标签:
1条回答
  • 2021-01-05 17:10

    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 讨论(0)
提交回复
热议问题