Last active
April 11, 2023 18:47
-
-
Save arnaudrenaud/5927cefeb5f713533def8bbe0a89377f to your computer and use it in GitHub Desktop.
Batch convert videos to 1280x720 H.265
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert *.jpg -resize 50% -set filename:f '%t' smaller/'%[filename:f].jpg' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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