How to record video from ARKit?

后端 未结 5 1550

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!

提交回复
热议问题