Last active
April 9, 2025 13:35
-
-
Save smohammadhn/6b33aa4664c1b6253337e2656156039f to your computer and use it in GitHub Desktop.
Useful `ffmpeg` commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
** ffmpeg command to convert any video to a format which is widely known by older devices (Tvs, etc ...) | |
ffmpeg -i input.mp4 -vf "fps=24" -c:v libx264 -crf 23 -maxrate 2M -bufsize 2M -c:a aac -b:a 192k output.mp4 | |
** ffmpeg Command to reduce the file size of a video while preserving good quality | |
ffmpeg -i test.mov -vf "scale=-1:720" -r 24 -c:v libx264 -crf 28 -preset medium -c:a aac -b:a 128k output.mp4 | |
** ffmpeg command to reduce the file size of an image, scale down the resolution to 480p, low quality | |
ffmpeg -i input.jpg -vf "scale=-1:480" -preset medium -q:v 4 output.jpg |
Author
smohammadhn
commented
Mar 1, 2024
- -i input.mp4: Specifies the input video file.
- -vf "fps=24": Sets the output frame rate to 24 frames per second.
- -c:v libx264: Specifies the video codec as H.264, which is widely supported by TVs.
- -crf 23: Sets the Constant Rate Factor (CRF) for video quality. Lower values result in higher quality but larger file sizes. A value of around 23 provides a good balance between quality and file size.
- -maxrate 2M -bufsize 2M: Sets the maximum bitrate and buffer size to 2 Mbps, ensuring compatibility with weaker devices.
- -c:a aac -b:a 192k: Specifies the audio codec as AAC with a bitrate of 192 kbps.
- output.mp4: Specifies the output file name.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment