Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CUETools.Flake --vbr encodes wrong #220

Open
H2Swine opened this issue Sep 23, 2022 · 3 comments
Open

CUETools.Flake --vbr encodes wrong #220

H2Swine opened this issue Sep 23, 2022 · 3 comments

Comments

@H2Swine
Copy link

H2Swine commented Sep 23, 2022

Running the encoder with --vbr 1 to --vbr 4 sometimes yields lossy results. Examples given at https://hydrogenaud.io/index.php/topic,123016 - with a file as well.

@c72578
Copy link
Collaborator

c72578 commented Sep 24, 2022

@H2Swine Thanks for reporting this issue also here at the CUETools github repo.
The issue can be reproduced using the given example from https://hydrogenaud.io/index.php/topic,123016.msg1016175.html#msg1016175 the following way:

CUETools.Flake.exe -q -8 --verify --vbr 0 "foo.flac" -o "foo_vbr_0.flac"
CUETools.Flake.exe -q -8 --verify --vbr 1 "foo.flac" -o "foo_vbr_1.flac"
CUETools.Flake.exe -q -8 --verify --vbr 2 "foo.flac" -o "foo_vbr_2.flac"
CUETools.Flake.exe -q -8 --verify --vbr 3 "foo.flac" -o "foo_vbr_3.flac"
CUETools.Flake.exe -q -8 --verify --vbr 4 "foo.flac" -o "foo_vbr_4.flac"

metaflac --show-md5sum *.flac
foo_vbr_0.flac:7293d3b213a1281d6ab96ee800aade56
foo_vbr_1.flac:7293d3b213a1281d6ab96ee800aade56
foo_vbr_2.flac:7293d3b213a1281d6ab96ee800aade56
foo_vbr_3.flac:7293d3b213a1281d6ab96ee800aade56
foo_vbr_4.flac:7293d3b213a1281d6ab96ee800aade56

flac -t foo_vbr_*.flac

flac 1.4.1
Copyright (C) 2000-2009  Josh Coalson, 2011-2022  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

foo_vbr_0.flac: ok
foo_vbr_1.flac: ERROR, MD5 signature mismatch
foo_vbr_2.flac: ERROR, MD5 signature mismatch
foo_vbr_3.flac: ERROR, MD5 signature mismatch
foo_vbr_4.flac: ERROR, MD5 signature mismatch

@c72578
Copy link
Collaborator

c72578 commented Sep 24, 2022

Tests with older versions of CUETools show the following. The issue is not immediately obvious down to CUETools 2.0.8. In version 2.0.7 and earlier, an Exception is thrown during encoding of the affected example file:

  • CUETools 2.0.8
CUETools.Flake.exe -q -8 --verify -v 0 "foo.flac" -o "foo_vbr_0_2.0.8.flac"
CUETools.Flake.exe -q -8 --verify -v 1 "foo.flac" -o "foo_vbr_1_2.0.8.flac"
CUETools.Flake.exe -q -8 --verify -v 2 "foo.flac" -o "foo_vbr_2_2.0.8.flac"
CUETools.Flake.exe -q -8 --verify -v 3 "foo.flac" -o "foo_vbr_3_2.0.8.flac"
CUETools.Flake.exe -q -8 --verify -v 4 "foo.flac" -o "foo_vbr_4_2.0.8.flac"

metaflac --show-md5sum foo_vbr_*2.0.8.flac
foo_vbr_0_2.0.8.flac:7293d3b213a1281d6ab96ee800aade56
foo_vbr_1_2.0.8.flac:7293d3b213a1281d6ab96ee800aade56
foo_vbr_2_2.0.8.flac:7293d3b213a1281d6ab96ee800aade56
foo_vbr_3_2.0.8.flac:7293d3b213a1281d6ab96ee800aade56
foo_vbr_4_2.0.8.flac:7293d3b213a1281d6ab96ee800aade56

flac -t foo_vbr_*2.0.8.flac

flac 1.4.1
Copyright (C) 2000-2009  Josh Coalson, 2011-2022  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

foo_vbr_0_2.0.8.flac: ok
foo_vbr_1_2.0.8.flac: ERROR, MD5 signature mismatch
foo_vbr_2_2.0.8.flac: ERROR, MD5 signature mismatch
foo_vbr_3_2.0.8.flac: ERROR, MD5 signature mismatch
foo_vbr_4_2.0.8.flac: ERROR, MD5 signature mismatch
  • CUETools 2.0.7
CUETools.Flake.exe -q -8 --verify -v 0 "foo.flac" -o "foo_vbr_0_2.0.7.flac"

CUETools.Flake.exe -q -8 --verify -v 1 "foo.flac" -o "foo_vbr_1_2.0.7.flac"

Unhandled Exception: System.Exception: validation failed!
   at CUETools.Codecs.FLAKE.FlakeWriter.output_frame()
   at CUETools.Codecs.FLAKE.FlakeWriter.Write(AudioBuffer buff)
   at CUETools.FlakeExe.Program.Main(String[] args)

CUETools.Flake.exe -q -8 --verify -v 2 "foo.flac" -o "foo_vbr_2_2.0.7.flac"

Unhandled Exception: System.Exception: validation failed!
   at CUETools.Codecs.FLAKE.FlakeWriter.output_frame()
   at CUETools.Codecs.FLAKE.FlakeWriter.Write(AudioBuffer buff)
   at CUETools.FlakeExe.Program.Main(String[] args)

CUETools.Flake.exe -q -8 --verify -v 3 "foo.flac" -o "foo_vbr_3_2.0.7.flac"

Unhandled Exception: System.Exception: validation failed!
   at CUETools.Codecs.FLAKE.FlakeWriter.output_frame()
   at CUETools.Codecs.FLAKE.FlakeWriter.Write(AudioBuffer buff)
   at CUETools.FlakeExe.Program.Main(String[] args)

CUETools.Flake.exe -q -8 --verify -v 4 "foo.flac" -o "foo_vbr_4_2.0.7.flac"

Unhandled Exception: System.Exception: validation failed!
   at CUETools.Codecs.FLAKE.FlakeWriter.output_frame()
   at CUETools.Codecs.FLAKE.FlakeWriter.Write(AudioBuffer buff)
   at CUETools.FlakeExe.Program.Main(String[] args)

metaflac --show-md5sum foo_vbr_0_2.0.7.flac
foo_vbr_0_2.0.7.flac:7293d3b213a1281d6ab96ee800aade56

flac -t foo_vbr_0_2.0.7.flac

flac 1.4.1
Copyright (C) 2000-2009  Josh Coalson, 2011-2022  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

foo_vbr_0_2.0.7.flac: ok

@H2Swine
Copy link
Author

H2Swine commented Sep 25, 2022

How does it verify, really? Does it actually decode?
If so, would it be possible then to reverse it and get the PCM back?

c72578 added a commit to c72578/cuetools.net that referenced this issue Oct 5, 2022
In some cases, variable block mode 1-4 can lead to corrupt flac files.

- Disable variable blocksize modes for now in CUETools.Flake
- Details:
  https://hydrogenaud.io/index.php/topic,123016
  gchudov#220
c72578 added a commit to c72578/cuetools.net that referenced this issue Oct 5, 2022
In some cases, variable block mode 1-4 can lead to corrupt flac files.

- Disable variable blocksize modes for now in CUETools.Flake
- Details:
  https://hydrogenaud.io/index.php/topic,123016
  gchudov#220
c72578 added a commit that referenced this issue Oct 12, 2022
In some cases, variable block mode 1-4 can lead to corrupt flac files.

- Disable variable blocksize modes for now in CUETools.Flake
- Details:
  https://hydrogenaud.io/index.php/topic,123016
  #220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants