1

In iPhone developing video compress functionality. I developed that features but little bit confusion about bit rate calculation.

I m using bellow methods for video compress.

 1. AVAsset 
 2. AVAssetTrack
 3. AVAssetWriterInput
 4. AVAssetWriter
 5. AVAssetReader
 6. AVAssetReaderOutput
 7. AVAssetTrack
 8. AVAssetReader

Can we get video bit rate of original video?

Bhavesh Kumbhani
  • 555
  • 4
  • 11
  • http://stackoverflow.com/questions/18199018/programatically-get-the-bitrate-of-an-audio-file http://stackoverflow.com/questions/2159663/how-to-get-specific-information-about-media-files-duration-bitrate-fps-etc – Tirth Jan 21 '14 at 05:36
  • http://stackoverflow.com/questions/4929825/how-can-i-read-the-properties-of-an-audio-file-in-objective-c-for-ios – Tirth Jan 21 '14 at 05:38

1 Answers1

2

Loop through the tracks of AVAsset, determine what kind of track it is (audio/video) and use "estimatedDataRate" property of AVAssetTrack to get the average bitrate of file. Something like this:

AVAsset *asset = [AVAsset assetWithURL:url];
for(AVAssetTrack *track in asset.tracks)
{
    if([track.mediaType isEqual:AVMediaTypeVideo])
    {
        videoBitrate = track.estimatedDataRate;
    }
    if([track.mediaType isEqual:AVMediaTypeAudio])
    {
        audioBitrate = track.estimatedDataRate;
    }
}
Farhad Malekpour
  • 1,314
  • 13
  • 16