Skip to content

Instantly share code, notes, and snippets.

@arnaudrenaud
Last active April 11, 2023 18:47
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 arnaudrenaud/5927cefeb5f713533def8bbe0a89377f to your computer and use it in GitHub Desktop.
Save arnaudrenaud/5927cefeb5f713533def8bbe0a89377f to your computer and use it in GitHub Desktop.
Batch convert videos to 1280x720 H.265
convert *.jpg -resize 50% -set filename:f '%t' smaller/'%[filename:f].jpg'
#!/bin/bash
# Example usage:
# ./convert-videos-to-1280-720-h265.sh /Volumes/EOS_DIGITAL/DCIM/100CANON "*.MOV"
source_dir="$1"
file_pattern="$2"
echo $(ls -l "$source_dir"/$file_pattern)
mkdir -p "$source_dir"/encoded
for f in "$source_dir"/$file_pattern; do
file_name=$( basename "$f" );
ffmpeg -i "$f" -c:v libx265 -vtag hvc1 -vf scale=1280:720 -crf 18 "$source_dir/encoded/$file_name";
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment