Status and usage of cudacodec::VideoWriter

Thanks, that looks great already! Your snippet mostly works for me although I found a few issues.

  1. A small typo I assume but ColorFormat_NV_YUV410_10BIT should be ColorFormat_NV_YUV420_10BIT

  2. The resulting video is readble in vlc but not on Mac OS Quicktime. This is probably related to the choice of fourcc as Quicktime is a bit peculiar with this and requires hvc1 instead of hev1:
    opencv_contrib/modules/cudacodec/src/video_writer.cpp at 3c2bcbfe8374edaf3eb756b560374244538d57b6 · opencv/opencv_contrib · GitHub
    Could a way of changing the fourcc be exposed to the user?

  3. The corresponding reading of 10bit YUV420 with cudacodec doesn’t seem to work. If I specify reader.set(cv.cudacodec.ColorFormat_NV_YUV410_10BIT) instead of reader.set(cv.cudacodec.ColorFormat_NV_NV12), the frames from the reader have 4 uint8 channels and the size of the video rather than what you currently expect for the writer (1 channel, frame height of 1.5x the video height, uint16 element type)

For testing purposes, here is how to generate a test sample:

ffmpeg -hide_banner -loglevel error -stats -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 -y -pix_fmt yuv420p10le -c:v libx265 -x265-params log-level=warning -tag:v hvc1 testsrc-hevc-yuv420p10le.mp4