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.88k stars 611 forks source link

Loading a local video is somehow showing in the RenderView rotated 90 degrees #290

Open cosmicsalad opened 5 years ago

cosmicsalad commented 5 years ago

I'm trying to load a local video file into a MovieInput, then into a RenderView and it's showing up like this: photo dec 14 12 36 44 pm

Here's how I'm loading things, testing a basic filter:

do {
    let asset = assetV as! AVURLAsset
    let screenSize = UIScreen.main.bounds.size

    self.filterView = RenderView(frame: CGRect(x: 0, y: 0, width: screenSize.width, height: (screenSize.height - 10) * 0.4))
    self.filterView.center = CGPoint(x: self.view.center.x, y: self.view.center.y - (DataBox.homeMenuHeight/4))
    //self.filterView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9)
    self.filterView.fillMode = .preserveAspectRatio
    self.filterView.orientation = .portrait

    self.view.addSubview(self.filterView!)

    let filter = BrightnessAdjustment()
    filter.brightness = 0.1
    self.player = try MovieInput(url: asset.url, playAtActualSpeed: true, loop: true)
    self.player --> filter --> self.filterView!
    //movie.runBenchmark = true
    self.player.start()
} catch {
    print("Nope")
}

Console is showing: Generating new framebuffer at size: GLSize(width: 3840, height: 2160) Not sure why width and height seemed to be reversed. Any ideas? It also happens with 1080 and 720 videos, but doesn't happen with boomerang gifs created with Instagram. Any thoughts?

Topwiz commented 5 years ago

Try changing self.filterView.orientation = .portrait To .landscapeLeft or .landscapeRight

cosmicsalad commented 5 years ago

Try changing self.filterView.orientation = .portrait To .landscapeLeft or .landscapeRight

Hmm, that rotates 1080 - 4k videos correctly, but now any gif videos like those created by Instagram are sideways.