When you've saved enough videos to one directory, use the following script to convert them to mp3. You will need faad and lame (or twolame)
#!/bin/bash
#hacked by adrian (at) javaguru [dot] org
if [ -f /usr/bin/faad ]
then
if [ -z $1 ]
then
echo "Usage: mp3-to-mp3
exit 0
fi
if [ $1 != "all" ]
then
if [ -f $1 ]
then
echo Processing $1
faad $1
#filename change
FNAME_LENGTH=${#1}
FEXT_INDEX=$((FNAME_LENGTH-4))
echo Filename length: $FNAME_LENGTH
WAVFILE=${1:0:$FEXT_INDEX}.wav
echo $WAVFILE created. Processing...
# Running lame encoder
echo Running lame mp3 encoder with 256kbps and HQ settings
lame -h -b 256 $WAVFILE
# process filenames
MP3FILE=$WAVFILE.mp3
NEWMP3FILE=${MP3FILE:0:$FEXT_INDEX}.mp3
mv $MP3FILE $NEWMP3FILE
echo Deleting intermediate WAV file
rm -v $WAVFILE
echo $NEWMP3FILE created. Enjoy!
fi
else
if [ $1 == "all" ]
then
# removing keepvid.com tag
find . -name "*keepvid*" -exec rename -v 's/\_\[www.keepvid.com\]//'$
find . -name "*.mp4" -exec mp4-to-mp3 {} \;
fi
fi
else
echo /usr/bin/faad missing! Exiting
fi
No comments:
Post a Comment