Compressed Video over IP

advertisement
Compressed Video over IP
Independent Study – Spring 2002
August Visco
May 14th 2002
Instructor: Longin Jan Latecki
Office: 510 Wachman Hall
E-mail: latecki@temple.edu
Phone: (215) 204 5781
Office Hours: Thursday 2:00 pm - 3:00 pm
Related Documents:
http://www.cis.temple.edu/~latecki/Courses02/Presentations/fileFormat02-1.doc
http://www.cis.temple.edu/~latecki/Courses02/Presentations/streamFormat02-1.doc
Application Overview:
The purpose of this application is to provide video over a network using the user datagram protocol. The application
runs on linux kernal 7.2 with Ezonics webcam. It can service two way communication, both sending and receiving
video, or it can act only to send video or only to receive video. When using this application for simultaneous sending
and receiving of video with jpeg compression on, you might find that the application crashes. This could be the
result of using the linux jpeg library calls in multiple threads. One possible solution would be to treat every jpeg
library call as a single atomic action, although this would obviously slow down the application further.
Application Parameters:
#the IP address of the local machine, required if you want to receive video data from remote
-LOCAL_IP 111.111.111.111
#the port of the local machine, required if you want to receive video data from remote
-LOCAL_PORT 11111
# remote machine has no webcam
-NO_REMOTE_VIDEO
#the IP address of the remote machine, required if you want to send video data to remote
-REMOTE_IP 222.222.222.222
#the port of the remote machine, required if you want to send video data to remote
-REMOTE_PORT 22222
#local machine has no webcam
-NO_LOCAL_VIDEO
#sets the maximum transmittion unit, if not specified, data sent as raw...
-MAXIMUM_MTU 333
# send data raw, by default, jpeg compression is used...
-NO_COMPRESSION
Running the Application:
The best way to run this application for now is to write a simple shell script for each machine you want to run it on.
Here is an example, the first line is run on the machine 155.247.170.11 . It both displays its local webcam video and
also sends the compressed images to its remote. The second line runs on the machine 155.247.170.15 and has no
webcam of its own, hence no local video, it only displays the video from its remote.
./gqcam -LOCAL_IP 155.247.170.11 -LOCAL_PORT 55555 -REMOTE_IP 155.247.170.15 -REMOTE_PORT 66666 -MAXIMUM_MTU 1400
./gqcam -LOCAL_IP 155.247.170.15 -LOCAL_PORT 66666 -NO_LOCAL_VIDEO -MAXIMUM_MTU 1400
Application Logs:
When the application is exited it generates a log name “$HOSTNAME”_stats.log, were $HOSTNAME is the full
hostname of the local machine. It logs the packets sent, bytes sent, and bytes received.
Packet Formats:
The following is a section of the header file udp_packets.h describing the packet structures used in this
implementation.
#define VIDEO_STREAM_HEADER
#define FRAME_HEADER
#define FRAME_DATA
#define END_OF_FRAME
#define END_OF_VIDEO_STREAM
0
1
2
3
4
typedef unsigned int u_4byte_int;
typedef struct generic_video_stream_packet {
u_4byte_int packet_number;
u_4byte_int packet_type;
} generic_packet;
typedef struct video_stream_start_packet {
generic_packet info;
u_4byte_int version;
u_4byte_int encoding_type;
u_4byte_int height;
u_4byte_int width;
} VS_start;
typedef struct frame_header_packet {
generic_packet info;
u_4byte_int frame_number;
u_4byte_int time_stamp;
u_4byte_int fractional_time_stamp;
u_4byte_int frame_size;
} FRM_header;
typedef struct frame_data_packet {
generic_packet info;
u_4byte_int frame_number;
u_4byte_int start_byte;
u_4byte_int end_byte;
} FRM_data;
typedef struct end_of_frame_packet {
generic_packet info;
u_4byte_int frame_number;
} FRM_end;
typedef struct end_of_stream_packet {
generic_packet info;
} VS_end;
Generic Video Stream Packet
Name
Packet Number
Packet Type
Size
4 byte unsigned
integer
4 byte unsigned
integer
Description
value 0 – means this is video stream header,
value 1 – means this is frame header, it also indicates
beginning of a frame
value 2 – for data of a single frame
value 3 – end of frame
value 4 – end of video stream
Video Stream Start Packet
Name
Packet Number
Packet Type
Video Stream Version
Encoding Type Used
Image Height
Image Width
Size
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
Description
value 0 – this is the first packet in the video stream
value 0 – means this is video stream header
We will use version value 1
Value 0 means jpeg, value 1 RAW
Frame Header Packet (informs us that a new frame starts)
Name
Packet Number
Packet Type
Frame Number
Time Stamp
Fractional Time Stamp
Frame Size
Size
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
Description
value 1 – means this is frame header
The timestamp of a particular frame measured in
seconds
The fractional piece of a particular frame measured in
microseconds
in bytes, the size of the image data
Frame Data Packet
Name
Packet Number
Packet Type
Frame Number
Start Byte
End Byte
Data
Size
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
varies
Description
2 – for data of a single frame
For a frame having the above frame number
For a frame having the above frame number
End Byte – Start Byte gives the size
Start byte begins with 0, and the start byte and end byte numbers are
inclusive.
End of Frame Packet
Name
Packet Number
Packet Type
Frame Number
Size
4 byte unsigned
integer
4 byte unsigned
integer
4 byte unsigned
integer
Description
Size
4 byte unsigned
integer
4 byte unsigned
integer
Description
value 3 – end of frame
End of Stream Packet
Name
Packet Number
Packet Type
value 4 – end of stream
Download