I use to digitally record my old 33s and 45s, in single audio files, so I've just written a bash script to separate these files into individual files (one for each track).
I am sorry if it's not the proper place to put this (I am new to this forum, and ffmpeg generally), but I thought someone might have a use for it.
(also, sorry for my English).
Any suggestions for improvement are greatly appreciated !
- Code: Select all
This script separates an audio file (typically a full album) into multiple smaller audio files (typically the songs of the album). It uses ffmpeg and a description file.
The path of the input audio file and of the description file must be passed as arguments (in that order) when calling the script.
The description file must be written this way:
You can add id3 tags (artist, album, release year, genre) at the beginning.
# Menu for adding global tags
while [ $choice!=5 ]
echo "Which tag do you want to add ? (please enter a digit between 1 and 5)"
echo "1: Artist"
echo "2: Album"
echo "3: Year"
echo "4: Genre"
echo "5: Done"
case "$choice" in
1) echo "Please enter artist name"
2) echo "Please enter album name"
3) echo "Please enter release year"
4) echo "Please enter genre"
*) echo "Bad choice"
for line in $(cat $2)
IFS="|" read track title begin end <<< $line
echo "$track-$title.mp3" > tempo
IFS=: read min sec <<< $begin
IFS=: read min1 sec1 <<< $end
tot=$(( 10#$min*60 + 10#$sec ))
tot1=$(( 10#$min1*60 + 10#$sec1 ))
dur=$(( $tot1 - $tot ))
ffmpeg -ss $begin -t $dur -i $1 "$file"
id3v2 --track $track --song "$title" --artist "$artist" --album "$album" --genre "$genre" --year $year "$file"