Skip to content

Instantly share code, notes, and snippets.

@jack126guy
Created December 23, 2017 08:32
Show Gist options
  • Save jack126guy/6a5ac6fc9e3fd183592ec23de8a9e4c9 to your computer and use it in GitHub Desktop.
Save jack126guy/6a5ac6fc9e3fd183592ec23de8a9e4c9 to your computer and use it in GitHub Desktop.
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