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.

Dm814xEVM v4l2src capture problem

Other Parts Discussed in Thread: TVP7002

Dear All:
I am trying to let v4l2 capture use a usb camera working on my evm814x board from mistral .
The EZSDK I am using is Version5_05_01_04.

My usb camera can support the following format:
YUY2(320*240)
MJPEG(640*480)

My bootargs are:
#setenv bootargs console=ttyO0,115200n8 rootwait rw mem=364M@0x80000000 mem=320M@0x9FC00000
vmalloc=500M notifyk.vpssm3_sva=0xBF900000 root=/dev/nfs
nfsroot=192.168.1.200:/home/be/targetfs ip=dhcp

#setenv serverip '192.168.1.200';tftp 0x82000000 uImage-dm814x-evm.bin;

#setenv bootcmd 'tftpboot 0x82000000 uImage-dm814x-evm.bin;bootm 0x82000000';

I download the gstreamer_ti_dm81xx source from
https://gstreamer.ti.com/svn/gstreamer_ti/trunk/gstreamer_ti_dm81xx

What I modified is following:
1、change_resolution.sh 1080p60
2、change_display.sh hdmi
3、change from OMX to V4L2 firmware for capture/display
#cp load-hd-v4l2-firmware.sh /etc/init.d/load-hd-firmware.sh
#sync

when I run the following commands are success working on evm814x board
#gst-launch -v videotestsrc num-buffers=1000 ! omx_h264enc ! filesink location=sample.264

#gst-launch -v videotestsrc num-buffers=1000 ! omx_h264enc ! gstperf ! rtph264pay pt=102 !
udpsink host=192.168.1.4 port=6010 sync=false
#gst-launch -v filesrc location=/usr/share/ti/data/videos/dm816x_1080p_demo.264 ! 'video/x-
h264' ! h264parse access-unit=true ! omx_h264dec ! omx_scaler ! omx_ctrl display-
mode=OMX_DC_MODE_1080P_60 ! omx_videosink sync=false

But when I run the following commands is wrong working on evm814x board

root@dm814x-evm:~# gst-launch v4l2src num-buffers=1 ! ffmpegcolorspace ! video/x
-raw-yuv, format=\(fourcc\)YUY2, width=320,height=240 ! filesink location=test.
yuv
Setting pipeline to PAUSED ...

Mode set is 0
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Could not negotiate format
Additional debug info:
gstbasesrc.c(2778): gst_base_src_start (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Check your filtered caps, if any
Setting pipeline to NULL ...
Freeing pipeline ...

but the command can work on my ubuntu use the same usb scamera.
when I use the v4l2src plugin ,I alaway get the error.

Can anyone help me the solve problem or tell me why?

Thanks!

  • Hi,

    V4L2 firmware is for V4L2 capture using HDVPSS and not for USB. So loading V4L2 firmware v/s OMX firmware doesnt make any sense.

  • Hi, ,thank you for your answer.And what your said is right.

    Then I have solved the problem ,I change the v4l2 streaming I/O from user pointers to memory mapping for my usb camera.And it successed.

  • Can anyone make it more clear?

    I have same problem but not fully understood your solution.

  • Hello sphone pan:

     I use the ADV7611(or TVP7002 ) which support HMDI receive to capture the 1280*720 video,and show on the  LCD screens  which only supports the resolution of 1024*600 and must be RGB ,not YUV .So based on the example of  saLoopbackFbedev, I have to get the 1280*720 capture data to another 

    user buffer(not FBDEV buffer as the example) first and then extract 1024*600 by some algorithm ,But when I use my new user defined buffer to replace the fbdev buffer,I found there are many *** question,eg:the programe will be crashed undefined or the picture is overlapping 。。。。although I use the methord to show the video on the TV Screeen which support 1280*720(so I not need extract anything),still exist the above question.
    My steps are: 
          (1)Add the new variable which will be used  to as the buffer  of caputre.
            unsigned char *captBufferArray[MAX_BUFFER];
         (2In function "setupFbdevAndBuffers"  add:
           captBufferArray[0]=(unsigned char *)malloc(1280*720*3*MAX_BUFFER);
    for (i = 1; i < MAX_BUFFER; i++)
    captBufferArray[i] = captBufferArray[i-1] + 1280*720*3;
    memset(captBufferArray[0], 0x00,1280*720*3*MAX_BUFFER);
         (3)In function "queueCaptureBuffers" ,Replace fbdev.buffer_addr  with the capBufferArray.
     static int queueCaptureBuffers(void)
    {
    int ret, i;
    for (i = 0; i < MAX_BUFFER; i++) {
    capt.buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    capt.buf.memory = V4L2_MEMORY_USERPTR;
    capt.buf.index = i;
    /*capt.buf.m.userptr = (unsigned long)fbdev.buffer_addr[0];*/
            capt.buf.m.userptr = (unsigned long)captBufferArray[capt.buf.index];
    capt.buf.length =1280*720*3;
    ret = ioctl(capt.fd, VIDIOC_QBUF, &capt.buf);
    if (ret < 0) {
    perror("VIDIOC_QBUF\n");
    /*return -1;*/
    }
    }
    return ret;
    }
    (4)
    static int app_main(int argc , char *argv[])
    {
    -----------
    for (i = 0; i < MAXLOOPCOUNT; i++)
    {
        /*
      Get capture buffer using DQBUF ioctl
    */
    /*printf("Get capture buffer 1\n");*/
    ret = ioctl(capt.fd, VIDIOC_DQBUF, &capt.buf);
    if (ret < 0) {
    printf("VIDIOC_DQBUF\n");
    /*return -1;*/
    }
             memcpy(fbdev.buffer_addr[0],(unsigned char *)(capt.buf.m.userptr),1280*3*720);
    -------------
    capt.buf.m.userptr = (unsigned long)captBufferArray[capt.buf.index];
    capt.buf.length = 1280*3*720;
    ret = ioctl(capt.fd, VIDIOC_QBUF, &capt.buf);
    if (ret < 0) {
    perror("VIDIOC_QBUF\n");
    /*return -1;*/
    }
    }
    1.Am I right?Is there something wrong? Why my user defined buffer captBuffer can not get the correct caputre data?But if use the buffer which was mmaped by fb0(Fbdev) was ok.So wheather there are some others steps need to do when pass a user defined buffer to capture capt.buf.m.userptr ?
    2.if use gstreamer cmd,My capture source is 1280*720 which base on hdmi input interface,and I want to show on the lcd which resolution is 1024*600 and RGB model,so how make the gstreamer cmd?
    Thanks very much.
                                           zhichao.
  • Hello zhichao,

    It would be better to open a new topic regarding this new issue.

    Thank you!

    BR

    Margarita