video-slideshow.cmd 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. @echo off
  2. chcp 65001
  3. setlocal enableextensions enabledelayedexpansion
  4. set SRCFILE=%~1
  5. if not defined SRCFILE call :PRINT_USAGE
  6. set DESTPATH=%~2
  7. if not defined DESTPATH set DESTPATH=%cd%
  8. set PROCS="%~dp0procs.cmd"
  9. if not exist "%SRCFILE%" call %PROCS% DIR_ERROR
  10. if not exist "%DESTPATH%" ( md "%DESTPATH%" || exit /b )
  11. set OUTFILEPREFIX=%~3
  12. if not defined OUTFILEPREFIX for %%I in ( %SRCFILE% ) do set "OUTFILEPREFIX=%%~nI"
  13. for /f "usebackq tokens=* delims=" %%I in ( `call %PROCS% NEWDATENAME %OUTFILEPREFIX%` ) do set "OUTFILENAME=%%I.mp4"
  14. set "ffmpeg=e:\Work\video\bin\ffmpeg\ffmpeg.exe"
  15. set "x264opts=colorprim=bt709:transfer=bt709:colormatrix=bt709:fullrange=off:analyse=0x3,0x133"
  16. %ffmpeg% -r 2 -y -fflags +genpts -f concat -safe 0 -i "%SRCFILE%" -map 0:0 -c:v libx264 -crf:v 21 -level:v 4.1 -profile:v high -tune:v film -preset:v fast ^
  17. -maxrate:v 1000k -bufsize:v 2000k -r 10 -threads 0 -f mp4 -pix_fmt yuv420p -metadata title=%OUTFILEPREFIX% ^
  18. -x264opts %x264opts% -x264-params %x264opts% %DESTPATH%%OUTFILENAME%
  19. ::-map 0:1 -c:a libfdk_aac -profile:a aac_he_v2 -afterburner 1 -signaling explicit_sbr -vbr 5 -ac 2 -ar 44100 ^
  20. echo.Ready. File "%DESTPATH%%OUTFILENAME%" saved.
  21. echo.&pause&goto:eof
  22. :PRINT_USAGE
  23. echo:
  24. echo USAGE:
  25. echo %~nx0 ^<source^> [destination] [outfile prefix title]
  26. exit /b !ERRORLEVEL!