Help - Search - Members - Calendar
Full Version: FLAC re-encoding
Hydrogenaudio Forums > Lossless Audio Compression > FLAC
Pages: 1, 2, 3, 4, 5, 6
Synthetic Soul
QUOTE(jamesbaud @ Feb 19 2007, 05:27) *
Your program is a big hit! You should post this on your web site! smile.gif
Then I'd have even more people hassling me. smile.gif

I'm more likely to remove it than publish it!

QUOTE(vinnie97 @ Feb 19 2007, 06:51) *
Yet I have it in the same directory as the batch file. What obvious factor am I overlooking? sad.gif
1. That a batch file is simply a text file and can be opened, or edited, in Notepad. 2. That when a script runs it runs from system32, where cmd.exe resides, and not the containing folder.

Either edit the script to point to the proper location of your FLAC.EXE (all config is at the top) or put FLAC.EXE in a folder in your path (like system32 or your windows folder) - which I would always recommend anyway.

QUOTE(ludwig @ Feb 19 2007, 07:21) *
Hello, any chance to have a script for convert from old flac to flac 1.1.4, with test before and GUI ?
It's hard for me all these things... I tested to re-encode with omni encoder and it deleted my old flac without giving new flac, just because of an error on an old file. Thanks
No chance of a GUI in the next five years or so. This script will convert to 1.1.4 (see a few posts up - #147), and performs two unique tests before overwriting.
ludwig
Hi again, maybe flac-113.bat can use flac 1.1.4 ?
But how configure your script ?
Sorry, I'm beginner with this things...
Where I set the path for flac.exe ?
regards
Synthetic Soul
If you open the script in Notepad you will see the following near the top:

CODE
REM ######################################################
SET pathToFLAC="FLAC.EXE"
SET flacOptions=-8
SET retainListOfFailedFiles=1
SET retainListOfProcessedFiles=0
SET retainListOfSuccessfulFiles=0
SET flacVersion=114
REM ######################################################

Use pathToFLAC to set the path to your FLAC.EXE file.
If you are using FlacGetV to check the file's current version before encoding (search this thread for FlacGetV for more info) then you will need to set flacVersion to your required version. All other variables have been explained somewhere in this thread (search for the var name using the search at the bottom-left of this page).
ludwig
QUOTE(Synthetic Soul @ Feb 18 2007, 23:38) *

If you open the script in Notepad you will see the following near the top:

CODE
REM ######################################################
SET pathToFLAC="FLAC.EXE"
SET flacOptions=-8
SET retainListOfFailedFiles=1
SET retainListOfProcessedFiles=0
SET retainListOfSuccessfulFiles=0
SET flacVersion=114
REM ######################################################

Use pathToFLAC to set the path to your FLAC.EXE file.
If you are using FlacGetV to check the file's current version before encoding (search this thread for FlacGetV for more info) then you will need to set flacVersion to your required version. All other variables have been explained somewhere in this thread (search for the var name using the search at the bottom-left of this page).

Thank you very much, I modify the path:


REM ######################################################
SET pathToFLAC="C:\Soft\Audio\FLAC_RE-ENCODE\FLAC.EXE"
SET flacOptions=-8
SET retainListOfFailedFiles=1
SET retainListOfProcessedFiles=0
SET retainListOfSuccessfulFiles=0
SET flacVersion=114
REM ######################################################

but when I launch, I have:
"To run this script, please pass a valid file or folder as a parameter."
What else to modify, please ? (and sorry to bother you)
Regards
probedb
QUOTE(ludwig @ Feb 19 2007, 07:41) *
but when I launch, I have:
"To run this script, please pass a valid file or folder as a parameter."
What else to modify, please ? (and sorry to bother you)
Regards


You give it a directory as a parameter, I'm pretty sure it says in this thread if you read it.

i.e.

CODE

flac-113.bat "c:\my music"
Synthetic Soul
probedb is correct. Either run the script on the command line as he suggests, or simply drag a folder onto the batch file icon. If you run:

CODE
flac-113.bat "c:\my music"

.. the script will process all files and subfolders in "C:\My Music". Similarly, if you drag the folder "My Music" onto the batch file icon.
ludwig
QUOTE(Synthetic Soul @ Feb 19 2007, 01:39) *

probedb is correct. Either run the script on the command line as he suggests, or simply drag a folder onto the batch file icon. If you run:

CODE
flac-113.bat "c:\my music"

.. the script will process all files and subfolders in "C:\My Music". Similarly, if you drag the folder "My Music" onto the batch file icon.

GREAT !!!!!!!!!!
IT WORKS !!!!!!!!
Thanks to all of you !
I still don't know how drag a folder onto the batch file icon, bot with dos command it works.
Synthetic Soul
Dragging a folder is as simple as it sounds.
  1. Use Explorer to navigate to the folder you want to process
  2. Make sure that the batch file icon is visible on the screen also*
  3. Drag the folder from Explorer onto the icon
* If the batch file is not visible but you have another Explorer window open listing the file you can drag the folder onto the relevant taskbar item and wait a second, without releasing the drag, for the window to become visble, then continue your drag.

I assumed everyone was using the drag'n'drop approach. smile.gif I generally write the scripts so that non-command line users can use them as well.
PatchWorKs
QUOTE(Synthetic Soul @ Feb 17 2007, 13:42) *
All my batch file does is use FLAC.EXE to encode FLACs to FLAC. If FLAC can't handle Ogg FLAC files as input then it can't handle Ogg FLAC files. Nothing I can do.

Well, FLAC.exe is able to re-encode a single OGG-flac file to .flac but won't "*.ogg" input (strange, isn't it ?)
Synthetic Soul
Sorry, I didn't realise that Ogg-FLAC files had a .ogg extension!

You may just need to amend line 91 to:

CODE
IF /I [%~x1] EQU [.ogg] (

... and line 115 to:

CODE
FOR /R %1 %%G IN (*.ogg) DO CALL :ListFiles "%%G"

... and amend line 176 (the line that runs the encode) accordingly.

PatchWorKs
QUOTE(Synthetic Soul @ Feb 19 2007, 11:19) *

Sorry, I didn't realise that Ogg-FLAC files had a .ogg extension!


OK, it works now (sincerly i already changed that lines, but my FLAC.exe was corrupted blush.gif )

BTW 2 errors:

1. (baddest) directory drop won't work

2. testing fails (WARING, cannot check MD5 signature since it was unset in the STREAMINFO)
vinnie97
QUOTE(Synthetic Soul @ Feb 18 2007, 23:29) *

QUOTE(vinnie97 @ Feb 19 2007, 06:51) *
Yet I have it in the same directory as the batch file. What obvious factor am I overlooking? sad.gif
1. That a batch file is simply a text file and can be opened, or edited, in Notepad. 2. That when a script runs it runs from system32, where cmd.exe resides, and not the containing folder.

Either edit the script to point to the proper location of your FLAC.EXE (all config is at the top) or put FLAC.EXE in a folder in your path (like system32 or your windows folder) - which I would always recommend anyway.

Thanks so much...I completely forgot about scripts utilizing the system directory! I also have little experience with them but this did the trick. It's probably been answered already but will this work with the FLAKE encoder as well?

And here's another thank you for this most useful batch (the ratio reading is an extra useful touch!).
Synthetic Soul
QUOTE(PatchWorKs @ Feb 19 2007, 10:45) *
BTW 2 errors:

1. (baddest) directory drop won't work

2. testing fails (WARING, cannot check MD5 signature since it was unset in the STREAMINFO)
1. In what way? Are you saying that it works if you run on the command line but not if you drag/drop? If so, that would be really freaky!

2. Hmm.. guess that must be an Ogg-FLAC thing. Certainly not something I'll be supporting further, sorry.

QUOTE(vinnie97 @ Feb 19 2007, 10:51) *
It's probably been answered already but will this work with the FLAKE encoder as well?
Currently the script uses FLAC's -t switch to test the files, and then uses FLAC, with the -V switch, to encode.

You could use FLAC.EXE to perform the test and FLAKE.EXE to do the encode, but you'd have to amend line 176 to run FLAKE, and remove the -V switch - which I don't think Flake has.
ludwig
Some files encoded with flac frontend with 1.1.4 -8 are re-encoding with flac-113.bat last version...
Do I have to put any FlacGetV file into the same directory ?
Regards
Synthetic Soul
Yes. The version check will only be made if FlacGetV, and the DLLs it requires (all included in the download) are in the same directory as the batch file.

I guess i should have a readme, but all the info can be found in this thread, so I didn't bother. I realise that it makes it more of a task for someone only joining the thread now.
probedb
I'm going to see if I can amend your script to do a check even if the version is up to date. I just want to make sure that after reripping some broken tracks that all my FLACs are now 100% OK smile.gif
Synthetic Soul
I have an existing script that will use FLAC -t on a folder of files, if that's what you want.

http://www.synthetic-soul.co.uk/files/flac-verify.bat

Pass it a folder and it will go through all files, run FLAC -t, and report any that fail at the end.

Hopefully that will do what you need. smile.gif Job done!
probedb
QUOTE(Synthetic Soul @ Feb 19 2007, 13:30) *

I have an existing script that will use FLAC -t on a folder of files, if that's what you want.

http://www.synthetic-soul.co.uk/files/flac-verify.bat

Pass it a folder and it will go through all files, run FLAC -t, and report any that fail at the end.

Hopefully that will do what you need. smile.gif Job done!


Sweet biggrin.gif Cheers for that! Is it recursive or should I try and mangle it to be recursive?
Synthetic Soul
It is recursive.

Glad to be of further help. smile.gif
ludwig
Once more THANKS to YOU !!!!
Wonderful Job...
probedb
QUOTE(Synthetic Soul @ Feb 19 2007, 13:49) *

It is recursive.

Glad to be of further help. smile.gif


Awesome biggrin.gif Thanks again.
aliendesaster
Nice and fast synthetic-soul, your solution is much appreciated!
dandomoore
Got the same problem with drag n drop - folders don't work, and if you drag multiple files, it processes only the first one.... I assumed it was because I was running vista.....
Synthetic Soul
Curious!

The multiple files thing makes sense - the script is only expecting one parameter - a FLAC file or a folder.

No idea what the change in drag'n'drop functionality is though, sorry.
cpalcott
Is there a quick easy fix to get te batch file to write the proper version to the encode tag? It's still showing 1.1.3 in the tags.
drbeachboy
QUOTE(cpalcott @ Feb 19 2007, 20:21) *

Is there a quick easy fix to get te batch file to write the proper version to the encode tag? It's still showing 1.1.3 in the tags.

FLAC itself writes the encoder name to the file. If you are talking about the "encoding" tag that REACT writes to the file, then you need to change the [USERSETTINGS] (Near the bottom) of the REACT config file to: Ver_Flac=1.1.4.
Synthetic Soul
As drbeachboy said, FLAC writes the vendor string to the file. If it's writing 1.1.3 you must still be running FLAC 1.1.3.

If you are talking about a specific tag that you have set as "1.1.3" I guess you'll need to use a tagging app to update that. I can't add it to the script as it is non-standard.
cpalcott
I downloaded Flac 1.1.4 and overwrote the files in the existing Flac folder (C:\Program Files\Flac), downloaded the latest batch file with the changed version number in the config, yet when I watch the encoding process it is still showing that it is encoding to 1.1.3. However, at the end of the encode it lists the version as 114 (from the config listing I assume). Then when I re-convert those same files,I would expct them to be skipped and come up as already in correct version, but they don't they reprocess. Could this have something to do with the Flacgetv? Do I need to specify a path to flac.exe. Before it seemed to default C:\Program Files\Flac. Thanks for your help.
Synthetic Soul
I think you have two versions of FLAC on your machine. Do a search in Explorer.

To explicitly use the one in Program Files set the script's pathToFLAC variable accordingly.

I suspect the other version is in your Windows folder. You may have even done this after a recommendation from me! I personally think it's best to have the EXEs in a folder in PATH, like your Windows folder, so wherever you open a command line you can just use FLAC.EXE, not "C:\Program Files\Flac\FLAC.EXE". You should only have one version though, to save confusion.
probedb
I found a copy of flac.exe in Windows/System32 and I have no idea what put it there!
Synthetic Soul
I snuck into your room, skiffed your toothbrush, and put FLAC in your system32 folder to play with your mind.

Nah, I'm just playing wit ya. I honestly have no idea.

Blame the FLAC pixies...
cpalcott
Good call...that took care of it. Thanks for your help!
probedb
QUOTE(Synthetic Soul @ Feb 20 2007, 13:10) *

I snuck into your room, skiffed your toothbrush, and put FLAC in your system32 folder to play with your mind.

Nah, I'm just playing wit ya. I honestly have no idea.

Blame the FLAC pixies...


They're quite mischievous I've heard...I'll keep an eye out in future.
aliendesaster
Recently I ran the bat, skipped testing a flac with keys ctrl+c and afterwards even skipped reencoding to 1.14 on a flac, sadly source flac was deleted and incomplete renamed to source flac. While this time the source file is easily restore (and could have been reripped easily as well) I had initially hoped your batch file could detect this.

Scheme:
testing process + ctrl+c starts...
encoding process + ctrl+c starts...
deletetion of source & renaming of output file starts regardless if output file is complete

Anyway instead of deleting a file I'd lik to have an option so that source files are moved to root:/somedir and must be deleted manually. I don't know batch scripting that well but since I guess one cannot detect if execution of some programm started by a batch has been halted with ctrtl+c my proposed behaviour would help.
Synthetic Soul
As you say, I don't think I can detect users messing about in this way.

The option to move the source is quite achievable. In essence, line 189 could be amended from:

CODE
MOVE /Y "%~dpn1-flac-113.flac" %1

.. .to:

CODE
IF NOT EXIST "C:\My\New\Root\%~p1" MKDIR "C:\My\New\Root\%~p1"
MOVE /Y %1 "C:\My\New\Root\%~pnx1"
MOVE /Y "%~dpn1-flac-113.flac" %1


Progressing this further, 'C:\My\New\Root' could be set in a variable (preferably at the top with the other config vars), e.g.:

CODE
movePath=C:\My\New\Root
...
IF [%movePath%] NEQ [] (
    IF NOT EXIST "%movePath%%~p1" MKDIR "%movePath%%~p1"
    MOVE /Y %1 "%movePath%%~pnx1"
)
MOVE /Y "%~dpn1-flac-113.flac" %1

Edit: Tested and updated code.

aliendesaster
Thanks for your support, I will try it out later. smile.gif
foo_fighter
I've used the bat script on ~8000 files or so and it works great.

I had trouble with the following:
id3v2 tags: had to cut then paste the tags back with mp3tag

1 file had an error due to missing md5 checksum

The most false errors were due to files with ' (apostrophe) in the filename or % in the filename.

When passed individually they work but not when passed as a directory. It always thought they were missing.

Any easy fix for that?

Thanks.

krabapple
How does one add more options to the default "SET flacOptions=-8"?
Is it a matter of adding more "SET flacOptions=" lines to the code, or do the options all get added on one line?


Synthetic Soul
No, just add more switches to that one line, e.g.:

CODE
SET flacOptions=-5 -A hamming --no-padding --no-seektable

The script already adds -V, so no need to add that.
krabapple
I tried this

SET flacOptions=-8 -A tukey(0.25) -A gauss(0.1875) -b 4096

and it refused to run
Synthetic Soul
Sorry, try this:

CODE
SET flacOptions=-8 -A "tukey(0.25)" -A "gauss(0.1875)" -b 4096


The script gets confused with the brackets.
tylast
OK...I got lost in the numerous pages. What's the most current bat file to convert to 1.1.4??
Thanks!
Synthetic Soul
http://www.synthetic-soul.co.uk/files/flac-113.bat
tylast
Thanks! OK, figured out that I needed to actually drag/drop the top most folder on the bat file. smile.gif

Is this bat using the 1.1.4 dll???
Synthetic Soul
To save all such further questions I have finally gotten around to writing a readme (of sorts).

http://www.synthetic-soul.co.uk/files/flac-113.txt

I realise that it is a little unfair to expect new users finding this thread to scan the whole thread and piece the information together. It is worth noting that any questions still left unanswered after reading the document may have been answered here already though.
Tim Morris
Neil,

Just wanted to add my thanks to the rest. I was going to use Foobar, but that would have meant transcoding to a different folder and then moving all the artwork across.

Often the simplest solutions are the best.

Tim
Tim Morris
One Minor problem I came across yesterday is that it won't accept track names with a % symbol in them. At a guess I'd say there's not a lot you can do about that.

Tim
Synthetic Soul
Yes, you're right. This was reported to me before, and I spent some time trying to work around it, but could not. It would involve a total re-write, and even then I'm not sure. Sorry.
madorangepanda
Thanks for this, shaved off half a gig using this yesterday going from various old Flac versions.

One problem, exiting the script part way through I ended up with a corrupted file. Is there any way to exit safely? I was simply able to re-rip the file so it didn't matter much.
Synthetic Soul
Sorry, AFAIK I have no control over stopping a script.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.