This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

V4L2 capture at 720x576

Other Parts Discussed in Thread: TVP7002

Dear All,

on our custom dm814x hardware, we have a pal decoder (CX25836) connect to VIN1A. I've already managed how to configure it to work as V4L2 input by "telling" the system that it's capturing at 1080p  resolution (subdevice reports V4L2_DV_1080P60 like tvp7002 does). This work pretty well with the sample saLookback video example but now I want to use it with gstreamer and, for example, do something like capture/encode/display example (encode h264 and display on 1080p HDMI screen).

Here is my simple pipeline:

gst-launch v4l2src device="/dev/video2" always-copy=false queue-size=12 num-buffers=1000 ! 'video/x-raw-yuv-strided,format=(fourcc)NV12,width=1920,height=1080,framerate=(fraction)50/1' ! omxbufferalloc silent=false numBuffers=12 ! omx_mdeiscaler name=d d.src_01 !  omx_h264enc bitrate=5000000 ! filesink location=v4l2cap.h264  d.src_00 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink display-mode=OMX_DC_MODE_1080P_60

The capture is show correctly for the "active" area, but the rest of the screen is filled with random data (which lead to a "wrong" encoded stream). How can I clip/crop with 720x576 resolution to create a h264 with only active area? Is it possible?

I've also try to report V4L2_DV_576P50 as dv preset and use the following pipeline

gst-launch v4l2src device="/dev/video2" always-copy=false queue-size=12 num-buffers=1000 ! 'video/x-raw-yuv-strided,format=(fourcc)NV12,width=720,height=576,framerate=(fraction)50/1' ! omxbufferalloc silent=false numBuffers=12 ! omx_mdeiscaler name=d d.src_01 !  fakesink  d.src_00 ! omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink display-mode=OMX_DC_MODE_1080P_60

but it's not working at all and I get the following errors:

ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed trying to get video frames from device '/dev/video2'.
Additional debug info:
gstv4l2bufferpool.c(650): gst_v4l2_buffer_pool_dqbuf (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
The buffer type is not supported, or the index is out of bounds, or no buffers have been allocated yet, or the userptr or length are invalid. device /dev/video2

Any clue or any example in how to capture something different from 1080p or 720p?

Best Regards,

Andrea

  • Hi,

    Encode of 1080P60 buffer with content of 720X576 should not result in wrong encode, you can try memsetting the full 1080P60 buffer and than give it to capture for filing it up. What do you mean by wrong encoding here.

  • For "wrong" encoding I mean that the resulting h264 is not playing correctly (I'm using VLC on my Windows PC). It's shows only a few frame with a really low framerate.

    To me this is caused by the "noise" that's present in the buffer outside the valid 720x576 area. So your suggestion of memsetting the whole 1080p buffer data should be correct, but I dont know how to fill those buffers with gstreamer.

    With the sample v4l2 application (saLoopback) the buffer are allocated by the app itself and are filled with a simple memset() so the problem is solved easily here.

    Do you have any suggestion?

    Best Regards,

    Andrea

  • Dear All,

    the only way I've found to solve this issue is to hack gstreamer sources and memset()-ing the omx buffer as soon as they are created. This solve the h264 issue (I think that there was a problem with having an input source with too much entropy due random data on initialized part of the buffer).

    However.. I'm wondering if it's possible to acquire or, at least, create a h264 compressed file with just the "valid" data (720x576 pixels)

    Best Regards,

    Andrea