Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCAssetExportSession watermark orientation bug #202

Open
pingguoilove opened this issue Aug 25, 2015 · 3 comments
Open

SCAssetExportSession watermark orientation bug #202

pingguoilove opened this issue Aug 25, 2015 · 3 comments

Comments

@pingguoilove
Copy link

I found a bug when export a video file which import from album, the water mark orientation is wrongwrong gif

@realcarlos
Copy link

me too, is there any solutions?

@pingguoilove
Copy link
Author

@realcarlos No

@pixelmatrix
Copy link

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:

  1. enabling keepInputAffineTransform (passes through the transform to the export session)
  2. disabling translatesFilterIntoComposition (seems the composition doesn't respect the transform)
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants