Skip to content
Snippets Groups Projects
protocols.texi 37.5 KiB
Newer Older
  • Learn to ignore specific revisions
  • Martin Storsjö's avatar
    Martin Storsjö committed
    VLC/Live555 requires this to be set to 1, to be able to receive the stream.
    
    Martin Storsjö's avatar
    Martin Storsjö committed
    The RTP stack in libavformat for receiving requires all streams to be sent
    on unique ports.
    
    Martin Storsjö's avatar
    Martin Storsjö committed
    @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}:
    
    Martin Storsjö's avatar
    Martin Storsjö committed
    
    @example
    ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
    @end example
    
    
    And for watching in @command{ffplay}, over IPv6:
    
    Martin Storsjö's avatar
    Martin Storsjö committed
    
    @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
    
    
    Andrey Utkin's avatar
    Andrey Utkin committed
    @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
    
    
    @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
    
    
    @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
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @section tcp
    
    
    The required syntax for a TCP url is:
    @example
    tcp://@var{hostname}:@var{port}[?@var{options}]
    @end example
    
    
    @var{options} contains a list of &-separated options of the form
    @var{key}=@var{val}.
    
    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}
    
    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 listen_timeout=@var{milliseconds}
    Set listen timeout, expressed in milliseconds.
    
    @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
    
    
    Peter Ross's avatar
    Peter Ross committed
    @section tls
    
    
    Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
    
    Peter Ross's avatar
    Peter Ross committed
    
    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):
    
    
    Peter Ross's avatar
    Peter Ross committed
    @table @option
    
    
    @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.
    
    Peter Ross's avatar
    Peter Ross committed
    
    @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
    
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @section udp
    
    User Datagram Protocol.
    
    
    The required syntax for an UDP URL is:
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @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
    
    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.
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    
    @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}.
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    
    @item localport=@var{port}
    
    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.
    
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @item pkt_size=@var{size}
    
    Set the size in bytes of UDP packets.
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    
    @item reuse=@var{1|0}
    
    Explicitly allow or disallow reusing UDP sockets.
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    
    @item ttl=@var{ttl}
    
    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.
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @end table
    
    
    @itemize
    @item
    Use @command{ffmpeg} to stream over UDP to a remote endpoint:
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @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:
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @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:
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @example
    
    ffmpeg -i udp://[@var{multicast-address}]:@var{port} ...
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @end example
    
    Luca Barbato's avatar
    Luca Barbato committed
    @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
    
    
    Stefano Sabatini's avatar
    Stefano Sabatini committed
    @c man end PROTOCOLS