Linux flac cue to flac

Ubuntu Genius’s Blog

Cool UBUNTU Tips & Tricks brought to you by OzzyFrank

Split FLAC Audio Album with CUE File into Separate FLAC Tracks in Ubuntu Linux

Introduction to the FLAC Format

The FLAC audio format is so awesome, I still can’t get my head around it! It is lossless, like WAV files, yet often less than half the size. For example, if you had an album at full-quality (320 kbps) in MP3 format (which is lossy, meaning some quality had to be sacrificed), it could well be around 140Mb. Raw, lossless audio in the form of .wav files would on the other hand take up around 1Gb, if not closer to 1.5Gb. The reason .flac files have become so popular is that while being lossless in quality like .wav files, that album would probably only take up about 450Mb – half the size or less, but the same lossless quality.

If you’re quite happy with MP3s and their much-smaller filesize, if you ever end up with an album in FLAC format, you can always convert the tracks down to MP3 with a program like Sound Converter . But what if you get the album as one, long, continuous .flac file? Well, as long as that file also came with a .cue file (which specifies the breaks between tracks), it’s really easy to split it via the command-line, as you’ll see.

How to Split a FLAC Album with CUE File

First off, you need to make sure you have the necessary packages installed, which you can do with the following command:

sudo apt-get install cuetools shntool flac

Once done, you can start splitting the album with a command like the following:

cuebreakpoints album.cue | shnsplit -o flac album.flac

… replacing the word “album” in each case with the correct name . If the 2 files have multiple words with spaces, you’ll have to enclose them in double-quotes, like in the following example:

cuebreakpoints “The Number Of The Beast.cue” | shnsplit -o flac “The Number Of The Beast.flac”

Once that’s done, all you’ll have to do is rename the tracks (unless it doesn’t worry you), and edit the tags (the info you see in your audio player) via Rhythmbox, or a dedicated tag editor.

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Читайте также:  Oracle linux postgresql odbc

Buy Ubuntu Genius a Beer to say Thanks!

Share this:

Like this:

3 Responses

on February 4, 2015 at 7:37 am | Reply Andrew P.

Does this mean that using CUE files with a FLAC file, it is possible to play the tracks without gaps, yet be able to skip to specific tracks with an appropriate player? One CD album that comes to mind is the music from “1492: Conquest of Paradise”, where tracks 1 and 2 play without a gap on a CD player, but invariably get a 2-second gap if one burns the WAV files to another CD or if they’re ripped to MP3 and played in an MP3 player. Most MP3 players, as far as I know, automatically insert a gap between tracks and there is no way to suppress this behavior or set a different gap length.

Well, the CUE file is just for splitting the album in one FLAC file to separate FLACs for each song. Whether you then play the tracks as FLACs or convert them to MP3 and then play them, the gap (which does not appear between tracks when playing the actual disc) will automatically be inserted by some players, as you mention. Not sure which one you’re using, but good old Rhythmbox doesn’t add them – at worst, all I notice is a slight *bump* as it moves from one track to the next, but definitely no gap of even a second, let alone two. Now, if you using Rhythmbox and that isn’t happening for you, there is one trick you can try. While gapless playback is (apparently) not enabled by default, you can go to Edit > Preferences, and in the Playback tab check the box next to Crossfade between tracks, setting the value of Crossfade Duration (Seconds) to 0.0. However, on my system crossfade is not enabled, and I still get gapless playback. So if you try the crossfade and it doesn’t change things, check out other Linux players like Aqualung which explicitly support gapless playback. Failing that too, you will then need to look at the tags of the song files themselves (not all media types support gapless playback [though MP3s should be fine]), or even your gstreamer configuration. All the best!

The easiest way is using K3B. 1.- Open the CUE file in K3B. 2.- Choose convert tracks to FLAC. 3.- Press Start. It will not re-convert the tracks but only split them into tracks according to the CUE file. It will keep the original name of each track and it takes seconds to complete the “convertion/split”.

Источник

Универсальные

Понадобится установить три пакета. Скачиваем первый пакет:

wget http://members.iinet.net.au/~aidanjm/mac-3.99-u4_b3-1_i386.deb

И устанавливаем его командой:

sudo dpkg -i mac-3.99-u4_b3-1_i386.deb
sudo apt-get install flac sudo apt-get install shntool

Допустим, нужно сделать преобразование APE ⇒ FLAC В терминале заходим в директорию, где лежат файлы APE:

После чего набираем команду:

Результатом выполнения команды будет переконвертация всех файлов APE в формат FLAC

Читайте также:  Копировать файл linux командная строка

А эта команда преобразовывает APE в WAV:

Способ 2 (подходит для amd64)

sudo aptitude install cuetools shntool flac wavpack

Отсюда (т.к. репозиторий, который был указан в статье на Opennet, не хотел добавляться) ставим libmac2 и monkeys-audio

Выделяем треки из sample.flac на основании индекса sample.cue, результат кодируем кодеком без потерь flac:

cuebreakpoints sample.cue | shnsplit -a "sample" -o flac sample.flac

При желании вместо «-o flac» можно указать «-o wav», «-o mp3» или «-o ogg». Опция «-a sample» задает имя префикса для сохраняемой группы файлов.

cuetag sample.cue sample*.flac

Если файл *.cue в неправильной кодировке, то сохраните его в правильной (geditom, например). Правильная — UTF-8.

Проверено на ubuntu 9.04 amd64

Кодирование в mp3

Вариант «-o mp3» не сработает, выдав ошибку:

shnsplit: error: invalid file format: [mp3] shnsplit: shnsplit: type 'shnsplit -h' for help

Смотрим man shnsplit, касательно ключа -o :

-o -o ’cust ext=mp3 lame --quiet - %f’ (create mp3 files using lame)

Он говорит, что конвертирование в mp3 делается через lame, т.е. нам нежен еще пакет lame :

sudo aptitude install lame

И, следовательно, команда будет выглядеть примерно так:

cuebreakpoints sample.cue | shnsplit -a "sample" -o 'cust ext=mp3 lame --quiet - %f' sample.flac

По другим форматам вывода смотрите man, например для вывода в wav достаточно -o wav :

cuebreakpoints sample.cue | shnsplit -a "sample" -o wav sample.flac

Flac в MP3

Пофайловая конвертация c переносом ID тэгов

Зависимости

Для конвертации понадобятся программы flac и lame

sudo apt-get install libav-tools

Скрипт

Скрипт для конвертации (сохранен в ~/bin/)

#!/bin/bash for f in *.flac; do avconv -i "$f" -qscale:a 0 "$" done

Алгоритм действий

Переходим в папку с flac файлами запускаем скрипт в виде ~/bin/flac-mp3.sh

Flac-образ в mp3 c разбивкой на трэки

Зависимости

sudo apt-get install shntool cuetools lame enca

Скрипт

#!/bin/sh FROMCP=`enca -e *.cue` iconv -f $FROMCP -t UTF-8 *.cue > /tmp/list.cue DATE=`grep "REM DATE" /tmp/list.cue | sed -e 's/REM DATE \(.*\)/\1/g'` GENRE=`grep "REM GENRE" /tmp/list.cue | sed -e 's/REM GENRE \(.*\)/\1/g'` COMMENT=`grep "REM COMMENT" /tmp/list.cue | sed -e 's/REM COMMENT \(.*\)/\1/g'` NUMBER=`cueprint -d "%N" /tmp/list.cue` shntool split -f /tmp/list.cue *.flac -t %n for((I=1;I=$NUMBER;I++)); do cueprint -n $I -t "ARTIST=\"%p\"\nALBUM=\"%T\"\nTRACKNUMBER=\"%n\"\nTITLE=\"%t\"\n" /tmp/list.cue > /tmp/tags . /tmp/tags J=`printf "%02d" $I` lame -b 192 --cbr \ --ty "$DATE" \ --tg "$GENRE" \ --tc "$COMMENT" \ --ta "$ARTIST" \ --tl "$ALBUM" \ --tn "$TRACKNUMBER" \ --tt "$TITLE" \ --add-id3v2 \ --id3v2-only \ $J.wav $J.mp3 rm $J.wav done rm /tmp/list.cue /tmp/tags

Примечания

Ошибки

iconv: convert from ASCII/CRLF is not supported

значит необходимо сконвертировать CRLF переносы строки при помощи dos2unix

sudo apt-get install dos2unix dos2unix *.cue

Советы

Для правильного распознования тэгов загляните в файл CUE и проверьте, что названия полей совпадают с теми, что будут использоватся в скрипте.

Другие программы

Cueek — скрипт для конвертирования образов музыкальных альбомов в другой формат потреково, с переносом тэгов.

Ссылки

APE => FLAC, APE =>WAV, WAV=>FLAC и другие комбинации перекодировок аудио — статья на форуме. Кроме прочего, содержит ссылки на другие программы.

Источник

unixforum.org

Надо разбить скачанный флак по трекам. Не хочется юзать редакторы, думаю есть тулзы как под виндой. Не гонять же вайн?

 From Somewhere $ ls Covers Don Ross & Andy McKee - The Thing That Came From Somewhere.cue Don Ross & Andy McKee - The Thing That Came From Somewhere.flac LOG

rm_ Сообщения: 3340 Статус: It’s the GNU Age ОС: Debian Контактная информация:

Re: Конвертировать flac+cue

Сообщение rm_ » 29.08.2009 17:36

Re: Конвертировать flac+cue

Сообщение SilentOS » 29.08.2009 18:10

cuebreakpoints CDImage.cue | shnsplit -o flac CDImage.ape cuebreakpoints CDImage.cue | shnsplit -o flac CDImage.flac

Xaktyc Сообщения: 604 ОС: Gentoo 2008.0, WinXP Контактная информация:

Re: Конвертировать flac+cue

Сообщение Xaktyc » 29.08.2009 18:44

Можно подсказку в каких пакетах оно есть?

«Ещё один» скрипт для преобразования музыкальных альбомов в формате CUE+(один FLAC/APE/WV-файл) в отдельные трёки FLAC, с чтением тэгов из CUE-файла и их переносом во FLAC’и.
Основное отличие этого скрипта от других состоит в том, что он написан в расчёте на использование в Debian:

У меня вроде как Gentoo, написано, стоит.

rm_ Сообщения: 3340 Статус: It’s the GNU Age ОС: Debian Контактная информация:

Re: Конвертировать flac+cue

Сообщение rm_ » 29.08.2009 20:39

Чтобы переделать тот скрипт под Gentoo, достаточно исправить три строчки (проверку наличия в системе нужных пакетов), либо вообще их удалить, если Вы уверены, что всё нужное в системе уже есть.

Re: Конвертировать flac+cue

Сообщение SilentOS » 30.08.2009 00:24

Xaktyc Сообщения: 604 ОС: Gentoo 2008.0, WinXP Контактная информация:

Re: Конвертировать flac+cue

Сообщение Xaktyc » 30.08.2009 10:20

Re: Конвертировать flac+cue

Сообщение smeea » 30.08.2009 14:29

Re: Конвертировать flac+cue

k3b
Открываем проект AudioCD диска и добавляем в него cue файл. А далее там кнопочка «конвертировать» есть.

Re: Конвертировать flac+cue

Сообщение -AR- » 31.08.2009 18:59

Действует по принципу. Образ >> WAV >> Нарезка >> Сжатие в указанный кодек (flac, mp3, ogg etc) >> Переименование и перемещение.

З.ы. Подобные темы часто мелькают, неплохо было бы сделать иллюстрированный мануал и прикрепить тему.

Xaktyc Сообщения: 604 ОС: Gentoo 2008.0, WinXP Контактная информация:

Re: Конвертировать flac+cue

Сообщение Xaktyc » 31.08.2009 19:24

З.ы. Подобные темы часто мелькают, неплохо было бы сделать иллюстрированный мануал и прикрепить тему.

Re: Конвертировать flac+cue

Сообщение -AR- » 31.08.2009 19:27

Сделаю на примере gCue2tracks, хотя чего может быть непонятного в гуишной проге, не знаю.

UPD
Подумал я. ещё раз подумал. И решил не писать никаких мануалов, ибо нефиг. Программа проста как советский трёхколёсный велосипед, если будем к т аким мануалы писать, то скоро у некоторых мозги атрофируются.

1. Качаем и ставим (удовлетворяя зависимости), или качаем и собираем. http://www.gtk-apps.org/content/show.php/g. s?content=80703 http://www.assembla.com/wiki/show/gCue2tracks . Если при выполнении данного пункта у вас возникли проблемы, переходите к пункту 7

2. Запускаем программу.

3. Выбираем файл CUE, по нему автоматически будет найден образ, будет показан список треков. Если в CUE хранилась информация о тегах, она будет записана при конвертировании. Выбираем аудиокодер, качество/битрейт. Жмём Конвертировать.

Изображение

5. Слушаем полученный файлы. Что не надо — удаляем.

6. Радуемся жизни.

7. Для чтение, если навернулись на пункте 1. Как советуют добрые люди, ставьте Foobar под Wine, проделывайте все необходимые операции там. После переходите на пункты 5 и 6

Источник

Оцените статью
Adblock
detector