Re: Python and webcam capture delay?



On Mon, 06 Jul 2009 07:10:38 +0100, jack catcher (nick) <nomail@xxxxxxxxx> wrote:

Tim Roberts kirjoitti:
"jack catcher (nick)" <nomail@xxxxxxxxx> wrote:
I'm thinking of using Python for capturing and showing live webcam stream simultaneously between two computers via local area network. Operating system is Windows. I'm going to begin with VideoCapture extension, no ideas about other implementation yet. Do you have any suggestions on how short delay I should hope to achieve in showing the video? This would be part of a psychological experiment, so I would need to deliver the video stream with a reasonable delay (say, below 100ms).
You need to do the math on this. Remember that a full 640x480 RGB stream
at 30 frames per second runs 28 megabytes per second. That's more than
twice what a 100 megabit network can pump.
You can probably use Python to oversee this, but you might want to consider
using lower-level code to control the actual hardware. If you are
targeting Windows, for example, you could write a DirectShow graph to pump
into a renderer that transmits out to a network, then another graph to
receive from the network and display it.
You can manage the network latency by adding a delays in the local graph.

Thanks Tim, you're correct about the math. What is your main point about DirectShow: that it is generally faster and more reliable than doing the job high-level, or that one could use coding/decoding in DirectShow to speed up the transmission? I think the latter would be a great idea if the latency were tolerable. On the other hand, I'd like to keep things simple and do all the programming in Python. I've got no experience with DirectShow, but I guess the filters need to be programmed in C++ and called from Python?

Another option might be to use resolution 320x240@15fps.

Does the webcam just deliver frames, or are you getting frames out of
a decoder layer? If it's the latter, you want to distribute the encoded
video, which should be much lower bandwidth. Exactly how you do that
depends a bit on what format the webcam claims to deliver.

--
Rhodri James *-* Wildebeest Herder to the Masses
.



Relevant Pages

  • Re: directshow and windows format for broadcast ?
    ... > by now I've build a filter graph that capture live stream from a webcam, ... > over the network but it's too slow ... > I thought I could use WMF in conjunction with directshow but the WM asf ...
    (microsoft.public.windowsmedia.sdk)
  • Re: directshow and windows format for broadcast ?
    ... > by now I've build a filter graph that capture live stream from a webcam, ... > over the network but it's too slow ... > I thought I could use WMF in conjunction with directshow but the WM asf ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: directshow and windows format for broadcast ?
    ... > by now I've build a filter graph that capture live stream from a webcam, ... > over the network but it's too slow ... > I thought I could use WMF in conjunction with directshow but the WM asf ...
    (microsoft.public.multimedia.directx.dshow.programming)
  • Re: How to stream on the network encoded audio
    ... Actually another thread read the .wav file ... that is created and send chunk of bytes via network. ... The sofware is in C#, .NET 1.1 and runs on Windows 2000, Windows XP and ... If you're not using DirectShow the easiest method is to use the ACM. ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: Excuse my ignorance - accessing network files
    ... stored on a network drive. ... to connect to the Windows ... So you can't stream music or video to a PS3 the way you can on a 360?- Hide quoted text - ...
    (uk.games.video.playstation)