Hi @DaneLLL, I think it is better to explain my problem:
I grab a frame from the camera, appsink
, do some processing etc; then I want to send it to udpsink
in H264 through appsrc
and using nvv4l2enc
.
Right now I’m using OpenCV to do the processing between appsink
and appsrc
, and using the CVVideoWriter
with Gstreamer API, the main problem is latency and I identified it in the time it takes for the frame to being copy from memory to NVMM. I’m looking for a way to speed up this process.
I’m using Unified Memory so I have both a GpuMat
, a Mat
, and a pointer to the memory that is wrapped by OpenCV mats. None of my tries works after the first frame: copy operations (both Opencv copy that call cudaMemcpy2D
or cudaMemcpy
using the pointer) or color conversion (BGR->RGBA) directly on the GpuMat
that wraps the EGLImage.
I think the problem is not in OpenCV functions but something about the feeding function and appsrc
. I also tried without forcing a cuda context with cudaFree(0)
because I’m not familiar with the Cuda Driver API but seems like the context “protects” the data.
Any way to solve this problem?
P.S.For my understanding 2 alternative are NVEnc from the jetson multimedia api or creating a eglstream with cuda Producer, but I’d like to use this code (for compatibility reasons).