Skip to content

Instantly share code, notes, and snippets.

@martjanz
Last active June 10, 2021 12:48
Show Gist options
  • Save martjanz/383612d00007f53eee54484ed4e45657 to your computer and use it in GitHub Desktop.
Save martjanz/383612d00007f53eee54484ed4e45657 to your computer and use it in GitHub Desktop.
Convert audio and image formats to smaller and compressed formats
#!/bin/sh
# (Linux, Unix) Convert to mp3 at maximum VBR using ffmpeg, then delete source audio files
fd -t f -e aiff -x ffmpeg -i "{}" -qscale:a 0 "{.}.mp3" && fd -t f -e aiff -x rm {}
fd -t f -e flac -x ffmpeg -i "{}" -qscale:a 0 "{.}.mp3" && fd -t f -e flac -x rm {}
fd -t f -e m4a -x ffmpeg -i "{}" -qscale:a 0 "{.}.mp3" && fd -t f -e m4a -x rm {}
fd -t f -e wav -x ffmpeg -i "{}" -qscale:a 0 "{.}.mp3" && fd -t f -e wav -x rm {}
fd -t f -e wma -x ffmpeg -i "{}" -qscale:a 0 "{.}.mp3" && fd -t f -e wma -x rm {}
# (Mac) Convert bmp to jpeg
fd -t f -e bmp -x mogrify -format jpg "{}" && fd -t f -e bmp -x rm {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment