Questions tagged [cmsamplebuffer]

106 questions
0
votes
1 answer

How to add a callback to AVAssetReader copyNextSampleBuffer?

I am trying to read audio frames and decode them with AVAssetReader. I want to be able to read the frames asynchronously and add some kind of callback when a sample buffer was read. So after calling: ... [reader startReading]; CMSampleBufferRef…
0
votes
1 answer

Capturing a CMSampleBuffer using an RTCAudioSource on iOS

I'm trying to stream a CMSampleBuffer video / audio combo using WebRTC on iOS, but I'm running into trouble trying to capture audio. Video works just fine: guard let pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { print("couldn't…
William
  • 81
  • 1
  • 9
0
votes
1 answer

CMSampleBufferCreate causes Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)

I am trying to make a CMSampleBuffer out of a CMBlockBuffer and I am using CMSampleBufferCreate but whatever I try I always get Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) let status = CMSampleBufferCreate(kCFAllocatorDefault, …
Asra
  • 151
  • 1
  • 11
0
votes
0 answers

CMSampleBufferGetDataBuffer() returns nil value - Cocoa Swift

I am trying to capture my system's screen and process the data. But I get nil value for CMSampleBufferGetDataBuffer for the sample buffer I get in captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection:…
prabhu
  • 1,158
  • 1
  • 12
  • 27
0
votes
1 answer

How to implement a CMSampleBuffer for MLkit facial detection?

Basically, I'm trying to create a simple real-time facial recognition IOS app that streams the users face and tells them whether their eyes are closed. I'm following the google tutorial here -…
0
votes
1 answer

converting kCVPixelFormatType_32BGRA sampleBuffer to kCVPixelFormatType_420YpCbCr8BiPlanarFullRange

i am using janus gateway for my webrtc app and capturing samplebuffer from my camera as kCVPixelFormatType_32BGRA because i am doing face with the samplebuffer and can't use directly kCVPixelFormatType_420YpCbCr8BiPlanarFullRange to send it directly…
0
votes
1 answer

CMSampleBufferGetImageBuffer return nil for captured JPEG stillImage

I work on capture Mac screen using JPEG format, and then get the pixelBuffer and imageBuffer of the captured JPEG samplebuffer. But, the pixelBuffer is always nil, while when I convert the JPEG buffer to NSImage, the image can be got and displayed…
onTheWay
  • 128
  • 1
  • 8
0
votes
0 answers

iOS - AVassetWriter outputting file of 0 size and not giving errors

I'm still very new to swift (and programming) and I'm trying to output the CVPixelbuffer I get from ARFrame to a video in realtime (without the AR stuff on top). I've set up the AVAssetWriter and Input and on each frame I try to append the…
0
votes
1 answer

Extract CMSampleBuffer from HLS video stream on iOS

How can I save what AVPlayer is currently playing (both video and audio) from Live HLS stream? I know how to load and play m3u8 video file using AVPlayer. Please note that the HLS stream is live and not Video on demand so cannot use…
0
votes
1 answer

iOS swift - Recording multiple video segments freezes on playback in AVQueuePlayer

Let me start by saying I have searched for an answer to this question for a long time and have read through many SO posts, but none have provided the answer I need I am attempting to record multiple video segments using multiple…
0
votes
0 answers

CMSampleBuffer from front camera to UIImage

I am trying to create an UIImage from a CMSampleBuffer. The following code works fine for sample buffers from the rear camera but not on the front facing camera. When the front facing camera is used, the CGContext fails to initialise, i.e. CGContext…
0
votes
0 answers

ios didOutputSampleBuffer drop first few frames

Iam making an app which needs to record video and audio usingAVCaptureVideoDataOutputSampleBufferDelegate the functions i use are : func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, from…
0
votes
0 answers

CMSampleBuffer extension to convert to UIImage: Too expensive on memory

I'm trying to convert a CMSampleBuffer to an UIImage with Swift 3.0. A popular solution is to write an extension for the CMSampleBuffer class and add a getter to convert the buffer to an image. This is what it looks like: import Foundation import…
NFarrell
  • 255
  • 1
  • 17
0
votes
1 answer

Perform a translation / rotation of a CMSampleBuffer OpenGL Swift

I'm trying to read an AVAsset and in every frame of the asset, do a translation or a rotation operation, using the GPU. From my researches, I found out a way to convert a CMSampleBuffer to a GPU texture. I'm using the following method to do…
gutiago
  • 129
  • 3
0
votes
1 answer

Can't get AudioStreamBasicDescription from capture output

I'm trying to access mSampleRate and mChannelsPerFrame and assign the values to global variables. Method: func setAudioFormat(format: CMFormatDescriptionRef) { let asbd: UnsafePointer =…
justin shores
  • 687
  • 7
  • 24