Command works if called in a subroutine, causes error in For loop?
Posted: 2022-Mar-22, 10:30 pm
I'm trying to convert some video files to a slower framerate. I have all the programs and commands needed to do this, so I figured I'd make a script to batch process them. If I put the commands inside a For loop, one of them immediately causes an error. However if I move all the commands to a separate routine and Call it, they work fine. Can someone please explain why?
This does not work;
When run, it immediately says that "-azid was unexpected at this time".
This works;
It's the exact same code, just moved to a subroutine. Why does it work there and not in the For loop?
This does not work;
Code: Select all
for %%F in (*.mkv) do (
mkvextract tracks %%F 0:video.264
ffmpeg -i %%F audio.ac3
BeSweet -core( -input "audio.ac3" -output "audio-new.ac3" ) -azid( ) -ota( -r 25000 23976 ) -bsn( -exe aften.exe )
mkvmerge.exe" --default-duration 0:23.976fps --fix-bitstream-timing-information 0 video.264 audio-new.ac3 -o %%~nF-new.mkv
del video.264 audio.ac3 audio-new.ac3
)
This works;
Code: Select all
for %%F in (*.mkv) do (
set Name=%%~nF
call :Process
)
goto End
:Process
mkvextract tracks %Name%.mkv 0:video.264
ffmpeg -i %Name%.mkv audio.ac3
BeSweet -core( -input "audio.ac3" -output "audio-new.ac3" ) -azid( ) -ota( -r 25000 23976 ) -bsn( -exe aften.exe )
mkvmerge.exe" --default-duration 0:23.976fps --fix-bitstream-timing-information 0 video.264 audio-new.ac3 -o %Name%-new.mkv
del video.264 audio.ac3 audio-new.ac3
exit /b
:End