How to Split Video into Three Streams Using FFmpeg
This guide explains how to use the FFmpeg split filter
to duplicate a single video input into three identical, independent
streams inside a filtergraph. By splitting the video pipeline
internally, you can apply distinct video filters, scaling algorithms, or
encoding presets to each stream simultaneously without reading the
source file multiple times from disk.
The split Filter
Syntax
The split filter takes a single video stream as input
and outputs two or more identical copies. By default, running
split produces two streams. To generate three streams, you
must pass the parameter 3 to the filter:
split=3
Within a -filter_complex graph, each output must be
assigned a unique stream label (e.g., [v1],
[v2], [v3]) so that subsequent filters can
reference them independently.
Basic Structure in
-filter_complex
A standard implementation defines the source stream, invokes
split=3, and labels the three outputs:
ffmpeg -i input.mp4 -filter_complex "[0:v]split=3[out1][out2][out3]" ...[0:v]specifies the primary video stream of the first input file.split=3instructs FFmpeg to duplicate the stream into three branches.[out1][out2][out3]assigns custom labels to each resulting stream.
Practical Example: Multi-Filter Processing
A common use case involves routing the three split streams to different filters—such as applying grayscale to the first, blurring the second, and scaling the third—before exporting them.
Command Example
ffmpeg -i input.mp4 -filter_complex \
"[0:v]split=3[stream1][stream2][stream3]; \
[stream1]hue=s=0[gray]; \
[stream2]boxblur=5:1[blurred]; \
[stream3]scale=640:360[small]" \
-map "[gray]" -c:v libx264 output_gray.mp4 \
-map "[blurred]" -c:v libx264 output_blurred.mp4 \
-map "[small]" -c:v libx264 output_small.mp4Breakdown of the Pipeline
- Splitting the Source:
[0:v]split=3[stream1][stream2][stream3]takes the input video and creates three identical instances labeled[stream1],[stream2], and[stream3]. - First Processing Branch:
[stream1]hue=s=0[gray]strips the color saturation from the first stream, naming the result[gray]. - Second Processing Branch:
[stream2]boxblur=5:1[blurred]applies a blur effect to the second stream, naming the result[blurred]. - Third Processing Branch:
[stream3]scale=640:360[small]resizes the third stream to 360p resolution, naming the result[small]. - Mapping Outputs: The
-mapflags route each processed stream to its respective output file (output_gray.mp4,output_blurred.mp4, andoutput_small.mp4), encoding each with thelibx264codec.
Merging the Streams Later in the Graph
You can also use the split streams to assemble a single composite video (such as a split-screen or picture-in-picture effect) within the same command:
ffmpeg -i input.mp4 -filter_complex \
"[0:v]split=3[v1][v2][v3]; \
[v1]scale=640:360[top]; \
[v2]scale=640:360,hue=s=0[bottom_left]; \
[v3]scale=640:360,negate[bottom_right]; \
[bottom_left][bottom_right]hstack[bottom_row]; \
[top]pad=1280:360:320:0[top_row]; \
[top_row][bottom_row]vstack[final]" \
-map "[final]" -c:v libx264 combined_output.mp4In this pipeline, split=3 supplies the three copies
needed to create three resized variations, which are then combined
horizontally and vertically into a single output video.