AFathi / ARVideoKit

Capture & record ARKit videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆.
Apache License 2.0
1.62k stars 226 forks source link

possible to capture just the video without the AR overlay? #102

Closed shi-yan closed 4 years ago

shi-yan commented 4 years ago

If I want to only capture the video stream without the AR overlay, can I do it?

I want to use AR to guide video recording, but I don't want to record the AR overlay.

Thanks!

digitallysavvy commented 4 years ago

@shi-yan you can get that directly from ARKit using ARFrame's capturedImage

AFathi commented 4 years ago

@shi-yan see the following instructions,

@digitallysavvy that's a good point. In addition to the option to retrieve the original frame using the ARFrame.capturedImage, you can also use ARVideoKit's RenderARDelegate. To set the the RenderARDelegate, make sure to follow these steps:

  1. Set renderAR of RecordAR to a class conforming to RenderARDelegate.
recordAR?. renderAR = self
  1. Make sure the class conforming to RenderARDelegate has the required method
    
    class MyViewController: UIViewController, RenderARDelegate {
    ...
    ...
    ...
    func frame(didRender buffer: CVPixelBuffer, with time: CMTime, using rawBuffer: CVPixelBuffer) {
    // Use `rawBuffer` here to retrieve the original frame
    // Use `buffer` to retrieve the rendered frame
    }

}

shi-yan commented 4 years ago

Thank you. I'm aware of capturedImage. The reason for raising the question was that if I use capturedImage, I need to implement my own video encoding code?

@AFathi Thank you very much for the answer!

taeger commented 3 years ago

@AFathi: Sorry, bloody beginner's question. What do I have to write – HERE – to make this work?

func frame(didRender buffer: CVPixelBuffer, with time: CMTime, using rawBuffer: CVPixelBuffer) { – HERE – }