VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. I am trying to remove the sound stream from videos in a folder and save the new ones without sound in same folder with different names.
    I am using a batch file comprising these commands:

    set PATH=D:\movies folder
    for %%a in %PATH%\*.MTS do ffmpeg -i "%%a" -c:v copy -an "%%~na.MTS" > errorlog.txt
    pause

    It doesn't do anything and the log file is always empty.

    I tried this too
    set PATH=D:\movies folder\*.MTS
    for %%a in %PATH% do ffmpeg -i "%%a" -c:v copy -an "%%~na.MTS" > errorlog.txt

    but same result. What am I doing wrong...?

    Any hints appreciated
    Quote Quote  
  2. REM this would help:
    set Folder="D:\movies folder"
    Quote Quote  
  3. Since your folder name has a space in it quotes are required. And PATH is the systems search path. If you set it to something else the system won't be able to find any program that's not in the current folder (for that instance of CMD.COM). Use a different name, like Folder (as suggested by butterw). Finally, the file spec in the FOR loop should be enclosed in parenthesis.

    Code:
    set FOLDER="D:\movies folder"
    for %%a in (%FOLDER%\*.MTS) do ffmpeg -i "%%a" -c:v copy -an "%%~na.MTS" > errorlog.txt
    pause
    I don't know if this was your intentions, but all the new files will be created in the same folder in which the batch file resides.
    Quote Quote  
  4. Thanks jagabo and butterw, it's working now well.

    One more issue- it saves the processed files in the same location where the bat file is.
    I would like to save those files in a location of my choice, it could be for example the same folder
    where the initial files are and a some suffix could be added at filenames of the new files.

    Is there any possible syntax to do that..?
    Quote Quote  
  5. Code:
    set FOLDER="D:\movies folder"
    for %%a in (%FOLDER%\*.MTS) do ffmpeg -i "%%a" -c:v copy -an "%%~dpna (no audio).MTS" > errorlog.txt
    pause
    Quote Quote  
  6. Thanks Jagabo, working now as expected.
    Last edited by windranger; 25th Jul 2020 at 03:53.
    Quote Quote  



Similar Threads