Rotate AVAssetWriter 180 degrees around the x axis

I am creating a Quicktime video file using AVAssetWriter . The output video is currently upside down. Theoretically, I can fix this by rotating the video 180 degrees about the horizontal axis (essentially “flipping” the video). What is the best way to do this?

I am currently trying to assign a CGAffineTransform to myAVAssetWriterInput.transform . Perhaps CGAffineTransformMake(a, b, c, d, tx, ty) will allow me to specify the correct affine transformation matrix?

Neither Apple docs nor wikipedia provide a clear explanation of how the affinity transform matrix works. And everything can be best.

+6
source share
1 answer
 myAVAssetWriterInput.transform = CGAffineTransformMakeRotation(M_PI); 

if you want to rotate the video 180 degrees around the z axis or

 myAVAssetWriterInput.transform = CGAffineTransformMakeScale(1, -1); 

if you want to flip x

+17
source

Source: https://habr.com/ru/post/901952/


All Articles