INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Integrity Checkup of FLAC  (Read 2125 times)

benn600

  • Citizen of the Universe
  • *****
  • Posts: 3849
  • Living: Santa Monica CA Hometown: Cedar Rapids IA
Integrity Checkup of FLAC
« on: March 25, 2009, 01:15:08 pm »

Is there a way to scan my entire library and look for any FLAC files that may have gotten corrupted somehow some way?  Just something I thought about...don't really have any specific reason for doing so.  Perhaps preventative maintenance.
Logged

Listener

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1084
Re: Integrity Checkup of FLAC
« Reply #1 on: March 25, 2009, 11:47:39 pm »

You could use the Flac.exe command line program driver by a batch file or a Perl/Python program.

The -t option should work.

http://flac.sourceforge.net/documentation_tools_flac.html

Bill
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Integrity Checkup of FLAC
« Reply #2 on: March 26, 2009, 01:08:11 am »

If you have Cygwin installed:

Code: [Select]
find /path/to/musicfolder -name '*.flac' \( -exec /path/to/flac.exe -t -s  {} \; -o  -ls \)

This will print out a list of files that fail the flac -t test.
Logged
The opinions I express represent my own folly.

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: Integrity Checkup of FLAC
« Reply #3 on: March 26, 2009, 02:25:58 am »

I'd find a way to work xargs into that statement.

Or you load up memory per file with a call to flac.exe whilst it only takes one call to flac.exe with xargs  :D

iow

with -exec, call flac each time per file

with xargs, call flac once and feed it a list of files.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Integrity Checkup of FLAC
« Reply #4 on: March 26, 2009, 06:51:25 pm »

The exec call is orders of magnitude less than, and inconsequential relative to, the time required to complete the flac test.

Using xargs would be nice, but you have to get the status of each file, and then conditionally perform some output.  Have any way to do it without invoking (eg. exec'ing) a shell to perform the "flac OR print filename"?
Logged
The opinions I express represent my own folly.

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: Integrity Checkup of FLAC
« Reply #5 on: March 27, 2009, 09:03:33 am »

Using xargs would be nice, but you have to get the status of each file, and then conditionally perform some output.  Have any way to do it without invoking (eg. exec'ing) a shell to perform the "flac OR print filename"?

Yes and that's required because you have used the -s option

What if you did not, and just piped the output to a txt file and then just grepped for a failure string. This way you also have a record of all files tested.

I had used something similar with mp3s, tho it was just limited to reading tags rather than integrity testing and wherever there was a failure the tool itself would inidcate which file had a problem. When i replaced with xargs i noticed a speedup anywhere from 1-5 times.

What matters in the end is whether it provides any speedup, i have a feeling that in this particular case, as you mentioned with testing times, maybe not :(
Logged

Alex B

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 10121
  • The Cosmic Bird
Re: Integrity Checkup of FLAC
« Reply #6 on: March 27, 2009, 09:56:49 am »

The following should work from inside MC.

1) Disable: Tools > Options > General > Update tags when file info changes (untick)
2) Disable: Tools > Plug-in manager > Input > Flac plugin> Configure > Decode through errors (untick)
3) Select the files to be checked
4) Disable: Tools > Library Tools > Analyze audio > Skip analyzed files (untick)
...and run the analyzer. It will stop if it encounters a decoding error.

The "number one" disables file tagging and thus preserves the last modified timestamps. You may want to keep tagging enabled if the files are not already analyzed.

I tested the procedure by changing a couple of characters inside a flac file with a hex editor. The analyzer stopped in the middle of this file.

This should be able to find any serious errors. It does not find all possible errors if the errors do not affect playback (like minor errors in the FLAC header structure).
Logged
The Cosmic Bird - a triple merger of galaxies: http://eso.org/public/news/eso0755

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Integrity Checkup of FLAC
« Reply #7 on: March 27, 2009, 10:13:07 am »

The following should work from inside MC.

1) Disable: Tools > Options > General > Update tags when file info changes (untick)
2) Disable: Tools > Plug-in manager > Input > Flac plugin> Configure > Decode through errors (untick)
3) Select the files to be checked
4) Disable: Tools > Library Tools > Analyze audio > Skip analyzed files (untick)
...and run the analyzer. It will stop if it encounters a decoding error.


Ugh.
Logged
The opinions I express represent my own folly.
Pages: [1]   Go Up