All Projects → gorastudio → SCNRecorder

gorastudio / SCNRecorder

Licence: MIT license
The best way to record your AR experience!

Programming Languages

swift
15916 projects
Metal
113 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to SCNRecorder

avantindietro
Sample Swift iOS ARKit project which shows how to implement an Undo feature for ARKit/SceneKit apps.
Stars: ✭ 16 (-88.24%)
Mutual labels:  scenekit, arkit
Tom and Jerry
A multiuser AR game based on ARKit 2 and MultipeerConnectivity
Stars: ✭ 24 (-82.35%)
Mutual labels:  scenekit, arkit
Arkit2.0 Prototype
After Apple’s introduction of ARKit 2, we have been consistently working behind to create shared-AR experiences. Our goal is to improve the utility of mobile using AR experiences.
Stars: ✭ 236 (+73.53%)
Mutual labels:  scenekit, arkit
Arplayer
Playback videos using ARKit and AVFoundation.
Stars: ✭ 117 (-13.97%)
Mutual labels:  scenekit, arkit
ARichMan
Use ARKit to realize your dream of becoming rich.
Stars: ✭ 19 (-86.03%)
Mutual labels:  scenekit, arkit
React Native 3d Model View
A React Native view for displaying 3D models
Stars: ✭ 119 (-12.5%)
Mutual labels:  scenekit, arkit
arkit-graffiti
A demo that shows painting on walls with ARKit+SceneKit
Stars: ✭ 49 (-63.97%)
Mutual labels:  scenekit, arkit
Measurethings
ARKit framework demo for our article
Stars: ✭ 97 (-28.68%)
Mutual labels:  scenekit, arkit
ARMultiuser
this demo use arkit 2.0, realize multiplayer play together! The project refers to the official demo!
Stars: ✭ 30 (-77.94%)
Mutual labels:  scenekit, arkit
SceneKit-PortalMask
Clean class to create a portal in SceneKit for use in ARKit.
Stars: ✭ 60 (-55.88%)
Mutual labels:  scenekit, arkit
Artetris
Augmented Reality Tetris made with ARKit and SceneKit
Stars: ✭ 1,483 (+990.44%)
Mutual labels:  scenekit, arkit
TheLaughingMan-ARKit
Use ARKit to become the infamous Laughing Man from Ghost in the Shell
Stars: ✭ 26 (-80.88%)
Mutual labels:  scenekit, arkit
Arkit Portal
Simple portal demo implemented with ARKit+SceneKit, the trick is to change the rendering order and render invisible "masks" to hide what's inside.
Stars: ✭ 105 (-22.79%)
Mutual labels:  scenekit, arkit
Arkit Floorislava
Basic ARKit example that detects planes and makes them lava.
Stars: ✭ 120 (-11.76%)
Mutual labels:  scenekit, arkit
Ios Learning Materials
📚Curated list of articles, web-resources, tutorials and code repositories that may help you dig a little bit deeper into iOS [and Apple Platforms].
Stars: ✭ 1,380 (+914.71%)
Mutual labels:  scenekit, arkit
Arkit Smb Homage
An implementation of a Super Mario Bros-like game in augmented reality with ARKit and SceneKit.
Stars: ✭ 244 (+79.41%)
Mutual labels:  scenekit, arkit
Arkit Shell Game
Shell Game built with ARKit and SceneKit
Stars: ✭ 82 (-39.71%)
Mutual labels:  scenekit, arkit
Arkit Sampler
Code examples for ARKit.
Stars: ✭ 1,334 (+880.88%)
Mutual labels:  scenekit, arkit
ARKit-FocusNode
FocusSquare class taken straight from Apple's ARKit examples and packed up for anyone to use with ease.
Stars: ✭ 50 (-63.24%)
Mutual labels:  scenekit, arkit
aruco-arkit-opencv
This iOS app detects aruco markers in a live view. v4.4
Stars: ✭ 19 (-86.03%)
Mutual labels:  scenekit, arkit

SCNRecorder

GitHub license Platforms Swift Cocoapods compatible Carthage compatible Swift Package Manager

SCNRecorder allows you to record videos and to capture images from ARSCNView, SCNView and ARView (RealityKit) without sacrificing performance. It gives you an incredible opportunity to share the media content of your augmented reality app or SceneKit based game.

Starting version 2.2.0 SCNRecorder supports Metal only.

Sample

Requirements

  • iOS 12.0+
  • Xcode 12.0+
  • Swift 5.0+

Installation

CocoaPods

pod 'SCNRecorder', '~> 2.7'

Carthage

github "gorastudio/SCNRecorder"

Usage

Import the SCNRecorder module.

import SCNRecorder

Call sceneView.prepareForRecording() at viewDidLoad.

@IBOutlet var sceneView: SCNView!

override func viewDidLoad() {
  super.viewDidLoad()
  sceneView.prepareForRecording()
}

And now you can use new functions to capture videos.

try sceneView.startVideoRecording()
sceneView.finishVideoRecording { (videoRecording) in 
  /* Process the captured video. Main thread. */
  let controller = AVPlayerViewController()
  controller.player = AVPlayer(url: recording.url)
  self.navigationController?.pushViewController(controller, animated: true)
}

To capture an image it is enough to call:

sceneView.takePhoto { (photo: UIImage) in
  /* Your photo is now here. Main thread. */
}

or

sceneView.takePhotoResult { (result: Result<UIImage, Swift.Error>) in
  /* Result is here. Main thread. */
}

Look at the Example project for more details.

Audio capture

ARSCNView

To capture video with audio from ARSCNView enable audio in the ARConfiguration.

let configuration = ARWorldTrackingConfiguration()
configuration.providesAudioData = true
sceneView.session.run(configuration)

SCNView

To capture audio from SCNView you have to implement it by yourself.

var captureSession: AVCaptureSession?

override func viewDidLoad() {
  super.viewDidLoad()
  sceneView.prepareForRecording()
  
  guard let recorder = sceneView.recorder else { return }
  let captureSession = AVCaptureSession()
  
  guard let captureDevice = AVCaptureDevice.default(for: .audio) else { return }
  
  do {
    let captureInput = try AVCaptureDeviceInput(device: captureDevice)
    
    guard captureSession.canAddInput(captureInput) else { return }
    captureSession.addInput(captureInput)
  }
  catch { print("Can't create AVCaptureDeviceInput: \(error)")}
  
  guard captureSession.canAddRecorder(recorder) else { return }
  captureSession.addRecorder(recorder)
  
  captureSession.startRunning()
  self.captureSession = captureSession
}

or, simply

var captureSession: AVCaptureSession?

override func viewDidLoad() {
  super.viewDidLoad()
  sceneView.prepareForRecording()
  
  captureSession = try? .makeAudioForRecorder(sceneView.recorder!)
}

Music Overlay

Instead of capturing audio using microphone you can play music and add it to video at the same time.

let auidoEngine = AudioEngine()

override func viewDidLoad() {
  super.viewDidLoad()
  
  sceneView.prepareForRecording()
  do {
    audioEngine.recorder = sceneView.recorder
    
    // If true, use sound data from audioEngine if any
    // If false, use sound data ARSession/AVCaptureSession if any
    sceneView.recorder?.useAudioEngine = true
    
    let player = try AudioEngine.Player(url: url)
    audioEngine.player = player
    
    player.play()
  }
  catch { 
    print(\(error))
  }
}

RealityKit

To support recording RealityKit, copy ARView+MetalRecordable.swift and ARView+SelfSceneRecordable.swift files to your project. Then look at RealityKitViewController.swift for usage.

That's it!

Look at the Example project for more details.

Author

Thanks to Fedor Prokhorov and Dmitry Yurlov for testing, reviewing and inspiration.

GORA Studio

Made with magic 🪄 at GORA Studio

License

This project is licensed under the MIT License - see the LICENSE file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].