Last active
November 19, 2020 00:10
-
-
Save heaversm/d87fe0afce5d13eb93fe1a245b135f93 to your computer and use it in GitHub Desktop.
This file contains 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
#find all videos in a folder and reduce their dimensions and or quality | |
#-crf lower is higher bitrate (better quality) | |
# -b 1000000 can be added, where you divide 1 GB by the video length in seconds (e.g. this is a 16m:40s video) | |
find . -type f -name "*.mp4" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -crf 20 -s 1280x720 -acodec copy -y "${FILE%.mp4}.shrink.mp4";' _ '{}' \; | |
#optimize an mp4 | |
ffmpeg -i input.mp4 -vcodec h264 output.mp4 | |
#imagemagick: | |
#resize and change quality of a folder of images | |
magick mogrify -strip -quality 80% -resize 50% *.jpg | |
#specify max image dimensions: | |
magick mogrify -resize 1280x720 *.jpg | |
#resize with aspect ratio | |
convert input.png -geometry x600 output.png | |
#convert format from png to jpg | |
mogrify -format jpg *.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment