0

I'm writing a Mac app that encodes AVCaptureVideoDataOutput with H264 using videotoolbox framework.

VTCompressionSessionRef session;
OSStatus ret = VTCompressionSessionCreate(NULL, (int)width, (int)height, kCMVideoCodecType_H264, NULL, NULL, NULL, OutputCallback, NULL, &session);

The callback is implemented like this:

void OutputCallback(void *outputCallbackRefCon,
            void *sourceFrameRefCon,
            OSStatus status,
            VTEncodeInfoFlags infoFlags,
            CMSampleBufferRef sampleBuffer) 
{

    CMBlockBufferRef block = CMSampleBufferGetDataBuffer(sampleBuffer);
    char* bufferData;
    size_t size;

    CMBlockBufferGetDataPointer(block, 0, NULL, &size, &bufferData);
    NSData *data = [NSData dataWithBytes:bufferData length:size];
    //and i use this data 

}

Have these warnings in log

GVA warning: init, skip trailing zeros pps size = 35

GVA warning: init, skip trailing zeros pps size = 34 GVA warning: AVF_Get_Standalone_PPS, skip trailing zeros pps size = 35

Can anyone suggest a better way to decode to display in AVSampleBufferdisplayLayer?

  • What exactly is not working / which errors do you get? – sina Oct 20 '17 at 10:06
  • @sandeep have used this encode and decode and its working fine,provide more info so i can help – PR Singh Oct 23 '17 at 11:07
  • error here while decompress CMVideoFormatDescriptionCreateFromH264ParameterSets with error code -12712 , i follow this code https://mobisoftinfotech.com/resources/mguide/h264-encode-decode-using-videotoolbox/ status = CMVideoFormatDescriptionCreateFromH264ParameterSets(kCFAlloc‌ atorDefault, 2, (const uint8_t const)parameterSetPointers, parameterSetSizes, 4, &_formatDesc); – Navaneeth A S Nov 09 '17 at 13:58
  • https://github.com/acsandeep/videoCompressionTest This is the test app; can anyone figure out the problem with this code. – Navaneeth A S Nov 09 '17 at 13:59

0 Answers0