首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用线性PCM编码音频的AVAsset的位深度

用线性PCM编码音频的AVAsset的位深度
EN

Stack Overflow用户
提问于 2014-04-16 20:38:12
回答 1查看 682关注 0票数 1

给定表示至少有一个音频轨道的电影的AVAsset,则可以通过获取与其对应的AudioStreamBasicDescription实例来确定该音频轨道的各种属性

代码语言:javascript
复制
AVAssetTrack audio_track =  [[asset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
CMFormatDescriptionRef formatDescriptionRef = [audio_track.formatDescriptions objectAtIndex:0];
AudioStreamBasicDescription *ASBD = CMAudioFormatDescriptionGetStreamBasicDescription(formatDescriptionRef);

然后可以检查此实例(ASBD),例如:

代码语言:javascript
复制
ASBD->mFormatID == kAudioFormatLinearPCM  // True if the track is PCM
ASBD->mFormatFlags & kAudioFormatFlagIsBigEndian // nonzero if the format is big endian

然而,我似乎无法找到一种方法来确定样本的比特深度。这是必要的,因为它将作为字典中键AVLinearPCMBitDepthKey的值提供,该字典将作为输出设置传递给+[AVAssetWriterInput assetWriterInputWithMediaType: outputSettings:]

如何从AVAssetAVAssetTrack中提取这些信息?

(上下文是在AVAsset中重新编码视频,但将音频保留为原样)

EN

回答 1

Stack Overflow用户

发布于 2014-06-05 15:18:46

位深度存储在ASBD->mBitsPerChannel中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23119668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档