Skip to content

Instantly share code, notes, and snippets.

@christopher-baek
Last active June 14, 2016 05:00
Show Gist options
  • Save christopher-baek/c727215d3fd95494dcc62c97543c8b73 to your computer and use it in GitHub Desktop.
Save christopher-baek/c727215d3fd95494dcc62c97543c8b73 to your computer and use it in GitHub Desktop.
Media Conversion Examples

Media Conversion Examples

# method 1
convert *.png -crop 1280x1024-0+87 -crop 1280x1024+0-40 output.png
# method 2
# crop an area of 643 by 393 pixels, starting at 7 pixels from the left and 83 pixels from the top of the image
mogrify -crop {Width}x{Height}+{X}+{Y} image.png
mogrify -crop 643×393+7+83 image.png
# batch resize images
# Resample image so height and width aren't greater than specified size.
sips -Z 300 *.png
-Z pixelsWH
--resampleHeightWidthMax pixelsWH
ffmpeg -i %INPUT%.flac -ab 320k -map_metadata 0 -id3v2_version 3 %OUTPUT%.mp3
flac -cd "${FILE}" | lame -b 320 - "${FILE%.flac}".mp3
sudo apt-get install libav-tools
# target 245k with a range of 220-260
avconv -i ${INPUT}.flac -qscale:a 0 ${OUTPUT}.mp3
# 320k
avconv -i ${INPUT}.flac -c:a libmp3lame -b:a 320k ${OUTPUT}.mp3
hdiutil convert -format UDRW -o ${OUTPUT_FILE} ${INPUT_FILE}
dd if=${OUTPUT_FILE} of=/dev/rdiskN bs=1m
ffmpeg -i "${FILE}" -acodec libmp3lame -ab 320k "${FILE%.m4a}.mp3"
sudo apt-get install libav-tools
avconv -i ${INPUT}.m4a ${OUTPUT}.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment