Linux: How to increase video volume without re-encoding video

Pycon Africa 2020 took place on August 4 to 8 of 2020. I had the privilege of giving a talk at this conference. I knew that I wouldn’t be able to give my talk live, so I sent the organisers a recording of the talk that I had made a few days before.  I hadn’t noticed that the volume on my mic had been very low. A few days before the conference, Marlene, the conference chair, sent me an email letting me know that the audio in the video was barely audible and that I’d either have to give the talk live or do something about the audio.

Giving the talk live wasn’t an option, I had concerns that my old laptop wouldn’t be up to the task of live streaming a whole talk, so I had to fix the audio. Recording the talk again wasn’t something I wanted to do either so I did a bit of googling and it turns out its possible to increase the volume in a video file from the  Linux command line. To do this, I used FFmpeg. FFmpeg has a -volume switch that you can pass to manipulate the video volume. Using ffmpeg allowed me to increase the volume of the video in a few seconds and saved me a whole lot of steps.

The command to run is:

ffmpeg -i <your_video_file.mp4> -vcodec copy -af "volume=50dB" <output_file.mp4>

Running the above command will increase the audio by 50 decibels. You can use any value you like so if you wanted to increase the volume by only 20db, you’d pass "volume=20dB" in the command. To decrease the volume, run the same command with a -:

ffmpeg -i <your_video_file.mp4> -vcodec copy -af "volume=-50dB" <output_file.mp4>