Advertisement
Guest User

Untitled

a guest
Aug 31st, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. REM ----------------------------------------------
  2. set folder=C:\My videos
  3. set vframes=10
  4. set width=384
  5. set height=216
  6. rem w = h*16/9
  7. set filetypes=*.mp4
  8. REM ----------------------------------------------
  9. setlocal EnableDelayedExpansion
  10.  
  11. pushd "%folder%"
  12. if not exist preview md preview
  13. for /f "usebackq delims=" %%f in (`dir /b %filetypes%`) do (
  14. if not exist "preview\%%~nf.mp4" (
  15. for /f %%i in ('ffprobe -v error -show_entries format^=duration "%%f" -of default^=noprint_wrappers^=1:nokey^=1') do set length=%%i
  16. set /a length=!length!+0
  17. set /a fps=!length!/%vframes%
  18. ffmpeg -threads 2 -i "%%f" -an -qscale:v 1 -vf "fps=1/!fps!, scale=iw*min(%width%/iw\,%height%/ih):ih*min(%width%/iw\,%height%/ih):flags=lanczos, pad=%width%:%height%:(%width%-iw*min(%width%/iw\,%height%/ih))/2:(%height%-ih*min(%width%/iw\,%height%/ih))/2, unsharp=5:5:0.5:5:5:0.5" -vframes %vframes% -f image2pipe -vcodec ppm - ^
  19. | ffmpeg -y -threads 2 -framerate 1 -i pipe:0 -c:v libx264 -profile:v baseline -level 3.0 -tune stillimage -r 30 -pix_fmt yuv420p "preview\%%~nf.mp4"
  20. )
  21. cls
  22. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement