Questions tagged [cmsamplebuffer]

106 questions
3
votes
0 answers

Rendering into a samplebuffer via cicontext with alpha blending?

in captureOutput I am getting video frames in sample buffers and I want to alpha blend another CIImage on top of the captured frames. Rendering should directly go into the passed sample buffer. Currently I use this: func captureOutput(_…
Chris
  • 1,231
  • 2
  • 10
  • 20
2
votes
0 answers

how to convert CIFilter output to CMSampleBuffer

I want to add some filter to CMSampleBuffer using CIFilter, then convert it back to CMSampleBuffer I have some filter like this: let filter = YUCIHighPassSkinSmoothing() filter.inputImage = CIImage(cvImageBuffer: pixelBufferFromCMSampleBuffer) …
famfamfam
  • 396
  • 3
  • 8
  • 31
2
votes
0 answers

Writing encoded audio CMSampleBuffer not working

I'm using AudioConverter to convert uncompressed CMSampleBuffer being captured via AVCaptureSession to AudioBufferList: let packetDescriptionsPtr = UnsafeMutablePointer.allocate(capacity:…
2
votes
2 answers

How to convert AudioBufferList containing AAC data to CMSampleBuffer

I'm using AudioConverter to convert uncompressed CMSampleBuffer being captured via AVCaptureSession to AudioBufferList: let status: OSStatus = AudioConverterFillComplexBuffer( converter, inputDataProc, …
2
votes
1 answer

Create CMSampleBuffer from AAC data

I am using external camera which records both audio and video. My app receives the audio in AAC format with the following struct: struct AudioPacket { let timestamp: TimeInterval let data: Data let asbd: AudioStreamBasicDescription let…
plamkata__
  • 729
  • 5
  • 13
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
2 answers

how to get video frame from CMSampleBuffer in RPScreenRecorder.shared().startCapture?

I use RPScreenRecorder.shared().startCapture fo screen recording and encode into h264 video file using AVAssetWriterInput but it gives me direct .mp4 and i want h264 video file frame by frame while recording screen for streaming. is there any way…
Vivek Nandha
  • 21
  • 1
  • 3
2
votes
0 answers

how to get cmsamplebuffer data to avformate_open_input() function in FFMpeg?

i want to stream apple mobile camera to a UDP port using FFMPEG. so far i have already done it from a video file. but now i want to do it live from apple mobile camera. some body can give me some clue for this. my head is spining for this…
2
votes
0 answers

How to convert CMSampleBuffer to Data for video in Swift?

I have downloaded a source code from here. I am getting CMSampleBuffer for video from the camera in the following function. public func captureOutput(_ captureOutput: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection:…
2
votes
2 answers

CMSampleBuffer rotate from portrait to landscape in Swift 3

I'm handling ReplayKit2 in iOS, for some reasons I need to rotate CMSampleBuffer from portrait to landscape, I found the result is not correct. What I miss ? this is original sample buffer this is actual output buffer width & height are…
PatrickSCLin
  • 1,419
  • 3
  • 17
  • 45
2
votes
1 answer

Rotate CMSampleBuffer by arbitrary angle and append to AVAssetWriterInput in swift 3

I convert the sample buffer to a CGContext. Then I apply a transformation to the context and create a CIImage from that, which in turn gets displayed in an UIImageView. At the same time I want to append this to the AVAssetWriterInput to create a…
Ramin Afshar
  • 989
  • 2
  • 18
  • 34
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
2 answers

didOutputSampleBuffer drops frames

I am writing an application for long exposure image taking. I used func captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!) to get a CMSampleBuffer for…
ferdyyy
  • 515
  • 4
  • 16
2
votes
1 answer

I am stuck between either a memory leak or excessive static in Audio while capturing audio from microphone

I am writing an iPhone app where I need to capture audio from the mic and stream the it to a streaming server in AAC format. So I first capture the audio and then use the AudioConverterFillComplexBuffer method for converting the audio to AAC.…
ozguronur
  • 1,223
  • 1
  • 8
  • 7
2
votes
1 answer

iOS video toolbox gives "Ignoring enqueueSampleBuffer: because status is "failed""

I am using video toolbox in iOS8 to play an h264 stream along with a PCM audio stream. Video is displayed fine as long as I dont start the audio stream. As soon as I call AudioQueueStart, all enqueueSampleBuffer calls stop displaying video and…
SKK
  • 81
  • 5