Q: Determine whether mp4 is a audio or video in objective C Since mp4 is a container file format it can store audio as well as video files. What i am struggling to find out is its true media type. (Whether its a audio or video) Could this be done in IOS (objective c) ?

A: AVAsset *asset = [AVAsset assetWithURL:<URL to mp4>];
BOOL hasVideo = [asset tracksWithMediaType:AVMediaTypeVideo].count > 0;
BOOL hasAudio = [asset tracksWithMediaType:AVMediaTypeAudio].count > 0;


A:     BOOL isMP4VideoType; //Global Variables;
    BOOL isMP4AudioType; //Global Variables;

    //Create an object of AVAsset  class With MP4 URL.
    AVAsset *asset = [AVAsset assetWithURL:YOUR_MP4_URL];

    NSArray *aryVideoTracks = [asset tracksWithMediaType:AVMediaTypeVideo];
    NSArray *aryAudioTracks = [asset tracksWithMediaType:AVMediaTypeAudio];
    if([aryVideoTracks count]!=0)
    {
     isMP4VideoType = YES;
    }else if([aryVideoTracks count]!=0)
    {
     isMP4AudioType = YES;
    }


A: AVURLAsset* asset = [[AVURLAsset alloc]initWithURL:_assetUrl options:nil];
NSArray *audioTracks = [asset tracksWithMediaType:AVMediaTypeAudio];
AVAssetTrack * audioTrack = [audioTracks firstObject];


if([track hasMediaCharacteristic:AVMediaCharacteristicAudible]){

}


