Linux command-line tool for converting WAV-image to FLAC singletracks, Input: EAC LOG + WAV + CUE, no Internet / user interaction required |
![]() ![]() |
Linux command-line tool for converting WAV-image to FLAC singletracks, Input: EAC LOG + WAV + CUE, no Internet / user interaction required |
Oct 28 2012, 18:03
Post
#1
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
This is an encoder script for EAC "Test & copy image" mode.
It splits the WAV image to WAV singletracks according to the EAC CUE and encodes them to FLACs. Its goal is to produce perfect FLAC files by verifying checksums in all steps and being totally paranoid. For guaranteeing this, it does the following checks and aborts if any of them fails:
Sample output: CODE perfect-flac-encode.sh Version BETA2 running ... BETA VERSION - NOT for productive use! Album: Paul Weller - Wild Wood Checking EAC LOG for whether AccurateRip reports a perfect rip... AccurateRip reports a perfect rip. Splitting WAV image to singletrack WAVs... shntool [split]: warning: discarding initial zero-valued split point Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/01 - Sunflower.wav] (4:06.62) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/02 - Can you heal us (holy man).wav] (3:41.68) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/03 - Wild wood.wav] (3:22.30) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/04 - Instrumental one (Part 1).wav] (1:37.05) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/05 - All the pictures on the wall.wav] (3:56.47) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/06 - Has my fire really gone out.wav] (3:51.38) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/07 - Country.wav] (3:38.60) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/08 - Instrumental two.wav] (0:49.52) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/09 - 5th season.wav] (4:54.00) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/10 - The weaver.wav] (3:43.08) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/11 - Instrumental one (Part 2).wav] (0:33.42) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/12 - Foot of the mountain.wav] (3:37.60) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/13 - Shadow of the sun.wav] (7:36.43) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/14 - Holy man (Reprise).wav] (1:50.72) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/15 - Moon on your pyjamas.wav] (4:02.00) : .......... OK Splitting [Paul Weller - Wild Wood.wav] (54:04.55) --> [Stage1_WAV_Singletracks_From_WAV_Image/16 - Hung up.wav] (2:41.68) : .......... OK Comparing AccurateRip checksums of split WAV singletracks to AccurateRip checksums from EAC LOG... AccurateRip checksum of track 01: 12A17108, expected 12A17108. OK. AccurateRip checksum of track 02: B8B12553, expected B8B12553. OK. AccurateRip checksum of track 03: EE647F8C, expected EE647F8C. OK. AccurateRip checksum of track 04: 198D1B89, expected 198D1B89. OK. AccurateRip checksum of track 05: 443F683F, expected 443F683F. OK. AccurateRip checksum of track 06: D4EA2156, expected D4EA2156. OK. AccurateRip checksum of track 07: 23A1013A, expected 23A1013A. OK. AccurateRip checksum of track 08: 59846ADB, expected 59846ADB. OK. AccurateRip checksum of track 09: 562695D4, expected 562695D4. OK. AccurateRip checksum of track 10: F8F465AC, expected F8F465AC. OK. AccurateRip checksum of track 11: 779AA114, expected 779AA114. OK. AccurateRip checksum of track 12: 826FDC3D, expected 826FDC3D. OK. AccurateRip checksum of track 13: 08E26E72, expected 08E26E72. OK. AccurateRip checksum of track 14: BB90680D, expected BB90680D. OK. AccurateRip checksum of track 15: 37AAC77A, expected 37AAC77A. OK. AccurateRip checksum of track 16: 1A3CD493, expected 1A3CD493. OK. Joining singletrack WAV temporarily for comparing their checksum with the original image's checksum... Joining [Stage1_WAV_Singletracks_From_WAV_Image/01 - Sunflower.wav] (4:06.62) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/02 - Can you heal us (holy man).wav] (3:41.68) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/03 - Wild wood.wav] (3:22.30) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/04 - Instrumental one (Part 1).wav] (1:37.05) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/05 - All the pictures on the wall.wav] (3:56.47) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/06 - Has my fire really gone out.wav] (3:51.38) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/07 - Country.wav] (3:38.60) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/08 - Instrumental two.wav] (0:49.52) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/09 - 5th season.wav] (4:54.00) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/10 - The weaver.wav] (3:43.08) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/11 - Instrumental one (Part 2).wav] (0:33.42) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/12 - Foot of the mountain.wav] (3:37.60) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/13 - Shadow of the sun.wav] (7:36.43) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/14 - Holy man (Reprise).wav] (1:50.72) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/15 - Moon on your pyjamas.wav] (4:02.00) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK Joining [Stage1_WAV_Singletracks_From_WAV_Image/16 - Hung up.wav] (2:41.68) --> [Stage2_WAV_Image_Joined_From_WAV_Singletracks/joined.wav] (54:04.55) : .......... OK No padding needed. Computing checksums... Original checksum: e47804481da6959636de7fbad147e3f2b2131c682aa54f07a2405d2b27aa7bdf Checksum of joined image: e47804481da6959636de7fbad147e3f2b2131c682aa54f07a2405d2b27aa7bdf Checksum of joined image OK. Encoding singletrack WAVs to FLAC ... NOTE: --keep-foreign-metadata is a new feature; make sure to test the output file before deleting the original. Running flac --test on singletrack FLACs... Decoding singletrack FLACs to WAVs to validate checksums ... NOTE: --keep-foreign-metadata is a new feature; make sure to test the output file before deleting the original. Generating checksums of original WAV files... Validating checksums of decoded WAV singletracks ... 01 - Sunflower.wav: OK 02 - Can you heal us (holy man).wav: OK 03 - Wild wood.wav: OK 04 - Instrumental one (Part 1).wav: OK 05 - All the pictures on the wall.wav: OK 06 - Has my fire really gone out.wav: OK 07 - Country.wav: OK 08 - Instrumental two.wav: OK 09 - 5th season.wav: OK 10 - The weaver.wav: OK 11 - Instrumental one (Part 2).wav: OK 12 - Foot of the mountain.wav: OK 13 - Shadow of the sun.wav: OK 14 - Holy man (Reprise).wav: OK 15 - Moon on your pyjamas.wav: OK 16 - Hung up.wav: OK All checksums OK. |
|
|
|
Oct 28 2012, 19:32
Post
#2
|
|
|
Group: Members Posts: 582 Joined: 12-May 06 From: Colorado, USA Member No.: 30694 |
How is HTOA handled?
Does "Go fuck yourself" really need to be one of the messages? |
|
|
|
Oct 28 2012, 19:41
Post
#3
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
How is HTOA handled? perfect-flac-encode itself does not parse CUE-sheets. They are interpreted by shntool. Therefore, the HTOA handling is up to shntool. The current commandline of shntool which is used is the following: CODE shntool split -P dot -d "$outputdir_relative" -f "$1.cue" -n %02d -t "%n - %t" -- "$1.wav" ($1 = filename of cue/wav) The commandline of shntool is still up for discussion. If you feel like different settings should be chosen for better HTOA handling, feel free to suggest those. Does "Go fuck yourself" really need to be one of the messages? Consider it as an easter-egg - The tool is aimed for being used in a setup to produce absolutely perfect rips, incorrect rips are not welcome I've changed the wording though, thanks for reporting this, I had forgotten about it. This post has been edited by leo-bogert: Oct 28 2012, 20:33 |
|
|
|
Oct 31 2012, 19:10
Post
#4
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
BETA3 available now.
Changelog: - Fix possible bug in startup temp dir deletion when using directory names with spaces - Make syntax match the syntax which is described in README.md: BETA2 used to assume that the CUE/WAV/LOG reside in a "<Artist> - <Title>" subdirectory of the directory which is the first parameter. We now assume that the first parameter is the directory where they reside in. - Move output FLACs to a newly created "<Artist> - <Title>" subdirectory upon success (and include this directory in the "delete existing output?" check upon startup). - Copy CUE/LOG to output directory ("<Artist> - <Title>") upon success - Delete temporary output directories upon success - Print an explicity SUCCESS message with the name of the output dir - Add TODO which shall be resolved in BETA4: What about the checksum in the EAC-LOG? Is it a plain CRC32 or a magic checksum with some samples excluded? If it is no plain checksum then we should keep the sha256sum as a file in the output dir for the user so he can check the sum in case he ever re-joins the FLACs to a WAV image. - Internal cleanup: Rename variables / functions to make their purpose more obvious |
|
|
|
Nov 1 2012, 03:58
Post
#5
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
BETA4 available now.
Changelog:
|
|
|
|
Nov 1 2012, 17:02
Post
#6
|
|
|
Group: Members Posts: 25 Joined: 14-February 12 Member No.: 97152 |
The CRC outputted by EAC excludes the RIFF header, just hashes the raw PCM audio data. If you rip to wav and delete the first 44 bytes of wav file, CRC of that file will match the reported by EAC. So, you could change the routine so that ignores the first 44 bytes of outputted wav fie, and hashes just the audio data. It is a plain CRC32, nothing magic, like AccurateRip's checksum.
|
|
|
|
Nov 1 2012, 17:46
Post
#7
|
|
![]() Group: Members Posts: 1063 Joined: 4-May 04 From: France Member No.: 13875 |
To compute an EAC-compatible CRC hash:
CODE mkfifo 'fifo' shncat -q -e 'file.wav' > 'fifo' & crc="$( cksfv -b 'fifo' | fgrep -v ';' )" There must be a more straightforward way, but I haven't investigated any further. -------------------- Save my friend from going homeless: http://outpost.fr/url/308w
|
|
|
|
Nov 4 2012, 17:48
Post
#8
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
To compute an EAC-compatible CRC hash: Thank you. Yes, I found a more straightforward way which doesn't need a FIFO and uses a pipe instead.CODE mkfifo 'fifo' shncat -q -e 'file.wav' > 'fifo' & crc="$( cksfv -b 'fifo' | fgrep -v ';' )" There must be a more straightforward way, but I haven't investigated any further. Using that, I've published a tool to compute the EAC CRC on github: https://github.com/leo-bogert/eac-crc I hope you are OK with me adding a donation address to it. I decided for this because my script works quite different to yours. This post has been edited by leo-bogert: Nov 4 2012, 18:01 |
|
|
|
Nov 4 2012, 18:01
Post
#9
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
BETA6 available now.
The changelog of BETA5 should be considered, BETA6 was needed for a simple quickfix and contains no actual changes. BETA5/6 Changelog:
|
|
|
|
Nov 7 2012, 00:47
Post
#10
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
BETA7 available. Changelog follows. Notice that there are quite a few questions in in which I would request feedback for. Thank you!
This post has been edited by leo-bogert: Nov 7 2012, 00:55 |
|
|
|
Nov 8 2012, 02:56
Post
#11
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
BETA8 available now. Changelog:
|
|
|
|
Nov 9 2012, 05:46
Post
#12
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
BETA9/10 available.
10 is only a bugfix for 9, so here is the changelog of 9:
Sample REAMDE.txt: CODE About the quality of this CD copy:
---------------------------------- These audio files were produced with perfect-flac-encode version BETA10, using flac 1.2.1. They are stored in "FLAC" format, which is lossless. This means that they can have the same quality as an audio CD. This is much better than MP3 for example: MP3 leaves out some tones because some people cannot hear them. The used prefect-flac-encode is a program which converts good Exact Audio Copy CD copies to FLAC audio files. The goal of perfect-flac-encode is to produce CD copies with the best quality possible. This is NOT only about the quality of the audio: It also means that the files can be used as a perfect backup of your CDs. The author of the software even trusts them for digital preservation for ever. For allowing this, the set of files which you received were designed to make it possible to burn a disc which is absolutely identical to the original one in case your original disc is destroyed. Therefore, please do not delete any of the contained files! For instructions on how to restore the original disc, please visit the website of perfect-flac-decode. You can find the address below. Explanation of the purpose of the files you got: ------------------------------------------------ "Paul Weller - 1994 - Wild Wood.cue" This file contains the layout of the original disc. It will be the file which you load with your CD burning software if you want to burn a backup of the disc. Please remember: Before burning it you have to decompress the audio with perfect-flac-decode. If you don't do this, burning the 'cue' will not work. "Paul Weller - 1994 - Wild Wood.sha56" This contains a so-called checksum of the original, uncompressed disc image. If you want to burn the disc to a CD, you will have to decompress the FLAC files to a WAV image with perfect-flac-decode. The checksum file allows perfect-flac-decode to validate that the decompression did not produce any errors. "Paul Weller - 1994 - Wild Wood.log" This file is a 'proof of quality'. It contains the output of Exact Audio Copy and perfect-flac-encode as well as their versions. It allows you to see the conditions of the copying. You can check it to see that there were no errors. Further, if someone finds bugs in the future in certain versions of the involved software you will be able to check whether your audio files are affected. Websites: --------- perfect-flac-encode: http://leo.bogert.de/perfect-flac-encode perfect-flac-decode: http://leo.bogert.de/perfect-flac-decode FLAC: http://flac.sourceforge.net/ Exact Audio Copy: http://www.exactaudiocopy.de/ |
|
|
|
Nov 10 2012, 05:39
Post
#13
|
|
|
Group: Members Posts: 36 Joined: 27-October 12 Member No.: 104130 |
BETA11 available. Changelog:
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 24th May 2013 - 06:36 |