To compress audio using FFmpeg, you can use the -b:a
option to specify the desired audio bitrate. Here’s an example command to compress audio using FFmpeg:
ffmpeg -i input.mp3 -b:a 128k output.mp3
In this example, input.mp3
is the input audio file, and output.mp3
is the compressed output file. The -b:a
option is set to 128k
, which represents a target audio bitrate of 128 kilobits per second. You can adjust the bitrate value according to your desired compression level.
FFmpeg supports various audio codecs, so the output file format will depend on the input file format and the codecs available in your FFmpeg installation. The above example assumes the input and output files are in the MP3 format, but you can use other formats such as AAC, OGG, or FLAC.
Additionally, you can specify other options to further customize the audio compression process. For example, you can set the desired audio codec using the -c:a
option, or adjust other parameters like sample rate or number of channels. Refer to the FFmpeg documentation for more information on available options and codecs.
Remember to ensure that you have FFmpeg installed on your system and accessible from the command line before running the above command.