My goal is to have a script that takes an audio file and increases its volume by 50%.
I currently use the following AutoHotKey snippet to encode a file to MP3:
run_string := "bash -c ""\""c:\Program Files\VideoLAN\VLC\vlc.exe\"" -I dummy \""" . file_path . "\"" --sout='#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst=\""" . file_path . ".mp3\""}' vlc://quit"""
How can I modify this line to not only encode to mp3, but also increase the volume of the file by 50%? I tried setting --volume 150
but it just made the file play, while I don't want to play, I want to have it saved with that volume.
If you have suggestions for other Windows-compatible tools to modify audio that can do this, (along with instructions on how to do this) I'll be happy to hear about them.
1 Launch VLC Player and go to Tools > Preferences 2 Under Show Settings, select the All radio button. 3 On the left panel, locate and expand Main Interfaces, then select Qt. 4 On the right panel, scroll down to the bottom and change the maximum volume displayed.
Note that gain is independent of volume: If you increase it, sound will be louder even though the volume setting will not change. Works on Linux (VLC v3.0.9.2)!
1. Launch VLC Player and go to Tools > Preferences. 2. Under Show Settings, select the All radio button. 3. On the left panel, locate and expand Main Interfaces, then select Qt. 4. On the right panel, scroll down to the bottom and change the maximum volume displayed. You can change the value to whatever you like but the maximum volume is 300%.
To get to VLC’s advanced preferences for audio: Go to Tools > Preferences [CTRL + P]. In the bottom, under show settings, click on All. Click on Audio for the General audio settings.
I suggest you to use ffmpeg. it is very powerful, cross platform 32 or 64 bit, audio and video converter. Can be downloaded from Zeranoe FFmpeg - Builds
Below sample commands work for audio extracting from video, or audio converter with volume increasing or decreasing support.
Extract audio from video to MP3, or convert audio to MP3 (sample InputFilePath_VideoOrAudio = "e:\video.mp4" or "e:\audio.m4a")
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -acodec libmp3lame -ab 192k -ar 48000 -sn -dn -vn "E:\out.mp3"
Extract audio from video to MP3 and increase volume 150% while extracting add -af "volume=1.5" parameter.
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -acodec libmp3lame -ab 192k -ar 48000 -sn -dn -vn -af "volume=1.5" "E:\out.mp3"
List of audio converter parameters (mp3,ogg,ac3,wma,flac,wav,aiff,m4a....). to change volume level while converting to audio add -af "volume=VolumeValue" parameter.
VolumeValue=0.5 decrease volume %50
VolumeValue=1.5 increase volume %150
VolumeValue=2.0 increase volume %200 and so on.
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -acodec libmp3lame -ab 192k -ar 48000 -sn -dn -vn -af "E:\out.mp3"
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -acodec ac3 -ab 192k -ar 48000 -sn -dn -vn "E:\out.ac3"
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -f ogg -acodec libvorbis -ab 192k -ar 48000 -sn -dn -vn "E:\out.ogg"
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -acodec wmav2 -ab 192k -ar 48000 -sn -dn -vn "E:\out.wma"
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -acodec flac -sn -dn -vn "E:\out.flac"
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -sn -dn -vn "E:\out.wav"
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -f aiff -sn -dn -vn "E:\out.aiff"
e:\ffmpeg\ffmpeg.exe -y -i "InputFilePath_VideoOrAudio" -acodec aac -ab 192k -ar 48000 -sn -dn -vn "E:\out.m4a"
Note 1: some codecs can be experimental in such case you should use -strict experimental or -strict -2 parameters.
Note 2: -ab parameter means audio bit rate. Some devices can not play audio file that bit rate greater than -ab 192k. Use -ab 128k or -ab 192k with -ar 44100 parameters to produce audio file that can be playable most of the mobile devices. -ac 2 parameter means stereo -ac 1 means mono.
to convert specific part of the input file use -ss 00:00:00 and -t parameters. -ss means Start From -t means duration. Important: parameter -ss should placed before the -i parameter, otherwise ffmpeg seeks to -ss position slowly.
Samples: assume that input file duration is 00:20:00 (20 minutes)
using only -ss 00:05:00 means convert input file starting from 5th minute to end of the input file. Duration of the output file will be 15 minutes.
using -ss 00:05:00 with -t 120 or -t 00:02:00 means convert 120 seconds, starting from 5th minute. Duration of the output file will be 120 seconds.
e:\ffmpeg\ffmpeg.exe -y -ss 00:05:00 -i "InputFilePath_VideoOrAudio" -t 120 -acodec libmp3lame -ab 192k -ar 48000 -sn -dn -vn -af "E:\out.mp3"
Note: -y means in advance YES to ffmpeg's yes/no questions such as output file already exist, over write? with -y parameters ffmpeg over writes the output file if it is already exist without asking the user.
-sn disables subtitle, -vn disable video, -dn disable data streams for output file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With