VideoHelp Forum
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. Member
    Join Date
    Jan 2009
    Location
    United Kingdom
    Search Comp PM
    I'm seeing if anyone knows of a bat file that I can just drag a video file onto and increment the filename every time I drag a video file to the bat file.

    It would have to check for previous filename, then ffmpeg will render it with an incremented filename.

    Eg: Scene_001.mov and Scene_002.mov already exists in the folder. When I drag the video file to the bat file , it should render it as Scene_003.mov.

    Hope that makes sense.

    Help appreciated.
    Quote Quote  
  2. this should work, fill in/correct underlined parts :
    Code:
    @echo off
    setlocal EnableDelayedExpansion
    
    SET "ffmpeg=your_path_to\ffmpeg.exe"
    SET "output_folder=D:\rendered_files"
    SET "extension=mov"
    SET "prefix=Scene_"
    
    rem do not set this, just define it empty:
    SET "output_path="
    
    call :get_output_path "%output_folder%" %prefix% %extension%
    
    rem here goes your ffmpeg command line where %1 is input file and "%output_path%" is your destination
    
    "%ffmpeg%" -i %1 ..... your filters end such ..... "%output_path%"
    
    echo Done
    endlocal & echo press any key to exit ... & pause>nul & goto :eof
    
    
    
    :get_output_path <output folder> <prefix> <extension>
    SET "i=0"
    SET "formated_value=000"
    :loop
    SET "output_path=%~1\%~2%formated_value%.%3"
    if exist "%output_path%" call :increase& goto :loop 
    goto :eof
    
    :increase
    SET /a "i=%i%+1"
    SET "value=000000%i%"
    SET "formated_value=%value:~-3%"
    goto :eof
    Last edited by _Al_; 22nd Nov 2019 at 17:55.
    Quote Quote  
  3. Member
    Join Date
    Jan 2009
    Location
    United Kingdom
    Search Comp PM
    Very cool! All working thanks!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!