Questions tagged [cmsamplebuffer]
106 questions
25
votes
5 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
- 371
- 5
- 18
19
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
- 3,887
- 1
- 33
- 35
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
- 525
- 1
- 6
- 14
10
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…

Tornike Kikalishvili
- 190
- 2
- 11
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,601
- 14
- 26
8
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
- 3,321
- 2
- 24
- 47
7
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
- 4,896
- 9
- 46
- 90
7
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,908
- 3
- 26
- 63
7
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,637
- 3
- 24
- 43
7
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,228
- 10
- 48
- 79
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
- 143
- 1
- 2
- 7
6
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,…

anthonya1999
- 253
- 3
- 13
5
votes
1 answer
Real-time AVAssetWriter synchronise audio and video when pausing/resuming
I am trying to record a video with sound using iPhone's front camera. As I need to also support pause/resume functionality, I need to use AVAssetWriter. I've found an example online, written in Objective-C, which almost achieves the desired…

Andriy Gordiychuk
- 6,163
- 1
- 24
- 59
5
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
- 3,151
- 7
- 45
- 92
5
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
- 3,151
- 7
- 45
- 92