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.

Linux/AM5728: Video streaming from USB camera fails

Part Number: AM5728


Tool/software: Linux

Hi,

I am trying to get the output of usb camera on the matrix gui. Without stopping weston and matrix.

I am using gstreamer the command which ia m using is:

gst-launch-1.0 v4l2src device="/dev/video1" ! video/x-raw , width=640, height=480 ! waylandsink

After entering this command the LCD is blinked once but not able to stream camera data.

the error which i got after entering this command is :

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[destroyed object]: error 0: invalid format 0x56595559

What does this mean?

Will anyone please recorrect this command if it is wrong.

Thanks & Regard

Vijay Patil

  • The software team have been notified. They will respond here.
  • Hello,

    I would recommend you to check the multimedia user guide for capture pipelines:
    processors.wiki.ti.com/.../Processor_Training:_Multimedia
    I would recommend you to set the format in the capsfilter(refer the guide).
    Yo could try to add vpe element and set the capsfilter after it also.
    If you try kmssink instead of waylandsink is it working(first stop weston)?
    Hope this helps.

    BR
    Margarita
  • If you try kmssink instead of waylandsink is it working(first stop weston)?
    Hope this helps.

    i tried this but it giving same error.

    $gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! video/x-raw, format=YUY2, width=320, height=240 ! vpe num-input-buffers=8 ! queue ! kmssink

    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    [ 667.301303] contiguous chunk is too small 4096/153600 b
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
    Additional debug info:
    ../../../../gstreamer-1.8.3/libs/gst/base/gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming task paused, reason error (-5)
    Execution ended after 0:00:01.270090268
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...
    root@am57xx-evm:~#

    also how to set capsfilter will you please help about how to set capsfilter??

    thanks & regards

    Vijay Patil
  • Hello,

    For USB capture, please check this thread:
    e2e.ti.com/.../2023362
    You could add --gst-debug=v4l2src:5 for more debug prints.

    BR
    Margarita
  • I gone through the thread:
    e2e.ti.com/.../2023362
    ------------------------------------------------------------------------------------------------------------------------------------
    Root caused the issue to be with usb/uvc driver. The usb/uvc driver was using vmalloc to allocate the video buffers and hence large allocated buffers were not contiguous. VPE driver need contiguous buffers to work on and hence the handshake was failing. I modified the usb/uvc driver to work in dma-contiguous mode and with that change, below gstreamer pipeline works great. Attached patch of the changes done to usb/uvc driver.

    gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720' ! queue ! vpe ! queue ! kmssink

    usb_capture.txt

    --------------------------------------------------------------------------------------------------------------------------------------

    As mentioned, i have question,

    how to change usb/uvc driver on AM5728-evm to work dma-contigeous mode and what is the process??
    what changes i need to do on evm to open camera or video streaming??
    Please tell the process.

    Thanks & Regards.

    Vijay Patil
  • Vijay,

    You will need to apply the patch usb_capture.txt as shared in this e2e post to get the USB camera working. You may need to manually apply the patch as the kernel version may be different -

  • hi manisha,

    i understand that i need to apply patch.

    but where i apply the patch and how will i do this? will you tell the process.

    it will helpful to me because i am new for am5728 sitara processor.

    Thanks & Regards

    Vijay Patil

  • Hello,

    I would recommend you to apply the patch manually. As Manisha said the kernel version are different.
    1. Open patch for example you see +....uvc_driver.c.
    2.Open this file. In it you should add +#include <media/videobuf2-dma-contig.h> after #include <asm/unaligned.h>.
    You should add these lines :
    + dev->alloc_ctx = vb2_dma_contig_init_ctx(&intf->dev);
    + intf->dev.coherent_dma_mask = DMA_BIT_MASK(32);
    before /* Initialize controls. */
    if (uvc_ctrl_init_device(dev) < 0)
    and save the edited file.
    Then open uvc_queue.c make the changes as you see it in the patch.
    Same for other files.

    Then you should recompile the patched source(kernel, modules etc) and cp them to the SD card.

    I would recommend you to search over the internet for linux commands how patch could be apply.

    Hope this helps.

    BR
    Margarita
  • Hello,

    One more note when you see line with "-" you must remove it or comment it.


    BR
    Margarita

  • Still it giving same error:

    $gst-launch-1.0 v4l2src device="/dev/video0" ! video/x-raw , width=640, height=480 ! waylandsink

    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    [destroyed object]: error 0: invalid format 0x56595559

    thanks and regard

    Vijay Patil

  • Hello,

    The pipeline that you are using seems not correct.
    /dev/video0 does not seems right.
    Please could you verify that this is the correct note for your camera (execute v4l2-ctl --list-devices).
    I would recommend you to check this guide for capture pipelines:
    processors.wiki.ti.com/.../Processor_Training:_Multimedia

    BR
    Margarita
  • its a mistake i entered the following command still it gives error:

    $gst-launch-1.0 v4l2src device="/dev/video1" ! video/x-raw , width=640, height=480 ! waylandsink

    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    [destroyed object]: error 0: invalid format 0x56595559

    thanks and regard

    Vijay Patil
  • Hello,

    Please refer the above link with capture pipelines.
    Did you verify this is the correct device note?
    This does not to be full console log. Verify the format, resolution in the caps filter is it correct.
    You could add --gst-debug also for more debug prints.
    I would recommend you to tr with yavta also. Here is the link:
    processors.wiki.ti.com/.../Linux_Core_VIP_User's_Guide

    Hope this helps.

    BR
    Margarita
  • You need to use io-mode=4 option with v4l2src. Below pipeline works well.

    gst-launch-1.0 -v v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=60/1' ! queue ! kmssink

    Using waylandsink at my end is showing some color distortions (possibly a bug because of which it is not accepting YUY2 as input format). If you insert vpe plugin in between, the output looks good.

    gst-launch-1.0 -v v4l2src device=/dev/video1 io-mode=4 ! 'video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=60/1' ! queue ! vpe ! queue ! waylandsink
  • Hello Vijay Patil,

    I am closing this thread, please feel free to reopen it again.

    BR
    Margarita