Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg IF .bat condition on channel count and language #5

Open
geextahslex opened this issue Mar 14, 2024 · 0 comments
Open

ffmpeg IF .bat condition on channel count and language #5

geextahslex opened this issue Mar 14, 2024 · 0 comments

Comments

@geextahslex
Copy link

Hi I have a .bat file to convert and change channel volume levels(with ffmpeg) from 5.1 Audio to Stereo, and a different .bat for Stereo/Mono Audio that doesn't change loudness.
Now I have to manually look if a movie is 5.1 or Mono/Stereo and decide which .bat to run. I would like to make one .bat with a condition so it looks what the channel layout is and then decide which profile to run. I hope this makes sense. It has to check also the language tag, because sometimes (in my case) german is 2.0 but English is 5.1 or vice versa.

Thank you for any advice

5.1

ffmpeg ^
	-i "%~1" ^
	-af "pan=stereo|c0=c2+0.6*c0+0.6*c4+c3|c1=c2+0.6*c1+0.6*c5+c3" -map 0:v:0 -c:v copy -map 0:a:m:language:ger -codec:a ac3 -b:a 160k -ar 44100 -sn -dn ^
	"G:\%~n1.mkv"

2.0/Mono

ffmpeg ^
	-i "%~1" ^
	-map 0:v:0 -c:v copy -map 0:a:m:language:ger -codec:a ac3 -b:a 160k -ar 44100 -sn -dn ^
	"G:\%~n1.mkv"

This is the whole .bat

@echo off
:again

ffmpeg ^
	-i "%~1" ^
	-map 0:v:0 -c:v copy -map 0:a:m:language:ger -codec:a ac3 -b:a 160k -ar 44100 -sn -dn ^
	"G:\%~n1.mkv"
if NOT ["%errorlevel%"]==["0"] goto:error
echo �[92m%~n1 Done!�[0m

shift
if "%~1" == "" goto:end
goto:again

:error
�
echo �[93mThere was an error. Please check your input file or report an issue on github.com/L0Lock/FFmpeg-bat-collection/issues.�[0m
pause
exit 0

:end
�
cls
echo �[92mEncoding succesful. This window will close after 10 seconds.�[0m
timeout /t 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant