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: How can I complete this huge conversion job? (Read 7717 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How can I complete this huge conversion job?

Hi all,
I have a large collection of wav files, 123 GB of wavs, in fact, which I have recorded over the past few years. some of them are 16 bit, others are 24 bit. Some are at 44K sample rate and others are as high as 96. so we have a wide assortment of bit depths and sample rates.
All of these files are split into around 30 folders. I need to convert all of the files to flac to save space. Flac is also very high on my compatibility list, so most of the time I wont' even notice a difference between it and Wav.
Normally, I'd go to my favorite audio editor, Gold Wave, which has quite a feature list for batch conversions. Gold Wave can preserve most of the attributes of the original files, which is what I would really need. However, there is a problem. Gold Wave cannot detect the bit depth of the files and convert accordingly. Instead, you have to select the bit depth that the files are converted to. I E-mailed support about that, and I'm waiting to hear back. I thought i'd post here in the meantime to see if there was other software that would allow for better conversion.
If I convert all the files to 24 bit flac to be on the safe side, the files which were originally 16 bit won't compress nearly as much because they're being converted to 24. From what I've been reading about how compressors work, I thought lossless and lossy formats didn't have a bit depth, only the decoded, uncompressed files do. I might be wrong about that... I'm the last person to be investigating the complex math behind those facts. But I'm guessing here that the reason the 16 bit wavs don't compress as well with 24 bit is because now we're exposing 16 bit quantization errors, which are well above the floor of 24 bit... anyway that's not really the point of this topic.
The point of this topic is to ask if there's a program to convert a huge batch of wav files to Flac, and retain the file attributes. Preferably, it would allow me to set the compression level, as I would probably go for the highest, even though it's slow. It would certainly have to dig through subdirectories without my assistance. There are too many folders for me to add them individually, I'd rather just have it look through the main folder where all the subdirectories with the files are.
I'd greatly appreciate any help! Perhaps Gold Wave has this feature, and I have been missing it... somehow I doubt that. If anything comes out of the support inquiry though, I'll post it here.

How can I complete this huge conversion job?

Reply #1
Why do you think you need to make any effort to ensure losslessness? The basic encoder will read the sampling rate and depth from the input file, assuming it specifies these correctly in its header, and preserve them accordingly. As long as you have not ruined any headers, everything will be done for you automatically.

[edit] To be clear, I mean you need not use Goldwave or anything ungainly like that: just run the CLI encoder using wildcards and/or from a batch file, or use something like FLAC Frontend or, as AndyH-ha suggested below, foobar2000. [/edit]

Quote
Flac is also very high on my compatibility list, so most of the time I wont' even notice a difference between it and Wav.
No, you will not notice any difference. FLAC is a lossless format. What else would that word mean?

How can I complete this huge conversion job?

Reply #2
Batch conversions with foobar2000 will select all files in subdirectories when one uses Add folder and selects the folder that contains many subfolders. I've done quite a few conversions that way. What I don't know is how mixed spec input files will be handled as I haven't tried that. You , being interested, might experiments with a few small batches to see what comes out.

How can I complete this huge conversion job?

Reply #3
I second foobar2000 as a recommendation.

(db1989, shouldn't this be moved from FLAC? In the end the OP is just asking for software to encode large collections...)

How can I complete this huge conversion job?

Reply #4
Wow, less than 2 hours and we have 3 replies.
First to db1989:
I need to make an effort to ensure losslessness, because Gold Wave uses its own extentions to encode and decode files. Which means that they end up meeting Gold Wave in the middle, and Gold Wave likes to let you control everything in the batch conversions. There are a few things that you can just set to auto, but bit depth is not one of them, at least to my knowledge. Thus, the files are converted to the bit depth you select, before being sent to the encoder. and when I say I wouldn't notice a difference between flac and wav, I was not questioning or confirming Flac's losslessness. I was saying, that since Flac compatibility is high,I'll be able to work with flac files, as easily as I can with wavs. I don't understand where that confusion came up.
And, if this topic is in the wrong place, I apologize. I thought since it was related to a problem I was having with Flac conversion, it would fit here.
And finally, to the Foobar recommendations:
I just downloaded Foobar again, and am trying the batch conversion. It works well on small batches, and it indeed has an auto option that works but I wouldn't expect much less from Foobar. It just takes about 10 times as long as Gold Wave to import a large group of files. This is probably because Gold Wave only gathers the directories, and then gathers the files during the conversion. But Foobar has many more options, and I like it a lot more for this purpose. If nothing else, the better conversion will make me use Foobar more, and I may get into the other things it can do.

How can I complete this huge conversion job?

Reply #5
Sure, I understood your points regarding the compromises introduced by GoldWave. Hence my sentiment that you should use something that is actually meant for batch-conversion. The reason GoldWave asks you to specify bit-depths and suchlike is probably that such programs are usually used for editing purposes that might require conversion to differing parameters afterwards. A dedicated batch-converter will not have any such obstacles and will simply pass the WAVs to flac.exe/dll, allowing it to determine and preserve the input parameters automatically.

My mistake regarding your statement about a difference. I see what you meant now that you have specified it.

As for foobar2000 and speed, if the reason is the one you suggested, I assume the initial slowdown when loading files into the playlist will be compensated because fb2k now will not have to acquire them immediately prior to conversion, whereas GoldWave would.

Finally, I don’t feel this is in the wrong location at all, so no worries there.

How can I complete this huge conversion job?

Reply #6
Yep, I see your point completely with Gold Wave not being meant for this kind of conversion. My laziness suggested otherwise, however. I still wonder if they can add that. It'll at least be one more feature to add to the big list of batch conversion options available.
I can't tell just how much of a difference we get with speed in Foobar yet, but apart from the somewhat long wait for the list to get populated, the conversion seems fast enough. If I find anything else, I will post here.


How can I complete this huge conversion job?

Reply #8
I would use the command line tools provided by FLAC, and windows PowerShell to make a for loop that would recursively go thru all the folders. The FLAC command line tool has a flag to verify compression. Linux/Mac should have for loops as well.

I believe the target file should remain in the same folder as the originals. And you can opt to preserve or delete the originals.

How can I complete this huge conversion job?

Reply #9
Hi,
Ideally, I'd do something exactly like that. But after reading through the main features of Power Shell, I don't think that's an option for me. I know virtually nothing when it comes to programming/scripting, and I'll get lost so easily, it's embarrassing. Still, I'm not totally against using the command line to do tasks like that, I'm just very weak with doing those kinds of things that way since I'm so used to plain frontends and the like.

How can I complete this huge conversion job?

Reply #10
You don't need windows powershell, normal shell will do.

The basics of what you want is:
Code: [Select]
for /r %i in (*.wav) do flac --verify --best "%i"


Now in case you don't know how to get around a command prompt, here is some quick basics.
View contents of current folder:
Code: [Select]
dir


Change drive letter:
Code: [Select]
C:


Change folder:
Code: [Select]
cd FolderName


Go Back to parent folder:
Code: [Select]
cd ..


NOTE: You'll either have to copy the flac.exe program on the folder where you are going to be when you run the for command. Or put it's full path in quotes.

How can I complete this huge conversion job?

Reply #11
so we have a wide assortment of bit depths and sample rates.

Take one of each variation, copy those three or four files to a folder, convert them as an experiment and see what happens. If it's flawless, hit up the main load and go get lunch.

How can I complete this huge conversion job?

Reply #12
Hi,
I already tried a small batch to see if it worked, and it failed. That's why I posted here. Fortunately it's fine with Foobar, and we'll see if anything else passes the test.
And thanks for the command line tips. I'll give it a spin now, as I think I can probably do those things. I'll post back with results.

How can I complete this huge conversion job?

Reply #13
As far as your comment about converting from 16 bit to 24 bit before lossless conversion (which makes no sense at all), if all you do is add 8 bits of zeros then the file will still compress just as well. If, on the other hand, you do any kind of processing or add dither, then the compressed file will be much larger, just as you said.

How can I complete this huge conversion job?

Reply #14
For conversion I would use sox as it does all format detection automatically. It preserves samplerate or bitdepth of the resultant flac file, no need to do any preliminary conversion, checks, or using different command lines for different files.

All you need to do is call sox on each of the files., just like the loop shown above.

Actually this task would be the very motivation for using a computer many decades ago. The work-intensive GUI tools without any automation available make this task look complicated.

How can I complete this huge conversion job?

Reply #15
For conversion I would use sox as it does all format detection automatically. It preserves samplerate or bitdepth of the resultant flac file, no need to do any preliminary conversion, checks, or using different command lines for different files.

But flac.exe itself can do this just fine when all the files input are supported formats, as seems to be the case here. Maybe if the OP were using a wide mixture of formats including raw PCM and ones that flac.exe does not support, there would be a rationale for using another executable. As it is, I feel they might as well just take the simple route of using the official encoder since it is perfectly capable. The suggestion is good, as is telling people about SoX in general, but I feel it is surplus to requirements in this case.

But anyway, I presume the current plan is to pipe things through fb2k, which does the same thing that SoX would be doing.

How can I complete this huge conversion job?

Reply #16
Hi PDQ:
You are right. I just tested some more, and sure enough, going from 16 to 24 in foobar doesn't change file size much. Going from 16 to 24 bit in Gold Wave makes the 24 bit flacs twice as large as the 16 bit ones, if not larger. So it must be adding dither. There would be no need for it, but it's probably not smart enough to know that. There's no dithering options either, at least not that I can find. Man, I now know just how ineffective Gold Wave would've been for this conversion, for once I'm glad I'm not using it for something.

How can I complete this huge conversion job?

Reply #17
Lucky escape!

How can I complete this huge conversion job?

Reply #18
FYI when a program is invoked by a for loop, it is invoked again (individually) for each file. It is the equivalent of running the command on each file, one by one. And that should detect the files bit rate and sample rate

AFAIK, before a recent update. FLAC.exe didn't support wildcards on windows, and the for loop was the recommended way of working with multiple files in a folder:
https://xiph.org/flac/faq.html#tools__wildcards_on_windows

How can I complete this huge conversion job?

Reply #19
I indicated above that either method will preserve parameters on a per-file basis. And if flac.exe does now support wildcards, that method too will read the parameters from each individual file. Doing anything else would be ridiculous.