Posts

Post not yet marked as solved
2 Replies
I have the same problem. Have you solved it?
Post not yet marked as solved
2 Replies
In the system above iOS 12.0 of iPhone devices, video converted by the following codes is used. Compared with the original video, the color of the red part is different, and the original red part becomes yellow.The same code, in iPhone devices below iOS 12.0 (excluding iOS 12.0), after the conversion of the original video, there is no color difference compared with the original video, and the red part shows the same red color as the original video.- (AVMutableVideoComposition *)getVideoComposition:(AVAsset *)asset { AVMutableVideoComposition *videoComposition; AVMutableVideoCompositionInstruction * instruction; AVMutableVideoCompositionLayerInstruction *layerInstruction = nil; AVAssetTrack *assetVideoTrack = nil; if ([[asset tracksWithMediaType:AVMediaTypeVideo] count] != 0) { assetVideoTrack = [[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; } CGSize videoSize = CGSizeMake(1280, 720); CGAffineTransform transform = [self transformWithVideoAssetTrack:assetVideoTrack rotateAngle:0 displayFrame:CGRectMake(0, 0, videoSize.width, videoSize.height)]; instruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction]; instruction.timeRange = CMTimeRangeMake(kCMTimeZero, asset.duration); layerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:assetVideoTrack]; CGSize renderSize = videoSize; if (CGSizeEqualToSize(renderSize, CGSizeZero)) { renderSize = CGSizeApplyAffineTransform(assetVideoTrack.naturalSize, transform); renderSize = CGSizeMake(fabs(renderSize.width), fabs(renderSize.height)); } videoComposition = [AVMutableVideoComposition videoComposition]; videoComposition.renderSize = renderSize; float frameRate = 30; videoComposition.frameDuration = CMTimeMake(1000, 1000 * frameRate); NSLog(@"frameDuraton {value: %lld, timescale: %d}", videoComposition.frameDuration.value, videoComposition.frameDuration.timescale); instruction.layerInstructions = [NSArray arrayWithObject:layerInstruction]; videoComposition.instructions = [NSArray arrayWithObject:instruction]; return videoComposition;}