- 1 year ago
Encode video with H.264 using FFmpeg in Windows
Comment
1 / 1
To encode a video with H.264 using FFmpeg in Windows, you can use the following command:
shellffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4
Here's a breakdown of the command and its options:
-i input.mp4
: Specifies the input video file.-c:v libx264
: Sets the video codec to H.264 (libx264).-crf 23
: Sets the Constant Rate Factor (CRF) value for video quality. A lower value produces higher quality but larger file size. The range is typically 18-28, with 23 being a default value.-preset medium
: Specifies the encoding speed and compression efficiency. The available presets are ultrafast, superfast, veryfast, faster, fast, medium (default), slow, slower, veryslow, and placebo. Choose a preset that balances speed and quality according to your needs.-c:a aac -b:a 128k
: Sets the audio codec to AAC and the audio bitrate to 128kbps.output.mp4
: Specifies the output file name.
Adjust the options according to your specific requirements, such as input and output file names, codec settings, and other parameters.