How to record video from ARKit?

后端 未结 5 1484

Now I\'m testing ARKit/SceneKit implementation. The basic rendering to the screen is kinda working so then I wanna try recording what I see on the screen into a video.

相关标签:
5条回答
  • 2021-02-02 00:14

    I just found this framework, called ARVideoKit, and it seems to be easy to implement plus they have more features such as capturing GIFs and Live Photos.

    The framework official repo is: https://github.com/AFathi/ARVideoKit/

    To install it, you'd have to clone the repo and drag the .framework file into your project's embedded binary.

    Then the implementation is pretty simple:

    1. import ARVideoKit in your UIViewController class

    2. Create a RecordAR? variable

      var videoRec:RecordAR?

    3. Initialize your variable in viewDidLoad

      videoRec = RecordAR(ARSpriteKit:sceneView)

    4. Prepare RecordAR in viewWillAppear

      videoRec.prepare(configuration)

    5. Begin recording a video

      videoRec.record()

    6. Stop and export to camera roll!

      videoRec.stopAndExport()

    Take a look at the framework's documentation, it supports more features to use!

    You can find their documentation here: https://github.com/AFathi/ARVideoKit/wiki

    Hope that helped!

    0 讨论(0)
  • 2021-02-02 00:27

    ReplayKit is not a good solution because your users are presented with an ugly permission dialog, and you also have to work around it recording UI elements. You also have less control on your video resolution.

    Instead, you should use the captured frame CVPixelBuffer returned by ARKit, and handle it like you would if you were recording frames captured from the camera. Assuming you need to process your video frames, you may also need to use a framework like Metal to handle the drawing. It is not simple. See answer provided here: How to record video in RealityKit?

    0 讨论(0)
  • 2021-02-02 00:31

    Don't know if you have managed to answer this by now or not, but lacyrhoades, the person who wrote the class you referenced, has released another project on github that seems to do what you're asking for. I've used it and it manages to record the SceneView with AR Objects as well as the camera input. You can find it through this link:

    https://github.com/lacyrhoades/SCNKit2Video

    If you want to use it with AR though, you have to configure the ARSceneView to the project he's make, as his one just runs a SceneView, not one with AR.

    Hope it helps.

    0 讨论(0)
  • 2021-02-02 00:33

    If you can keep your device connected to your Mac, it is really easy to just use QuickTime Player to record screen (and sound) from your iOS device.

    In QuickTime choose new Movie Recording in the File menu, then in the record dialog near the big red record button there is a little dropdown arrow, where you can pick audio input and video input. Choose your i-device there and you're set to go.

    0 讨论(0)
  • 2021-02-02 00:39

    You can record everything seen on the screen (or live stream it to services like Twitch, for that matter) using ReplayKit, ARKit and SceneKit content included.

    (As Apple pointed out at WWDC, ReplayKit is actually the basis for the Control Center screen recording feature in iOS 11.)

    0 讨论(0)
提交回复
热议问题