shortstheory / APStreamline

Live Video Streaming Made Easy!
GNU General Public License v3.0
117 stars 35 forks source link

not working with usb camera #11

Closed profff closed 4 years ago

profff commented 4 years ago

before anything else I must say it's a great tool and it working perfectly with CSI2 raspi cam so big thank's for this fantastic tool I'm trying to use it for also streaming a second camera connected via USBI'm on a R-pi 4 with standard buster distribution lsusb saying :

pi@raspberrypi:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0000:5001  
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

dmesg says :

[  287.042761] usb 1-1.1: new high-speed USB device number 5 using xhci_hcd
[  287.253426] usb 1-1.1: New USB device found, idVendor=0000, idProduct=5001, bcdDevice= 5.19
[  287.253444] usb 1-1.1: New USB device strings: Mfr=0, Product=2, SerialNumber=3
[  287.253460] usb 1-1.1: Product: USB Camera                      
[  287.253475] usb 1-1.1: SerialNumber: 20130208
[  287.392528] uvcvideo: Found UVC 1.00 device USB Camera                       (0000:5001)
[  287.424870] uvcvideo 1-1.1:1.0: Entity type for entity Extension 5 was not initialized!
[  287.424889] uvcvideo 1-1.1:1.0: Entity type for entity Extension 4 was not initialized!
[  287.424907] uvcvideo 1-1.1:1.0: Entity type for entity Processing 2 was not initialized!
[  287.424925] uvcvideo 1-1.1:1.0: Entity type for entity Camera 1 was not initialized!
[  287.425285] input: USB Camera                      as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0/input/input2
[  287.459112] usb 1-1.1: Warning! Unlikely big volume range (=5760), cval->res is probably wrong.
[  287.459132] usb 1-1.1: [5] FU [Mic Capture Volume] ch = 1, val = 0/5760/1

APStreamline launch looks like :

pi@raspberrypi:~ $ ./APStreamline/bin/stream_server wlan0
Interface : wlan0
Address : 192.168.9.114
***APStreamline***
Access the following video streams using VLC or gst-launch following the instructions here: https://github.com/shortstheory/adaptive-streaming#usage
==============================
/dev/video0 (mmal service 16.1): rtsp://192.168.9.114:8554/cam7
/dev/video1 (USB Camera                     ): rtsp://192.168.9.114:8554/cam8
/dev/video10 (bcm2835-codec-decode): rtsp://192.168.9.114:8554/cam4
/dev/video11 (bcm2835-codec-encode): rtsp://192.168.9.114:8554/cam5
/dev/video12 (bcm2835-codec-isp): rtsp://192.168.9.114:8554/cam6
/dev/video13 (bcm2835-isp): rtsp://192.168.9.114:8554/cam0
/dev/video14 (bcm2835-isp): rtsp://192.168.9.114:8554/cam1
/dev/video15 (bcm2835-isp): rtsp://192.168.9.114:8554/cam2
/dev/video16 (bcm2835-isp): rtsp://192.168.9.114:8554/cam3
/dev/video2 (USB Camera                     ): rtsp://192.168.9.114:8554/cam9

if I try to access /dev/video0 trought rtsp://192.168.9.114:8554/cam7 it works perfectly but if I try to access : rtsp://192.168.9.114:8554/cam9 heres what I get :

pi@raspberrypi:~ $ ./APStreamline/bin/stream_server wlan0
Interface : wlan0
Address : 192.168.9.114
***APStreamline***
Access the following video streams using VLC or gst-launch following the instructions here: https://github.com/shortstheory/adaptive-streaming#usage
==============================
/dev/video0 (mmal service 16.1): rtsp://192.168.9.114:8554/cam7
/dev/video1 (USB Camera                     ): rtsp://192.168.9.114:8554/cam8
/dev/video10 (bcm2835-codec-decode): rtsp://192.168.9.114:8554/cam4
/dev/video11 (bcm2835-codec-encode): rtsp://192.168.9.114:8554/cam5
/dev/video12 (bcm2835-codec-isp): rtsp://192.168.9.114:8554/cam6
/dev/video13 (bcm2835-isp): rtsp://192.168.9.114:8554/cam0
/dev/video14 (bcm2835-isp): rtsp://192.168.9.114:8554/cam1
/dev/video15 (bcm2835-isp): rtsp://192.168.9.114:8554/cam2
/dev/video16 (bcm2835-isp): rtsp://192.168.9.114:8554/cam3
/dev/video2 (USB Camera                     ): rtsp://192.168.9.114:8554/cam9
Stream disconnected!

(stream_server:1025): GStreamer-CRITICAL **: 11:24:34.102: gst_element_set_state: assertion 'GST_IS_ELEMENT (element)' failed

(stream_server:1025): GStreamer-CRITICAL **: 11:24:34.103: gst_object_unref: assertion 'object != NULL' failed
Segmentation fault
pi@raspberrypi:~ $
shortstheory commented 4 years ago

Thank you for the bug report! I believe the issue might be with the way linux now handles V4L2 devices as described here: https://unix.stackexchange.com/questions/512759/multiple-dev-video-for-one-physical-device

This is why there are so many extra devices. I am working on a rewrite of APStreamline which will remove the spurious camera devices, but for the time being, you will need to use cam7 as you mentioned. Let me know if there are other issues!

profff commented 4 years ago

I'm so confused !! I've made a mistake I have to chose /dev/video1 (and not 2) and it's working perfectly all my apologies for my mistake

i'm taking the opportunity to speak to you to ask if I can find a way force ( via config file or command line) a chosed resolution on selected device because I don't want to have to launch APWeb for changing it manually and "auto" is to low by default thank's again

shortstheory commented 4 years ago

There is a way, but you would need to recompile the code for it to work. You can change the default quality in the constructor here. Settings are in the form of VIDEO_W_H_FRAMERATE and can be found here

profff commented 4 years ago

thank's a lot !! I will do that !! as you look familiar with GStreamer and it's C API would you be ok to talk a bit together I'm actually trying to modify QGroundControl to split stream for sending it back in multicast udp if yes I can leave you my email or a zoom contact thank's again

shortstheory commented 4 years ago

Sure, let me know if you need any help with GStreamer! I would be happy to take a look, though I also suggest you get in touch with the folks on #gstreamer on FreeNode irc (http://irc.lc/freenode/gstreamer). They were super helpful when I was developing APStreamline :-)