I need to convert all MP4 files in my subdirectories to MKV. So I wrote this script:
@ECHO OFF
SET oldName=
SET newName=
FOR /r %%A IN (*.mp4) DO (
SET oldName=%%A
SET newName=%%A
CALL :MAKEMKV
)
:MAKEMKV
SET newName=%newName:mp4=mkv%
IF NOT EXIST %newName% (
START /B /WAIT ffmpeg -i "%oldName%" -map 0 -map -0:s -codec copy "%newName%"
)
The problem is that only first file in folder is converted and then it exits. But I use for do
loop. So I could not get why it exits.
My structure is:
/FOLDER
../A/filea.mp4
../B/fileb.mp4
../C/filec.mp4
When I run above program I get only converted filea.mp4
to filea.mkv
and script exits.
The other files fileb.mp4
and filec.mp4
are not converted by the batch file.
What I am missing?