Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.3 kB
2
Indexable
Never
@echo off
setlocal

:: Check if a file was dragged and dropped onto the script
if "%~1"=="" (
    echo Please drag and drop a video file onto this script to adjust the volume of both audio tracks independently.
    pause
    exit /b
)

:: Set variables
set "input_file=%~1"
set "output_file=%~dpn1_custom_volume_combined.mp4"

:: Prompt for volume levels
echo Enter the volume level for the GAME AUDIO (percentage, e.g., 50 for 50%):
set /p volume1=
echo Enter the volume level for the MICROPHONE AUDIO (percentage, e.g., 50 for 50%):
set /p volume2=

:: Calculate decimal values for volume
set /a volume1_dec=%volume1% * 100
set /a volume2_dec=%volume2% * 100

:: Correct decimal placement for volume in FFmpeg command
set volume1_ffmpeg=0.%volume1_dec%
set volume2_ffmpeg=0.%volume2_dec%

:: Adjust the volume of both tracks and combine them
ffmpeg -i "%input_file%" -filter_complex "[0:a:0]volume=%volume1_ffmpeg%[a0]; [0:a:1]volume=%volume2_ffmpeg%[a1]; [a0][a1]amix=inputs=2:duration=longest[a]" -map 0:v -map "[a]" -c:v copy -c:a aac -b:a 192k "%output_file%"

:: Notify the user
echo The audio tracks have been adjusted to %volume1%% and %volume2%% respectively, and combined into "%output_file%"
pause
endlocal
Leave a Comment