Older versions of ffmpeg can also do this, using 2 piped processes, where the first process is used to encode the stream(s) and second process is used to duplicate that to several outputs.

ffmpeg -i input1 -i input2 -acodec … -vcodec … -f mpegts - | \
	ffmpeg -f mpegts -i - \
		-c copy output1 \
		-c copy output2 \
		-c copy output3 \
Note: If you are using older ffmpeg and -c copy is not recognized, then you can replace it with -acodec copy -vcodec copy.

ffmpeg -f v4l2 -i /dev/video0 -vcodec libx264 -f mpegts - | \
	ffmpeg -f mpegts -i - \
		-c copy -f mpegts udp://1.2.3.4:5678 \
		-c copy -f mpegts local.ts
Older versions of ffmpeg can also do this, using 2 piped processes, where the first process is used to encode the stream(s) and second process is used to duplicate that to several outputs.

ffmpeg -i input1 -i input2 -acodec … -vcodec … -f mpegts - | \
	ffmpeg -f mpegts -i - \
		-c copy output1 \
		-c copy output2 \
		-c copy output3 \
Note: If you are using older ffmpeg and -c copy is not recognized, then you can replace it with -acodec copy -vcodec copy.

ffmpeg -f v4l2 -i /dev/video0 -vcodec libx264 -f mpegts - | \
	ffmpeg -f mpegts -i - \
		-c copy -f mpegts udp://1.2.3.4:5678 \
		-c copy -f mpegts local.ts
The example below outputs an MKV file, and a UDP stream. Streams are separated by the | symbol. Options can be applied to an individual output: [f=mpegts] is equivalent to -f mpegts in a normal ffmpeg command-line. Multiple options can be separated with a :, which means that any : have to be escaped (so use \:).

ffmpeg -i input.file -c:v libx264 -c:a mp2 \
-f tee -map 0:v -map 0:a "output.mkv|[f=mpegts]udp://10.0.1.255:1234/"
If you want to choose specific streams then use the select option. In this next example the video stream is split and scaled to two different sized outputs, and the audio is encoded only once but used by both outputs. Otherwise you would have to unnecessarily re-encode the same audio multiple times. The ignore value for the onfail option in the last output will keep the other outputs running even if that last output fails. The default value for onfail is abort.

ffmpeg -i input -filter_complex \
"[0:v]split=2[s0][s1]; \
 [s0]scale=1280:-2[v0]; \
 [s1]scale=640:-2[v1]" \
-map "[v0]" -map "[v1]" -map 0:a -c:v libx264 -c:a aac -f tee \
"[select=\'v:0,a\']local0.mkv| \
 [select=\'v:0,a\':f=flv]rtmp://server0/app/instance/playpath| \
 [select=\'v:1,a\']local1.mkv| \
 [select=\'v:1,a\':f=flv:onfail=ignore]rtmp://server1/app/instance/playpath"
ffmpeg supports multiple outputs created out of the same input(s) in the same process. The usual way to accomplish this is:

ffmpeg -i input1 -i input2 \
	-acodec … -vcodec … output1 \
	-acodec … -vcodec … output2 \
	-acodec … -vcodec … output3
For example, to encode your video to three different outputs, at the same time, but with the boxblur, negate, yadif filter applied to the different outputs respectively, you would use something like this:

# the `split=3` means split to three streams
ffmpeg -i input -filter_complex '[0:v]split=3[in1][in2][in3];[in1]boxblur[out1];[in2]negate[out2];[in3]yadif[out3]' \
        -map '[out1]' -acodec … -vcodec … output1 \
        -map '[out2]' -acodec … -vcodec … output2 \
        -map '[out3]' -acodec … -vcodec … output3
The following example command lines, that are usually written in one line, have been split into multiple lines, using the new-line delimiter character \ for more clarity. So, if the example shows something like this:

ffmpeg -i input \
	-acodec … \
	-vcodec … \
	output1
For example, to encode your video in HD, VGA and QVGA resolution, at the same time, but with the yadif filter applied, you would use something like this:

# the `split=3` means split to three streams
ffmpeg -i input -filter_complex '[0:v]yadif,split=3[out1][out2][out3]' \
        -map '[out1]' -s 1280x720 -acodec … -vcodec … output1 \
        -map '[out2]' -s 640x480  -acodec … -vcodec … output2 \
        -map '[out3]' -s 320x240  -acodec … -vcodec … output3
For example, to encode your video in HD, VGA and QVGA resolution, at the same time, you would use something like this:

ffmpeg -i input \
	-s 1280x720 -acodec … -vcodec … output1 \
	-s 640x480  -acodec … -vcodec … output2 \
	-s 320x240  -acodec … -vcodec … output3
that means the actual command line, typed in the shell, would be:

ffmpeg -i input -acodec … -vcodec … output1

Recommend

FFMPEG Creating Multiple Outputs Duplicate outputs Tee pseudo-muxer

FFMPEG Creating Multiple Outputs Different parallel outputs One filtering instance per each output

FFMPEG Creating Multiple Outputs Different parallel outputs Same filtering for all outputs

FFMPEG Creating Multiple Outputs Different parallel outputs No filtering

FFMPEG Creating Multiple Outputs Introduction

FFMPEG FFmpegandtheSoXResampler–FFmpeg Context Navigation

FFMPEG Example: Creating a live stream with limited bit rate

FFMPEG Trac Reports Changing Report Numbering

FFMPEG Trac Reports Advanced Reports: Custom Formatting A note about SQL rewriting

FFMPEG Trac Reports Advanced Reports: Custom Formatting Changing layout of report rows

FFMPEG Trac Reports Advanced Reports: Custom Formatting Custom formatting columns

FFMPEG Trac Reports Advanced Reports: Dynamic Variables Special/Constant Variables

FFMPEG Trac Reports Advanced Reports: Dynamic Variables Using Variables in a Query

FFMPEG Trac Reports Ticket columns

FFMPEG Trac Reports Table of Contents

FFMPEG Trac with FastCGI Nginx Configuration

FFMPEG Trac with FastCGI LiteSpeed Configuration

FFMPEG Trac with FastCGI Lighttpd Configuration

FFMPEG Trac with FastCGI Cherokee Configuration

FFMPEG Trac with FastCGI Apache configuration Alternative environment setup

FFMPEG Trac with FastCGI Apache configuration Set up with mod_fcgid

FFMPEG Trac with FastCGI Apache configuration Set up with mod_fastcgi

FFMPEG Examples Re-order streams

FFMPEG Examples Optional mapping

FFMPEG Examples Multiple outputs

FFMPEG Examples Choose outputs from filters

FFMPEG Examples Specific language

FFMPEG Examples Everything except audio

FFMPEG Examples Video and audio from different files

FFMPEG Examples A specific video stream only

FFMPEG Examples Video streams only

FFMPEG Examples Choose all streams

FFMPEG Syntax

FFMPEG Trac Logging Log Format

FFMPEG InterTrac Links Examples

FFMPEG InterTrac Links Link Syntax

FFMPEG Cropping a video stream An alternative to cropdetect filter

FFMPEG Detailed explanation

FFMPEG Overview

FFMPEG How to convert YouTube SBV to SRT

FFMPEG Email Notification of Ticket Changes Troubleshooting Permission denied error

FFMPEG Email Notification of Ticket Changes Using GMail as the SMTP relay host

FFMPEG Email Notification of Ticket Changes Sample Email

FFMPEG Email Notification of Ticket Changes Configuring SMTP Notification Customizing the email content

FFMPEG Email Notification of Ticket Changes Configuring SMTP Notification Customizing the email subject

FFMPEG Email Notification of Ticket Changes Configuring SMTP Notification Example Configuration (default subscriptions)

FFMPEG Email Notification of Ticket Changes Configuring SMTP Notification Example Configuration (sendmail)

FFMPEG Email Notification of Ticket Changes Configuring SMTP Notification Example Configuration (SMTP)

FFMPEG Email Notification of Ticket Changes Receiving Notification Mails Ticket attachment notifications

FFMPEG Fine grained permissions Debugging permissions

FFMPEG Fine grained permissions Permission Policies DefaultWikiPolicy and DefaultTicketPolicy

FFMPEG Fine grained permissions Permission Policies AuthzSourcePolicy (mod_authz_svn-like permission policy) Subversion Configuration

FFMPEG Fine grained permissions Permission Policies AuthzSourcePolicy (mod_authz_svn-like permission policy) Trac Configuration

FFMPEG Fine grained permissions Permission Policies AuthzSourcePolicy (mod_authz_svn-like permission policy)

FFMPEG Fine grained permissions Permission Policies AuthzPolicy Missing Features

FFMPEG Fine grained permissions Permission Policies AuthzPolicy Usage Notes