Created
November 16, 2011 08:21
-
-
Save Kagee/1369569 to your computer and use it in GitHub Desktop.
Extracting MP3 sound from SWF notes
This file contains hidden or 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
#! /bin/bash | |
echo Extracting from $1; | |
bname=$(basename $1 .swf); | |
data=$(swfdump "$1" | grep MP3) | |
echo "$data" | |
# Remove double spaces and take value in field 7 separated by spaces | |
ids=$(echo "$data" | sed 's, , ,g' |cut -d " " -f 7) | |
Counter=1 # Counter 1..2..3..4..N | |
CounterWoError=0 | |
# Loop through all id's | |
for id in $ids; do | |
zpCounter=$(printf '%02d' $Counter) # Zeropadd Counter | |
fName="$bname"_"$zpCounter"_"$id.mp3" | |
echo swfextract -s "$id" -o "$fName" $1 | |
swfextract -s "$id" -o "$fName" $1 | |
if [ "$?" -eq 0 ] | |
then | |
echo "Extraction complete"; | |
CounterWoError=$((CounterWoError+1)); | |
fi | |
Counter=$((Counter+1)); | |
done; | |
Counter=$((Counter-1)); | |
echo "$CounterWoError of $Counter sounds extracted" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment