#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/audio-convert convert-to () { local new_ext=$1 shift local files=($@) local name local out for f in $files; do name=${f:r} out=${name}.${new_ext} ffmpeg -y -i $f $out done } get-wav () { local files=($@) convert-to "wav" $files } get-m4a () { local files=($@) convert-to "m4a" $files } get-mp3 () { local files=($@) local out for f in $files; do out=${f:r}.mp3 # ffmpeg -i $f -b:a 320K -vn $out # size 57M -> 145M :O # ffmpeg -i $f -vn -ar 44100 -ac 2 -b:a 192k $out # 87M :S ffmpeg -i $f -acodec libmp3lame $out # 58M :) done }