Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get FPS of video in ios

How to get FPS of video in iOS SDK. I have tried below line of code but it does not seems perfect to me.

AVAssetTrack *videoAssetTrack = [myAsset tracksWithMediaType:AVMediaTypeVideo].firstObject;
NSLog(@"FPS is  : %f ",videoAssetTrack.nominalFrameRate);

Any help will be appreciated.

like image 576
Payal Maniyar Avatar asked Mar 12 '23 01:03

Payal Maniyar


1 Answers

I got correct FPS with below line of code :

AVAsset * myAsset = [[AVURLAsset alloc] initWithURL: _videoUrl options: nil];
AVAssetTrack * videoAssetTrack = [myAsset tracksWithMediaType: AVMediaTypeVideo].firstObject;
NSLog(@"FPS is  : %f ", videoAssetTrack.nominalFrameRate);
like image 191
Payal Maniyar Avatar answered Mar 17 '23 21:03

Payal Maniyar