I’m trying to use DriveWorks FrameCapture module to encoded processed images (DW_IMAGE_NVMEDIA or DW_IMAGE_CUDA) in H.264 bitstream. Previously, I used SensorSerializer module to encoded camera frames into H.264 bitstream, and it works fine. However, to encoded processed images, it seems I have to used FrameCapture API since dwSensorSerializer_serializeImage() has been marked as ‘Deprecated’.
The code I used to initialize FrameCapture is like:
dwFrameCaptureHandle_t frameCapturer = DW_NULL_HANDLE;
dwSerializerParams serializerParams;
serializerParams.onData = (dwSensorSerializerOnDataFunc_t)&encoderCallback;
serializerParams.parameters = "format=h264,bitrate=8000000,framerate=30,type=user,slave=0";
dwFrameCaptureParams frameCaptureParams;
frameCaptureParams.captureCustom = false;
frameCaptureParams.height = 1208;
frameCaptureParams.width = 1920;
frameCaptureParams.params = serializerParams;
frameCaptureParams.serializeGL = false;
frameCaptureParams.mode = DW_FRAMECAPTURE_MODE_SERIALIZE;
CHECK_DW_ERROR(dwFrameCapture_initialize(&frameCapturer, &frameCaptureParams, sal, sdk));
CHECK_DW_ERROR(dwFrameCapture_start(frameCapturer));
and the code executed on camera reading is like:
dwSensorCamera_readFrame(&cameraFrame, 0, timeout, cameraSensor);
dwSensorCamera_getImage(&processedImage, DW_CAMERA_OUTPUT_NATIVE_PROCESSED, cameraFrame);
CHECK_DW_ERROR(dwFrameCapture_appendFrame(processedImage, frameCapturer))
The error I got is:
terminate called after throwing an instance of 'std::runtime_error'
what(): [2020-02-06 10:28:59] DW Error DW_NOT_AVAILABLE executing DW function:
dwFrameCapture_appendFrame(processedImage, frameCapturer)
I tried to use both DW_IMAGE_NVMEDIA and DW_IMAGE_CUDA, but both raised the same error. I also tried to convert dwImageHandle_t into dwImageCUDA or dwImageNvMedia first, then call dwFrameCapture_appendFrameCUDA() or dwFrameCapture_appendFrameNvMedia. The error is still the same. I wonder is the FrameCapture module not implemented or maybe there’s something I’m missing?
Please advise, thank you!