PDA

View Full Version : How are flac (embedded) quesheets expected to work?



Slonk
2009-12-20, 13:27
.flac file's are often originating from CD backup rip's and accompanied by a .cue file. Using the .cue and the .flac, the original CD may be recreated.

Without any further tagging of the .flac file SBS can use the .cue/.flac combo to generate usefull track data for SBS.

However, let's say I would like to drop the .cue file because .flac file allows to embed cue info. A .flac file may contain the following:

* type 5 CUESHEET block. "--import-cuesheet-from=FILE=... Import a cuesheet from a file. A seekpoint will be added for each index point in the cuesheet to the SEEKTABLE."

* type 4 VORBIS comment block with regular tagging

* type 4 VORBIS comment block with special CUESHEET tagging "--set-tag-from-file="CUESHEET=image.cue""

To take a shortcut: .flac files without .cue files do not work using SBS 7.4.1.

The type 5 CUESHEET block works a tiny little bit, SBS seems to understand the track boundaries. Thats all.

The type 4 VORBIS special CUESHEET block doesn't do a thing.

QUESTION: what kind of .flac embedded cuesheet data is supposed to work (if any)?

No use making a bug entry if I have no idea what's supported and what not...

gharris999
2009-12-20, 18:25
Flacs with embedded cuesheets work very well with the nightly releases of 7.4.2 and 7.5 and with the final release of 7.3.4. There was a bug with the initial release of 7.4 that screwed up correct processing of embedded cuesheets in certain rare circumstances but that bug has been resolved.

Embedded cuesheets share the same limitation as external cuesheets with SC/SBS: the flacs will get transcoded by the server rather than streamed directly to the player. This isn't much of a limitation now, but it is a couple of extra processes running on your server. If you know absolutely that none of your flacs have spurious ID3vX tags...i.e. just native Vorbis tags, you can use this custom-convert.conf file to eliminate the necessity of SBS spawning a SOX process.

custom-convert.conf


flc flc transcode *
# FT:{START=--skip=%t}U:{END=--until=%v}D:{RESAMPLE=-r %d}
[flac] -c --totally-silent --compression-level-0 $START$ $END$ $FILE$

With that custom-convert.conf, just a single flac process is spawned, e.g.:


3347 ? S 0:03 /usr/share/squeezecenter_trunk/server/Bin/i386-linux/flac -c --totally-silent --compression-level-0 --skip=38:41.02 --until=43:22.69 /mnt/media/Music/g_German_Baroque/Bach, J S/Kbd Die Kunst der Fuge, BWV 1080 - Menno Van Delft - D1.flac



My library of 2537 albums by 1084 artists with 48183 tracks is almost completely made up of whole-cd flacs with embedded cuesheets and embedded album art. 3985 flacs (many tagged as multi-disc albums) make up the collection. SC 7.3.4 and SBS 7.4.2 work just fine with this collection.

Here's an example cuesheet from the above album:


REM DISC_ID E01764
REM CDDB_ID 830bcb0b
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
TITLE "Kbd Die Kunst der Fuge, BWV 1080 - Menno Van Delft"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
FILE "Kbd Die Kunst der Fuge, BWV 1080 - Menno Van Delft - D1.flac" WAVE
REM COMMENT "J S Bach (1685-1750); Die Kunst der Fuge, BWV.1080 (v1742, rev. c1745,1748–9); Menno Van Delft, harpsichord, Geert Karman, 1997 after an instrument of Johann Heinrich Gräbner, Dresden, 1744; "
TRACK 01 AUDIO
TITLE "Die Kunst der Fuge, BWV.1080 (v1742, rev. c1745,1748–9) - 1 Contrapunctus 1"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 00:00:00
TRACK 02 AUDIO
TITLE " 2 Contrapunctus 2"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 03:35:57
TRACK 03 AUDIO
TITLE " 3 Contrapunctus 3"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 07:24:20
TRACK 04 AUDIO
TITLE " 4 Contrapunctus 4"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 10:27:17
TRACK 05 AUDIO
TITLE " 5 Contrapunctus 5"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 15:53:47
TRACK 06 AUDIO
TITLE " 6 Contrapunctus 6 a 4 in stylo Francese"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 19:30:47
TRACK 07 AUDIO
TITLE " 7 Contrapunctus 7 a 4 per Augmentationem et Diminutionem"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 24:10:32
TRACK 08 AUDIO
TITLE " 8 Contrapunctus 8 a 3"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 29:00:62
TRACK 09 AUDIO
TITLE " 9 Contrapunctus 9 a 4 alla Duodecima"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 35:14:20
TRACK 10 AUDIO
TITLE " 10 Contrapunctus 10 a 4 alla Decima"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 38:41:02
TRACK 11 AUDIO
TITLE " 11 Contrapunctus 11 a 4"
PERFORMER "Bach, J S"
REM COMPOSER "Bach, J S"
REM GENRE "g_German_Baroque"
REM YEAR "1999"
INDEX 01 43:22:52

I haven't experimented with adding DISC and DISCC tags to cuesheets to indicate multi-disc albums. Instead, my embedding script automatically adds a DISCNUMBER tag using metaflac if it sees that the input flac filename ends in " - Dn.flac" This DISCNUMBER tag is independent of the embedded cuesheet. But again, SBS interprets this correctly and combines the multi-disc albums into a single album if you have the settings so set.

The biggest problem with embedded cuesheets is that it's a minority format. Periodically, support for this format breaks in the SBS development code and it's usually the last format to get fixed too. That said, this is my preferred format. I'd much rather have 4000 flacs to wrangle than 40000.

gharris999
2009-12-20, 18:43
But, to more directly answer your question, here are the metaflac commands I use for embedding a cuesheet and cover art. These are taken from a windows cmd batch file and the assumption here is that the target flac file and the cuesheet share the same base filename. It's also assumed here that the cuesheet file is alreay UTF8 encoded.



@echo off

:CHGDIR
rem change to the input file drive and directory..
%~d1
cd "%~p1"
if "%CD%\"=="%~dp1" goto CHK_FLAC
echo Sorry. "%CD%\" does not == "%~dp1"
goto end


:CHK_FLAC
if exist "%~n1.flac" goto IN_DIR
echo Sorry. I only process FLAC files. Better luck next time.
pause
goto end

:IN_DIR
echo Processing "%~nx1"

:ZAP_TAGS
echo Removing tags..
"%~dp0metaflac.exe" --remove-all "%~n1.flac"
"%~dp0metaflac.exe" --merge-padding "%~n1.flac"
"%~dp0metaflac.exe" --sort-padding "%~n1.flac"


rem Import and embed the cuesheet
echo Importing and embedding utf8 cuesheet
"%~dp0metaflac.exe" --no-utf8-convert "--import-cuesheet-from=%~n1.cue" "--set-tag-from-file=CUESHEET=%~n1.cue" "%~n1.flac"

:CALC_RPG
echo Calculating and adding replay-gain info..
"%~dp0metaflac.exe" --add-replay-gain "%~n1.flac"

:NUM_DISCS
for /L %%Z in (1,1,9) do for %%I in ("* - D%%Z.flac") do if "%%I"=="%~n1.flac" if exist "%%I" echo Numbering discs.. & "%~dp0metaflac.exe" --set-tag=DISCNUMBER=%%Z "%%I"
for /L %%Z in (1,1,9) do for %%I in ("* - D0%%Z.flac") do if "%%I"=="%~n1.flac" if exist "%%I" echo Numbering discs.. & "%~dp0metaflac.exe" --set-tag=DISCNUMBER=0%%Z "%%I"
for /L %%Z in (10,1,99) do for %%I in ("* - D%%Z.flac") do if "%%I"=="%~n1.flac" if exist "%%I" echo Numbering discs.. & "%~dp0metaflac.exe" --set-tag=DISCNUMBER=%%Z "%%I"

:EMBED_SPECIFIC_PICT
echo Embedding coverart.. & "%~dp0metaflac.exe" "--import-picture-from=|image/jpeg|||%~n1.jpg" "%~n1.flac"

:REMOVE_PADDING
echo Removing padding..
"%~dp0metaflac.exe" --dont-use-padding --remove --block-type=PADDING "%~n1.flac"

:end

If you're working in a windows environment, you can just create a shortcut on your desktop to that batch file. Then you can drag and drop a flac file onto the shortcut. The batch file will then embed the cuesheet, cover art, add replay-gain info and add DISCNUMBER tags.

I have a whole series of such scripts and utilities useful for managing flacs with embedded cuesheets. Let me know if you're interested in them and I'll post my (mostly home made) tool box.

Slonk
2009-12-21, 15:32
@gharris999:

Many thanks for your extended and very informative reply. After lookin up the bugs you refer to I think I must have stumbled on the FILE=path/file issue, which must be correct for the 7.4.1 scanner to function. I'll need some time to check upon 7.4.2 and/or recreating example flacs with correct FILE= data in the embbeded CUE sheet (my test cases omit a correct path to be sure..., but was the FILE parameter also dependend on the PATH in 7.4.1?). Reporting back later..

Slonk
2009-12-23, 14:11
OK, using 7.4.2 beta (20-12-2009) things are starting to work better. I experimented with the two different types of embedded cuesheets. I created 4 flacs:

1. flac type 5 cuesheet block (--import-cuesheet-from)
2. flac type 4 vorbis comment block with cuesheet syntax (--set-tag-from-file="CUESHEET=...)
3. flac file having both.
4. flac cleared from all info blocks

SBS could not figure out #1, but did undertstand #2 and #3. So my conclusion is:

* SBS 7.4.2 parses a type 4 vorbis cuesheet

However, when you start up flac files using the Music Folder, no flac file plays, except #4! Strange...

gharris999
2009-12-26, 09:46
However, when you start up flac files using the Music Folder, no flac file plays, except #4! Strange...
I believe that this is a longstanding limitation. Flacs with embedded cues have long been kind of "2nd class citizens" in the SBS world.

gharris999
2009-12-26, 09:51
@gharris999:

Many thanks for your extended and very informative reply. After lookin up the bugs you refer to I think I must have stumbled on the FILE=path/file issue, which must be correct for the 7.4.1 scanner to function. I'll need some time to check upon 7.4.2 and/or recreating example flacs with correct FILE= data in the embbeded CUE sheet (my test cases omit a correct path to be sure..., but was the FILE parameter also dependend on the PATH in 7.4.1?). Reporting back later..

These were actually interrelated bugs. Fixing the FILE != actual filename issue solves the diacritics-in-the-path issue. But since Andy fixed the latter problem first, that fix stayed in, though it's not needed.