Questions tagged [cmsamplebufferref]

71 questions
3
votes
1 answer

Capturing iPhone game audio

I'd like to capture the audio (music + sound effects) coming from my iPhone game. AVCaptureSession seems to have only the microphone as audio source. I'd like to capture the audio, put it into CMSampleBufferRefs and append these to an…
MrDatabase
  • 43,245
  • 41
  • 111
  • 153
3
votes
1 answer

How does one obtain image buffers in their original format from a video stream using AVFoundation?

In Apple's documentation for AVAssetReaderTrackOutput, it indicates the following about the parameter for outputSettings when instantiating an instance using +[AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:outputSettings:] A value of nil…
Dan
  • 1,258
  • 1
  • 10
  • 22
3
votes
2 answers

CMSampleBufferGetImageBuffer returning null

I am trying to retrieve a CVPixelBufferRef from CMSampleBufferRef in-order to alter the CVPixelBufferRef to overlay a watermark on the fly. I am using CMSampleBufferGetImageBuffer(sampleBuffer) in-order to achieve that. I am printing the result of…
Basel JD
  • 275
  • 3
  • 17
3
votes
2 answers

How to create a time lapse video like the photos app?

I'm looking for a way to create long time lapse videos on an iPhone running iOS 9, and hoping to get some pointers on how to start. Ideally I would compress 1 hour of footage into 1 minute, so the scaling factor is 60. I take one frame out of 60 and…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
3
votes
2 answers

Memory Leak in CMSampleBufferGetImageBuffer

I'm getting a UIImage from a CMSampleBufferRef video buffer every N video frames like: - (void)imageFromVideoBuffer:(void(^)(UIImage* image))completion { CMSampleBufferRef sampleBuffer = _myLastSampleBuffer; if (sampleBuffer != nil) { …
loretoparisi
  • 15,724
  • 11
  • 102
  • 146
3
votes
1 answer

AVAssetWriter is always on AVAssetWriterStatusFailed status

my goal is to apply some filters on the camera input in real time. To do that step by step, I'm trying to get the input form the camera with AVFoundation record a video and save it in the camera roll. I tried, but for some reason the AVAssetWriter…
3
votes
1 answer

How to Convert CIImage to CMSampleBufferRef

I am using AVCapturesession to record video I am reciving out at didrecive sample buffer method in the form of CMSamplbufferRef.I Have Converted that to CIImage and made some some change and now I Want to convert that CIImage to CMSampleBufferRef…
3
votes
1 answer

How do I determine the duration of a sample buffer uses in an AVAssetWriter

I have a sample buffer that I'm using to capture video for an AVAssetWriter. I'm trying to figure out a way to determine how much video (time) I have captured. currently I am able to access the current buffer timestamp by using CMTime pts =…
user379468
  • 3,989
  • 10
  • 50
  • 68
3
votes
2 answers

Capture still UIImage without compression (from CMSampleBufferRef)?

I need to obtain the UIImage from uncompressed image data from CMSampleBufferRef. I'm using the code: captureStillImageOutput captureStillImageAsynchronouslyFromConnection:connection completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError…
dreamzor
  • 5,795
  • 4
  • 41
  • 61
3
votes
0 answers

Record audio on one device and play on another device using UDP

I want to record audio from one iOS device and send and play it to another device at the same time. I have tried to use AVCaptureAudioDataOutput and send/received CMSampleBufferRef properly on both end but when I play it on receiver device, I am…
2
votes
0 answers

Extract CMSampleBuffer from an mp3 file swift

I am trying to extract CMSampleBuffer from an mp3 file to use it for my recording video. Here is the code: First get PCM buffer from mp3 guard let audioPCMBuffer = AVAudioPCMBuffer(pcmFormat: audioFile.processingFormat, …
sahara108
  • 2,829
  • 1
  • 22
  • 41
2
votes
0 answers

Split CMSampleBufferRef containing Audio

I'am splitting the recording into different files while recording... The problem is, captureOutput video and audio sample buffers doesn't correspond 1:1 (which is logical) - (void)captureOutput:(AVCaptureOutput *)captureOutput…
2
votes
1 answer

Capture 120/240 fps using AVCaptureVideoDataOutput into frame buffer using low resolution

Currently, using the iPhone 5s/6 I am able to capture 120(iPhone 5s) or 240(iPhone 6) frames/second into a CMSampleBufferRef. However, the AVCaptureDeviceFormat that is returned to me only provides these high speed frame rates with a resolution of…
2
votes
1 answer

How to monitor audio on iPhone headphones from AVCaptureSession?

I want to be able to monitor audio on headphones before and during the capture of video. I have an AVCaptureSession set up to capture video and audio. My idea is to hook and AVCaptureAudioDataOutput instance up to the AVCaptureSession for this and…
2
votes
0 answers

Create CMSampleBufferRef using a UIImage

How to create a CMSampleBufferRef using a UIImage,i need to add text on video frames while recording. *Please do not tell me to use PixelBuffer.
user2504522
  • 63
  • 1
  • 6