Skip to content

Instantly share code, notes, and snippets.

@joelataylor
Created November 6, 2012 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelataylor/4027760 to your computer and use it in GitHub Desktop.
Save joelataylor/4027760 to your computer and use it in GitHub Desktop.
Convert mp3 w/ FFmpeg
printf '\nTOKEN: %s\n' "$auth_token"
printf 'STORAGE: %s\n\n' "$storage_url"
store="need_encoding.log"
comm -23 <(swift list "audio-in" | sed 's/.mp3//') <(swift list "audio-out" | sed 's/.ogg//') > "$store"
counter=0
total=$(wc -l <"$store")
while read -r line; do
((counter++))
printf '%d OF %d | ATTEMPTING TO COPY: %s\n' "$counter" "$total" "$line"
swift download "audio-in" "${line}.mp3"
ffmpeg -i "${line}.mp3" -vn -acodec libvorbis -b:a 128k "${line}.ogg" </dev/null
while read -r key val; do
case "$key" in
HTTP/1.1) echo ${val%?};;
esac;
done < <(curl -i -X PUT -H "X-Auth-Token: $auth_token" -T "/var/www/as/scripts/songs/${line}.ogg" "$storage_url/audio-out/${line}.ogg")
rm -f "${line}.mp3"
rm -f "${line}.ogg"
#if [[ $counter -gt 50 ]]; then
exit
#fi
done < "$store"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment