[iOS][AvFoundation] Need to get the similar classes like MediaCodec in android

Viewed 30

is there any class in iOS which returns encoder/ decoder capabilities just like Android MediaCodec/ MediaCodecList.(https://developer.android.com/reference/android/media/MediaCodec)

I need to get the fps/profile/level and width /height supported on each profile of h264 and hevc codec.

I have found it related to AvCaptureSession, but this may not be correct since we need to support AvPlayer only (and camera is not in the part of the flow.)

1 Answers

AVFoundation has very limited supported formats. Refer to this StackOverflow

So If somebody wants to query for the codec info, I recommend him/she use ffmpeg. To be specific, it's ffmpeg-kit. Check here for all API documentation.

I wrote you a sample about how to use it in iOS and query for codec info(or anything you want). Please check it out: showcase

    let mediaInfoSession = FFprobeKit.getMediaInformation(kSampleFilePath)
    let mediaInfo = mediaInfoSession?.getMediaInformation()
    let props = mediaInfo?.getAllProperties()
    let duration = mediaInfo?.getDuration()
    let bitRate = mediaInfo?.getBitrate()
    ...

enter image description here

Feel free to contact me.

Related