Newer
Older
VLC/Live555 requires this to be set to 1, to be able to receive the stream.
The RTP stack in libavformat for receiving requires all streams to be sent
on unique ports.
@end table
Example command lines follow.
To broadcast a stream on the local subnet, for watching in VLC:
@example
ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
@end example
Similarly, for watching in @command{ffplay}:
@example
ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
@end example
And for watching in @command{ffplay}, over IPv6:
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
@example
ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
@end example
@subsection Demuxer
The syntax for a SAP url given to the demuxer is:
@example
sap://[@var{address}][:@var{port}]
@end example
@var{address} is the multicast address to listen for announcements on,
if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
is the port that is listened on, 9875 if omitted.
The demuxers listens for announcements on the given address and port.
Once an announcement is received, it tries to receive that particular stream.
Example command lines follow.
To play back the first stream announced on the normal SAP multicast address:
@example
ffplay sap://
@end example
To play back the first stream announced on one the default IPv6 SAP multicast address:
@example
ffplay sap://[ff0e::2:7ffe]
@end example
@section sctp
Stream Control Transmission Protocol.
The accepted URL syntax is:
@example
sctp://@var{host}:@var{port}[?@var{options}]
@end example
The protocol accepts the following options:
@table @option
@item listen
If set to any value, listen for an incoming connection. Outgoing connection is done by default.
@item max_streams
Set the maximum number of streams. By default no limit is set.
@end table
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
@section srtp
Secure Real-time Transport Protocol.
The accepted options are:
@table @option
@item srtp_in_suite
@item srtp_out_suite
Select input and output encoding suites.
Supported values:
@table @samp
@item AES_CM_128_HMAC_SHA1_80
@item SRTP_AES128_CM_HMAC_SHA1_80
@item AES_CM_128_HMAC_SHA1_32
@item SRTP_AES128_CM_HMAC_SHA1_32
@end table
@item srtp_in_params
@item srtp_out_params
Set input and output encoding parameters, which are expressed by a
base64-encoded representation of a binary block. The first 16 bytes of
this binary block are used as master key, the following 14 bytes are
used as master salt.
@end table
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
@section subfile
Virtually extract a segment of a file or another stream.
The underlying stream must be seekable.
Accepted options:
@table @option
@item start
Start offset of the extracted segment, in bytes.
@item end
End offset of the extracted segment, in bytes.
@end table
Examples:
Extract a chapter from a DVD VOB file (start and end sectors obtained
externally and multiplied by 2048):
@example
subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB
@end example
Play an AVI file directly from a TAR archive:
subfile,,start,183241728,end,366490624,,:archive.tar
Andreas Cadhalpun
committed
Transmission Control Protocol.
The required syntax for a TCP url is:
@example
tcp://@var{hostname}:@var{port}[?@var{options}]
@end example
Stefano Sabatini
committed
@var{options} contains a list of &-separated options of the form
@var{key}=@var{val}.
Stefano Sabatini
committed
The list of supported options follows.
@table @option
@item listen=@var{1|0}
Listen for an incoming connection. Default value is 0.
@item timeout=@var{microseconds}
Stefano Sabatini
committed
Set raise error timeout, expressed in microseconds.
Stefano Sabatini
committed
This option is only relevant in read mode: if no data arrived in more
than this time interval, raise error.
Stefano Sabatini
committed
@item listen_timeout=@var{milliseconds}
Set listen timeout, expressed in milliseconds.
Stefano Sabatini
committed
@end table
The following example shows how to setup a listening TCP connection
with @command{ffmpeg}, which is then accessed with @command{ffplay}:
@example
ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
ffplay tcp://@var{hostname}:@var{port}
@end example
Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
The required syntax for a TLS/SSL url is:
@example
tls://@var{hostname}:@var{port}[?@var{options}]
@end example
The following parameters can be set via command line options
(or in code via @code{AVOption}s):
@item ca_file, cafile=@var{filename}
A file containing certificate authority (CA) root certificates to treat
as trusted. If the linked TLS library contains a default this might not
need to be specified for verification to work, but not all libraries and
setups have defaults built in.
The file must be in OpenSSL PEM format.
@item tls_verify=@var{1|0}
If enabled, try to verify the peer that we are communicating with.
Note, if using OpenSSL, this currently only makes sure that the
peer certificate is signed by one of the root certificates in the CA
database, but it does not validate that the certificate actually
matches the host name we are trying to connect to. (With GnuTLS,
the host name is validated as well.)
This is disabled by default since it requires a CA database to be
provided by the caller in many cases.
@item cert_file, cert=@var{filename}
A file containing a certificate to use in the handshake with the peer.
(When operating as server, in listen mode, this is more often required
by the peer, while client certificates only are mandated in certain
setups.)
@item key_file, key=@var{filename}
A file containing the private key for the certificate.
@item listen=@var{1|0}
If enabled, listen for connections on the provided port, and assume
the server role in the handshake instead of the client role.
@end table
Example command lines:
To create a TLS/SSL server that serves an input stream.
@example
ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
@end example
To play back a stream from the TLS/SSL server using @command{ffplay}:
@example
ffplay tls://@var{hostname}:@var{port}
@end example
@section udp
User Datagram Protocol.
The required syntax for an UDP URL is:
@example
udp://@var{hostname}:@var{port}[?@var{options}]
@end example
@var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
In case threading is enabled on the system, a circular buffer is used
Andreas Cadhalpun
committed
to store the incoming data, which allows one to reduce loss of data due to
UDP socket buffer overruns. The @var{fifo_size} and
@var{overrun_nonfatal} options are related to this buffer.
The list of supported options follows.
@table @option
@item buffer_size=@var{size}
Set the UDP maximum socket buffer size in bytes. This is used to set either
the receive or send buffer size, depending on what the socket is used for.
Default is 64KB. See also @var{fifo_size}.
Override the local UDP port to bind with.
@item localaddr=@var{addr}
Choose the local IP address. This is useful e.g. if sending multicast
and the host has multiple interfaces, where the user can choose
which interface to send on by specifying the IP address of that interface.
Set the size in bytes of UDP packets.
Explicitly allow or disallow reusing UDP sockets.
Set the time to live value (for multicast only).
@item connect=@var{1|0}
Initialize the UDP socket with @code{connect()}. In this case, the
destination address can't be changed with ff_udp_set_remote_url later.
If the destination address isn't known at the start, this option can
be specified in ff_udp_set_remote_url, too.
This allows finding out the source address for the packets with getsockname,
and makes writes return with AVERROR(ECONNREFUSED) if "destination
unreachable" is received.
For receiving, this gives the benefit of only receiving packets from
the specified peer address/port.
@item sources=@var{address}[,@var{address}]
Only receive packets sent to the multicast group from one of the
specified sender IP addresses.
@item block=@var{address}[,@var{address}]
Ignore packets sent to the multicast group from the specified
sender IP addresses.
@item fifo_size=@var{units}
Set the UDP receiving circular buffer size, expressed as a number of
packets with size of 188 bytes. If not specified defaults to 7*4096.
@item overrun_nonfatal=@var{1|0}
Survive in case of UDP receiving circular buffer overrun. Default
value is 0.
@item timeout=@var{microseconds}
Set raise error timeout, expressed in microseconds.
This option is only relevant in read mode: if no data arrived in more
than this time interval, raise error.
@item broadcast=@var{1|0}
Explicitly allow or disallow UDP broadcasting.
Note that broadcasting may not work properly on networks having
a broadcast storm protection.
@subsection Examples
@itemize
@item
Use @command{ffmpeg} to stream over UDP to a remote endpoint:
@example
ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
@end example
@item
Use @command{ffmpeg} to stream in mpegts format over UDP using 188
sized UDP packets, using a large input buffer:
@example
ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
@end example
@item
Use @command{ffmpeg} to receive over UDP from a remote endpoint:
ffmpeg -i udp://[@var{multicast-address}]:@var{port} ...
@end itemize
@section unix
Unix local socket
The required syntax for a Unix socket URL is:
@example
unix://@var{filepath}
@end example
The following parameters can be set via command line options
(or in code via @code{AVOption}s):
@table @option
@item timeout
Timeout in ms.
@item listen
Create the Unix socket in listening mode.
@end table