Flack + cue to mp3 on unix

Август 5th, 2009

И все же как разрезать flac+cue в mp3 в unix?
Смотрим далее…

Разрезаем на файлы:

grundik@grundik-desktop:/media/new/video/Воскресение$ ls -l
итого 515076
-rw-r--r-- 1 grundik grundik 1064 2009-08-05 16:07 1 CD1.cue
-rw-r--r-- 1 grundik grundik 252631596 2009-08-05 17:11 1 CD1.flac
-rw-r--r-- 1 grundik grundik 3294 2009-08-05 16:12 1 CD1.log
-rw-r--r-- 1 grundik grundik 671 2009-08-05 16:12 1 CD1.txt
-rw-r--r-- 1 grundik grundik 1127 2009-08-05 16:10 1 CD2.cue
-rw-r--r-- 1 grundik grundik 274244769 2009-08-05 17:10 1 CD2.flac
-rw-r--r-- 1 grundik grundik 3465 2009-08-05 16:10 1 CD2.log
-rw-r--r-- 1 grundik grundik 714 2009-08-05 16:10 1 CD2.txt
drwxr-xr-x 2 grundik grundik 4096 2009-08-05 16:11 cover
grundik@grundik-desktop:/media/new/video/Воскресение$ cuebreakpoints 1\ CD1.cue | shnsplit -a cd1 -o flac 1\ CD1.flac
Splitting [1 CD1.flac] (39:58.15) --> [cd101.flac] (2:27.25) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd102.flac] (3:01.70) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd103.flac] (3:37.20) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd104.flac] (4:11.35) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd105.flac] (3:10.25) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd106.flac] (4:35.40) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd107.flac] (5:46.55) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd108.flac] (3:45.10) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd109.flac] (3:31.00) : 100% OK
Splitting [1 CD1.flac] (39:58.15) --> [cd110.flac] (5:51.35) : 100% OK
grundik@grundik-desktop:/media/new/video/Воскресение$ cuebreakpoints 1\ CD2.cue | shnsplit -a cd2 -o flac 1\ CD2.flac
Splitting [1 CD2.flac] (44:17.00) --> [cd201.flac] (5:54.00) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd202.flac] (3:27.40) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd203.flac] (3:23.60) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd204.flac] (4:34.25) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd205.flac] (4:20.50) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd206.flac] (3:54.50) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd207.flac] (3:09.70) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd208.flac] (3:11.60) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd209.flac] (4:35.05) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd210.flac] (4:32.65) : 100% OK
Splitting [1 CD2.flac] (44:17.00) --> [cd211.flac] (3:12.25) : 100% OK

Проставляем теги cue:

cuetag sample.cue split-track*.flac

Нагоняем на каждый разрезанный flac скрипт:

#!/bin/bash
#########################################################
# Flac to Mp3 Conversion Software #
# Script Created by Nick Sklavenitis #
# Date: September 18 2007 #
#########################################################
# modify the lame options to your preference example change -b 320 to -b 128 or -b 192 or -b 256
lame_opts=" --vbr-new -V 2 -b 320 "

# Creates the loop that allows more than 1 file to be specified, Can use single file name or example *.flac
for x in "${@}"
do
FLAC=${x}
MP3=`basename "${FLAC%.flac}.mp3"`
[ -r "$FLAC" ] || { echo can not read file \"$FLAC\" >&1 ; exit 1 ; } ;

#This section pulls the Tag info from flac and stores it as a variable.

TITLE="`metaflac --show-tag=TITLE "$FLAC" | awk -F = '{ printf($2) }'`"
ALBUM="`metaflac --show-tag=ALBUM "$FLAC" | awk -F = '{ printf($2) }'`"
ARTIST="`metaflac --show-tag=ARTIST "$FLAC" | awk -F = '{ printf($2) }'`"
TRACKNUMBER="`metaflac --show-tag=TRACKNUMBER "$FLAC" | awk -F = '{ printf($2) }'`"
GENRE="`metaflac --show-tag=GENRE "$FLAC" | awk -F = '{ printf($2) }'`"
COMMENT="`metaflac --show-tag=COMMENT "$FLAC" | awk -F = '{ printf($2) }'`"
DATE="`metaflac --show-tag=DATE "$FLAC" | awk -F = '{ printf($2) }'`"

#This section handles the conversion of the Flac file to MP3

flac -dc "$FLAC" | lame${lame_opts} \
--tt "$TITLE" \
--tn "$TRACKNUMBER" \
--tg "$GENRE" \
--ty "$DATE" \
--ta "$ARTIST" \
--tl "$ALBUM" \
--add-id3v2 \
- "$MP3"

done

Скачать скрипт.

Получаем mp3 из flac+cue…

Оставить комментарий

Вам надо войти чтобы оставить комментарий.