Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

212
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda