USB camera support via Libreelec 9.2.0 on an RPi4

  • I'm running LibreElec 9.2.0 on an RPi4. I attached a Mobius action cam in Webcam mode which works pretty well on a Win 10 box via VLC.

    Code
    v4l2-ctl --list-device

    provides this result:

    Code
    Mobius (usb-0000:01:00.0-1.1):
    /dev/video0
    /dev/video1
    Code
    lsusb

    tells me this:

    Code
    Bus 001 Device 010: ID 0603:1002 Novatek Microelectronics Corp.

    After typing

    Code
     dmesg

    I do get this among other things:

    v4l2-ctl produes a meaningful output:

    Code
    v4l2-ctl --list-devices
    Mobius (usb-0000:01:00.0-1.1):
    /dev/video0
    /dev/video1

    At least to me it seems that something is still not installed properly. Could someone help in this case what could be the next step to get such a device running? This is just a quick test for me, next to this I'd like to use another USB camera device.

    Any hints would be highly welcome.

  • This is a very unusual device for LE, because LE is made for playing media, not recording. I would guess the driver is missing. Most people with unusual hardware try to make it work on Raspbian first, because, unlike LE, Raspbian is made for all types of input devices.

    Take into account that cameras are time-critical (latency issues). It's very likely that RPi's camera-over-USB is too slow. RPi's have an own port for cameras, so using USB is generally a bad idea.

  • Thanks for your valuable hint, but I already have a similar working setup with a second Pi running plain Raspbian and streaming the USB input as is (copy) via cvlc with no further issues except for some inconvenient but constant lag. I have so far not been able to get the same up and running with ffmpeg although I tried really hard.

  • The working config is actually an RPi3 but on an RPi4, which I still have to test under plain Raspbian, I hope there will be a quality improvement in speed (USB 3.0) and display quality (higher FPS).

    How would I plug Raspbian USB camera drivers (which ones?) into LE without building it from source? I would really be glad if you could provide a hint.

  • How would I plug Raspbian USB camera drivers (which ones?) into LE without building it from source? I would really be glad if you could provide a hint.

    I'm not familiar with camera drivers on Linux. On a working Linux (like Raspbian) you could use the lsmod command to list all loaded driver modules. Then identify the modules for your camera. On a non-working Linux (like LE) you can try to load those driver modules by insmod <module_name>. If you get a "not found" error while trying to load the modules, then my theory will be proofed.

    Unfortunately there is no way to install new drivers modules on LE without compiling from source. Maybe driver modules for the RPi camera port are available by default on LE.

  • If LE has any support for camera devices it's accidental not intentional. RPi3 should have good overall support for devices under Raspian but as we have no real need for camera support there's no guarantee we have the right kernel config etc. in place. RPi4 capabilities are broadly on-par with RPi3 but the overall codebase is newer so there may be differences; don't assume they are the same.

  • OK, either on my RPi3 running Raspbian with the USB webcam attached or on the RPi4 running LE 9.2.0 lsmod tells me that uvcvideo, videobuf2_v4l2, videobuf2_vmalloc, videodev are present, but only on the Raspbian I do see videobuf2_core, media in addition. I'm absolutely not familiar enough with this stuff to know which one of those is needed and which would be not.

    On both machines the camera is present as /dev/video0. On the RPi3, either with vlc or v4l2 test utility I could view the stream coming from that camera.

    E.g. insmod uvcvideo does not work on both machines.

    Could one perhaps run a docker container under LE 9.2.0 containing anything needed for streaming the camera video? Unfortunately I'm not experienced enough with docker to know instantaneously what needs to be done.

    Edited once, last by FHoevi (January 25, 2020 at 10:42 AM).

  • I have set up an fresh RPi4 box running Raspbian Buster, installed Kodi as well as TVHeadend and now am experimenting with ffmpeg / vlc on that machine to stream as needed. Basic streams with that USB device do work (which I knew already before) but unfortunately so far not the one I need.

  • I have set up an fresh RPi4 box running Raspbian Buster, installed Kodi as well as TVHeadend and now am experimenting with ffmpeg / vlc on that machine to stream as needed. Basic streams with that USB device do work (which I knew already before) but unfortunately so far not the one I need.

    Good choice. So it's no LE question anymore. An RPi camera port device will deliver best streaming data to work with. So don't fall in love with your USB camera too much.

  • Finally I got it working. My setup is like this: RPi4 with plain Raspbian Buster, USB cam attached in webcam mode, TVHeadend, Kodi with TVHeadend client addon. Via the TVHeadend GUI I defined a Mux as a ffmpeg pipe, for which options really need to be set carefully, for such an ffmpeg pipe it should also be possible to stream via command line for which the final pipe:1 should be exchanged with udp://localhost:port?pkt_size=1316. Without this the pipe doesn't work either.

    My personal next step is to check whether a higher quality USB device attached to a USB 3.0 port of the RPi4 would lead to a similar result but with higher video quality than this simple webcam device.