Creating video from all images in a folder

Simple concat Code concat.bat

@echo OFF
setlocal ENABLEDELAYEDEXPANSION
rem 1366x768
set BG_W=1366
set BG_H=768
set SLIDE_DURATION=4
set IMG_TYPE=JPG
set /a TOTAL_IMAGE_FILES=0
set PICS_FOLDER=PICS
set VIDS_FOLDER=VIDS
for %%f in (./%PICS_FOLDER%/*.%IMG_TYPE%)  do (
    set /a TOTAL_IMAGE_FILES=TOTAL_IMAGE_FILES+1
    rem https://stackoverflow.com/a/2919699
    rem echo TOTAL_IMAGE_FILES is !TOTAL_IMAGE_FILES!
    rem echo file name is %%f
     rem https://stackoverflow.com/a/45811503
    set filename[!TOTAL_IMAGE_FILES!]=%%f
    set TEMP_FILENUM=!TOTAL_IMAGE_FILES!
    echo filename[!TOTAL_IMAGE_FILES!] is %filename[!TOTAL_IMAGE_FILES!]%
    rem set /a ID+=1
)
echo TOTAL_IMAGE_FILES is %TOTAL_IMAGE_FILES%
for /L %%i in (1,1,%TOTAL_IMAGE_FILES%) do (
    echo [%%i] "!filename[%%i]!"
)
rem set /p id="Press any key to continue: "
rem ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=3:rate=25:color=blue -i DSC00570.jpg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=3:rate=25:color=black -i DSC01253.JPG -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]; [3:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl],[2:v][ovrl]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v1];[v0][v1]concat=n=2:v=1[outv]"  -map "[outv]" -y concatSingle.mp4
FOR %%f IN (./%PICS_FOLDER%/*.%IMG_TYPE%) do call :createmp4 %%f   ← subroutine called here
for /L %%n in (1,1,%TOTAL_IMAGE_FILES%)  do call :concat %%n  ← subroutine called here
set /p id="Press any key to continue: "
exit /b
:increaseby1
set /a "TOTAL_IMAGE_FILES+=1"
exit /b
:createmp4
set IMAGE_NAME=%1
echo IMAGE_NAME IS %IMAGE_NAME%
echo ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=%SLIDE_DURATION%:rate=25:color=0xFFFFF0 -i %PICS_FOLDER%/%IMAGE_NAME% -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]" -map "[vo]" -y %VIDS_FOLDER%/%IMAGE_NAME%_SILENT.mp4*************************************************************************************
rem set /p id="Press any key to continue: "
ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=%SLIDE_DURATION%:rate=25:color=0xFFFFF0 -i %PICS_FOLDER%/%IMAGE_NAME% -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]" -map "[v0]" -y %VIDS_FOLDER%/%IMAGE_NAME%_SILENT.mp4
exit /b
:concat
if %TOTAL_IMAGE_FILES% EQU 1 (  
    exit /b
)
set FILE_NUM=%1
echo FILE_NUM is %FILE_NUM%
rem set IMAGE_NAME="%FILE_PREFIX%-%FILE_NUM%.jpeg_SILENT.mp4"
set FILE_NAME=!filename[%FILE_NUM%]!
set IMAGE_NAME=%VIDS_FOLDER%\%FILE_NAME%_SILENT.mp4
echo IMAGE_NAME is %IMAGE_NAME%*************************************************************************************
if %FILE_NUM% EQU 1 (   
    rem echo copy %IMAGE_NAME% %VIDS_FOLDER%\concatStart.mp4*************************************************************************************
    rem copy "VIDS\DSC01276.jpg_SILENT.mp4" "concatStart.mp4"
    echo copy %IMAGE_NAME% concatStart.mp4
    copy %IMAGE_NAME% concatStart.mp4
    rem set /p id="Press any key to continue: "
)
if %TOTAL_IMAGE_FILES% EQU 1 (
    if %FILE_NUM% GEQ 1 (
     exit /b
     )
)
set IMAGE_NAME=%VIDS_FOLDER%/%FILE_NAME%_SILENT.mp4
if %FILE_NUM% GTR 1 (
    echo ffmpeg -i "concatStart.mp4" -i "%IMAGE_NAME%" -filter_complex ^
"[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
    rem set /p id="Press any key to continue: "
    ffmpeg -i "concatStart.mp4" -i "%IMAGE_NAME%" -filter_complex ^
"[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
)
if %FILE_NUM% GTR 1 (
 copy vtrimmedConcat.mp4 concatStart.mp4 
 del vtrimmedConcat.mp4
 )
del %IMAGE_NAME%
rem echo ffmpeg -i "concatStart.mp4" -i %IMAGE_NAME% -filter_complex "[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
exit /b

WithFFMEPG XFADE Transitions

With Single transition

concatWithSingleTransition.bat

@echo OFF
setlocal ENABLEDELAYEDEXPANSION
rem 1366x768
set BG_W=1366
set BG_H=768
set SLIDE_DURATION=10
set TRANSITION_DURATION=1
set IMG_TYPE=JPG
set /a TOTAL_IMAGE_FILES=0
set PICS_FOLDER=PICS
set VIDS_FOLDER=VIDS
set /a TRANSITION_OFFSET=0
for %%f in (./%PICS_FOLDER%/*.%IMG_TYPE%)  do (
    set /a TOTAL_IMAGE_FILES=TOTAL_IMAGE_FILES+1
    rem https://stackoverflow.com/a/2919699
    rem echo TOTAL_IMAGE_FILES is !TOTAL_IMAGE_FILES!
    rem echo file name is %%f
     rem https://stackoverflow.com/a/45811503
    set filename[!TOTAL_IMAGE_FILES!]=%%f
    set TEMP_FILENUM=!TOTAL_IMAGE_FILES!
    echo filename[!TOTAL_IMAGE_FILES!] is %filename[!TOTAL_IMAGE_FILES!]%
    rem set /a ID+=1
)
echo TOTAL_IMAGE_FILES is %TOTAL_IMAGE_FILES%
for /L %%i in (1,1,%TOTAL_IMAGE_FILES%) do (
    echo [%%i] "!filename[%%i]!"
)
rem set /p id="Press any key to continue: "
rem ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=3:rate=25:color=blue -i DSC00570.jpg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=3:rate=25:color=black -i DSC01253.JPG -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]; [3:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl],[2:v][ovrl]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v1];[v0][v1]concat=n=2:v=1[outv]"  -map "[outv]" -y concatSingle.mp4
FOR %%f IN (./%PICS_FOLDER%/*.%IMG_TYPE%) do call :createmp4 %%f   ← subroutine called here
for /L %%n in (1,1,%TOTAL_IMAGE_FILES%)  do call :concat %%n  ← subroutine called here
set /p id="Press any key to continue: "
exit /b
:increaseby1
set /a "TOTAL_IMAGE_FILES+=1"
exit /b
:createmp4
set IMAGE_NAME=%1
echo IMAGE_NAME IS %IMAGE_NAME%
echo ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=%SLIDE_DURATION%:rate=25:color=0xFFFFF0 -i %PICS_FOLDER%/%IMAGE_NAME% -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]" -map "[vo]" -y %VIDS_FOLDER%/%IMAGE_NAME%_SILENT.mp4*************************************************************************************
rem set /p id="Press any key to continue: "
ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=%SLIDE_DURATION%:rate=25:color=0xFFFFF0 -i %PICS_FOLDER%/%IMAGE_NAME% -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]" -map "[v0]" -y %VIDS_FOLDER%/%IMAGE_NAME%_SILENT.mp4
exit /b
:concat
if %TOTAL_IMAGE_FILES% EQU 1 (  
    exit /b
)
set FILE_NUM=%1
echo FILE_NUM is %FILE_NUM%
rem set IMAGE_NAME="%FILE_PREFIX%-%FILE_NUM%.jpeg_SILENT.mp4"
set FILE_NAME=!filename[%FILE_NUM%]!
set IMAGE_NAME=%VIDS_FOLDER%\%FILE_NAME%_SILENT.mp4
echo IMAGE_NAME is %IMAGE_NAME%*************************************************************************************
if %FILE_NUM% EQU 1 (   
    rem echo copy %IMAGE_NAME% %VIDS_FOLDER%\concatStart.mp4*************************************************************************************
    rem copy "VIDS\DSC01276.jpg_SILENT.mp4" "concatStart.mp4"
    echo copy %IMAGE_NAME% concatStart.mp4
    copy %IMAGE_NAME% concatStart.mp4
    rem set /p id="Press any key to continue: "
)
if %TOTAL_IMAGE_FILES% EQU 1 (
    if %FILE_NUM% GEQ 1 (
     exit /b
     )
)
set IMAGE_NAME=%VIDS_FOLDER%/%FILE_NAME%_SILENT.mp4
if %FILE_NUM% GTR 1 (
    echo ffmpeg -i "concatStart.mp4" -i "%IMAGE_NAME%" -filter_complex ^
"[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
    rem set /p id="Press any key to continue: "

rem !TRANSITION_OFFSET! will be ((%FILE_NUM%-1)*%SLIDE_DURATION%)-(%FILE_NUM%-1)
set /a FILE_NO_MINUS_ONE=%FILE_NUM%-%TRANSITION_DURATION%
echo FILE_NO_MINUS_ONE is !FILE_NO_MINUS_ONE!
set /a OFFSET_INTERIM_VAL=!FILE_NO_MINUS_ONE!*%SLIDE_DURATION%
echo OFFSET_INTERIM_VAL is !OFFSET_INTERIM_VAL!
set /a TRANSITION_OFFSET=!OFFSET_INTERIM_VAL!-!FILE_NO_MINUS_ONE!
echo TRANSITION_OFFSET is !TRANSITION_OFFSET!
echo ffmpeg -y -i concatStart.mp4 -i "%IMAGE_NAME%" -filter_complex ^
"[0:v][1:v]xfade=transition=circlecrop:duration=2:offset=!TRANSITION_OFFSET![outv];^
 [0:a][1:a]acrossfade=duration=2[outa]" -map [outv] -map [outa]  -y  vtrimmedConcat.mp4

rem https://stackoverflow.com/a/70198046 
echo ffmpeg -i concatStart.mp4 -i "%IMAGE_NAME%" -filter_complex "[0:v][1:v]xfade=transition=circlecrop:duration=%TRANSITION_DURATION%:offset=!TRANSITION_OFFSET!,format=yuv420p" -map  -an -y vtrimmedConcat.mp4
rem set /p id="Press any key to continue: "
ffmpeg -i concatStart.mp4 -i "%IMAGE_NAME%" -filter_complex "[0:v][1:v]xfade=transition=circlecrop:duration=%TRANSITION_DURATION%:offset=!TRANSITION_OFFSET!,format=yuv420p" -map  -an -y vtrimmedConcat.mp4
echo ffmpeg -i "concatStart.mp4" -i "%IMAGE_NAME%" -filter_complex ^
"[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
rem ffmpeg -y -i concatStart.mp4 -i "%IMAGE_NAME%" -filter_complex ^
rem "[0:v][1:v]xfade=transition=circlecrop:duration=2:offset=!TRANSITION_OFFSET![outv]" -map [outv]   -y  vtrimmedConcat.avi
rem set /p id="Press any key to continue: "
)
if %FILE_NUM% GTR 1 (
 copy vtrimmedConcat.mp4 concatStart.mp4 
 del vtrimmedConcat.mp4
 )
del %IMAGE_NAME%
rem echo ffmpeg -i "concatStart.mp4" -i %IMAGE_NAME% -filter_complex "[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
exit /b

With Multiple Transitions

You must first declare required transitions in setpate batch file config.bat

@echo OFF
set TRANSITION1=fade
set TRANSITION2=fadeblack
set TRANSITION3=fadewhite
set TRANSITION4=distance
set TRANSITION5=wipeleft
set TRANSITION6=wiperight
set TRANSITION7=wipeup
set TRANSITION8=wipedown
set TRANSITION9=slideleft
set TRANSITION10=slideright
set TRANSITION11=slideup
set TRANSITION12=slidedown
set TRANSITION13=smoothleft
set TRANSITION14=smoothright
set TRANSITION15=smoothup
set TRANSITION16=smoothdown
set TRANSITION17=rectcrop
set TRANSITION18=circlecrop
set TRANSITION19=circleclose
set TRANSITION20=circleopen
set TRANSITION21=horzclose
set TRANSITION22=horzopen
set TRANSITION23=vertclose
set TRANSITION24=vertopen
set TRANSITION25=diagbl
set TRANSITION26=diagbr
set TRANSITION27=diagtl
set TRANSITION28=diagtr
set TRANSITION29=hlslice
set TRANSITION30=hrslice
set TRANSITION31=vuslice
set TRANSITION32=vdslice
set TRANSITION33=dissolve
set TRANSITION34=pixelize
set TRANSITION35=radial
set TRANSITION36=hblur
set TRANSITION37=wipetl
set TRANSITION38=wipetr
set TRANSITION39=wipebl
set TRANSITION40=wipebr
set TRANSITION41=fadegrays
set TRANSITION42=squeezev
set TRANSITION43=squeezeh
set TRANSITION44=zoomin
set NO_OF_TRANSITIONS=0
FOR /L %%I IN (1,1,1000) DO (
    echo TRANSITION%%I
    rem https://stackoverflow.com/a/37073832
    rem https://www.robvanderwoude.com/battech_defined.php
    IF DEFINED TRANSITION%%I (
        echo TRANSITION%%I is defined
    ) ELSE (
        ECHO  TRANSITION%%I is NOT defined
        set /a NO_OF_TRANSITIONS=%%I-1
        GOTO :ENDOF_TRANSITIONS
    )
    rem call :callbyrefernce %%I
    rem IF %%I==5 exit /b
)
:ENDOF_TRANSITIONS
echo NO_OF_TRANSITIONS is %NO_OF_TRANSITIONS%
rem set FILENO_4_TRANSITION=19
rem set /a TRANSISITION_REMAINDER="%FILENO_4_TRANSITION% %% %NO_OF_TRANSITIONS%"
rem echo %TRANSISITION_REMAINDER%
rem set /p id="Press any key to continue:"
rem exit /b

AND then call this in main file concatWithMultipleTransitions.bat

@echo OFF
setlocal ENABLEDELAYEDEXPANSION
rem 1366x768
set BG_W=1366
set BG_H=768
set SLIDE_DURATION=3
set TRANSITION_DURATION=1
set IMG_TYPE=JPG
set /a TOTAL_IMAGE_FILES=0
set PICS_FOLDER=PICS
set VIDS_FOLDER=VIDS
set /a TRANSITION_OFFSET=0
set TRANSITION_2_USE=fade
rem https://stackoverflow.com/a/2763907
call config.bat
for %%f in (./%PICS_FOLDER%/*.%IMG_TYPE%)  do (
    set /a TOTAL_IMAGE_FILES=TOTAL_IMAGE_FILES+1
    rem https://stackoverflow.com/a/2919699
    rem echo TOTAL_IMAGE_FILES is !TOTAL_IMAGE_FILES!
    rem echo file name is %%f
     rem https://stackoverflow.com/a/45811503
    set filename[!TOTAL_IMAGE_FILES!]=%%f
    set TEMP_FILENUM=!TOTAL_IMAGE_FILES!
    echo filename[!TOTAL_IMAGE_FILES!] is %filename[!TOTAL_IMAGE_FILES!]%
    rem set /a ID+=1
)
echo TOTAL_IMAGE_FILES is %TOTAL_IMAGE_FILES%
for /L %%i in (1,1,%TOTAL_IMAGE_FILES%) do (
    echo [%%i] "!filename[%%i]!"
)
rem set /p id="Press any key to continue: "
rem ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=3:rate=25:color=blue -i DSC00570.jpg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=3:rate=25:color=black -i DSC01253.JPG -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]; [3:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl],[2:v][ovrl]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v1];[v0][v1]concat=n=2:v=1[outv]"  -map "[outv]" -y concatSingle.mp4
FOR %%f IN (./%PICS_FOLDER%/*.%IMG_TYPE%) do call :createmp4 %%f   ← subroutine called here
for /L %%n in (1,1,%TOTAL_IMAGE_FILES%)  do call :concat %%n  ← subroutine called here
set /p id="Press any key to continue: "
exit /b
:increaseby1
set /a "TOTAL_IMAGE_FILES+=1"
exit /b
:createmp4
set IMAGE_NAME=%1
echo IMAGE_NAME IS %IMAGE_NAME%
echo ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=%SLIDE_DURATION%:rate=25:color=0xFFFFF0 -i %PICS_FOLDER%/%IMAGE_NAME% -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]" -map "[vo]" -y %VIDS_FOLDER%/%IMAGE_NAME%_SILENT.mp4*************************************************************************************
rem set /p id="Press any key to continue: "
ffmpeg -f lavfi -i color=size=%BG_W%x%BG_H%:duration=%SLIDE_DURATION%:rate=25:color=0xFFFFF0 -i %PICS_FOLDER%/%IMAGE_NAME% -filter_complex "[1:v]scale=iw*min(%BG_W%/iw\,%BG_H%/ih):ih*min(%BG_W%/iw\,%BG_H%/ih)[ovrl1],[0:v][ovrl1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[v0]" -map "[v0]" -y %VIDS_FOLDER%/%IMAGE_NAME%_SILENT.mp4
exit /b
:concat
if %TOTAL_IMAGE_FILES% EQU 1 (  
    exit /b
)
set FILE_NUM=%1
echo FILE_NUM is %FILE_NUM%
rem set IMAGE_NAME="%FILE_PREFIX%-%FILE_NUM%.jpeg_SILENT.mp4"
set FILE_NAME=!filename[%FILE_NUM%]!
set IMAGE_NAME=%VIDS_FOLDER%\%FILE_NAME%_SILENT.mp4
echo IMAGE_NAME is %IMAGE_NAME%*************************************************************************************
if %FILE_NUM% EQU 1 (   
    rem echo copy %IMAGE_NAME% %VIDS_FOLDER%\concatStart.mp4*************************************************************************************
    rem copy "VIDS\DSC01276.jpg_SILENT.mp4" "concatStart.mp4"
    echo copy %IMAGE_NAME% concatStart.mp4
    copy %IMAGE_NAME% concatStart.mp4
    rem set /p id="Press any key to continue: "
)
if %TOTAL_IMAGE_FILES% EQU 1 (
    if %FILE_NUM% GEQ 1 (
     exit /b
     )
)
set /a FILE_NO_MINUS_ONE=%FILE_NUM%-%TRANSITION_DURATION%
echo NO_OF_TRANSITIONS is %NO_OF_TRANSITIONS%
set /a TRANSISITION_REMAINDER="!FILE_NO_MINUS_ONE! %% %NO_OF_TRANSITIONS%"
rem set /a TRANSISITION_REMAINDER="%FILE_NUM% %% %NO_OF_TRANSITIONS%"
echo TRANSISITION_REMAINDER is !TRANSISITION_REMAINDER!
if !TRANSISITION_REMAINDER! EQU 0 (
    rem set /a TRANSISITION_REMAINDER=1
    set /a TRANSISITION_REMAINDER=%NO_OF_TRANSITIONS%
)
echo TRANSISITION_REMAINDER is !TRANSISITION_REMAINDER!
rem set /p id="Press any key to continue: "
set IMAGE_NAME=%VIDS_FOLDER%/%FILE_NAME%_SILENT.mp4
if %FILE_NUM% GTR 1 (
    echo ffmpeg -i "concatStart.mp4" -i "%IMAGE_NAME%" -filter_complex ^
"[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
    rem set /p id="Press any key to continue: "
rem !TRANSITION_OFFSET! will be ((%FILE_NUM%-1)*%SLIDE_DURATION%)-(%FILE_NUM%-1)
echo FILE_NO_MINUS_ONE is !FILE_NO_MINUS_ONE!
set /a OFFSET_INTERIM_VAL=!FILE_NO_MINUS_ONE!*%SLIDE_DURATION%
echo OFFSET_INTERIM_VAL is !OFFSET_INTERIM_VAL!
set /a TRANSITION_OFFSET=!OFFSET_INTERIM_VAL!-!FILE_NO_MINUS_ONE!
echo TRANSITION_OFFSET is !TRANSITION_OFFSET!
rem set TRANSITION_2_USE=!TRANSITION[%FILE_NUM%]!
set TRANSISTION_VAR=TRANSITION!FILE_NO_MINUS_ONE!
echo TRANSISTION_VAR is !TRANSISTION_VAR!
set TRANSITION_2_USE=!TRANSISTION_VAR!
rem https://stackoverflow.com/a/14339439
rem call  :callbyrefernce !FILE_NO_MINUS_ONE!
call  :callbyrefernce !TRANSISITION_REMAINDER!
echo TRANSITION_2_USE is !TRANSITION_2_USE!
rem set /p id="Press any key to continue: "
echo ffmpeg -y -i concatStart.mp4 -i "%IMAGE_NAME%" -filter_complex ^
"[0:v][1:v]xfade=transition=circlecrop:duration=2:offset=!TRANSITION_OFFSET![outv];^
 [0:a][1:a]acrossfade=duration=2[outa]" -map [outv] -map [outa]  -y  vtrimmedConcat.mp4
rem https://stackoverflow.com/a/70198046 
echo ffmpeg -i concatStart.mp4 -i "%IMAGE_NAME%" -filter_complex "[0:v][1:v]xfade=transition=!TRANSITION_2_USE!:duration=%TRANSITION_DURATION%:offset=!TRANSITION_OFFSET!,format=yuv420p" -map  -an -y vtrimmedConcat.mp4
rem set /p id="Press any key to continue: "
ffmpeg -i concatStart.mp4 -i "%IMAGE_NAME%" -filter_complex "[0:v][1:v]xfade=transition=!TRANSITION_2_USE!:duration=%TRANSITION_DURATION%:offset=!TRANSITION_OFFSET!,format=yuv420p" -map  -an -y vtrimmedConcat.mp4
echo ffmpeg -i "concatStart.mp4" -i "%IMAGE_NAME%" -filter_complex ^
"[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
rem ffmpeg -y -i concatStart.mp4 -i "%IMAGE_NAME%" -filter_complex ^
rem "[0:v][1:v]xfade=transition=circlecrop:duration=2:offset=!TRANSITION_OFFSET![outv]" -map [outv]   -y  vtrimmedConcat.avi
rem set /p id="Press any key to continue: "
)
if %FILE_NUM% GTR 1 (
     copy vtrimmedConcat.mp4 concatStart.mp4
     del vtrimmedConcat.mp4 
    if %FILE_NUM% EQU %TOTAL_IMAGE_FILES% (
        copy concatStart.mp4 videoFromImages.mp4 
        del concatStart.mp4 
    )
 )
del %IMAGE_NAME%
rem echo ffmpeg -i "concatStart.mp4" -i %IMAGE_NAME% -filter_complex "[0:v][1:v]concat=n=2:v=1 [v]" -map "[v]"  -r 30 -y  vtrimmedConcat.mp4
exit /b
rem https://stackoverflow.com/a/14339439
:callbyrefernce
REM Now %1 contains the value "parm"
rem set "%1=!%1! world"
REM Now variable "parm" contains "Hello world"
set TRANSITION_2_USE=!TRANSITION%1!
exit /b