get-tracks/README.md

58 lines
1.4 KiB
Markdown

# Get Tracks
`get-tracks.sh` allows you to easily extract music tracks from a file with multiple songs, like a CD-in-a-file.
# Required applications
`get-tracks.sh` is a simple shell script based around `ffmpeg`, using `xxd` and `awk`.
* ffmpeg
* xxd (with '-r' and '-p' options)
* awk
It was tested on both OpenBSD and Linux.
# Usage
Download a CD and the starting time of each track in a file, and you're good to go.
```Bash
get-tracks.sh <audio-file> <time-file>
# Example
get-track.sh doom-eternal.opus doom-eternal.txt
```
*audio-file* can be in any format understood by `ffmpeg`.
The *time-file* must have this format:
```
0:00 intro
2:20 First song
3:18 Awesome song
```
# Environment variables
* **SIMULATION** [empty or not]\
do not invoke ffmpeg
* **NONUMBER** [empty or 1]\
do not write song numbers
* **FORMAT** [mp3,ogg,opus,…]\
see the ffmpeg documentation for the output formats available
* **SEPARATOR** [separator] (default: ' - ')\
separator between number and name\
example with SEPARATOR='_': 01_intro.opus 02_blah.opus…
* **HEADERS** [empty or 1]\
print environment parameters (verbosity, simulation, etc.)
* **VERBOSITY** [0-3] (default: 1)\
0: no output except errors from ffmpeg\
1: simple indications on the current track being extracted\
2: print actual ffmpeg commands the script currently runs
# More
Run `get-track.sh` without arguments.