iOS에서 변경 가능한 프레임 속도 및 클립 기간으로 입력 MOV 파일을 다시 인코딩하려고합니다. 순간 나는 비디오 속성을 설정 AVAssetWriter이이 같은 비트가 :AVAssetWriter를 사용하여 H264 mov 파일을 다시 인코딩 - 프레임 속도를 설정하는 방법?
NSMutableDictionary* compressionPropertiesDict = [NSMutableDictionary new];
compressionPropertiesDict[AVVideoProfileLevelKey] = AVVideoProfileLevelH264High40;
if(self.fps > 0) {
compressionPropertiesDict[AVVideoAverageNonDroppableFrameRateKey] = [NSNumber numberWithInt:self.fps];
_sessionMgr.videoSettings = @
{
AVVideoCodecKey: AVVideoCodecH264,
AVVideoWidthKey: [NSNumber numberWithFloat:self.outputSize.width],
AVVideoHeightKey: [NSNumber numberWithFloat:self.outputSize.height],
AVVideoCompressionPropertiesKey: compressionPropertiesDict,
};
이처럼 보이는 런타임에 나오는 그 :
videoSettings =
{
AVVideoCodecKey = avc1;
AVVideoCompressionPropertiesKey = {
AverageNonDroppableFrameRate = 15;
ProfileLevel = "H264_High_4_0";
};
AVVideoHeightKey = 960;
AVVideoWidthKey = 640;
}
을 마지막에있는, 나는 NSInvalidArgumentException: "Compression property AverageNonDroppableFrameRate is not supported for video codec type avc1"
와 충돌을 얻을 . (시뮬레이터를 사용한 단위 테스트에서)
iOS, AVVideoCodecH264/"avc1"에서 사용할 수있는 코덱 유형은 하나 뿐이며 다른 프로젝트에서는 AVVideoAverageNonDroppableFrameRateKey
을 사용합니다. 사실 SDAVAssetExportSession을 사용하고 있으며 코드베이스에서이 키를 명시 적으로 사용하고 있습니다. 그래서 프레임 속도를 설정하기 위해이 키를 사용하는 방법이 있어야한다고 생각했을 것입니다.
AVVideoMaxKeyFrameIntervalKey
를 사용하여 약간의 실험을했지만, 그래서, 요약 그 사람이 다른 설정과 함께 나를 도울 수 ... 모든
을 내 프레임 속도를 변경하지 않습니다 (항상 낮은) iOS AVFoundation 기반 비디오 변환을위한 출력 프레임 속도? 감사!
솔루션을 찾았습니까? – user924
아, 그래, 나는 대답으로 게시 할 것입니다! – Mete