The video conferencing example programs capture, compress, send, receive, and decompress video images. Figure 7-1 shows an example of a simple two- party video conferencing configuration.
Figure 7-1 Two-Party Video Conference
The programs that make up the SunVideo video conferencing examples do the following:
To run the video conferencing examples, your workstation must have a network connection to another workstation that has the SunVideo subsystem installed. The example programs do not provide support for audio.
Note - The video decompression operations are performed in software on the receiving systems. Therefore, systems need not have a SunVideo card installed in order to use the rtvc_video_receiver program to receive transmissions.
The source code for the video conferencing examples is located in the directory:
/opt/SUNWits/Graphics-sw/xil/examples/rtvc_video_conference
Use the Makefile that is provided in the directory to compile the programs.
The broadcaster program (rtvc_video_conference) captures video frames from the SunVideo card's selected input port, compresses the frames into a CellB bytestream, and broadcasts the stream onto the local network via the selected channel. The broadcaster can simultaneously decompress the CellB bytestream and display the result in a preview window on the local workstation.
Note -
The broadcaster program is designed to demonstrate the use of the
CellB compression technique in a video conferencing application. You also can
compress the images with JPEG, MPEG-1, or UYVY, but the example video
receiver program is not designed to receive MEPG-1 frames. This limitation is
not inherent in the SunVideo card or XIL, but is instead due to the way the
examples are written. For the sake of simplicity, the underlying network
communication mechanism chosen for these examples is a "datagram" packet,
which is not guaranteed to be received. This can be a problem for an MPEG-1
video conference.
Also, the broadcaster does not send a frame if the size of the compressed frame
exceeds a limit, which is based on the design of the example's video packets.
Given the relatively poor compression ratio of UYVY (2 bytes/pixel), a large
shrink factor must be used for the UYVY frames to meet this limit.
(Alternatively, the width and height could be reduced using the -w and -h
arguments.)
After compiling the program, you can display its usage information by typing the program name and an argument that the program doesn't use. For example:
% rtvc_video_conference -@
Table 7-1 describes the rtvc_video_conference command's arguments. Arguments without values are switches. For example, -p is a switch.
-------------------------------------------------------------------------------------
Argument Description Default -------------------------------------------------------------------------------------
-I <port_number'> The number of the SunVideo card's Composite
input port to which your video port 1
device is connected (0 for S-Video, 1
or 2 for composite).
-p Turns off the local preview window. Preview on
-C <compression_type'> The type of compression. Valid CellB
compressor names are CellB, Jpeg,
Mpeg1, or UYVY.
-k <Mpeg_pattern'> Compression pattern for MPEG-1 Variable bit
compression. If the pattern contains rate, I
any P or B frames, constant bit rate frames only
MPEG-1 will be used with bit rate
equal to 1.15 mbits/sec.
-f <number_frames The number of frames to capture, 18,000 frames
compress, and broadcast.
-m <frames'> Maximum number of frames to 2
buffer on the SunVideo card.
Generally, higher values increase
performance, but increase latency.
-P <number_msecond'> The number of milliseconds to delay 0
after sending a video packet (may
help reduce the number of missed
packets if the network is busy or the
receiver is running on a heavily
loaded system.
-s <shrink_factor'> Shrinks the captured image by the 2
integer value of <shrink_factor>
(1, 2, 3, 4, 5, ... ). A shrink factor of 0
turns off shrinking, which is
equivalent to a shrink factor of 1.
For NTSC, the default shrink factor of
2 delivers SIF images of 320x240 pixel
images. A shrink factor of 4 delivers
smaller Quarter SIF (QSIF) images of
160x120 pixels.
See the section "About the Shrink
Factor Argument" on page 65 for
more information about the shrink
factor.
-c <broadcast_channel'> The number of the broadcast channel 0
(0-9). The program uses a socket to
connect to a broadcast channel.
Different instances of the video
conferencing program must broadcast
on unique channels to avoid
collisions. Change this value to select
an open channel.
-H <dest_host'> The destination hostname for the Send the
broadcast. The value can be the name broadcast to
of a single machine or the Class C the local
Internet address of a subnet. In that subnet
case, the last digit of the Internet
address is a "0."
-F <dest_host_file'> Name of a file that lists one or more None
destination hostnames (up to a
maximum of 32). The file can contain
the names of single machines or the
Class C Internet addresses of subnets.
Entries in the file must be on single
lines.
-w <width'> Specifies (in pixels) the width of a 640 NTSC
rectangle that enables you to select
part of a device image. The rectangle 768 PAL
is centered on the image. The
maximum width is 640 pixels for
NTSC and 768 pixels for PAL.
-h <height'> Specifies (in pixels) the height of a 480 NTSC
rectangle that enables you to select 576 PAL
part of a device image. The rectangle
is centered on the image. The
maximum height is 480 pixels for
NTSC and 576 pixels for PAL.
-x <xpos'> Specifies the x-axis location of the Random
display window relative to the upper
left-hand corner of the screen.
-y <ypos'> Specifies the y-axis location of the Random
display window relative to the upper
left-hand corner of the screen.
-i <skip_frames'> Number of frames to skip between 0
capture.
-t Disable transmission. Transmit
-d <filename'> Save compressed video to a file. Does not
save to file
-v Turn on verbose mode. When verbose Verbose
mode is on, error messages about the mode off
status of the video conferencing
network connections are displayed at
the local workstation.
-b Include extra information in each Do not
video packet that allows the receiver include this
to display a partial frame in the case information
of missed packets (CellB only). in the video
packets
-D <devname'> Name of the SunVideo video device. /dev/rtvc0
See the section "A Comment About
Moving SunVideo Cards Among
Slots" on page 19 for more
information about SunVideo device
names.
-E Exit on first XIL error. Keep
running and
try to recover
-------------------------------------------------------------------------------------
To broadcast to all SPARCstations on a local subnet using the default parameters (18,000 frames = 10 minutes, CellB compression, broadcast on channel 0) from a SPARCstation with a SunVideo subsystem:
% rtvc_video_conference
To receive the transmission, other systems on the local subnet (which need not have SunVideo subsystems) must issue the command:
% rtvc_video_receiver
To video conference for 45 minutes (45*60*30 = 81,000 frames) between two SPARCstations (in this example, "salsa" and "nachos"), both with SunVideo subsystems. The systems send and receive over different channels.
On the "salsa" system:
salsa% rtvc_video_conference -c 7 -H nachos -f 81000 &
salsa% rtvc_video_receiver -c 8 &
On the "nachos" system:
nachos% rtvc_video_conference -c 8 -H salsa -f 81000 &
nachos% rtvc_video_receiver -c 7 &
You can use the -t command line argument to disable transmission. This enables you to use the example program as an image previewer while you are setting up a video conference. Or, you can use the program to display live video from a camera or to play video from a VCR or laser disk. You can also save compressed video to a file (with the -d argument) so that you can play it later.
For rtvc_video_conference, if the shrink_factor is 0 or 1, you must specify width and height arguments that are smaller than the default, which is 640 x 480 for NTSC and 768 x 576 for PAL. Otherwise, rtvc_video_conference will issue the following error message:
This restriction is due to the design of the video packets used in the example rtvc_video_conference program and is not a limitation of CellB or the SunVideo subsystem.
The rtvc_video_receiver program receives a CellB bytestream broadcast by the rtvc_video_conference program anywhere on the broadcaster's local network and on the selected channel. The receiver decompresses the frames and displays them in a window.
You also can receive compressed JPEG and UYVY frames. However, the example video conferencing programs are optimized for CellB (as discussed in the note on page 61).
The initial size of the display window is 320x240. The size automatically adjusts to that of the broadcaster.
After compiling the program, you can display its usage information by typing the program name and an argument that the program doesn't use. For example:
% rtvc_video_receiver -@
Table 7-2 describes the rtvc_video_receiver command's arguments. Arguments without values are switches. For example, -v is a switch.
--------------------------------------------------------------------------------
Argument Description Default --------------------------------------------------------------------------------
-f <number_frames The number of frames to receive. 18,000 frames
-C <compression_type'> The type of compression. Valid CellB
compression names are CellB, Jpeg, or
UYVY.
-c <receive_channel'> The number of the channel on which 0
to receive a broadcast (0-9). This must
be the same value that the sender set
in their rtvc_video_conference
program's -c
<broadcast_channel> argument.
-x <xpos'> Specifies the x-axis location of the Random
display window relative to the upper
left-hand corner of the screen.
-y <ypos'> Specifies the y-axis location of the Random
display window relative to the upper
left-hand corner of the screen.
-v Turn on verbose mode. When verbose Verbose
mode is on, error messages about the mode off
status of the video conferencing
network connections are displayed at
the local workstation.
-b When one or more video packets from Discard the
a frame are missed, fill in the missing entire frame
parts of the bytestream with CellB skip if any packet
codes to display the previous frame in is missed
place of the missed packets. (For this
to work, you must also use the -b
argument of the broadcaster program
(rtvc_video_conference).
-E Exit on first XIL error. Keep
running and
try to recover
--------------------------------------------------------------------------------
There are nine source modules in the video conferencing suite. Figure 7-2 shows how the modules are connected.
Figure 7-2 Example Video Conferencing Programs
As shown in Figure 7-2 the modules are divided into three functional groups: display, rtvc_video_conference, and rtvc_video_receiver. Both the rtvc_video_conference and rtvc_video receiver modules use the display modules. Each group has a main module as follows:
--------------------------------------
Group Main Module --------------------------------------
display window.c
rtvc_video_confernece xilbroadcast.c
rtvc_video_receiver xilvc.c
--------------------------------------
Table 7-3 defines each module and the relationship among them.
Table 7-3 Video Conferencing Suite Modules
---------------------------------------------------------------------------------
Module Definition ---------------------------------------------------------------------------------
window.c Handles the displaying of images for the
rtvc_video_conference and rtvc_video_receiver
programs. This module uses the functions defined in cmap.c
and dither.c.
cmap.c Initializes the X colormap with a 3-banded lookup table.
dither.c Initializes the variables for a YUV to RGB dither.
xilbroadcast.c Reads an image from the SunVideo card, transmits compressed
video over the local network, and optionally displays the image
in an X window. This function uses the functions defined in
transmit.c, tparams.c, and window.c.
transmit.c Initializes and opens the socket through which the compressed
video will be sent to a network.
tparams.c Defines the arguments for the rtvc_video_conference
program.
xilvc.c Receives compressed video over the local network and displays
the decompressed images in an X window. This module uses
the functions defined in receive.c, rparams.c, and window.c.
receive.c Initializes and opens the socket through which the compressed
video will be received from a network.
rparams.c Defines the arguments for the rtvc_video_receiver
program.
---------------------------------------------------------------------------------
The optional cellb_util.c module (for CellB only) provides support for the -b option, which allows the receiver to include extra information in each video packet to display a partial frame in the case of missed packets.