audioffmpegbitratere-encoding

Is it possible to change volume with no reencode with ffmpeg?


I just had this question because I used the following command with ffmpeg:

ffmpeg -i input.wav -filter:a "volume=0.2" output.wav

Following the documentation here: https://trac.ffmpeg.org/wiki/AudioVolume

However, when I created the new file, the output was half the size of the input and the bitrate of the audio track was reduced as well.

So my questions are:

  1. Is the bitrate supposed to decrease with decreasing and increasing volume like so?
  2. Is it possible to change volume without reencoding with ffmpeg?

Solution

  • Okay as someone from Reddit kindly explained to me, I should be able to change the volume without reencoding, however, my input codec was pcm_f32le and the default setting for the output codec for ffmpeg without any specifiers is pcm_f16le.

    The first one pcm_f32le is 32 bits, so it stores more information than the second which is 16 bits.

    So the answer is:

    1. Yes it is because in this case I was reencoding unknowingly to a codec with less information.

    2. Actually no, it still reencoding. The best option is to use the same code I used above with an extra specifier:

    ffmpeg -i input.wav -filter:a "volume=0.2" -c:a pcm_f32le output.wav
    

    The codec for input and output must be the same as in both 32 bit or 16 bit or else I have to add a specifier which I was shown how to do by the same person on Reddit.

    However, this is still reencoding whenever you add a filter.