Hi,
For using hardware encoder you would need to create NvBuffer and have your data in the buffer. If your buffer in appsink is a GPU-accessible buffers, you may create NvBuffer in appsrc and copy the data through cudaMemcpy
. NvBuffer does not support BGR format, so if you get BGR data in appsink, would need to handle format conversion from BGR to RGBA.
Here is an updated appsrc_nvmm sample to apply OpenCV CUDA filter:
// generate input frame data
$ gst-launch-1.0 videotestsrc num-buffers=150 ! video/x-raw,width=1920,height=1080,format=RGBA ! filesink location=1080.yuv
// build sample
$ CUDA_VER=10.2 ENABLE_OCV_CUDA=1 make
// run
$ ./appsrc_nvmm
// check a.mkv for the effect
appsrc_nvmm_ocv_cuda.zip (4.5 KB)