| Customize Help

Using IP multicast



When sending images from your GigE Vision camera to multiple computers, the overall bandwidth requirements can be significant; this can lead to significantly reduced network performance for other computers on your network. One way to reduce the bandwidth requirements, without reducing the overall frame rate or image size, is to use IP multicast between your GigE Vision camera and your computers' Gigabit Ethernet network adapter.

IP multicast is a method of sending data from one computer to a group of computers (on the Internet or on local networks) in a single transmission. Streaming media applications often use multicasting on the Internet or on private networks. Using IP multicast, a GigE Vision-compliant camera can stream data to multiple destinations without having to send multiple copies of the data; in this case, the network routers and Ethernet switches perform the data replication instead. On a local network, the Internet Group Management Protocol (IGMP) typically controls multicast delivery. In a typical network, IGMP resides on a router.

With IP multicasting, beside the camera having its own IP address, the camera is also assigned a multicast IP address. The camera sends its multicast stream to the multicast IP address. Each computer that waits to receive this multicast stream, joins the group associated with the multicast IP address (called a multicast group). Each computer must either know the multicast IP address used by the camera or have the camera's IP address and access to read the camera's settings to establish the multicast address. Each computer communicates with its networks' multicast service (typically implemented in a router) to join the list of destinations for the particular multicast group through the Matrox GigE Vision driver. This list of destinations that a multicast stream is sent to is known as a distribution tree. When the camera sends its multicast stream to the multicast address, the stream is forwarded through your network, according to the distribution tree stored on each router or switch, until it reaches the Ethernet switch closest to one or more destination computers. Once there, the image stream is sent directly to the destination computer and not to all computers attached to the Ethernet switch (as would be the case with an IP broadcast). The Ethernet routers on your network manage additions and deletions to the multicast group and its associated distribution tree; and translate the multicast IP address into multiple IP addresses using IGMP.

A multicast address is an IP address within a predetermined range from 224.0.0.0 to 239.255.255.255. This predetermined range and its subnets have been established by the Internet Engineering Task Force (IETF) best current practice document and are defined in RFC 5771 and RFC 2365. If you allocate a digitizer for a GigE Vision camera and specify the camera should use IP multicast (that is, be in multicast mode), the Matrox GigE Vision driver selects a multicast address in the 239.0.0.0 to 239.255.255.255 range; this is a range of IP addresses that is not used on the Internet. If you use an IP address outside this range (but inside the predetermined multicast IP range), conflicts are more likely to occur. If your IGMP-aware device (that is, a router, switch, or server) uses a different range of IP addresses, you can reset MIL's multicast IP addresses using MdigControl() with M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING (for the image stream) and M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING (for the message stream).

Note, when using IP multicast to stream images from the camera to several computers, you must allocate a multicast master digitizer on one computer for the GigE Vision-compliant camera, and allocate a multicast slave digitizer or a monitor digitizer on one or more different computers for the same camera. The MIL application that allocates the multicast master digitizer is the only one that can modify the camera's settings. The MIL application that allocates the multicast slave digitizer can only inquire the camera's settings, receive the image stream and GigE Vision messages (events), and request packets be resent. The MIL application that allocates a multicast monitor digitizer can do everything that the multicast slave digitizer can do, except inquire the camera's settings.

To use IP multicast with your cameras, the following considerations should be taken:

  • You need a network consisting of a GigE Vision-compliant camera, an Ethernet switch (with IGMP enabled), and at least two computers (each with their own Gigabit Ethernet network adapter).

  • Only one computer can have a MIL application that allocates a multicast master digitizer. This application is the only one that can control, read from, write to, and receive the image stream from the camera.

  • One or more computers can have a MIL application that allocates a multicast slave or monitor digitizer. These applications can read settings and information from (multicast slave digitizer only) and receive the image stream from the camera.

There are two streams available from your camera: an image stream and a message stream. This section predominantly focuses on the image stream. The message stream is similarly configured as the image stream (in that it also has a multicast IP address and port address). The message stream carries GigE Vision messages from the camera and is available only if the camera manufacturer has enabled the feature. GigE Vision messages are camera-specific. Refer to your camera's documentation for more information.

Configuring a multicast master

The multicast master digitizer behaves like a standard MIL digitizer. A multicast master digitizer assigns the multicast address of the cameras's destination stream and the multicast address of the message channel (if supported). Once configured, the multicast master digitizer receives images and GigE Vision messages from the camera through its multicast address.

By default, if the digitizer was allocated using M_DEVn, the multicast master digitizer sets the IP multicast address to be 239.255.0.(n +1). For example, if you allocate a multicast master digitizer using M_DEV0, the multicast addresses used will be: 239.255.0.1 for the stream channel, and 239.255.1.1 for the message channel. For a multicast master digitizer allocated using M_DEV15 (provided you have 16 or more cameras connected to your computer), the addresses used will be 239.255.0.16 for the stream channel, and 239.255.1.16 for the message channel.

To allocate and use a multicast master digitizer, perform the following:

  1. Allocate the multicast master digitizer using MdigAlloc() with M_GC_MULTICAST_MASTER.

  2. In the case of an IP conflict between the MIL-determined multicast IP address and a multicast IP address already in use on your network, you can change the multicast IP address and its associated port number using MdigControl() with M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING and M_GC_LOCAL_STREAM_PORT (for the image stream) or M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING and M_GC_LOCAL_MESSAGE_PORT (for the message stream).

  3. Configure your grab and any required processing, according to your specifications.

  4. Use either MdigGrab(), MdigGrabContinuous(), or MdigProcess() to grab the image with the multicast master digitizer; the network switches and routers will direct the image stream from the GigE Vision camera to all the members of the multicast group (that is, the multicast master, and any multicast slaves and monitor digitizers in your network).

The following example illustrates how to use a multicast master digitizer and a camera:

Configuring one or more multicast slaves

The multicast slave is restricted in what it can do. A slave digitizer can get information (using MdigInquireFeature() or MdigInquire()) and GigE Vision messages (using hooked-functions and MdigGetHookInfo()), from a camera, but it cannot set values on the camera (using MdigControlFeature() or MdigControl()). In addition, it can receive the images that the camera is transmitting to the master computer; to do so, the multicast slave must call MdigGrab(), MdigGrabContinuous(), or MdigProcess().

A multicast slave digitizer is typically used to view images on a secondary station and as such, data integrity is not typically critical. A slave digitizer can issue packet resend requests (if supported by your camera). Packet resend requests are issued when missing packets are detected. Due to the nature of multicast, resent packets will be forwarded to all members of the multicast group (the master, slave, and monitor digitizers). Disable packet resend on the slave digitizer; this eliminates the possibility that packet resend requests, issued by the slave, affect acquisition reliability on the master. To prevent a slave digitizer from issuing packet resend requests, you can use MdigControl() on the slave digitizer with M_GC_PACKET_RESEND set to M_DISABLE. You must set this control type before calling MdigGrab(), MdigGrabContinuous(), or MdigProcess(). Disabling packet resends on the slave digitizer does not prevent packet resends on the master digitizer.

The multicast slave digitizer's DCF (passed to MdigAlloc()) is not used. A multicast slave digitizer can receive events, and acquire images from the camera. However, the slave digitizer can perform image acquisition only after another computer (with the master digitizer) initiates a grab and the camera is streaming data. If the master digitizer has not initiated image acquisition, the slave digitizer will not receive an image when issuing a grab command (using MdigGrab(), MdigGrabContinuous() or MdigProcess()); instead it will wait. To avoid waiting indefinitely, set a slave digitizer's M_GRAB_TIMEOUT to an appropriate amount of time.

To allocate and use a multicast slave digitizer, perform the following:

  1. Allocate the multicast slave digitizer using MdigAlloc() with M_GC_MULTICAST_SLAVE.

  2. Verify that the multicast master is still connected to the camera, using MdigInquire() with M_GC_MULTICAST_MASTER_CONNECTED.

    If the multicast master digitizer disconnects, use M_GC_MULTICAST_MASTER_CONNECTED periodically to establish when it reconnects; then, update the multicast slave digitizer's information using MdigControl() with M_GC_UPDATE_MULTICAST_INFO.

  3. While the multicast master is grabbing, use either MdigGrab(), MdigGrabContinuous(), or MdigProcess() with the multicast slave digitizer to grab the image from the image stream.

The following example illustrates how to use a multicast slave digitizer and a camera:

Configuring one or more multicast monitors

A multicast monitor is more restricted than a multicast slave, since it is allocated without the right to read or modify the camera's settings. Multicast monitor digitizers can still send packet resend requests (if supported by your GigE Vision camera), receive image streams and GigE Vision messages, just like a multicast slave, but it cannot query the camera to get its multicast IP address, port address, or query the image size or pixel format before the first frame is grabbed. Due to this, you must set some information manually for the multicast monitor digitizer. Use a multicast monitor in situations where your MIL system cannot query the multicast IP address from the GigE Vision camera due to security restrictions on your network.

Note that, if your GigE Vision camera is in chunk mode, it cannot be used with a multicast monitor.

To allocate and use a multicast monitor digitizer, perform the following:

  1. Allocate the multicast monitor digitizer using MdigAlloc() with M_GC_MULTICAST_MONITOR. Note that you cannot allocate a monitor digitizer if your camera is in chunk-mode.

  2. Specify the multicast IP address that the multicast master digitizer has assigned to the camera to carry messages (events). To do so, use MdigControl() with M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING.

  3. Specify the multicast UDP port that the multicast master digitizer has assigned to the camera to carry messages. To do so, use MdigControl() with M_GC_LOCAL_MESSAGE_PORT.

  4. Specify the multicast IP address that the multicast master digitizer has assigned to the camera to carry images. To do so, use MdigControl() with M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING.

  5. Specify the multicast UDP port that the multicast master digitizer has assigned to the camera to carry images. To do so, use MdigControl() with M_GC_LOCAL_STREAM_PORT.

  6. Update the multicast information for the multicast monitor digitizer, using MdigControl() with M_GC_UPDATE_MULTICAST_INFO. Note that with a multicast monitor digitizer, you cannot detect when the master digitizer disconnects.

  7. Set the X-size, Y-size, and pixel format of the grab image for the digitizer, using MdigControl() with M_SOURCE_SIZE_X, M_SOURCE_SIZE_Y, and M_GC_PIXEL_FORMAT, respectively. Alternatively, you can set these values in the DCF (for an example, see the gigevision_multicast_monitor.dcf).

  8. While the multicast master is grabbing, use either MdigGrab(), MdigGrabContinuous() or MdigProcess() with the multicast monitor digitizer to grab the image from the image stream.

The following example illustrates how to use a multicast monitor digitizer and a camera: