Advertisement
lincruste

Convert & resize video to still images (needs FFmpeg)

Sep 9th, 2015
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. rem A windows build of FFmpeg must be copied in the same directory or set in the PATH
  3. rem Please check the official FFmpeg website to obtain a static build (https://www.ffmpeg.org/download.html#build-windows)
  4.  
  5. cd %~dp0
  6. if not exist convert (mkdir convert)
  7.  
  8. :ips
  9. rem Get the frame per second variable, loops until it is defined
  10. SET /P ips="Indiquer le nombre d'images par seconde … extraire (autour de 15, maximum 25)"
  11. IF NOT DEFINED ips GOTO :ips
  12.  
  13. rem Ask if the final images must be resized using FFmpeg presets. The preset name must be typed (ie: sqcif)
  14. rem Useful to convert HD stuff into animated GIF
  15.  
  16. CHOICE /C ON /T 10 /D N /M "Souhaitez-vous redimensionner les images ? (Valeur par d‚faut : N)"
  17.  
  18. IF ERRORLEVEL 2 (
  19. GOTO orig
  20. ) ELSE (
  21. GOTO reso
  22. )
  23.  
  24. GOTO end
  25.  
  26.  
  27. :orig
  28. FOR %%A IN (%*) DO (ffmpeg -i %%A -r %ips% -f image2 convert/%%~nA-%%3d.png)
  29. GOTO end
  30.  
  31. :reso
  32. @echo ______________________________________________________
  33. @echo.
  34. @echo sqcif     128x96      qcif    176x144     cif  352x288
  35. @echo 4cif  704x576     qqvga   160x120     qvga    320x240
  36. @echo vga   640x480     svga    800x600     xga     1024x768
  37. @echo uxga  1600x1200   qxga    2048x1536   sxga    1280x1024
  38. @echo qsxga     2560x2048   hsxga   5120x4096   wvga    852x480
  39. @echo wxga  1366x768    wsxga   1600x1024   wuxga   1920x1200
  40. @echo woxga     2560x1600   wqsxga  3200x2048   wquxga  3840x2400
  41. @echo whsxga    6400x4096   whuxga  7680x4800   cga     320x200
  42. @echo hd480     852x480     hd720   1280x720    hd1080  1920x1080
  43. @echo ______________________________________________________
  44. @echo.
  45. rem
  46. SET /P res="Indiquer la r‚solution finale souhait‚e"
  47. FOR %%A IN (%*) DO (ffmpeg -i %%A -r %ips% -s %res% -f image2 convert/%%~nA-%%3d.png)
  48.  
  49. GOTO end
  50.  
  51. :end
  52. @echo.
  53. @echo.
  54. @echo Script bas‚ sur "FFmpeg" de Fabrice Bellard
  55. @echo https://www.ffmpeg.org/
  56. @echo.
  57. @echo.
  58. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement