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 GStreamer issue with web camera

Other Parts Discussed in Thread: AM5728

Tool/software: Linux

Hi, TI.

I have some problem in using gstreamer in capturing video from web cameras.

The camera supports the following formats:

root@liqi-Lenovo-V480:~# v4l2-ctl -d /dev/video1 --list-formats
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUYV 4:2:2

Index : 1
Type : Video Capture
Pixel Format: 'MJPG' (compressed)
Name : Motion-JPEG

In my PC, I use the following command to capture the video from the camera, and it's successful.

gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-raw,format=YV12,framerate=30/1,width=960,height=720 ! xvimagesink

However. in my target board (am5728), I use the following command, but it failed. I tried another format, it failed, too.

root@liqi-Lenovo-V480:~# gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \
> format=(string)YUY2, width=(int)960, height=(int)720' ! vpe num-input-buffers=8 ! queue ! waylandsink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.432522695 1357 0x147260 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:00.432590039 1357 0x147260 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:00.432849818 1357 0x147260 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:00.432878284 1357 0x147260 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:00.433079503 1357 0x147600 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:00.433122284 1357 0x147600 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:01.068317235 1357 0x147260 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:01.068[ 2706.894051] contiguous chunk is too small 8192/1382400 b
398080 1357 0x147260 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:01.068662413 1357 0x147260 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:01.068696085 1357 0x147260 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:01.068923981 1357 0x147600 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:01.068957816 1357 0x147600 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
0:00:01.069150413 1357 0x147260 WARN vpe gstvpebufferpool.c:466:gst_vpe_buffer_pool_import: Allocating a new input buffer index: 0/128, 0
0:00:01.090575891 1357 0x147260 ERROR vpe gstvpebufferpool.c:380:gst_vpe_buffer_pool_queue: vpebufferpool: QBUF failed: Bad address, index = 31
0:00:01.090705048 1357 0x147980 WARN bufferpool gstbufferpool.c:300:do_alloc_buffer:<vpebufferpool1> alloc function failed
0:00:01.090796304 1357 0x147260 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop:<v4l2src0> error: Internal data flow error.
0:00:01.090831440 1357 0x147260 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop:<v4l2src0> error: streaming task paused, reason error (-5)
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:00.894897326
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

root@liqi-Lenovo-V480:~# gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \
> format=(string)YV12, width=(int)960, height=(int)720' ! vpe num-input-buffers=8 ! queue ! waylandsink
0:00:00.194933714 1363 0x14c4a0 ERROR GST_PIPELINE grammar.y:642:gst_parse_perform_link: could not link v4l2src0 to vpe0
WARNING: erroneous pipeline: could not link v4l2src0 to vpe0

Thanks.

Li Qi

  • Hello,

    What is the PSDK version that you are using here?

    BR
    Margarita
  • Hello,

    user4933918 said:
    root@liqi-Lenovo-V480:~# gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \
    > format=(string)YV12, width=(int)960, height=(int)720' ! vpe num-input-buffers=8 ! queue ! waylandsink

    This pipeline will not work since vpe does not support yv12 as input format.

    You could try to replace it with videoconvert element.

    user4933918 said:
    root@liqi-Lenovo-V480:~# gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \
    > format=(string)YUY2, width=(int)960, height=(int)720' ! vpe num-input-buffers=8 ! queue ! waylandsink

    I see this pipeline is moving to PLAYING state but there is error QBUF failed: Bad address, index = 31.

    Please, try to increase cma in bootargs.

    You could check this thread how you could do this https://e2e.ti.com/support/arm/sitara_arm/f/791/t/668287

    Please let me know the PSDK version that you are using and are you using a usb cam.

    Thank you!

    Best Regards,

    Margarita

  • Hi,
    the version of PSDK is 04_03_00_05.

    Li Qi
  • Actually, I am using a usb camera.
    I increase the cma in uEnv.txt as the following uEnv.txt implies.

    # This uEnv.txt file can contain additional environment settings that you
    # want to set in U-Boot at boot time. This can be simple variables such
    # as the serverip or custom variables. The format of this file is:
    # variable=value
    # NOTE: This file will be evaluated after the bootcmd is run and the
    # bootcmd must be set to load this file if it exists (this is the
    # default on all newer U-Boot images. This also means that some
    # variables such as bootdelay cannot be changed by this file since
    # it is not evaluated until the bootcmd is run.

    # The environment is saved to eMMC, but we wish that a newly created SD card
    # will boot without any manual configuration. To do this we will reset the
    # environment upon the first boot, and then create a file in the boot partition
    # of the SD card to mark when the first-time setup has been done.

    psdk_setup_file=.psdk_setup
    check_psdk_setup=load mmc 0:1 ${loadaddr} ${psdk_setup_file}
    cma=64MiB
    uenvcmd=run cma;

    # Unfortunately, the following will be erased before it can be invoked
    # (See below in "uenvcmd")
    #mark_psdk_setup=mw .b ${loadaddr} 0 1; fatwrite mmc 0:1 ${loadaddr} ${psdk_setup_file} 1

    # Reset to the default environment
    do_psdk_setup=env default -f -a; saveenv

    # If not previously configured, then configure the environment and indicate this by writing a file
    uenvcmd=run cma; if run check_psdk_setup; then echo "Already setup."; else run do_psdk_setup; mw.b ${loadaddr} 0 1; fatwrite mmc 0:1 ${loadaddr} .psdk_setup 1; reset; fi



    However, it doesn't not help in capturing video and the error information is the same as before.

    root@liqi-Lenovo-V480:~# gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video1 num-buffers=1000 io-mode=4 ! 'video/x-raw, \
    > format=(string)YUY2, width=(int)960, height=(int)720' ! vpe num-input-buffers=8 ! queue ! waylandsink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    0:00:00.964266851 1112 0x1f0c60 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:00.964361686 1112 0x1f0c60 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:00.964677747 1112 0x1f0c60 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:00.964730776 1112 0x1f0c60 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:00.964967456 1112 0x1d7200 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:00.965032848 1112 0x1d7200 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:01.714438830 1112 0x1f0c60 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:01.714524393 1112 0x1f0c60 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:01.714787100 1112 0x1f0c60 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:01.714820284 1112 0x1f0c60 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:01.715052409 1112 0x1d7200 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:01.715084780 1112 0x1d7200 WARN waylandsink wlvideoformat.c:102:gst_wl_shm_format_to_video_format: gst video format not found
    0:00:01.715277377 1112 0x1f0c60 WARN vpe gstvpebufferpool.c:466:gst_vpe_buffer_pool_import: Allocating a new input buffer index: 0/128, 0
    0:00:01.731325420 1112 0x1f0c60 ERROR vpe gstvpebufferpool.c:380:gst_vpe_buffer_pool_queue: vpebufferpool: QBUF failed: Bad address, index = 31
    0:00:01.731465638 1112 0x1f0c60 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop:<v4l2src0> error: Internal data flow error.
    0:00:01.731507281 1112 0x1f0c60 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop:<v4l2src0> error: streaming task paused, reason error (-5)
    0:00:01.731628142 1112 0x1ca980 WARN bufferpool gstbufferpool.c:300:do_alloc_buffer:<vpebufferpool1> alloc function failed
    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.003957843
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ...
  • Hello Li Qi,

    I will be OoO next week. Sorry for the inconvenience that this may cause.

    Here is all suggestions that you could try.


    1. Apply the patch from this thread.
    e2e.ti.com/.../2023362
    usb_capture.txt
    You must apply this patch manually.

    2. Please verify the capture by using yavta demo. Here is the command that you could try just change the resolution depending of what your video source provides:
    yavta -c10 -fYUYV -Fvout_800x600_yuyv.yuv -s800x600 /dev/video1

    3. Change the cma in bootargs.
    You could do this by executing this command in u-boot :
    => setenv optargs cma=64MiB
    => saveenv
    => boot
    or you could try to edit uEnv.txt

    You must verify that the value is accepted. You could execute this command:
    root@am57xx-evm:~# cat /proc/cmdline
    The output similar to this(or the same) :
    console=ttyO2,115200n8 cma=64MiB root=PARTUUID=00095f8c-02 rw rootfstype=ext4 rootwait
    You could check the prints when the linux is loading for:
    ...cma: Reserved 64 MiB at 0x00000000fbc00000

    Hope this helps.


    BR
    Margarita
  • Hello, Margarita.
    Thanks for your reply. Unfortunately, I have some other urgent things to do recently and have no time to validate your suggestion.
    I will come back and give the result as soon as I try your suggestion.

    Thanks.
    Li Qi
  • Hello Li Qi,

    O.K.
    But if the thread is locked due time-out open a new one.

    BR
    Margarita