Created
November 6, 2012 21:37
-
-
Save joelataylor/4027760 to your computer and use it in GitHub Desktop.
Convert mp3 w/ FFmpeg
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
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