HydrogenAudio

Lossless Audio Compression => FLAC => Topic started by: Rayearth on 2015-05-17 13:15:52

Title: flac --cuesheet (track numbers sequential)
Post by: Rayearth on 2015-05-17 13:15:52
My sample cuesheet look like this
Code: [Select]
REM GENRE Soundtrack
REM DATE 2009
PERFORMER "Christian Marcussen"
TITLE "Operation Flashpoint: Dragon Rising"
FILE "Christian Marcussen - Operation Flashpoint - Dragon Rising.wav" WAVE
  TRACK 01 AUDIO
    TITLE "Menu Theme"
    PERFORMER "Christian Marcussen"
    INDEX 01 00:00:00
  TRACK 10 AUDIO
    TITLE "End Credits"
    PERFORMER "Christian Marcussen"
    INDEX 01 05:57:39
So only first and last track.

And this is my cmd line
Code: [Select]
flac.exe --force --no-utf8-convert --compression-level-0 --tag "ALBUMARTIST=!albumartist!" --tag "DISCNUMBER=!discnumber!" --tag "TOTALDISCS=!totaldiscs!" --cuesheet="Christian Marcussen - Operation Flashpoint - Dragon Rising.cue" --picture="Christian Marcussen - Operation Flashpoint - Dragon Rising" "Christian Marcussen - Operation Flashpoint - Dragon Rising.wav"


Error msg
Code: [Select]
Error parsing cuesheet on line 10: CD-DA TRACK numbers must be sequential
Encoding won't start. Why? What's the point? How to ignore this ridiculous restriction?

If "TRACK 10 AUDIO" set to "TRACK 02 AUDIO" in the cuesheet - warning:
Code: [Select]
WARNING cuesheet is not audio compliant: CD-DA cue sheet lead-out offset must be evenly divisible by 588 samples

Encoding starts and finishes. The output flac in foobar2k doesn't look good
(http://i.imgur.com/SqOB8jJ.png)

What is happening?
Title: flac --cuesheet (track numbers sequential)
Post by: lvqcl on 2015-05-17 13:31:21
Encoding won't start. Why? What's the point? How to ignore this ridiculous restriction?

Don't (ab)use CUE sheets: they describe audio layout on CD disks, not some arbitrary data.

Encoding starts and finishes. The output flac in foobar2k doesn't look good [...] What is happening?

FLAC and foobar2000 use CUE sheets in 2 different incompatible ways. And IMHO FLAC --cuesheet option is pretty much obsolete.
Title: flac --cuesheet (track numbers sequential)
Post by: Rayearth on 2015-05-17 16:03:32
I have tons of albums and singles from them ripped with EAC to WAV+CUE, want to use FLAC format for archiving that collection and playing it with foobar2k. What method of encoding and embedding track information and cover art would You recommend?
Title: flac --cuesheet (track numbers sequential)
Post by: ChronoSphere on 2015-05-17 22:01:16
Try using CUETools, it can handle most types of cuesheets (unlike foobar2000 which can't handle non-compliant cuesheets). It can convert from and to most formats as well.
Title: flac --cuesheet (track numbers sequential)
Post by: korth on 2015-05-19 23:10:26
Try --tag-from-file="CUESHEET=image.cue" (https://xiph.org/flac/documentation_tools_flac.html#flac_options_tag_from_file) instead of --cuesheet="image.cue" (https://xiph.org/flac/documentation_tools_flac.html#flac_options_cuesheet)
foobar2k can read the CUESHEET tag.

edit: The file extension in the CUESHEET tag doesn't change. This shouldn't matter in foobar2k but it might in other programs. You can use foobar2k to edit the FILE line in the embedded CUESHEET tag from .wav to .flac.

Error msg
Code: [Select]
Error parsing cuesheet on line 10: CD-DA TRACK numbers must be sequential
Encoding won't start. Why? What's the point? How to ignore this ridiculous restriction?

http://digitalx.org/cue-sheet/syntax/#track (http://digitalx.org/cue-sheet/syntax/#track)
Quote
Rules:

All track numbers must be between 1 and 99 inclusive. The first track number can be greater than one, but all track numbers after the first must be sequential. You must specify at least one track per file.
Title: flac --cuesheet (track numbers sequential)
Post by: Rayearth on 2015-05-23 10:52:16
Try --tag-from-file="CUESHEET=image.cue" (https://xiph.org/flac/documentation_tools_flac.html#flac_options_tag_from_file) instead of --cuesheet="image.cue" (https://xiph.org/flac/documentation_tools_flac.html#flac_options_cuesheet)
foobar2k can read the CUESHEET tag.

No erros during encoding/embedding cue.
Looks like the cuesheet is embedded into flac file.
(http://s5.postimg.org/m9adcjpyv/screenshot_1.png)

However, foobar2k doesn't seems to read CUESHEET tag.
(http://s5.postimg.org/j4zpfr96f/screenshot_2.png)

Do I have to enable/change something in foobar2k's config?
Title: flac --cuesheet (track numbers sequential)
Post by: lvqcl on 2015-05-23 11:01:20
That's probably because foobar2000 treats this cuesheet as invalid (track 10 immediately after track 01).
Title: flac --cuesheet (track numbers sequential)
Post by: Rayearth on 2015-05-23 11:10:02
Nope. Changed the TRACK 10 to TRACK 02 in the cuesheet - same results.
Title: flac --cuesheet (track numbers sequential)
Post by: lvqcl on 2015-05-23 11:47:16
I took a wav file and encoded it to flac:
Code: [Select]
flac test.wav --tag-from-file CUESHEET=test.cue -o out.flac

(the cuesheet was copied to a file from the 1st post).
foobar2000 is able to see the embedded cuesheet and shows two tracks: 01 - Menu Theme and 10 - Credits (so I was wrong when I assumed that to be a problem).

It seems that your CUE file is in UTF-8 format with BOM, and FLAC copies BOM from the file to the tag. And foobar2000 doesn't like BOM in the beginning of the cuesheet tag.
Title: flac --cuesheet (track numbers sequential)
Post by: nu774 on 2015-05-23 13:28:09
From operations_shorthand_vorbiscomment.c in metaflac source:
Code: [Select]
    case OP__SET_VC_FIELD:
#ifdef _WIN32 /* do not convert anything or things will break */
        ok = set_vc_field(filename, block, &operation->argument.vc_field, needs_write, true);
#else
        ok = set_vc_field(filename, block, &operation->argument.vc_field, needs_write, raw);
#endif

So, in Windows, metaflac --set-tag-from-file always copies raw data in the file as if --no-utf8-convert was specified.
I guess it's because command line arguments are always unicode in Windows, so it's reasonable and fine for --set-tag=FIELD.
As for --set-tag-from-file, it may not be so good.
Title: flac --cuesheet (track numbers sequential)
Post by: lvqcl on 2015-05-23 13:45:44
Do flac/metaflac know what to do with BOM bytes?
Title: flac --cuesheet (track numbers sequential)
Post by: nu774 on 2015-05-23 14:22:34
Do flac/metaflac know what to do with BOM bytes?

No.
Title: flac --cuesheet (track numbers sequential)
Post by: Rayearth on 2015-05-23 19:55:29
It seems that your CUE file is in UTF-8 format with BOM, and FLAC copies BOM from the file to the tag. And foobar2000 doesn't like BOM in the beginning of the cuesheet tag.

Yeah... In the meantime I've done some testing and the results pointed to cuesheet encoding (UTF-8 with BOM). Got some cuesheets with non-ANSI characters. Any suggestions how to encode them for f2k to displays those characters correctly?
Title: flac --cuesheet (track numbers sequential)
Post by: lvqcl on 2015-05-23 20:39:43
Any suggestions how to encode them for f2k to displays those characters correctly?


Try this: create a CUE file in UTF-8 encoding, but without BOM mark. Then encode it as:

flac --no-utf8-convert --tag-from-file CUESHEET=file.cue -5 test.wav -o out.flac
Title: flac --cuesheet (track numbers sequential)
Post by: Rayearth on 2015-05-24 13:37:49
Yes! It worked. This concludes the battle... Thanks for all the help