Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
1,004
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # You need to have ImageMagick and ffmpeg installed (Installer (ffmpeg included): https://www.imagemagick.org/script/download.php#windows - ImageMagick-7.0.8-14-Q16-x64-static.exe)
  2. # Run in "images\Animated CGs"
  3.  
  4. Get-ChildItem "." -Directory | Sort |
  5. Foreach-Object {
  6.     $name = $_.Name
  7.  
  8.     if ($name -ne "foreplay_minigame" -and $name -ne "time_transition") {
  9.         # Converts .tga files to .png and fixes the numbering syntax, my intent is to make it easier to work with the individual frames
  10.         # so that we may loop segments in the future. Beware that this will take very long (1 hour+). If you just want to generate the videos from
  11.         # the .tga files just change this block to do a simple rename and tell ffmpeg to use .tga instead of .png
  12.         # You can comment this block out after the 1st run.
  13.         Get-ChildItem "$name\." -File -Filter "*.tga" |
  14.         Foreach-Object {
  15.             $filename = $_.Name
  16.             $newFilename = ([int]($filename).Substring(6).Replace(".tga", "")) # Fixes the broken numbers (leading 0s)
  17.  
  18.             echo "Converting $name\$filename -> $name\$newFilename.png"
  19.  
  20.             magick "$name\$filename" "$name\$newFilename.png"
  21.         }
  22.  
  23.         ffmpeg -framerate 17 -i "$name\%d.png" -preset veryslow -c:v libvpx -b:v 0 -crf 30 -pix_fmt yuv420p "$name.webm"
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement