Hey Komal,
In order to change the audio sample rate using FFmpeg, the -ar option in FFmpeg can be used. The quantity of audio samples recorded per second is determined by the audio sample rate. The audio quality, file size, and compatibility with various hardware and applications can all be impacted by changing the sampling rate.
Here is how to adjust the audio sample rate step-by-step:
ffmpeg -i input.mp3 -ar 44100 output.mp3
- The input audio file
input.mp3
and the desired output fileoutput.mp3
are used in the example above. 44100
is the intended sample rate (in this case, 44.1 kHz), while-ar
indicates the sample rate to be utilized.- The relevant file names and directories for your case can be used in place of
input.mp3
andoutput.mp3
. - Furthermore, you can change the sample rate (in the example, 44100) to the required amount.
Keep in mind that altering the audio sample rate can degrade the sound or create artifacts. It is advised to select a sample rate that is suitable for your individual requirements and the features of the audio source.
Additionally, You can use FFmpeg’s other audio-related options, including -ac
to adjust the number of audio channels and -ab
to adjust the audio bit rate, in addition to the -ar
option. You can mix and match these settings to get the output audio that best suits your requirements.
For example, if you need to alter the sample rate and the quantity of audio channels.
Do checkout this for more: