Questions tagged [cmsamplebuffer]

96 questions
20
votes
4 answers

Pulling data from a CMSampleBuffer in order to create a deep copy

I am trying to create a copy of a CMSampleBuffer as returned by captureOutput in a AVCaptureVideoDataOutputSampleBufferDelegate. Since the CMSampleBuffers come from a preallocated pool of (15) buffers, if I attach a reference to them they cannot be…
bennyty
  • 301
  • 4
  • 18
13
votes
3 answers

Convert CMSampleBuffer to UIImage

I am trying to convert sampleBuffer to a UIImage and display it in an image view with colorspaceGray. But it displays as the following image. I think there is a problem regarding the conversion. How can I convert the CMSampleBuffer? func…
Rubaiyat Jahan Mumu
  • 2,741
  • 1
  • 25
  • 32
11
votes
1 answer

Getting desired data from a CVPixelBuffer Reference

I have a program that views a camera input in real-time and gets the color value of the middle pixel. I use a captureOutput: method to grab the CMSampleBuffer from an AVCaptureSession output (which happens to be read as a CVPixelBuffer) and then I…
bbrownd
  • 475
  • 1
  • 6
  • 14
9
votes
2 answers

Play audio from CMSampleBuffer

I have created a video chat app for groups in iOS. I have been searching for some ways to control the audio volume for different participant separately. I found way to mute and unmute using isPlaybackEnabled in RemoteAudioTrack, but not to control…
Alok Subedi
  • 1,531
  • 10
  • 25
9
votes
0 answers

create CMSampleBuffer from CVPixelBuffer

I am provided with pixelbuffer, which I need to attach to rtmpStream object from lf.swift library to stream it to youtube. it looks like this: rtmpStream.appendSampleBuffer(sampleBuffer: CMSampleBuffer, withType: CMSampleBufferType) So, I need to…
7
votes
1 answer

Getting value from unSafeMutablePointer Int16 in Swift for audio data purposes

I'm working to convert to Swift this code which helps get me get audio data for visualizations. The code I'm working with in Obj C, which works well, is: while (reader.status == AVAssetReaderStatusReading) { AVAssetReaderTrackOutput…
MScottWaller
  • 2,611
  • 16
  • 36
7
votes
0 answers

How to fill audio AVFrame (ffmpeg) with the data obtained from CMSampleBufferRef (AVFoundation)?

I am writing program for streaming live audio and video from webcamera to rtmp-server. I work in MacOS X 10.8, so I use AVFoundation framework for obtaining audio and video frames from input devices. This frames come into delegate: -(void)…
Aleksei2414904
  • 133
  • 1
  • 2
  • 7
6
votes
2 answers

How to convert CMSampleBuffer to Data in Swift?

I need to convert CMSampleBuffer to Data format. I am using one Third party framework for audio related task. That framework gives me the streaming (i.e Real Time audio) audio in CMSampleBuffer object. Like this: func didAudioStreaming(audioSample:…
Sridhar
  • 2,108
  • 10
  • 42
  • 79
5
votes
0 answers

Rotate CMSampleBuffer/CVPixelBuffer

I am currently attempting to change the orientation of a CMSampleBuffer by first converting it to a CVPixelBuffer and then using vImageRotate90_ARGB8888 to convert the buffer. The problem with my code is that when vImageRotate90_ARGB8888 executes,…
5
votes
1 answer

Using AVCaptureVideoDataOutputSampleBufferDelegate without a preview window

I'm working on a Swift-based macOS app where I need to capture video input, but not display it on the screen...rather than display the video, I want to send the buffered data for processing elsewhere, and eventually display it on an object in a…
narner
  • 2,729
  • 3
  • 22
  • 54
4
votes
1 answer

Appropriately Release Buffers From AVCaptureDataOutputSynchronizerDelegate Due to Out Of Buffers

I am using AVCaptureDataOutputSynchronizerDelegate to handle capturing data for video, depth and metadata private let videoDataOutput = AVCaptureVideoDataOutput() private let depthDataOutput = AVCaptureDepthDataOutput() private let…
impression7vx
  • 1,741
  • 1
  • 14
  • 42
4
votes
0 answers

How to record audio from the mic while appending a modified sampleBuffer image to the AVAssetWriter

This is an extension to an unanswered question I had before: AVCaptureSession is not recording audio from the mic in Swift I'm very unclear how I can write both video that is being modified in real time and audio that is being recorded from the…
Chewie The Chorkie
  • 3,401
  • 4
  • 37
  • 77
4
votes
0 answers

Proper way to stop a video recording (finishWriting) with AVAssetWriter and without crashing

I record videos with AVAssetWriter. The user can send the video, then I call finishWriting, or cancel the recording, then I call cancelWriting. How I record: func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer:…
Marie Dm
  • 2,447
  • 2
  • 18
  • 35
4
votes
0 answers

AVFoundation captureOutput didOutputSampleBuffer Delay

I am using AVFoundation captureOutput didOutputSampleBuffer to extract an image then to be used for a filter. self.bufferFrameQueue = DispatchQueue(label: "bufferFrame queue", qos: DispatchQoS.background, attributes: [], autoreleaseFrequency:…
Gizmodo
  • 2,563
  • 4
  • 32
  • 71
4
votes
0 answers

Pixel Formats: kCVPixelFormatType_32BGRA vs AVVideoCodecJPEG

I am trying to figure out which performs better capturing JPEG with AVFoundatation -> PhotoCaptureDelegate I can use: photoSettings = AVCapturePhotoSettings(format: [ kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_32BGRA)…
Gizmodo
  • 2,563
  • 4
  • 32
  • 71
1
2 3 4 5 6 7