Bulk Volume Change
Modifies the volume of a bunch of files in a folder via FFmpeg.
param (
# The path to a folder with music files in it. Make sure you surround this in quotes if it contains spaces.
[Parameter(Mandatory = $true)]
[string] $Path,
# A percentage to increase the volume by, e.g. 1.5 for a 50% increase.
[Parameter(Mandatory = $true)]
[double] $Volume
)
# Create a temporary directory if it doesn't already exist
$tempDir = (Join-Path -Path $Path -ChildPath 'temp')
if (-not (Test-Path -Path $tempDir)) {
New-Item -ItemType Directory -Path $tempDir
}
foreach ($file in (Get-ChildItem -Path $Path -File)) {
# Need to store the output somewhere else temporarily, since FFMPEG can't edit in-place
$tempFile = (Join-Path -Path $tempDir -ChildPath $file.Name)
Start-Process -FilePath 'ffmpeg' -Wait -NoNewWindow -ErrorAction Stop -ArgumentList @(
'-y' # Force overwrite
'-i', "`"$file`"" # Input file
'-filter:a', "volume=$Volume" # Boost volume
"`"$tempFile`"" # Output file
)
# Move temp file over input file
Move-Item -Path $tempFile -Destination $file -Force
}
Run like BulkVolumeChange.ps1 -Path 'Folder Full Of Music' -Volume 1.5
.