0

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:

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.

  • 1
    You could stream it to your localhost with -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
  • @slhck Thanks, will try that. Though, would you happen to know how it could be done raw/uncompressed, based on the output i've now added to my question? As to avoid most need for compressing/encoding/decoding in the "pipeline" ? I've got some ffmpeg experience, though this subject is entirely new to me. And since your suggestion is probably the answer, it would be cool if you'd put it as one so that i can accept it as such :) – DhP Mar 2 '20 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.