Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shell script to demonstrate generation loss in an audio file
#!/bin/sh
COUNT=0
MAX=50
SOURCE='source_file.flac'
FORMAT='genloss%03d.mp3'
FLAGS='-b:a 128k'
while [ $COUNT -lt $MAX ]; do
if [ $COUNT -eq 0 ]; then
PREV="$SOURCE"
else
PREV=`printf "$FORMAT" $COUNT`
fi
COUNT=$(($COUNT + 1))
CUR=`printf "$FORMAT" $COUNT`
ffmpeg -i "$PREV" $FLAGS "$CUR"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment