Commit 92b5f8fe authored by Jan Sebechlebsky's avatar Jan Sebechlebsky Committed by Marton Balint

avformat: Add fifo pseudo-muxer

Signed-off-by: 's avatarJan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent 360d3f3c
......@@ -17,6 +17,7 @@ version <next>:
- acrusher audio filter
- bitplanenoise video filter
- floating point support in als decoder
- fifo muxer
version 3.1:
......
......@@ -2834,6 +2834,7 @@ dv_muxer_select="dvprofile"
dxa_demuxer_select="riffdec"
eac3_demuxer_select="ac3_parser"
f4v_muxer_select="mov_muxer"
fifo_muxer_deps="pthreads"
flac_demuxer_select="flac_parser"
hds_muxer_select="flv_muxer"
hls_muxer_select="mpegts_muxer"
......
......@@ -1440,6 +1440,101 @@ Specify whether to remove all fragments when finished. Default 0 (do not remove)
@end table
@section fifo
The fifo pseudo-muxer allows the separation of encoding and muxing by using
first-in-first-out queue and running the actual muxer in a separate thread. This
is especially useful in combination with the @ref{tee} muxer and can be used to
send data to several destinations with different reliability/writing speed/latency.
API users should be aware that callback functions (interrupt_callback,
io_open and io_close) used within its AVFormatContext must be thread-safe.
The behavior of the fifo muxer if the queue fills up or if the output fails is
selectable,
@itemize @bullet
@item
output can be transparently restarted with configurable delay between retries
based on real time or time of the processed stream.
@item
encoding can be blocked during temporary failure, or continue transparently
dropping packets in case fifo queue fills up.
@end itemize
@table @option
@item fifo_format
Specify the format name. Useful if it cannot be guessed from the
output name suffix.
@item queue_size
Specify size of the queue (number of packets). Default value is 60.
@item format_opts
Specify format options for the underlying muxer. Muxer options can be specified
as a list of @var{key}=@var{value} pairs separated by ':'.
@item drop_pkts_on_overflow @var{bool}
If set to 1 (true), in case the fifo queue fills up, packets will be dropped
rather than blocking the encoder. This allows to continue streaming without
delaying the input, at the cost of ommiting part of the stream. By default
this option is set to 0 (false), so in such cases the encoder will be blocked
until the muxer processes some of the packets and none of them is lost.
@item attempt_recovery @var{bool}
If failure occurs, attempt to recover the output. This is especially useful
when used with network output, allows to restart streaming transparently.
By default this option is set to 0 (false).
@item max_recovery_attempts
Sets maximum number of successive unsuccessful recovery attempts after which
the output fails permanently. By default this option is set to 0 (unlimited).
@item recovery_wait_time @var{duration}
Waiting time before the next recovery attempt after previous unsuccessful
recovery attempt. Default value is 5 seconds.
@item recovery_wait_streamtime @var{bool}
If set to 0 (false), the real time is used when waiting for the recovery
attempt (i.e. the recovery will be attempted after at least
recovery_wait_time seconds).
If set to 1 (true), the time of the processed stream is taken into account
instead (i.e. the recovery will be attempted after at least @var{recovery_wait_time}
seconds of the stream is omitted).
By default, this option is set to 0 (false).
@item recover_any_error @var{bool}
If set to 1 (true), recovery will be attempted regardless of type of the error
causing the failure. By default this option is set to 0 (false) and in case of
certain (usually permanent) errors the recovery is not attempted even when
@var{attempt_recovery} is set to 1.
@item restart_with_keyframe @var{bool}
Specify whether to wait for the keyframe after recovering from
queue overflow or failure. This option is set to 0 (false) by default.
@end table
@subsection Examples
@itemize
@item
Stream something to rtmp server, continue processing the stream at real-time
rate even in case of temporary failure (network outage) and attempt to recover
streaming every second indefinitely.
@example
ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv -map 0:v -map 0:a
-drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 rtmp://example.com/live/stream_name
@end example
@end itemize
@anchor{tee}
@section tee
The tee muxer can be used to write the same data to several files or any
......
......@@ -162,6 +162,7 @@ OBJS-$(CONFIG_FFM_DEMUXER) += ffmdec.o
OBJS-$(CONFIG_FFM_MUXER) += ffmenc.o
OBJS-$(CONFIG_FFMETADATA_DEMUXER) += ffmetadec.o
OBJS-$(CONFIG_FFMETADATA_MUXER) += ffmetaenc.o
OBJS-$(CONFIG_FIFO_MUXER) += fifo.o
OBJS-$(CONFIG_FILMSTRIP_DEMUXER) += filmstripdec.o
OBJS-$(CONFIG_FILMSTRIP_MUXER) += filmstripenc.o
OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o rawdec.o \
......
......@@ -123,6 +123,7 @@ void av_register_all(void)
REGISTER_MUXER (F4V, f4v);
REGISTER_MUXDEMUX(FFM, ffm);
REGISTER_MUXDEMUX(FFMETADATA, ffmetadata);
REGISTER_MUXER (FIFO, fifo);
REGISTER_MUXDEMUX(FILMSTRIP, filmstrip);
REGISTER_MUXDEMUX(FLAC, flac);
REGISTER_DEMUXER (FLIC, flic);
......
This diff is collapsed.
......@@ -32,8 +32,8 @@
// Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 47
#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_MINOR 48
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment