Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: FLAC re-encoding (Read 163991 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FLAC re-encoding

Reply #50
Thank you.

FLAC re-encoding

Reply #51
One issue I have noted with this batch file is that occasionally I'll try to process some FLAC that gives me an error about not being a WAV file... and how I need to enter a flag to process it. The batch craps out. I know FLAC is more than just a compressed WAV, but I am not any more knowledgeable. Any way you know of to quickly find such non-WAV-based FLAC files in my library?


FLAC re-encoding

Reply #53
One issue I have noted with this batch file is that occasionally I'll try to process some FLAC that gives me an error about not being a WAV file... and how I need to enter a flag to process it. The batch craps out. I know FLAC is more than just a compressed WAV, but I am not any more knowledgeable. Any way you know of to quickly find such non-WAV-based FLAC files in my library?
Are you talking about the message reported in post #31?  By "crap out" do you mean that the batch file terminates immediately? This response from FLAC shouldn't cause the batch file to terminate.  Perhaps you could post more info?

The easiest way to simply look for files that fail testing is to navigate to your root FLAC folder and use the command:

Code: [Select]
FOR /R %G IN (*.flac) DO (FLAC -t "%G" || ECHO "%G">>failed.txt)

This will create a text file called failed.txt in the same folder with the path of any files that failed testing.

Edit: Actually, if this is the same issue as post #31 then a test won't find them.  The re-encoding stage highlights these files. You could try running the following command in the root FLAC folder:

Code: [Select]
FOR /R %G IN (*.flac) DO (FLAC -f -o tmp.flac "%G" || ECHO "%G">>failed.txt) & DEL tmp.flac

This will re-encode all files to a file called "tmp.flac", and if an error occurs write the file in question to failed.txt (and finally delete "tmp.flac").

Any have ideas what this is and how to fix it?

Code: [Select]
state = FLAC__STREAM_DECODER_READ_FRAME
When do you receive this message?  Are you running my batch file, and if so: is it during the test phase, and does it result in the file not being encoded?
I'm on a horse.

FLAC re-encoding

Reply #54
2.2.1. Added two new variables.

Set retainListOfFailedFiles to 1 if you want to keep the list of files that failed (flac-113-failed.txt will be created in the same folder as the batch file).

Set retainListOfProcessedFiles to 1 if you want to keep the list of files that were processed by the script (flac-113-processed.txt will be created in the same folder as the batch file).

Both will delete any file of the same name before processing starts, so if you plan to run this on a folder, and then run it again, and want to keep past logs, please move or rename them after the first process.

Code: [Select]
REM ######################################################
SET pathToFLAC="C:\My\Path\To\FLAC.EXE"
SET flacOptions=-8 -A "tukey(0.5)" -A flattop
SET retainListOfFailedFiles=1
SET retainListOfProcessedFiles=0
REM ######################################################
I'm on a horse.

FLAC re-encoding

Reply #55
Any have ideas what this is and how to fix it?

Code: [Select]
state = FLAC__STREAM_DECODER_READ_FRAME
When do you receive this message?  Are you running my batch file, and if so: is it during the test phase, and does it result in the file not being encoded?


yes it was with your batch file (2.2), I believe it happened during the 'test' and the file was skipped. It's currently still processsing (I fed it my entire music folder after testing it several times on various folders/files).

Once it finishes I'll try again to get the exact text (I happened to saw which files it was), and I'll also try your updated version.

Cheers

FLAC re-encoding

Reply #56
One issue I have noted with this batch file is that occasionally I'll try to process some FLAC that gives me an error about not being a WAV file... and how I need to enter a flag to process it. The batch craps out.

Same happened here yesterday while 're-flac-ing' with my own batchfile. 
I use "glob.exe -c flac.exe -6 --force --delete-input-file -V *.flac" which works well most of the time.
Action didn't damage the faulty flac's
While viewing the problem files with an hex-editor, I noticed these begin with ID3 not fLaC
Didn't make the flacs myself but got them from the net.. Some are v1.1.0 and some are v1.1.2
After decoding them manually to wav they could be encoded to flac v1.1.3

Remark. For this encoding I sometimes use the Flac frontend v1.7 by speek which uses Tag by Case.
The newly compiled version 2.0.48 also annoyingly writes Db instead of dB. In an earlier version of tag.exe I managed to change that but in the latest version I failed.
So, Synthetic Soul can you change this before compiling it again in the future someday ?

FLAC re-encoding

Reply #57
I don't have the files handy anymore as I have since converted them to WavPack, then back to FLAC, to get rid of the problem. A test of the files reveals no problem, yet the batch file pops up some message about needing to reprocess based on a revised input flag. I remember some error verbiage about "--endian" and that FLAC.exe thought the files weren't WAVs, which I think they were.

I had previously used FLACTester to check out these files, and all of them passed.

I will find one of the files again on the Net and post a download site (here) for it soon for you to check out a sample of these problematic FLACs.

Thank you.

FLAC re-encoding

Reply #58
yes it was with your batch file (2.2), I believe it happened during the 'test' and the file was skipped. It's currently still processsing (I fed it my entire music folder after testing it several times on various folders/files).

Once it finishes I'll try again to get the exact text (I happened to saw which files it was), and I'll also try your updated version.
Hmm.  Unfortunately it sounds like the file is slightly corrupt.  You may have to use --decode-through-errors when decoding this file in order to reclaim it.  Josh, or a more proficient FLAC user, may be able to deny or add to this. NB: Once the script has finished it should list any files that failed (the major (only?) benefit of this batch file over a one line solution!).

Remark. For this encoding I sometimes use the Flac frontend v1.7 by speek which uses Tag by Case.
The newly compiled version 2.0.48 also annoyingly writes Db instead of dB. In an earlier version of tag.exe I managed to change that but in the latest version I failed.
So, Synthetic Soul can you change this before compiling it again in the future someday ?
I haven't changed the setup for compiling Tag, so if you could compile it before you should be able to compile it now.  That said, I can look into changing "Db" to "dB"... if I can find where the change needs to be made.  NB: Latest is 2.0.49 (TAK support added).

I don't have the files handy anymore as I have since converted them to WavPack, then back to FLAC, to get rid of the problem. A test of the files reveals no problem, yet the batch file pops up some message about needing to reprocess based on a revised input flag. I remember some error verbiage about "Indian" and that FLAC.exe thought the files weren't WAVs, which I think they were.
Quote
flac 1.1.3, Copyright © 2000,2001,2002,2003,2004,2005,2006  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

WARNING: E:\MP3\Depeche Mode\Playing The Angel\Depeche Mode - Damaged People.fla
c is not a WAVE file; treating as a raw file
ERROR: for encoding a raw file you must specify a value for --endian, --sign, --
channels, --bps, and --sample-rate
Type "flac" for a usage summary or "flac --help" for all options
In the case above, and in collector's experience, this occurs as the file has ID3v2 tags at the beginning.  These files do past the test (-t) as the audio data is fine, but when used as input for encoding FLAC barfs.
I'm on a horse.

FLAC re-encoding

Reply #59
Quote
________________________________________________________________________

flac 1.1.3, Copyright © 2000,2001,2002,2003,2004,2005,2006  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

-wumpscut- - 1997 - Embryodead (back-is-front edition) - 09 - Angel.flac: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC


-wumpscut- - 1997 - Embryodead (back-is-front edition) - 09 - Angel.flac: ERROR while decoding data
                                                                          state = FLAC__STREAM_DECODER_READ_FRAME

File failed testing.


I'll test the affected files shortly and see if they are playable.

FLAC re-encoding

Reply #60
>> In the case above, and in collector's experience, this occurs as the file has ID3v2 tags at the beginning.
>> These files do past the test (-t) as the audio data is fine, but when used as input for encoding FLAC barfs.

Perhaps so. I am still trying to find a file to post.

FLAC re-encoding

Reply #61
Thanks for any advice.

FLAC re-encoding

Reply #62
Thanks for a sample of your file.  The file has ID3v2 tags at the beginning, as suspected.  It looks like EAC added them (as one of the tags seems to be "Exact Audio Copy  (Secure mode)".

AFAIK FLAC will accommodate ID3v1 at the end of the file, but ID3v2 are totally non-standard.

Edit:  I have just tested, and it seems to have worked, but you may do best to test yourself.  Tag showed me that your file has ID3v1, ID3v2 and FLAC tags.  I used the command:

Code: [Select]
TAG.EXE --remove --force FLAC myfile.flac

... and that appears to have successfully removed the ID3 tags and left the FLAC (or copied any ID3 tags to the FLAC tags).

Actually, just remembered that you used WavPack to resolve this...  Forget me.

Edit 2: On the assumption that the file provided was pre 1.1.3 there is something I should note.  After using Tag 2.0.49, which is compiled with libFLAC 1.1.3, the file then presented itself as 1.1.3.  I renamed FlacGetV.exe to FlacGetV.exe.bak and dragged the file onto flac-113.bat to get it to re-encode irrespective of vendor string...
I'm on a horse.

FLAC re-encoding

Reply #63
I have verified the ID3 tags as well are the issue here. Thanks for your work.

God, wouldn't it be nice just to have a single tagging format for once to have to deal with?

FLAC re-encoding

Reply #64
The file has ID3v2 tags at the beginning, as suspected.

And I can't get this removed, neither by Tagscanner, Tag&Rename nor Tag

Code: [Select]
TAG.EXE --remove --force FLAC myfile.flac

Doesn't remove the id3 tag for me    I can decode the flac first, and then encode the wav to flac again. That's not the problem. But batchprocessing lots of files was just that easy now that flac113 can use flacs as input. Maybe any future flac.exe can ignore these tags and proceed with flac-to-flac

FLAC re-encoding

Reply #65
Strange that it appears to work for me (after running Tag the file provided could be re-encoded using FLAC.EXE).  I guess it depends on the tagger used to get the tags on there in the first place.  ID3v2 seem to be a pain. 

With the file that philaphonic provided I was able to remove the ID3v2 tag in a hex editor; I just deleted all the bytes before the "fLaC" header which was easy to find due to the padding in the ID3v2 tag.

The only other option I can think of is Tag's --fromfile switch.  That would involve re-encoding to a new file and then using Tag to copy the tags from the old to the new... I've no idea how well that would work in your situation, and whether the --force switch would be required...

Josh will probably have a better idea of how to remove these unwanted bytes. It's frustrating that the audio data is perfectly fine, but you can't get to it!
I'm on a horse.

FLAC re-encoding

Reply #66
Update for me:

The 'error' files would indeed play (in mediamonkey, didn't try anything else) with no apparent errors.

I tried 'cleaning' the tags with MM, and again with metaflac --remove-all and didn't help.

I ended up re-encoding them with mediamonkey flac to flac (1.1.2) and then I was able to successfully use the batch.

I'd recommend anyone having problem files try re-encoding them first with mediamonkey (tools > convert audio format > select FLAC and replace existing or specify an alternate file mask/filename), then run thru batch again.

BTW, From 190ish gigs of FLAC's, this script and 1.1.3 saved me ~2 gigs just from what explorer reported free space before/after. (I forgot to get exact size before starting it)

So thanks to the FLAC dev's and thanks Synthetic Soul for making it super easy to take advantage of re-encoding.

FLAC re-encoding

Reply #67
God, wouldn't it be nice just to have a single tagging format for once to have to deal with?


Yup. I really wouldn't mind if the world of audio tagging consisted just of either Vorbis comments or APEv2.

Begone, evil ID3! Begone, naughty ASF/WMA! Ohhhhhm! *breaks into some kind of ritual chant that summons up a greater demon to destroy all kinds of annoying metadata*

FLAC re-encoding

Reply #68
So thanks to the FLAC dev's and thanks Synthetic Soul for making it super easy to take advantage of re-encoding.
And don't forget to thank MediaMonkey developers for making a player capable of skipping the ID3v2 tags and play the FLAC's however nonstandard they are!

FLAC re-encoding

Reply #69
So thanks to the FLAC dev's and thanks Synthetic Soul for making it super easy to take advantage of re-encoding.
And don't forget to thank MediaMonkey developers for making a player capable of skipping the ID3v2 tags and play the FLAC's however nonstandard they are!



Always much love for the monkey and it's dev's! 

FLAC re-encoding

Reply #70
I was able to remove the ID3v2 tag in a hex editor; I just deleted all the bytes before the "fLaC" header which was easy to find due to the padding in the ID3v2 tag.

I could do so too, but then it's easier for me to decode the file to wav and re-encode again. But, up till flac113 I never transcoded flac-to-flac. The 1.1.0 and 1.1.2 play fine with or without those id3v2 tags.

Quote
Josh will probably have a better idea of how to remove these unwanted bytes. It's frustrating that the audio data is perfectly fine, but you can't get to it!

Unwanted when transcoding flac-to-flac that is.

FLAC re-encoding

Reply #71
I guess my final suggestion is to transcode problem files to WavPack, then back to FLAC. That strips the ID2 tags and keeps all the good FLAC tags.

I use Foobar 0.9.4.2 to do all this and it works a treat.

FLAC re-encoding

Reply #72
Just use the Programm "Mp3tag" to save your Tag's in the Flac file. It removes ID3-Tags automatically.

FLAC re-encoding

Reply #73
OK, version 2.2.0.

If FlacGetV.exe (and libFLAC.dll and libmmd.dll) is in the same directory as the batch file it will be used to check the vendor string, and skip 1.1.3 files.

If FlacGetV.exe is not present it will act as per 2.1.0.

Code: [Select]
9 file(s) processed.
8 file(s) skipped (already 1.1.3).
0 file(s) encoded.
1 file(s) returned an error.

Files that failed:

  "C:\Documents and Settings\Neil\Desktop\Media\Depeche Mode - Damaged People.flac" [E]


Hi SS,

The batch file is awesome, very helpful.  I noticed it even preserves the original file date which is a big plus in my book.  That allows me to track what hardware I used during the original rip.... besides the fact I'm a big date sentimentalist

Anyway, about the FlacGetV.exe, if tag.exe was used to create the FLAC tags then it overwrites the Flac version with an older one.  This is true if you use the flac113b.exe windows package and the tag.exe version that comes with that.  Here is the thread about that problem:
http://www.hydrogenaudio.org/forums/index....showtopic=38232

That problem threw me for a loop when I encountered it after upgrading to Flac 1.1.3.  Then I noticed all my old Flac 1.1.2 files encoded using the previous windows package had tags with the Flac 1.1.0 version string as a result of this problem.

I'm pointing this out in case people wonder why they might be seeing unnecessary reencodes.  Although after the reencode they would at least have the correct version.

I just thought I'd mention it in case anyone ran into that problem and didn't see the other thread.

FLAC re-encoding

Reply #74
The batch file is awesome, very helpful. I noticed it even preserves the original file date which is a big plus in my book. That allows me to track what hardware I used during the original rip.... besides the fact I'm a big date sentimentalist
I'm glad it's been of use.  I can't take credit for the date preservation, that's an inbuilt FLAC thing.

Anyway, about the FlacGetV.exe, if tag.exe was used to create the FLAC tags then it overwrites the Flac version with an older one. This is true if you use the flac113b.exe windows package and the tag.exe version that comes with that. Here is the thread about that problem:
http://www.hydrogenaudio.org/forums/index....showtopic=38232

That problem threw me for a loop when I encountered it after upgrading to Flac 1.1.3. Then I noticed all my old Flac 1.1.2 files encoded using the previous windows package had tags with the Flac 1.1.0 version string as a result of this problem.
Yes, I mentioned the opposite end of this a little further up this thread (post #63).

If you use my latest release of Tag, which has been compiled with libFLAC 1.1.3, on a pre-1.1.3 file, it will change the vendor string to 1.1.3. If you then use my batch file with FlacGetV.exe it will skip all those files.

The FLAC package uses Case's last release, 2.0.39, which was built with libFLAC 1.1.0.  So, as you say, if you use that to tag your 1.1.3 files the vendor string will be changed to 1.1.0, and my batch file will re-encode them unnecessarily.

I actually rebuilt Tag with libFLAC 1.1.3 because of that thread that you quote (glad to see you were the member who thanked me BTW ).  I don't really understand the vendor string, but it seems odd to me that simply tagging a file can change the perceived version of FLAC used to encode the file.  If the person that builds the installer continues to ignore my releases, or simply recompile the version 2.0.39 code with the latest libFLAC themselves, then I'm afraid you're stuck with having to overwrite the included version with mine, if you want the vendor string to reflect the encode version.

Thanks for the heads up.
I'm on a horse.