kotowo
4/30/2016 - 5:31 AM

hasVideoTrack.m

- (BOOL)hasVideo:(NSString*)filePath
{
    if (!filePath.length) {
        return NO;
    }
    NSURL* url = [NSURL fileURLWithPath:filePath];
    if (!url) {
        return NO;
    }
    NSLog(@"URL: %@", url.description);
    
    // check video track
    AVAsset* asset = [AVAsset assetWithURL:url];
    AVAssetTrack* track = [[asset tracksWithMediaType:AVMediaTypeVideo] firstObject];
    if (track) {
        return YES;
    }
    return NO;
}