I am working on a video app and I need to get the codec type and channel number of all audio tracks.
I succeed to get this value for the current track via assetTrack :
if ([track.assetTrack.mediaType isEqual:AVMediaTypeAudio]){
AVAssetTrack* assetTrack = track.assetTrack;
NSArray* formatDesc = assetTrack.formatDescriptions;
for(unsigned int j = 0; j < [formatDesc count]; ++j) {
CMAudioFormatDescriptionRef item = (__bridge CMAudioFormatDescriptionRef)[formatDesc objectAtIndex:j];
const AudioStreamBasicDescription* audioDes = CMAudioFormatDescriptionGetStreamBasicDescription (item);
if(audioDes) {
NSLog(@"channel:%d",audioDes->mChannelsPerFrame);
}
CMFormatDescriptionRef item2 = (__bridge CMFormatDescriptionRef)[formatDesc objectAtIndex:j];
FourCharCode result = CMFormatDescriptionGetMediaSubType(item2);
if(result) {
NSLog(@"codec:@%@",[self FourCCString:result]);
}
}
}
How to get these values for the audio tracks not played ?
Is it possible or this is a AVPlayer limitation ?
Thanks,
Fabien
Post
Replies
Boosts
Views
Activity
I am working on a video app and I get error like this:
" An unknown error occured (-16839)"
I couldn't find the map of the AVPlayer error code anywhere online. Someone knows the meaning of this error ?
Thanks!