SourceFile syntax

LEADTOOLS multimedia gives some filenames special handling. These filenames follow a syntax similar to an URL (“xxxxx://yyyyyy/zzzz”):

  1. Filenames starting with "http:", "https:", "ftp:" or "mms:" are assumed to be streamed from an URL. These filenames follow the standard URL syntax.

  2. Filenames starting with "ltsf" are assumed to be streamed from a LEAD video streaming server and the LEAD Network Source filter is used as the source filter.
     

  3. Filenames starting with "saic" are assumed to be streamed to a UDP port and the LEAD MPEG-2 Transport Source filter is used as the source filter.

  4. Filenames starting with "udp" are assumed to be streamed to a UDP port and the LEAD MPEG-2 Transport UDP Source filter is used as the source filter.

  5. Filenames starting with "tcp" are assumed to be streamed to a TCP/IP port and the LEAD MPEG-2 Transport UDP Source filter is used as the source filter.

  6. Filenames starting with "rtsp" are assumed to be streamed from a RTSP server and the LEAD MPEG-2 Transport RTSP Source filter is used as the source filter.

  7. Anything else is assumed to be a regular file and the regular DirectShow rendering mechanism is used.

 

Syntax for strings prefixed with “ltsf”:

ip_address

The IP address where the data is read from. This can be in the usual Ipv4 format (xx.xx.xx.xx) or it can be a valid host address accepted by the standard function inet_addr. For example, localhost is equivalent to 127.0.0.1. This is the IP address of the sending (server) computer.

ltsf_port

(Optional) The port to which to connect. The port must be a number from 1 to 65535. Note that you must make sure the port is open if you are running firewall software. The default value it 27015.

Syntax for strings prefixed with “saic” and “udp”:

ip_address

The IP address where the data is being read from. This can be in the usual Ipv4 format (xx.xx.xx.xx) or it can be a valid host address accepted by the standard function inet_addr. For example, localhost is equivalent to 127.0.0.1. This is usually the IP address of the receiving (client) computer.

The stream is considered to be multicast if the first number in the Ipv4 address is between 224..239 (0xE0 .. 0xEF). If the first number is not in this range, the stream is unicast.

network_card

(Optional) The address of the network card receiving the data. Used only for multicast streams. This is optional – if it is missing, the default network card is used.

udp_port

(Optional) The port on which to listen. The port must be a number from 1 to 65535. Note that you must make sure the port is open if you are running firewall software.

paramN=valN

(Optional, valid only with udp prefix) Parameters used to describe the format of RTP streams containing dynamic payloads for certain raw samples. Right now, this is used only with raw H264 streams. See Note 1 below for the possible values of parameters and values. Multiple parameter pairs should be separated using the '&' character.

Syntax for strings prefixed with “tcp”:

ip_address

The IP address of the server sending the data. This can be in the usual Ipv4 format (xx.xx.xx.xx) or it can be a valid host address accepted by the standard function inet_addr. For example, localhost is equivalent to 127.0.0.1. This is usually the IP address of the sending (server) computer.

TCP streams cannot be multicast. All TCP streams are assumed to be unicast.

tcp_port

(Optional) The port on which to listen. The port must be a number from 1 to 65535. Note that you must make sure the port is open if you are running firewall software.

paramN=valN

Optional) Parameters used to describe the format of RTP streams containing dynamic payloads for certain raw samples. Right now, this is used only with raw H264 streams. See Note 1 below for the possible values of parameters and values. Multiple parameter pairs should be separated using the '&' character.

Syntax for strings prefixed with “rtsp”:

ip_address

 

The IP address of the server sending the data. This can be in the usual Ipv4 format (xx.xx.xx.xx), or it can be a valid host address accepted by the standard function inet_addr. For example, localhost is equivalent to 127.0.0.1. This is usually the IP address of the sending (server) computer.

RTSP streams cannot be multicast. All RTSP streams are assumed to be unicast.

tcp_port

 

(Optional) The port number on which the server is listening for RTSP commands. The port must be a number from 1 to 65535. If absent, the default RTSP port (554) is used.

username

(Optional) For servers that use authentication, you can pass a username as part of the connection string. Passing the username and password avoids the message box appearing to ask for the username and password. If you pass the username and password but still get the message box, the server has rejected supplied username and/or password.

password

(Optional) For servers that use authentication, you can pass a username and password as part of the connection string. Passing the username and password avoids the message box appearing to ask for the username and password. If you pass the username and password but still get the message box, the server has rejected supplied username and password.

server_URL

The URL of the server RTSP. Obtain this from the server documentation.

paramN=valN

(Optional) These parameters are passed to the RTSP server. These parameters are server-dependent and you should consult the server's documentation for more information. These parameters are commonly used to influence the server's behavior: changing the video or audio compression, video size, etc. See Note 2 below for possible values and RTSP command examples. Multiple parameter pairs should be separated using the '&' character.  

 

Note 1: Parameters used to describe raw H264 video streams

H264 streams sent inside RTP packets use dynamic payloads with a payload type between 96 and 127. These streams can be decoded only when there is extra information being sent using a separate communication channel. The most common method of sending this extra information is through a Session Description Protocol (also known as SDP). The SDP contains extra information describing the stream. The UDP source needs to know the following information:

The UDP source needs to know this information in order to process these streams. There are two useful parameters right now (rtpmap and fmtp) and their syntax is described below:

Parameter

Description

payload_type

The payload type. This value should be between 96 and 127.

compression

The string describing the compression. Right now, only H264 is supported.

RTP_units_per_second

 The number of RTP units per second. This value is usually 90000.

These values are usually sent in the SDP information via the a=rtpmap line, as in the following example:

a=rtpmap:99 H264/90000

This should be translated by replacing the space with semicolon (';) into

rtpmap=99;H264/90000

So, the URL syntax for a H264 stream sent to port 40000 containing RTP packets with a payload of 99 and with sequence header packets (NAL units 7 and 8) sent inside the compressed stream is something like this:

udp://192.168.1.100:40000?rtpmap=99;H264/90000

Parameter

Description

payload_type

 The payload type. This value should be between 96 and 127. It should match the value in the rtpmap parameter.

seqN

 The base64 encoding of the sequence parameter. When there are several sequence headers, they are separated with a comma ( , ). Usually, there are two sequence headers. A double quote ( " ) should be added at the beginning and end of the sequence list.

Note that the three dots would not be passed in the string. They are there only to indicate there could be other seq values between seq2 and seqN.

These values are usually sent in the SDP information via the a=fmtp line, as in the following example:

a=fmtp:96 packetization-mode=1; profile-level-id=420029; sprop-parameter-sets=Z0IAKeKQFge2BqwYBBuHiRFQ,aM48gA==

In the above example, there are two sequence header strings following the sprop-parameter-sets, separated with a comma. The UDP source filter is interested only in the sprop-parameter-sets field, so this line should be translated into:

fmtp=96;sprop-parameter-sets="Z0IAKeKQFge2BqwYBBuHiRFQ,aM48gA=="

And this pair should be appended to the URL to form something like this:

udp://192.168.1.100:40000?rtpmap=99;H264/90000&fmtp=96;sprop-parameter-sets="Z0IAKeKQFge2BqwYBBuHiRFQ,aM48gA=="

The above URL syntax describes a stream streaming on port 40000, with H264 data inside RTP packets with payload type set to 99, with 90000 RTP units per second and whose sequence headers are not part of the stream. Instead, they are passed through the sprop-parameter-sets component of the fmtp parameter.

 

Note 2: Examples of RTSP Commands

RTSP servers are usually listening for commands to sent to a certain port. The commands can ask the server to describe the stream at a certain URL, to start, pause or stop playback.

In addition, certain servers allow the client to pass certain customization parameters to the server. These commands can change the compression used by the server, the video size, etc. These parameters are server-dependent and you should consult the server's documentation for information on the possible parameters supported by the server. You can see below an example of a command sent to a server to change the compression to jpeg. Again, keep in mind that this command might not work for another RTSP server.

Some RTSP Servers require the use of authentication to restrict access only to authorized users. In these cases, the RTSP Source Filter might display a login message box asking for a username and password. If you know the username and password beforehand, you can pass it as part of the URL to avoid having the message box appear. Note that the message box might still appear if the supplied username and/or password information is incorrect.

rtsp://192.168.0.164/axis-media/media.amp - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using the default compression.

rtsp://root:pass@192.168.0.164/axis-media/media.amp?videocodec=jpeg - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using JPEG compression. This server is using authentication, and we are connecting as username 'root' and with the password 'pass' in order to avoid having to enter the username and password.