Hi, TI members
I tried to record an h264 video from an NV12 image using V4L2. I'm working on PSDK8.2
When I checked the v4l2 driver in Linux, there are two devices. One is dec and another is enc like this.
root@j7-evm:~# v4l2-ctl --list-devices vxd-dec (platform:vxd-dec): /dev/video0 vxe-enc (platform:vxe-enc): /dev/video1
For my purpose(YUV420 NV12 - > H264), I think I have to use /dev/video1. Am I right?
I checked some things with query_device like this.
mfc_fd = open(/dev/video1, O_RDWR | O_NONBLOCK, 0); v4l2_capability cap = { 0 }; int ret = ioctl(mfc_fd, VIDIOC_QUERYCAP, &cap); fprintf(stderr, "Querycaps: fd=%#x driver=%s card=%s bus_info=%s\n", mfc_fd, cap.driver, cap.card, cap.bus_info); fprintf(stderr, "Querycaps: device_caps=%#08x capabilities=%#08x\n", cap.device_caps, cap.capabilities); { struct v4l2_fmtdesc desc = {0}; struct v4l2_frmsizeenum frmsize = {0}; desc.index = 0; desc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; fprintf(stderr, "Calling VIDIOC_ENUM_FMT on CAPTURE:\n"); while ((ret = ioctl(mfc_fd, VIDIOC_ENUM_FMT, &desc)) == 0) { fprintf(stderr, "\tdesc.index = %d, pixelformat=0x%x, description = %s\n", desc.index, desc.pixelformat, desc.description); desc.index++; } desc.index = 0; desc.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; fprintf(stderr, "Calling VIDIOC_ENUM_FMT on OUTPUT:\n"); while((ret = ioctl(mfc_fd, VIDIOC_ENUM_FMT, &desc))==0) { fprintf(stderr, "\tdesc.index = %d, pixelformat=0x%x, description = %s\n", desc.index, desc.pixelformat, desc.description); desc.index++; } frmsize.index = 0; fprintf(stderr, "Calling VIDIOC_ENUM_FRAMESIZES:\n"); ret = ioctl(mfc_fd, VIDIOC_ENUM_FRAMESIZES, &frmsize); if (ret) { throw Exception("VIDIOC_ENUM_FRAMESIZES failed."); } else if (frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) { fprintf(stderr, "VIDIOC_ENUM_FRAMESIZES got DISCRETE\n"); fprintf(stderr, "\tfrmsizes[%d] width=%d height=%d\n", frmsize.index, frmsize.discrete.width, frmsize.discrete.height); frmsize.index++; while ((ret = ioctl(mfc_fd, VIDIOC_ENUM_FRAMESIZES, &frmsize)) == 0) { fprintf(stderr, "\t\tfrmsizes[%d] width=%d height=%d\n", frmsize.index, frmsize.discrete.width, frmsize.discrete.height); frmsize.index++; } } else { fprintf(stderr, "VIDIOC_ENUM_FRAMESIZES types got %d\n", frmsize.type); fprintf(stderr, "\tfrmsizes[%d] width=%d height=%d\n", frmsize.index, frmsize.discrete.width, frmsize.discrete.height); frmsize.index++; } }
The logs are below as well.
Querycaps: fd=0x7f driver=vxe-enc card=vxe-enc bus_info=platform:vxe-enc Querycaps: device_caps=0x4204000 capabilities=0x84204000 Calling VIDIOC_ENUM_FMT on CAPTURE: desc.index = 0, pixelformat=0x34363248, description = H.264 Calling VIDIOC_ENUM_FMT on OUTPUT: desc.index = 0, pixelformat=0x3231564e, description = Y/CbCr 4:2:0 desc.index = 1, pixelformat=0x34424752, description = 32-bit A/XRGB 8-8-8-8 Calling VIDIOC_ENUM_FRAMESIZES: VIDIOC_ENUM_FRAMESIZES types got 2 frmsizes[0] width=1 height=1920 VIDIOC_ENUM_FRAMEINTERVALS got DISCRETE fival[0] numerator=1 denominator=15 framerate=15
I think video_encoder does not support when the input type is NV12.
Also, It looks like the only output frame(not input image) size that could be supported is1x1920.
Would it be possible to encode from NV12?
Best regards
Yongsig