Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
How to save TrueDepth data while recording video on iOS?

I am looking for a way to save the depth information (for each frame) to a file while recording a video using the TrueDepth camera. I have found solutions for saving the depth data while taking photos, but not with video.

I currently have code for recording video and saving it to a file and capturing the depth data simultaneously. However, I don't know how to save the depth data. Basically I use AVCaptureSession and AVCaptureMovieFileOutput to save the recorded video. I found that the depth data is given by AVCaptureDepthDataOutput, but how can I save that to a file?

The main parts of the code:

let captureSession = AVCaptureSession()
let sessionOutput = AVCapturePhotoOutput()
let movieOutput = AVCaptureMovieFileOutput()
let depthDataOutput = AVCaptureDepthDataOutput()

if let device = AVCaptureDevice.default(.builtInTrueDepthCamera,
                                 for: .video, position: .front) {
let input = try AVCaptureDeviceInput(device: device )

  if captureSession.canAddInput(input){
    captureSession.sessionPreset = AVCaptureSession.Preset.photo
    captureSession.addInput(input)
    if captureSession.canAddOutput(sessionOutput){   
      captureSession.addOutput(sessionOutput)
      // Code for adding previewing the video
    }
  }

  if captureSession.canAddOutput(depthDataOutput){
    captureSession.addOutput(depthDataOutput)
  }
  if let connection = depthDataOutput.connection(with: .depthData) {
    connection.isEnabled = true
    depthDataOutput.isFilteringEnabled = false
    print("Depth data working")
  } else {
    print("No AVCaptureConnection")
  }

  // Capture the video to a file
  captureSession.addOutput(movieOutput)
  captureSession.startRunning()

  // ...
  // How to store the depth data from AVCaptureDepthDataOutput ?
}

Any ideas?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda