草庐IT

CMSampleBufferRef

全部标签

ios - iOS中如何从CMSampleBufferRef获取Camera数据的当前捕获时间戳

我开发了一个iOS应用程序,它将捕获的相机数据保存到一个文件中,我使用了(void)captureOutput:(AVCaptureOutput*)captureOutputdidOutputSampleBuffer:(CMSampleBufferRef)sampleBufferfromConnection:(AVCaptureConnection*)connection捕获CMSampleBufferRef,这将编码为H264格式,帧将使用AVAssetWriter保存到文件中。我关注了thesamplesourcecode创建这个应用程序:现在我想获取保存的视频帧的时间戳来创建一个

ios - iOS中如何从CMSampleBufferRef获取Camera数据的当前捕获时间戳

我开发了一个iOS应用程序,它将捕获的相机数据保存到一个文件中,我使用了(void)captureOutput:(AVCaptureOutput*)captureOutputdidOutputSampleBuffer:(CMSampleBufferRef)sampleBufferfromConnection:(AVCaptureConnection*)connection捕获CMSampleBufferRef,这将编码为H264格式,帧将使用AVAssetWriter保存到文件中。我关注了thesamplesourcecode创建这个应用程序:现在我想获取保存的视频帧的时间戳来创建一个

ios - 如何将 CGImage 转换为 CMSampleBufferRef?

我想将CGImage转换为CMSampleBufferRef并使用appendSampleBuffer将其附加到AVAssetWriterInput:方法。我已设法使用以下代码获取CMSampleBufferRef,但appendSampleBuffer:在我提供生成的CMSampleBufferRef时仅返回NO。我做错了什么?-(void)appendCGImage:(CGImageRef)frame{constintwidth=CGImageGetWidth(frame);constintheight=CGImageGetHeight(frame);//Createadummyp

ios - 如何将 CGImage 转换为 CMSampleBufferRef?

我想将CGImage转换为CMSampleBufferRef并使用appendSampleBuffer将其附加到AVAssetWriterInput:方法。我已设法使用以下代码获取CMSampleBufferRef,但appendSampleBuffer:在我提供生成的CMSampleBufferRef时仅返回NO。我做错了什么?-(void)appendCGImage:(CGImageRef)frame{constintwidth=CGImageGetWidth(frame);constintheight=CGImageGetHeight(frame);//Createadummyp

ios - AVFoundation - 反转 AVAsset 并输出视频文件

我见过这个问题被问过几次,但似乎都没有任何有效的答案。要求是反转并输出视频文件(不仅仅是反转播放),保持与源视频相同的压缩、格式和帧速率。理想情况下,该解决方案将能够在内存或缓冲区中完成所有这些操作,并避免将帧生成为图像文件(例如:使用AVAssetImageGenerator)然后重新编译它(资源密集型、不可靠的时序)结果、原始帧/图像质量的变化等)。--我的贡献:这仍然无法正常工作,但到目前为止我已经尝试过的最好的方法:使用AVAssetReader将样本帧读入CMSampleBufferRef[]数组。使用AVAssetWriter以相反的顺序写回。问题:似乎每个帧的时间都保存在

ios - AVFoundation - 反转 AVAsset 并输出视频文件

我见过这个问题被问过几次,但似乎都没有任何有效的答案。要求是反转并输出视频文件(不仅仅是反转播放),保持与源视频相同的压缩、格式和帧速率。理想情况下,该解决方案将能够在内存或缓冲区中完成所有这些操作,并避免将帧生成为图像文件(例如:使用AVAssetImageGenerator)然后重新编译它(资源密集型、不可靠的时序)结果、原始帧/图像质量的变化等)。--我的贡献:这仍然无法正常工作,但到目前为止我已经尝试过的最好的方法:使用AVAssetReader将样本帧读入CMSampleBufferRef[]数组。使用AVAssetWriter以相反的顺序写回。问题:似乎每个帧的时间都保存在

c++ - 将 CMSampleBufferRef 转换为 cv::Mat

我正在尝试将CMSampleBufferRef(作为iOS中AVCaptureVideoDataOutputSampleBufferDelegate的一部分)转换为OpenCVMat,以尝试半实时地稳定输出。我正在运行一个测试应用程序,紧接着this,但在我创建和使用Mat时不断遇到问题。SwiftControllerletwrapper:OpenCVWrapper=OpenCVWrapper()...funccaptureOutput(captureOutput:AVCaptureOutput!,didOutputSampleBuffersampleBuffer:CMSampleBu

ios - CMSampleBufferRef kCMSampleBufferAttachmentKey_TrimDurationAtStart 崩溃

这件事困扰了我一段时间。我有视频转换将视频转换为“.mp4”格式。但是有些视频会发生崩溃,但不是全部。这是崩溃日志***Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'***-[AVAssetWriterInputappendSampleBuffer:]Cannotappendsamplebuffer:FirstinputbuffermusthaveanappropriatekCMSampleBufferAttachmentKey_TrimDurationAtStartsincetheco

ios - 将 CMSampleBufferRef 转换为 UIImage

我正在使用AVCaptureSession捕获视频。但我想将捕获的图像转换为UIImage。我在网上找到了一些代码:-(UIImage*)imageFromSampleBuffer:(CMSampleBufferRef)sampleBuffer{NSLog(@"imageFromSampleBuffer:called");//GetaCMSampleBuffer'sCoreVideoimagebufferforthemediadataCVImageBufferRefimageBuffer=CMSampleBufferGetImageBuffer(sampleBuffer);//Lock

ios - 捕获没有压缩的 UIImage(来自 CMSampleBufferRef)?

我需要从CMSampleBufferRef的未压缩图像数据中获取UIImage。我正在使用代码:captureStillImageOutputcaptureStillImageAsynchronouslyFromConnection:connectioncompletionHandler:^(CMSampleBufferRefimageSampleBuffer,NSError*error){//thatfamousfunctionfromAppledocsfoundonalotofwebsites//doesNOTworkforstillimagesUIImage*capturedIm