我有一个不能准确搜索的mp4文件,向后搜索很慢。我认为它是由压缩程度很高的编码引起的。
使用AVFoundation重新编码此文件的最佳方法是什么,以便我可以将每个帧作为关键帧?
答案 0 :(得分:0)
设置(最大)关键帧间隔的标准方法是AVVideoMaxKeyFrameIntervalKey
。
相应的值是
NSNumber
的实例。 1表示关键帧 仅 强>
您可以将它应用于AVAssetWriter
对象,该对象可能与此类似:
NSDictionary *compProps = @{ AVVideoAverageBitRateKey : @(bitsPerSecond),
AVVideoExpectedSourceFrameRateKey : @(30),
AVVideoMaxKeyFrameIntervalKey : @(1) };
_videoInput = [[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeVideo
outputSettings:compProps];