how to encoder with cv::Ptr<cv::cudacodec::VideoWriter>

cv::Ptr<cv::cudacodec::VideoWriter> cudaWriter = cv::cudacodec::createVideoWriter(videoPath, frame_size, frameRate);

core dump here with openCV-cuda-3.4.1

OpenCV(3.4.1) Error: The function/feature is not implemented (The called functionality is disabled for current build or platform) in throw_no_cuda, file /media/nvidia/UP/opencv-3.4.1/modules/core/include/opencv2/core/private.cuda.hpp, line 111
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.1) /media/nvidia/UP/opencv-3.4.1/modules/core/include/opencv2/core/private.cuda.hpp:111: error: (-213) The called functionality is disabled for current build or platform in function throw_no_cuda

This might require nvcuvid library, but it is not available for jetson.

how if i want to convert a couple of gpu mats to mp4 video?using cv::videowriter is not the best way for me.

Not sure what you mean with a couple of gpu mats. If copying into a couple of cpu mats is affordable, you may use video writers from cpu launching a gstreamer pipeline encoding into H264 with hardware (example to mkv container file).

that means i don’t want to download to cpumat,but i will try your pipeline example.thank you