I've got a computer that has a usb webcam attached to it. I currently use this with OBS for live streaming 24/7 to a remote streaming service.
However, if i e.g try to ffmpeg or opencv from the same camera, for a different purpose, the /dev/video0 will be unavailable/busy while OBS is streaming from it.
How can i use ffmpeg to make the /dev/video0 webcam's feed available (and uncompressed/raw) to multiple clients/processes running on the same computer, while preferably keeping the need for resource-hungry encoding/decoding/reencoding going on down to a minimum? (the pc is semi-potato)
ffplay -f video4linux2 -list_formats all /dev/video0
gives me:
[video4linux2,v4l2 @ 0x7ffa10000bc0] Raw : yuyv422 : YUYV 4:2:2 : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360 752x416 800x448 800x600 864x480 960x544 960x720 1024x576 1184x656 1280x720 1280x960
[video4linux2,v4l2 @ 0x7ffa10000bc0] Compressed: mjpeg : Motion-JPEG : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360 752x416 800x448 800x600 864x480 960x544 960x720 1024x576 1184x656 1280x720 1280x960
Some perhaps relevant notes:
- The camera's feed resolution above 1280x720 @~25fps is not necessary for my usecase, and would then just perhaps needlessly having to be scaled down to that said res.
- ffmpeg v4l2/video4linux docs: https://ffmpeg.org/ffmpeg-devices.html#toc-video4linux2_002c-v4l2
- How can I list the available video modes for a USB webcam in Linux?
Also, if there's perhaps even some better software solution than using ffmpeg to achieve this, i'd appreciate any tips on that as well.
-f rtp rtp://127.0.0.1:1234
and use that as input for other processes. Some examples here: trac.ffmpeg.org/wiki/StreamingGuide – slhck Mar 2 '20 at 12:45