FFmpeg#
A complete, cross-platform solution to record, convert and stream audio and video.
- https://ffmpeg.org/
Download#
You can download it very simply.
1# Debian / Ubuntu
2sudo apt-get install ffmpeg
3
4# Arch Linux
5sudo pacman -S ffmpeg
6
7#REHL / CentOS / Fedora
8sudo dnf install ffmpeg
9sudo rpm install ffmpeg
10sudo yum install ffmpeg
Using#
Change FPS#
1ffmpeg -i input.avi -filter:v fps=fps=30 output.avi
It’s means change the FPS of file “input.avi” to 30, and output its filename to “output.avi”.
Convert format#
For default method, you can just using like that:
1ffmpeg -i input.mp4 output.avi
Reduce file size#
Calculate the bitrate you need by dividing your target size (in bits) by the video length (in seconds). For example for a target size of 1 GB (one gigabyte, which is 8 gigabits) and 10 000 seconds of video (2 h 46 min 40 s), use a bitrate of 800 000 bit/s (800 kbit/s):
1ffmpeg -i input.mp4 -b 800k output.mp4
Additional options that might be worth considering is setting the Constant Rate Factor, which lowers the average bit rate, but retains better quality. Vary the CRF between around 18 and 24 — the lower, the higher the bitrate.
1ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4
-
Vicky Chijwani
onStackExchange
By the way, you are able to change the video format to
H.265
, it’s better thanH.264
.
And also you can add arugumentfps-fps=30
to specify the FPS to 30, so it will be looks like that:1ffmpeg -i input.mp4 -vcodec libx265 -crf 20 fps-fps=30 output.mp4
More Detail#
For more detail, please go to watching the documentation of FFmpeg Offical Website.
Here is the link: https://ffmpeg.org/ffmpeg.html
References#
- 《FFmpeg》https://ffmpeg.org/
- 《linuxhint - How to Reduce Video Size With FFmpeg, John Otieno》https://linuxhint.com/how-reduce-video-size-with-ffmpeg/
- 《StackExchange - How can I reduce a video’s size with ffmpeg?》https://unix.stackexchange.com/questions/28803/how-can-i-reduce-a-videos-size-with-ffmpeg