Advertisement
Guest User

Untitled

a guest
Feb 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.08 KB | None | 0 0
  1. @ECHO off
  2. SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
  3.  
  4. SET ffmpeg="C:\ffmpeg\bin\ffmpeg.exe"
  5. :: get selected folder path
  6. SET dir=%1\
  7. SET dir_inside=%1\*
  8.  
  9. :: loop through files to get image's sequence filename
  10. FOR %%G in (%dir_inside%) do (
  11.     SET filename=%%~nG
  12.     GOTO exit_loop
  13. )
  14.  
  15. :exit_loop
  16. :: remove trailing numbers from extracted filename
  17. call :strlen length filename
  18. SET /a length -= 4
  19. SET filename=!filename:~0,%length%!
  20. :: construct full file path with number padding for later use in ffmpeg
  21. SET filepath="%dir%%filename%/%04d.png"
  22.  
  23. :: should be f.e. "D:\Users\mig21\Desktop\dsaads\003 Maziaje%04d.png"
  24. ECHO %filepath%
  25.  
  26. call %ffmpeg% -r 25 -i %filepath% -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4
  27.  
  28. PAUSE
  29.  
  30. :strlen <resultVar> <stringVar>
  31. (  
  32.     setlocal EnableDelayedExpansion
  33.     set "s=!%~2!#"
  34.     set "len=0"
  35.     for %%P in (4096 2048 1024 512 256 128 64 32 16 8 4 2 1) do (
  36.         if "!s:~%%P,1!" NEQ "" (
  37.             set /a "len+=%%P"
  38.             set "s=!s:~%%P!"
  39.         )
  40.     )
  41. )
  42. (
  43.     endlocal
  44.     set "%~1=%len%"
  45.     exit /b
  46. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement