Luckfox Pico Ultra W USB Camera

  • Hello, the code you mentioned here s32Ret = RK_MPI_VI_GetChnFrame(0, 0, &stViFrame, -1); It is a function in the Rockchip micro multimedia processing interface used to obtain frame data from the CSI camera. Since USB cameras use standard UVC drivers, it is not possible to obtain data directly from this function. You'll need to adapt the code to the USB camera.
    Solution: You can use either the V4L2 or OpenCV frameworks.
  • Hi,

    I entered the luckfox-config settings and switched to USB host mode. Then, I turned off the device, made the USB connection, and powered the device on. I followed the steps in this document: https://wiki.luckfox.com/Luckfox-Pico/L ... x-Pico-USB. After running the command v4l2-ctl --list-devices, I get the following output. I couldn’t solve the issue, what should I do?
    Attachments
    WhatsApp Image 2025-03-27 at 08.44.46.jpeg
  • The error is normal, rkcif is the driver related to the CSI camera, your /dev/video0 has been recognized as USB 2.0 Camera: USB Camera, and it should be normal to see the input format supported by the camera

    Code: Select all

    v4l2-ctl --device=/dev/video0 --list-formats-ext 
    
    Or use the command to get the image

    Code: Select all

    v4l2-ctl --device=/dev/video0 --set-fmt-video=width=640,height=480,pixelformat=YUYV --stream-mmap --stream-to=video100.yuv --stream-count=30 
    
  • Hi,

    I'm trying to stream video from a USB camera using FFmpeg on a Luckfox board. I can successfully capture frames from /dev/video0, but when I try to stream over RTSP, I get the following error:

    Code: Select all

    [root@luckfox root]# ffmpeg -f v4l2 -framerate 10 -video_size 640x480 -i /dev/vi
    deo0 -f rtsp rtsp://0.0.0.0:8554/live.stream
    ffmpeg version 4.4.4 Copyright (c) 2000-2023 the FFmpeg developers
      built with gcc 8.3.0 (crosstool-NG 1.24.0)
      configuration: --enable-cross-compile --cross-prefix=/home/cro/GitPull/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/host/bin/arm-rockchip830-linux-uclibcgnueabihf- --sysroot=/home/cro/GitPull/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot --host-cc=/usr/bin/gcc --arch=arm --target-os=linux --disable-stripping --pkg-config=/home/cro/GitPull/luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/host/bin/pkg-config --disable-static --enable-shared --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --enable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --enable-network --disable-gray --enable-swscale-alpha --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-mipsdsp --disable-mipsdspr2 --disable-msa --enable-hwaccels --disable-cuda --disable-cuvid --disable-nvenc --disable-avisynth --disable-frei0r --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libvo-amrwbenc --disable-symver --disable-doc --disable-gpl --disable-nonfree --enable-ffmpeg --enable-ffplay --enable-libv4l2 --enable-avresample --enable-ffprobe --disable-libxcb --disable-postproc --enable-swscale --enable-indevs --enable-alsa --enable-outdevs --enable-pthreads --enable-zlib --disable-bzlib --disable-libfdk-aac --disable-libcdio --enable-gnutls --disable-openssl --enable-libdrm --disable-libopenh264 --disable-vaapi --disable-vdpau --disable-mmal --disable-omx --disable-omx-rpi --disable-libopencv --disable-libopus --disable-libvpx --enable-libass --disable-libbluray --disable-libmfx --disable-librtmp --disable-libmp3lame --disable-libmodplug --disable-libspeex --disable-libtheora --enable-iconv --disable-libfreetype --disable-fontconfig --disable-libopenjpeg --disable-libx264 --disable-libx265 --disable-libdav1d --disable-x86asm --disable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --enable-armv6 --enable-vfp --enable-neon --disable-altivec --extra-libs=-latomic --enable-pic --cpu=cortex-a7
      libavutil      56. 70.100 / 56. 70.100
      libavcodec     58.134.100 / 58.134.100
      libavformat    58. 76.100 / 58. 76.100
      libavdevice    58. 13.100 / 58. 13.100
      libavfilter     7.110.100 /  7.110.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  9.100 /  5.  9.100
      libswresample   3.  9.100 /  3.  9.100
    [video4linux2,v4l2 @ 0x4f6960] The driver changed the time per frame from 1/10 to 1/15
    Input #0, video4linux2,v4l2, from '/dev/video0':
      Duration: N/A, start: 98.445228, bitrate: 73728 kb/s
      Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 73728 kb/s, 15 fps, 15 tbr, 1000k tbn, 1000k tbc
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
    Press [q] to stop, [?] for help
    [tcp @ 0x5b5670] Connection to tcp://0.0.0.0:8554?timeout=0 failed: Connection refused
    Could not write header for output file #0 (incorrect codec parameters ?): Connection refused
    Error initializing output stream 0:0 -- 
    Conversion failed!
    [root@luckfox root]# 
    
  • Hi,

    I am still working on USB camera RTSP streaming. I couldn’t find any solution with FFmpeg, so I tried GStreamer. I configured Buildroot, but I am facing some problems.

    Code: Select all

    [root@luckfox root]# gst-launch-1.0 --gst-version
    GStreamer Core Library version 1.22.6
    [root@luckfox root]# gst-launch-1.0 rtspsrc device=/dev/video0 ! fakesink
    WARNING: erroneous pipeline: no element "rtspsrc"
    [root@luckfox root]# gst-launch-1.0 gst-rtsp-server device=/dev/video0 ! fakesink
    WARNING: erroneous pipeline: no element "gst-rtsp-server"
    [root@luckfox root]# gst-launch-1.0 v4l2src device=/dev/video0 ! fakesink
    WARNING: erroneous pipeline: no element "v4l2src"
    
    I couldn't find a solution. Can you help me?
  • GStreamer needs to rely on plugins to work, it looks like you should be missing related plugins, I have no experience with GStreamer, this problem belongs to GStreamer plugin configuration problems, you can consult relevant documentation or materials to solve