给定表示至少有一个音频轨道的电影的AVAsset,则可以通过获取与其对应的AudioStreamBasicDescription实例来确定该音频轨道的各种属性:
AVAssetTrack audio_track = [[asset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
CMFormatDescriptionRef formatDescriptionRef = [audio_track.formatDescriptions objectAtIndex:0];
AudioStreamBasicDescription *ASBD = CMAudioFormatDescriptionGetStreamBasicDescription(formatDescriptionRef);然后可以检查此实例(ASBD),例如:
ASBD->mFormatID == kAudioFormatLinearPCM // True if the track is PCM
ASBD->mFormatFlags & kAudioFormatFlagIsBigEndian // nonzero if the format is big endian然而,我似乎无法找到一种方法来确定样本的比特深度。这是必要的,因为它将作为字典中键AVLinearPCMBitDepthKey的值提供,该字典将作为输出设置传递给+[AVAssetWriterInput assetWriterInputWithMediaType: outputSettings:]。
如何从AVAsset或AVAssetTrack中提取这些信息?
(上下文是在AVAsset中重新编码视频,但将音频保留为原样)
发布于 2014-06-05 15:18:46
位深度存储在ASBD->mBitsPerChannel中。
https://stackoverflow.com/questions/23119668
复制相似问题