Skip to content

Instantly share code, notes, and snippets.

@juanpablocs
Last active March 17, 2017 23:48
Show Gist options
  • Save juanpablocs/3887801c32b5ce6a12d1c560de00ac53 to your computer and use it in GitHub Desktop.
Save juanpablocs/3887801c32b5ce6a12d1c560de00ac53 to your computer and use it in GitHub Desktop.
ffmpeg mp3 rename tag or bitrate on demand
#!/bin/bash
#rename id3 album
#output file with "_.mp3"
for file in myfolder/*.mp3; do
ffmpeg -i $file -acodec copy -metadata album="Mysite.CoM" "$( sed -e's/\.mp3/_.mp3/g' <<< $file )"
# convert to 128kbps
#ffmpeg -i $file -ab 128k "$( sed -e's/\.mp3/_.mp3/g' <<< $file )"
done
#remove file size 0
#move file with "_.mp3" to ".mp3"
for file in myfolder/*.mp3; do
if [ ! -s $file ] ; then
rm $file
fi
mv $file ${file//_\.mp3/\.mp3}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment