Tuesday, 15 January 2013

ios8 - VTCompressionSessionEncodeFrame returns OSStatus error code of -12780 -



ios8 - VTCompressionSessionEncodeFrame returns OSStatus error code of -12780 -

i have question regarding using vtcompressionsession in videotoolbox on ios8.

my vtcompressionsession has setup without returning error code. however, when trying encode frame using vtcompressionsessionencodeframe, got osstatus error code of -12780. cannot find defintion or explanation of such error code. have ideas ?

here snippet of code:

cvpixelbufferref input_frame_buffer_; void* plane_ptrs[3] = {frame->channel[0], frame->channel[1], frame->channel[3]}; size_t plane_widths[3] = {frame->header.width, frame->header.width / 2, frame->header.width / 2}; size_t plane_heights[3] = {frame->header.height, frame->header.height / 2, frame->header.height / 2}; size_t plane_bytes_per_row[3] = {frame->stride[0], frame->stride[1], frame->stride[2]}; cvreturn pixel_buffer_status = cvpixelbuffercreatewithplanarbytes(kcfallocatordefault, frame->header.width, frame->header.height, (ostype) kcvpixelformattype_420ypcbcr8planar, frame->channel[0], 0, 3, plane_ptrs, plane_widths, plane_heights, plane_bytes_per_row, &mypixelbufferreleasecallback, (void*)this, nullptr, &input_frame_buffer_); if (pixel_buffer_status != kcvreturnsuccess) { logger_->error("cvpixelbuffercreatewithbytes failed."); return; } vtencodeinfoflags info_flags; osstatus status = vtcompressionsessionencodeframe(session_, input_frame_buffer_, frame->header.pts, kcmtimeinvalid, nullptr, mysourceframerefcon, &info_flags);

i have same problem before, can follow these steps below

list item

// 1. sps,pps form stream data, , create cmformatdescription, vtdecompressionsession

// 2. create cmformatdescription

// 3. create vtdecompressionsession

// 4. nalunit payload cmblockbuffer

// 5. making sure replace separator code 4 byte length code (the length of nalunit including unit code)

// 6. create cmsamplebuffer

// 7. utilize vtdecompressionsessiondecodeframe

// 8. utilize videotoolbox decompress frame callback cvimagebufferref

you can reference in git https://github.com/htaiwan/hwdecoder

ios8 video-encoding

No comments:

Post a Comment