iphone Programming Glossary: cmsamplebuffergetpresentationtimestamp
This code to write video+audio through AVAssetWriter and AVAssetWriterInputs is not working. Why? http://stackoverflow.com/questions/4149963/this-code-to-write-videoaudio-through-avassetwriter-and-avassetwriterinputs-is sampleBuffer NSLog @ sample buffer is not ready. Skipping sample return if _isRecording YES lastSampleTime CMSampleBufferGetPresentationTimeStamp sampleBuffer if _videoWriter.status AVAssetWriterStatusWriting _videoWriter startWriting _videoWriter startSessionAtSourceTime..
AVAssetWritter does not work with audio http://stackoverflow.com/questions/5200077/avassetwritter-does-not-work-with-audio that is set to 0 on start. Then when my delegate receives the first packet I do if _startTime.value 0 _startTime CMSampleBufferGetPresentationTimeStamp sampleBuffer and then bufferWriter writer startWriting bufferWriter writer startSessionAtSourceTime _startTime Your code.. code removed . switch bufferWriter writer.status case AVAssetWriterStatusUnknown if _startTime.value 0 _startTime CMSampleBufferGetPresentationTimeStamp sampleBuffer bufferWriter writer startWriting bufferWriter writer startSessionAtSourceTime _startTime Break if not ready.. videoIn appendSampleBuffer sampleBuffer self delegateMessage @ Video Writing Error withType ERROR else CMTime pt CMSampleBufferGetPresentationTimeStamp sampleBuffer flipBuffer sampleBuffer pixelBuffer if bufferWriter adaptor appendPixelBuffer pixelBuffer withPresentationTime..
iOS - Scale and crop CMSampleBufferRef/CVImageBufferRef http://stackoverflow.com/questions/8493583/ios-scale-and-crop-cmsamplebufferref-cvimagebufferref write it directly to videoWriter by using void writeBufferFrame CMSampleBufferRef sampleBuffer CMTime lastSampleTime CMSampleBufferGetPresentationTimeStamp sampleBuffer if self.videoWriter.status AVAssetWriterStatusWriting self.videoWriter startWriting self.videoWriter startSessionAtSourceTime..
AVCaptureSession only got video buffer http://stackoverflow.com/questions/9257052/avcapturesession-only-got-video-buffer the capture self.captureSession startRunning Code from AVCaptureSession delegate captureOutput method lastSampleTime CMSampleBufferGetPresentationTimeStamp sampleBuffer if CMSampleBufferDataIsReady sampleBuffer NSLog @ sample buffer is not ready. Skipping sample return if isRecording.. AVAssetWriterStatusUnknown NSLog @ First time execute if CMTimeCompare lastSampleTime kCMTimeZero 0 lastSampleTime CMSampleBufferGetPresentationTimeStamp sampleBuffer videoWriter startWriting videoWriter startSessionAtSourceTime lastSampleTime Break if not ready otherwise.. break @try CVImageBufferRef buffer CMSampleBufferGetImageBuffer sampleBuffer CMTime frameTime CMSampleBufferGetPresentationTimeStamp sampleBuffer if buffer if videoWriterInput isReadyForMoreMediaData if adaptor appendPixelBuffer buffer withPresentationTime..
|