美文网首页
iOS 获取视频编码格式

iOS 获取视频编码格式

作者: 欢乐的乐 | 来源:发表于2019-11-11 14:50 被阅读0次
    + (CMVideoCodecType)videoCodecTypeForURL:(NSURL *)url {
        AVURLAsset *videoAsset = (AVURLAsset *)[AVURLAsset URLAssetWithURL:url
                                   options:nil];
        
        NSArray *videoAssetTracks = [videoAsset tracksWithMediaType:AVMediaTypeVideo];
        AVAssetTrack *videoAssetTrack = videoAssetTracks.firstObject;
        
        CMFormatDescriptionRef desc = (__bridge CMFormatDescriptionRef)videoAssetTrack.formatDescriptions.firstObject;
        CMVideoCodecType codec = CMVideoFormatDescriptionGetCodecType(desc);
        
        return codec;
    }
    

    相关文章

      网友评论

          本文标题:iOS 获取视频编码格式

          本文链接:https://www.haomeiwen.com/subject/neetictx.html