IOS gets video frame rate

I want to get the frame rate for a specific video. I tried to look at the APIs in AVFoundation and AssetsLibrary as AVURLAsset or AVAssetReader. None of them are very useful. Does anyone know a method in the Apple infrastructure / library to get the frame rate

+6
source share
2 answers

For iOS 7+, you can use the currentVideoFrameRate property for AVPlayerItemTrack. Its only permanent property that I have seen is measuring FPS. The nominal FrameRate property is apparently broken in HLS streams.

 AVPlayerItem *item = AVPlayer.currentItem; // Your current item float fps = 0.00; for (AVPlayerItemTrack *track in item.tracks) { if ([track.assetTrack.mediaType isEqualToString:AVMediaTypeVideo]) { fps = track.currentVideoFrameRate; } } 
+3
source

A simpler option is to get AVAssetTrack and read its nominal RrameRate property. Looks like this one can help you.

The nominal frame rate is the frame rate of the track in frames per second. (read-only) AVAssetTrack class @property (nonatomic, readonly) float nomFrameRate

+7
source

Source: https://habr.com/ru/post/915501/


All Articles