Python and webcam capture delay?
jack catcher (nick)
nomail at thank.you
Mon Jul 6 08:10:38 CEST 2009
Tim Roberts kirjoitti:
> "jack catcher (nick)" <nomail at thank.you> 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 at 15fps.
More information about the Python-list