Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE

This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

[Bash Script] Separate Album audio file into Track files

A collection of useful tutorials for some common tasks.

[Bash Script] Separate Album audio file into Track files

Postby Sputnik93 » Tue Sep 20, 2016 2:23 pm

Hello !
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 "======================"
        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"
        read choice
        case "$choice" in
                1) echo "Please enter artist name"
                read artist
                2) echo "Please enter album name"
                read album
                3) echo "Please enter release year"
                read year
                4) echo "Please enter genre"
                read genre
                5) break
                *) 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 ))
        file=$(cat tempo)
        ffmpeg -ss $begin -t $dur -i $1 "$file"
        id3v2 --track $track --song "$title" --artist "$artist" --album "$album" --genre "$genre" --year $year "$file"
Posts: 1
Joined: Tue Sep 20, 2016 11:22 am

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests