Last updated: 03-06-2021
-- Useful FFmpeg --
1. Converting file to MP4
ffmpeg -i [input file]
-c:a aac
-c:v libx264
-crf 23
-b:a 384k
-b:v 8M
[output file]
- -c:a - audio codec (aac for mp4)
- -c:v - video codec (libx264/libx265 for mp4)
- -crf - Constant Rate Factor (constant quality) (0 for lossless, 23 for standard, 51 for worst)
- -b:a - limit an audio bitrate (384k for stereo as
YouTube recommends)
- -b:v - limit a video bitrate (8M for 1080p as
YouTube recommends)
2. Cropping out a fragment of a file
ffmpeg -i [input file]
-ss 0:00:06.9
-to 0:00:42.0
[output file]
- -ss - crop start time
- -to - crop stop time (use -t for crop duration instead)
3. Rotating a video 180 degrees
ffmpeg -i [input file]
-vf "transpose=1, transpose=1"
[output file]
- -vf - video filters:
-
- transpose 0 - rotate 90 counter clockwise and vertical flip (default)
- transpose 1 - rotate 90 clockwise
- transpose 2 - rotate 90 counter clockwise
- transpose 3 - rotate 90 clockwise and vertical flip