Skip to content

Instantly share code, notes, and snippets.

@rizkysyazuli
Last active October 6, 2021 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rizkysyazuli/b1333d20c3cff5e065ed to your computer and use it in GitHub Desktop.
Save rizkysyazuli/b1333d20c3cff5e065ed to your computer and use it in GitHub Desktop.
[Shell - Media] Batch edit image or video #shell #ffmpeg #snippets
#!/bin/bash
IMAGES=~/Images
find "$IMAGES" -name '*.TIF' -exec sh -c 'convert "$0" -resize 1024x768 "${0%%.tif}_1024.jpg"' {} \;
# for debug
# find "$IMAGES" -name '*.TIF' -exec sh -c 'echo "${0%%.tif}_1024.jpg"' {} \;
exit;
#!/bin/bash
MOVIES=~/Movies
find "$MOVIES" -name '*.mp4' -exec sh -c 'ffmpeg -i "$0" -codec:v libx264 -preset medium -movflags faststart -vf scale=640:-1,format=yuv420p "${0%%.mp4}_640.mp4"' {} \;
# for debugging
# find "$MOVIES" -name '*.mp4' -exec sh -c 'echo "${0%%.mp4}_640.mp4"' {} \;
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment