ffmpeg basic commands
These are the basics of the video processing tool “ffmpeg”.
- Encode a video (using x264 codec) quickly.
ffmpeg -i input.mp4 -c:v libx264 -preset veryfast -crf 22 output.mp4
-presethas several possible values, faster encoding means less CPU load and less compression.
-crfstands for “Constant Rate Factor” and this is the recommended rate control mode for most uses. A lower value generally leads to higher quality, and a subjectively sane range is 17–28 (23 is the default).
- Overwrite output file if exists.
ffmpeg -y -i input.mp4 output.mp4
- Extract audio from video.
ffmpeg -i video.mp4 -vn sound.mp3
- Cut a video from mm:ss to mm2:ss2 (without re-encoding)
ffmpeg -ss mm:ss -to mm2:ss2 -i video.mp4 -codec copy output.mp4
- Capture a video frame (at mm:ss) and change its resolution
ffmpeg -ss mm:ss -i video.mp4 -frames 1 -s 1280x720 -f image2 image.png
- Capture one frame per second of the video
ffmpeg -i video.mp4 -r 1 -f image2 image%d.png
- Capture a frame from a video device (webcam, etc.)
ffmpeg -i /dev/video0 -frames 1 -f image2 image.png
In Debian/Ubuntu systems, you can use
dpkg-reconfigureto reconfigure an installed package using intuitive dialogs. I will show you how to use this command to change some system settings.
If you have a scanned PDF and you want to be able to search and copy text from it, in this tutorial I will show you how to do it.
If you want to do X11 forwarding from your container to your host, you can type these simple commands.
If you don’t have a Graphical User Interface (GUI) on your Linux device, or you need a simple text-based web browser, I will show you a couple of great programs.
A comprehensive list of Linux-related websites sorted by categories.