1

I got a simple webcam (640x480) that streams to a Windows-PC, where the webcam stream is show using a simple OpenCV-Application. I'm looking for a way to simultaniuosly show the video and save it to some external storage medium. I have no control over the Windows-PC or it's software, but I do have physical access to the PC, the USB-connection and the webcam.

I figured one way to achieve my goal, would be to use a Raspberry as some sort of "Webcam Logger", which would be connected inbetween the Webcam and the Windows-PC. The Raspberry would connect to the webcam, get it's video stream and save it to an external storage. Simultaniously, it should be connected to the Windows-PC via USB as a standard DirectShow device and just forward the webcams stream.

I don't have any experience with the Raspberry so far - I'm looking for an estimation if something like I imagined is possible and maybe some hints where to start looking.

I found a question on Stackoverflow covering the saving part already, but nothing regarding the raspberry mimicing a DirectShow-device.

7
  • 1
    The odds of this working as you describe are fairly slim. The only Raspberry Pi models which can act as a USB slave device are the A and the Zero. You might be able to persuade a Zero to act like a DirectShow device, but I don't think I've seen it done by anyone yet. It would be a lot easier to fork out for a second camera, gaffer tape it to the first one, then plug one camera into the PC and one into the Pi for a reasonable approximation of identical footage.
    – goobering
    Jan 11, 2017 at 16:09
  • 1
    You might be able to work something with an analogue capture device. Plug the webcam into the Pi, use something like gstreamer to write the video to disk and preview it on-screen. Run the Pi's analogue out (from the 3.5mm headphone socket) into the capture device, and the capture device into the PC. You may need to install a driver for the capture device, but only once.
    – goobering
    Jan 12, 2017 at 9:21
  • After a few days of tinkering, this is exactly what worked out in the end! Thanks a lot! I currently use some generic USB Vide Grabber that needs an installed driver, but it seems there is one device out there (the mystical FEBON 100) that works without any driver or software. I'll try to get my hands on one of those now...
    – DIF
    Jan 24, 2017 at 16:26
  • 1
    I'm impressed! That's a lot of hoops to jump through. If you feel your original question's been sufficiently answered, remember to mark your chosen answer with the big checkmark.
    – goobering
    Jan 24, 2017 at 18:25
  • 1
    Done! Sorry it took me a while.
    – goobering
    Feb 1, 2017 at 11:57

1 Answer 1

3

This doesn't sound possible.

I did a little more thinking following my comment below the question, and eventually realised that what you're describing is a Pi which is simultaneously in USB host mode (for the camera) and in USB slave mode (for the PC connection). To the best of my knowledge this isn't achievable with any model of Pi.

Your setup is being crippled by the lack of access to the Windows machine's software. If you can access that machine then you're dealing with a really simple streaming problem, although you will have to reconfigure your OpenCV program to deal with a network stream instead of a DirectShow camera.

I'm unaware of any device which would allow you to plug in a USB camera (device as USB host/camera as USB slave), receive a video stream from it, store the stream, then output the stream over USB to a PC (device as USB slave/PC as USB host) in real time while masquerading as a DirectShow camera. USB just isn't supposed to work that way.

As a workaround, you might be able to work something with an analogue capture device. Plug the webcam into the Pi, use something like gstreamer to write the video to disk and preview it on-screen. Run the Pi's analogue out (from the 3.5mm headphone socket) into the capture device, and the capture device into the PC. You may need to install a driver for the capture device, but only once.

1
  • Thanks for thinking this through for me. I'd like to keep the question open for a day or two, hoping somebody might come up with some miraculous solution to the problem :) Else, I'm happy to accept your answer since it pretty much desribes why my idea is very unlikely to solve like this.
    – DIF
    Jan 12, 2017 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.