Linux Shell FLAC

Embed cue

metaflac --import-cuesheet-from="file.cue" --set-tag-from-file="CUESHEET=file.cue" "file.flac"

Extract cue

Remove "CUESHEET=" from the first line in cue file after the extraction.

metaflac --show-tag="CUESHEET" "file.flac" > "file.cue"

Generate cue

metaflac --export-cuesheet-to="file.cue" "file.flac"

Remove all metadata

metaflac --remove-all "file.flac"

Remove picture without padding remaining

metaflac --dont-use-padding --remove --block-type=PICTURE "file.flac"

Import picture

metaflac --import-picture-from="cover.jpg" "file.flac"
metaflac --import-picture-from="3|image/jpeg|description|300x300x24|cover.jpg" "file.flac"

Split single file to multiple files

# Install cuetools, shntool, flac
brew install cuetools shntool flac

# Download `cuetag` script from 
# https://github.com/gumayunov/split-cue/blob/master/cuetag
chmod +x cuetag && mv cuetag /usr/local/bin

# Extract cue
metaflac --show-tag="CUESHEET" "file.flac" > "file.cue"

# Edit cue 
cuesheet=REM GENRE Soundtrack
# Remove 'cuesheet=' from the first line, it will be the following
REM GENRE Soundtrack
sed -i "" "1s|cuesheet=||g" "file.cue" # for mac
sed -i"" "1s|cuesheet=||g" "file.cue" # for linux

# split
shnsplit -o flac -f "file.cue" "file.flac"

# cue to each track file
cuetag "file.cue" [0-9]*.flac

你可能感兴趣的:(linux,shell,script)