Split screen
Problem
Compare two video files by using a vertical split screen.
Solution
ffmpeg \
-i input_file_1 \
-i input_file_2 \
-filter_complex \
"[0] crop=iw/2:ih:0:0 [left]; \
[1] crop=iw/2:ih:iw/2:0 [right]; \
[left][right] hstack [out]" \
-map "[out]" \
output_file
Command syntax
ffmpeg
- starts the command
-i input_file_1
- path, name and extension of the first input files
-i input_file_2
- path, name and extension of the second input files
-filter_complex
- A complex filter graph is needed:
- the first input file is cropped vertically to the left half;
- the second input file is cropped vertically to the right half;
- the two half images are stacked horizontally to a full image.
-map "[out]"
- maps the [out] stream to the output
output_file
- path, name and extension of the output file
Discussion
A split screen is useful for comparing files with big differences, while for comparing files with little differences a delta file is more useful.
The different filters of a filter chain are divided by a comma (, ) which is not used in this case. The different filter chains of a filter graph are divided by a semi-colon (; ). If the whole filter graph is put into quotation marks, then spaces can be added after , and ; and also elsewhere for readability reasons.
The mapping is not necessary in this case, because it’s implicit.
Exercises
- horizontal split screen
- split screen with a tiny black line between the two sectors
2024-11-29
|