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 172470 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FLAC re-encoding

Hey,

I want to re-encode my FLAC files with "FLAC Frontend". If I'll give a FLAC file as input, I get a Wave file decoded. Then I would need to encode it again. Because the programm tells me that I can just use Wave file as input to encode to FLAC.
If I do it like that I need lot's of time and I would lose all Tags.

Now I would like to know if there is a command line option to re-encode FLAC files with the "flac.exe", that I could keep my Tags.
Or is ther a good freeware program? (I would prefere the comand line option)


Thanks in advance.

FLAC re-encoding

Reply #1
Now I would like to know if there is a command line option to re-encode FLAC files with the "flac.exe", that I could keep my Tags.
Yes.  FLAC 1.1.3 will accept FLAC files as input and will transfer tags.

Code: [Select]
FLAC.EXE -8 -V -o new.flac old.flac
I'm on a horse.

FLAC re-encoding

Reply #2
flac -f filename.flac


FLAC re-encoding

Reply #4
There is some way to automatize all this process?

Some kind of frontend that supports flac2flac or a batch file?

thx

FLAC re-encoding

Reply #5
for /r %i in (*.flac) do start /low /wait flac --best --force "%i"
or
for /r %i in (*.flac) do start /low /wait flac -A "tukey(0,5)" --best --force "%i"
FLAC.

FLAC re-encoding

Reply #6
first thx Martin F.

and by the other way, I modified your command to create another file with the new encode, this could be usefull to someone and if its wrong probably someone can fix my command's sintaxis (Im not exactly an expert with flac  )

Code: [Select]
for /r %i in (*.flac) do start /low /wait flac --best --force -V "%i" --output-name="%i_"

FLAC re-encoding

Reply #7
I would have thought "%i_" would leave you with "<name>.flac_"?

A better solution may be:

Code: [Select]
for /r %i in (*.flac) do start /low /wait flac --best --force -V "%i" --output-name="%~dpni.new.flac"

This should convert "<name>.flac" to "<name>.new.flac".
I'm on a horse.

FLAC re-encoding

Reply #8
Omni Encoder will also do this, no weird command-line twiddling involved.

FLAC re-encoding

Reply #9
I would have thought "%i_" would leave you with "<name>.flac_"?

A better solution may be:

Code: [Select]
for /r %i in (*.flac) do start /low /wait flac --best --force -V "%i" --output-name="%~dpni.new.flac"

This should convert "<name>.flac" to "<name>.new.flac".


Is this the exact command line to use?  I must be missing something because when I try it I get this error "ERROR: -o/--output-name cannot be used with multiple files".

FLAC re-encoding

Reply #10
@agentk7

It's only a whole line.

FLAC re-encoding

Reply #11
I can get foobar2k v0.9.4.2 to transcode from flac 1.1.0 to 1.1.3, and transfer all the tags, using flac.exe as a custom commandline encoder, but I can't figure out how to get it to delete the old flac file  (or overwrite it).  I've tried -delete-input-file, or -f (where output directory = input dir), and nothing I've tried works. (ps, also tried --delete-input-file, and that does nothing)

some of the parameters I've tried:

-8 -delete-input-file - -o %d

-8 -delete-input-file %s -o %d

-8 -f - -o %d

-8 -f %s -o %d

FLAC re-encoding

Reply #12
[quote name='krabapple' date='Jan 4 2007, 14:55' post='461910']
(ps, also tried --delete-input-file, and that does nothing)

It certainly is --delete-input-file  (--)  The helpfiles say it only deletes files when no errors occurred.

I'm not familiar with foobar, but I use the (dos)commandline with a program called glob.exe. Don't know where I got it from, sorry.  Search the net for it ?

The syntax from the batchfile I use is "glob.exe -c flac.exe -6 --force --delete-input-file -S- *.flac"
Without the quotes.  Maybe its syntax is overcomplete but this works for me. And also works for  *.wav

FLAC re-encoding

Reply #13
Regarding deletion of source files in foobar2000: [a href='index.php?showtopic=51598']fb2k's converter cannot delete the original file[/a].

FLAC re-encoding

Reply #14
I notice that  flac-to-flac transcodes (using command line flac.exe and, I guess, metaflac.exe) automatically transfer many of the metadata tags from old file to new -- all the standards as well as COMPOSER and COMMENTS -- which is great.  However it does not seem to transfer the old replaygain values to the new.  Is that even possible?  If it requires a -T NAME=VALUE  in the command line as per vorbis comments  what are the VALUE variables for replaygain track peak, track gain, album peak, album gain?  For that matter, I'm not even sure how the NAME should be written -- e.g. with underscores?

-T replaygain_track_gain="  ? "

FLAC re-encoding

Reply #15
Now I would like to know if there is a command line option to re-encode FLAC files with the "flac.exe", that I could keep my Tags.
Yes.  FLAC 1.1.3 will accept FLAC files as input and will transfer tags.

Code: [Select]
FLAC.EXE -8 -V -o new.flac old.flac




When I run that , it first warns me my input file is not a WAV file and will be treated as a raw file, then throws an error because I have not specified --endian, --sign, etc.  So no file is output.

Does this command actually work for you, to reencode from flac to flac?  So far none of the command lines or batch scripts posted here work for me, using flac 1.1.0 or 1.1.2 files as input,and hoping for a smaller flac 1.1.3 file as output.

FLAC re-encoding

Reply #16
Are you sure that you are testing with FLAC 1.1.3?

It works fine here:

Code: [Select]
C:\Documents and Settings\Neil\Desktop>flac112 test.wav

flac 1.1.2, Copyright (C) 2000,2001,2002,2003,2004,2005  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.

options: -P 4096 -b 4608 -m -l 8 -q 0 -r 3,3
test.wav: wrote 197077 bytes, ratio=0.464

C:\Documents and Settings\Neil\Desktop>flac -o new.flac test.flac

flac 1.1.3, Copyright (C) 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.

test.flac: wrote 195137 bytes, ratio=0.990

Edit: If I use 1.1.2 to try to re-encode I get:

Code: [Select]
C:\Documents and Settings\Neil\Desktop>flac112 -o new2.flac test.flac

flac 1.1.2, Copyright (C) 2000,2001,2002,2003,2004,2005  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.

options: -P 4096 -b 4608 -m -l 8 -q 0 -r 3,3
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
I'm on a horse.

FLAC re-encoding

Reply #17
However it does not seem to transfer the old replaygain values to the new.  Is that even possible?

Tested the transcode from v1.1.0 to v1.1.3 and all values were copied. Replaygain values also.

You are sure you overwrote all older versions with the new 1.1.3 ones ?

FLAC re-encoding

Reply #18
Are you sure that you are testing with FLAC 1.1.3?


Yes. I've uninstalled, downloaded  and run  flac113b  installer twice now.  flac -v from the command line shows

flac 1.1.3


but I think I've found my error. I've been putting -V 8  in the command line instead of  -V -8  -- in other words a stupid typo on my part, probably me half-instinctively reverting to LAME  command line syntax for EAC. Flac-to-flac using flac.exe in a terminal window is working now,old file is ovewritten, and  replaygain values are transferred. I'm going to go slap myself with a wet fish when I'm done.

The flac batch commands I've copied from threads here still aren't working for me though.

FLAC re-encoding

Reply #19
This seems to work; I adapted it from one of Synthetic Soul's batch scripts on another thread; obviously it's very much like yours Martin --  except that with only one flac encoder in my system it seems smart enough not to need an explicit encoder statement

Code: [Select]
@ECHO OFF
FOR /R %1 %%G IN (*.flac) DO FLAC.EXE --best -V --force "%%G"



all is bliss!

and for even more compressed bliss, this substitutes a much slower but more aggressive  encode  I got from a post by JWolf

Code: [Select]
@ECHO OFF
FOR /R %1 %%G IN (*.flac) DO FLAC.EXE -8 -A tukey(0.25) -A gauss(0.1875) -b 4096 -V --force "%%G"




Bjork Homogenic directory --  size/size on disc, as reported by Windows

flac 1.1.0 probably set at -8
294 MB (308,537,323 bytes)/294 MB (308,559,872 bytes)

flac 1.1.3  --best
293 MB (307,439,199 bytes)/293 MB (307,462,144 bytes)

flac1.1.3  -8 -A tukey(0.25) -A gauss(0.1875) -b 4096
292 MB (307,129,792 bytes)/292 MB (307,150,848 bytes)

FLAC re-encoding

Reply #20
Nice to hear that you have gotten it sorted out now 

I added the %encoder% variable to the script in case you haden't flac.exe located somewhere within your PATH environment variable and so as to avoid you having to move it there for getting the script to work. Also your change to use %%G instead of %%F was also a good change, since i have just read that even though all letters can be used, then %%G are recommended to be used as e.g. using %%F and also some other letters could actually make some problems and also break a FOR script on NT4 systems.

Anyway, Nice work on making a functioning script and i'm happy that you've gotten it sorted out eventually

CU, Martin.

FLAC re-encoding

Reply #21
I have created a batch file to convert to FLAC 1.1.3.

If you drag a file or folder onto the batch file it will process all FLAC files within (including subfolders).

It will first use -t to test the source file, and only if the test is successful will then re-encode the file using -fto force an overwrite .  Edit:  Version 1.1.0 now encodes to a new file, and if the encode was successful will then overwrite the source with the new file (MOVE /Y <new file> <old file>). This should now ensure that the souce is only ever overwritten if the process has been 100% successful.*

If any files do fail testing or re-encoding they will be listed once all processing has finished.

To use the batch file you need to first open it in Notepad and amend the lines:

Code: [Select]
SET pathToFLAC="FLAC.EXE"
SET flacOptions=-8
... to suit.  You really only need quotes around pathToFLAC if the path contains spaces.  The switches -V -f are hardcoded into the command line already.
 
Hopefully some people will find this useful.

[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]* DISCLAIMER: But, of course, it may.  Don't blame me.  Test before you run it on anything precious.[/size]
I'm on a horse.

FLAC re-encoding

Reply #22
Thanks for the batch file - just what I was looking for. Unfortunately it's not working properly (using 1.0.0 or 1.1.0).

My directory structure is:

I:\albums\artist1 - year1 - album1\artist1 - year1 - album1.flac
I:\albums\artist2 - year2 - album2\artist2 - year2 - album2.flac
etc...

and when I drag the albums folder onto the batch file it keeps rencoding "artist1 - year1 - album1.flac" and doesn't move on to the next one. Could you have a look at that?

Cheers,

Ed

FLAC re-encoding

Reply #23
Here's my test (1.1.0 used):

Code: [Select]
Checking: "L:\albums"

Testing: "L:\albums\artist1 - year1 - album1\artist1 - year1 - album1.flac"
________________________________________________________________________

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.

artist1 - year1 - album1.flac: ok

Encoding: "L:\albums\artist1 - year1 - album1\artist1 - year1 - album1.flac"
________________________________________________________________________

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.

artist1 - year1 - album1.flac: Verify OK, wrote 256863 bytes, ratio=1.000


Testing: "L:\albums\artist2 - year2 - album2\artist2 - year2 - album2.flac"
________________________________________________________________________

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.

artist2 - year2 - album2.flac: ok

Encoding: "L:\albums\artist2 - year2 - album2\artist2 - year2 - album2.flac"
________________________________________________________________________

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.

artist2 - year2 - album2.flac: Verify OK, wrote 256863 bytes, ratio=1.000


2 file(s) processed.
2 file(s) encoded.
0 file(s) returned an error.

Press any key to exit
Bear in mind that FLAC first tests the file, and then re-encodes the file.  Are you sure you are not seeing the test and then the re-encode?
I'm on a horse.

FLAC re-encoding

Reply #24
Yeah, I'm pretty sure, here's my output:

Code: [Select]
Checking: "I:\Albums"

Testing: "I:\Albums\Guns N' Roses - 1987 - Appetite For Destruction\Guns N' Rose
s - 1987 - Appetite For Destruction.flac"
________________________________________________________________________

flac 1.1.3, Copyright (C) 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.

Guns N' Roses - 1987 - Appetite For Destruction.flac: ok

Encoding: "I:\Albums\Guns N' Roses - 1987 - Appetite For Destruction\Guns N' Ros
es - 1987 - Appetite For Destruction.flac"
________________________________________________________________________

flac 1.1.3, Copyright (C) 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.

Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.993
Guns N' Roses - 1987 - Appetite For Destruction.flac: 100% complete, ratio=0.992
Guns N' Roses - 1987 - Appetite For Destruction.flac: Verify OK, wrote 403736967
bytes, ratio=0.992


Testing: "I:\Albums\Guns N' Roses - 1987 - Appetite For Destruction\Guns N' Rose
s - 1987 - Appetite For Destruction.flac"
________________________________________________________________________

flac 1.1.3, Copyright (C) 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.

Guns N' Roses - 1987 - Appetite For Destruction.flac: ok

Encoding: "I:\Albums\Guns N' Roses - 1987 - Appetite For Destruction\Guns N' Ros
es - 1987 - Appetite For Destruction.flac"
________________________________________________________________________

flac 1.1.3, Copyright (C) 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.

Guns N' Roses - 1987 - Appetite For Destruction.flac: 1% complete, ratio=0.907

Ed