BradLarson / GPUImage2

GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing.
BSD 3-Clause "New" or "Revised" License
4.85k stars 605 forks source link

Recorded video with front camera playing inverted #233

Open aaasifrz9 opened 6 years ago

aaasifrz9 commented 6 years ago

Hi @BradLarson,

I have transformed video view to display. Now it's showing properly on the device as like as back camera. But when I recorded it is playing inverted again because we have transformed view only not camera orientation.

Can you please help, how to invert recorded video with proper orientation.

Thanks in advance.

joshbernfeld commented 6 years ago

I would place the following in the init() function of the Camera before commitConfiguration() is called

if let connections = videoOutput.connections as? [AVCaptureConnection] {
    for connection in connections {
        if(connection.isVideoMirroringSupported) {
            connection.isVideoMirrored = (location == .frontFacing)
        }
    }
}

If you use the MovieOutput for recording, it should come out as you see it on the screen. If you take a photo with AVCapturePhotoOutput, then you will have to manually flip the photo after it is taken.

aaasifrz9 commented 6 years ago

Thanks @joshbernfeld

w-i-n-s commented 5 years ago

Thanks @joshbernfeld