Guest User

Untitled

a guest
Jul 11th, 2026
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. export FFMPEG_FLAGS='-c:v libsvtav1 -crf 30 -preset 6 -vf scale=trunc(iw/2)*2:trunc(ih/2)*2 -pix_fmt yuv420p -movflags faststart -loop 0'
  4.  
  5. while IFS= read -r -d '' file; do
  6.     dir=$(dirname "$file")
  7.     name=$(basename "$file")
  8.     output="${name%.*}.mkv"
  9.  
  10.     pushd "$dir" > /dev/null || continue
  11.  
  12.     if [[ -e "$output" ]]; then
  13.         echo "Skipping existing: $output"
  14.         popd > /dev/null
  15.         continue
  16.     fi
  17.  
  18.     echo "Converting: $file -> $output"
  19.     ffmpeg -nostdin -i "$name" $FFMPEG_FLAGS "$output"
  20.     popd > /dev/null
  21. done < <(find . -type f -iname "*.gif" -print0)
  22.  
  23.  
Advertisement
Add Comment
Please, Sign In to add comment