Flip the image
Problem
Flip the video image horizontally and vertically.
Solution
ffmpeg \
-i input_file \
-filter:v "hflip, vflip" \
-c:a copy \
output_file
Command syntax
ffmpeg
- starts the command
-i input_file
- path, name and extension of the input file
-filter:v "hflip, vflip"
- flips the image horizontally and vertically
-c:a copy
- re-encodes using the same audio codec
output_file
- path, name and extension of the output file
Discussion
The video filter is specified by -filter:v. We advise to avoid the alias -vfilter and its abbreviation -vf as well. The quotation marks are not mandatory for these video filters, yet we advice to always put multiple filters into quotation marks. The quotation marks allow to insert a space between the filters for readability. Multiple filters are separated by a comma.
This filter flips the image horizontally and vertically. By using only one of the parameters hflip or vflip, of course, the image is flipped on that axis only.
The audio codec is specified by -codec:audio, which is usually abbreviated as -c:a (-codec:a or -c:audio are also possible). We advise to avoid the alias -acodec. For silent videos you can replace -c:a copy by -an; for video with sound you may choose to re-encode with another audio codec which is allowed by the container.
2024-11-27
|