PinkFloydRocks PinkFloydRocks - 2 months ago 30
iOS Question

How to flip a video using AVFoundation

I've recorded a video with the front facing camera and the output is mirrored...

I've tried using

AVMutablecomposition
and
layerinstructions
to flip the video but no luck.

Googling and searching Stack Overflow has been fruitless so I bet a simple, straight forward example of how to do this is something that would benefit many.

Answer

Theres no indication on what you are using to record the video, ill assume AVCaptureSession + AVCaptureVideoDataOutput

lazy var videoFileOutput: AVCaptureVideoDataOutput = AVCaptureVideoDataOutput()
let v = videoFileOutput.connectionWithMediaType(AVMediaTypeVideo)
v.videoOrientation = .Portrait
v.videoMirrored = true