SCRecorder
SCRecorder copied to clipboard
SCAssetExportSession watermark orientation bug
I found a bug when export a video file which import from album, the water mark orientation is wrong
me too, is there any solutions?
@realcarlos No
The reason for the different behavior is that portrait videos from the camera roll are actually landscape videos that have a transform applied to them as part of their metadata. The segments recorded by SCRecorder are actually portrait dimensions.
I solved this locally by:
- enabling keepInputAffineTransform (passes through the transform to the export session)
- disabling translatesFilterIntoComposition (seems the composition doesn't respect the transform)
- in the _buildWatermarkFilterForVideoSize method of SCAssetExportSession, just before drawing in the graphics context, I added this:
CGAffineTransform affineTransform = _videoInput.transform;
CGAffineTransform invertedTransform = CGAffineTransformInvert(affineTransform);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextConcatCTM(context, invertedTransform);
I can't guarantee this will work for everyone, but it worked for me. Hope this helps someone.