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: Is there an easy way to do FLAC<>WavPack on Linux? (Read 5742 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Is there an easy way to do FLAC<>WavPack on Linux?

Hi,

I've been experimenting with WavPack to try to cram more lossless music onto my phone's 256 GB SD card. Even with FLAC -8 -ep vs WavPack Extra High, I'm seeing a reduction of approximately 2% in favor of WavPack and while I am unable to speculate how easy this will be for a Galaxy S8+ to decode v. FLAC and the impact on battery life, etc.... That's open to further investigation and on a Skylake Core i7 I've determined that WavPack uses approximately 20% more CPU time than FLAC. which isn't bad considering that Monkey's Audio only provides similar compression to WavPack, but doubles the decode requirements v. FLAC and the Monkey's Audio licensing situation is horrendous and ensures that most Linux distros, including Fedora, will never provide it directly.

My question is..... So, I've converted my media library using foobar2000 in Wine, which works, although I'd prefer it if there was an easy way to use GNU Parallel along with the FLAC and WavPack command line encoders as provided by Fedora, and transfer the tagging over verbatim from one format to the other.

Since I can't find this documented anywhere, is there a script available that would do the job or some kind of relatively simple commands to go from one format to the other again?

Also, it would be kind of cool if a future release of WavPack accepted FLACs as input. Since FLAC is also an open format, would it be possible to do this? I feel WavPack would be easier to adopt if it could be fed FLAC files directly, read the tags, and did all of the heavy lifting for the user. One of the benefits of FLAC is that, as a Xiph.org format, you can feed it directly into Opus or Vorbis and they don't make you do any extra work. It would be kind of cool if the lossless encoders accepted each other's input as valid sources.

Thoughts?


Re: Is there an easy way to do FLAC<>WavPack on Linux?

Reply #2
My question is..... So, I've converted my media library using foobar2000 in Wine, which works, although I'd prefer it if there was an easy way to use GNU Parallel along with the FLAC and WavPack command line encoders as provided by Fedora, and transfer the tagging over verbatim from one format to the other.

Not sure about wavpack but I think ffmpeg copies tags just fine. Integrates great with any cli parallelisation.

@m14u: there really is no substitute for foobar on Linux.

Re: Is there an easy way to do FLAC<>WavPack on Linux?

Reply #3
 -hx6 would provide same or better compression to the extrahigh -hh , while being easier decode.  Even so, -hh on modern android would probably be very easy. My old S2 had no sweat with -hh lossy which is the 'heaviest' to decode.

The combo I use presently is -b3x4c. This gives 270k files for portable - good quality, relatively easy on storage, reasonable encoding speed and faster decoding, much faster usb transfer compared to lossless. Low overheads for both PC and phone while remaining lossless.

Re: Is there an easy way to do FLAC<>WavPack on Linux?

Reply #4
Do you happen to know the command line to do this to all files in a directory and use Extra High compression on Wavpack?

It seems obvious that paralleling this would be as simple as putting "parallel" before the command.

It looks like deadbeef might also work with some tweaking, but it's not parallel.

Re: Is there an easy way to do FLAC<>WavPack on Linux?

Reply #5
Assuming you're in the directory with your .flac files:
Code: [Select]
for f in *flac; do
    ffmpeg -i $f -c:a wavpack -compression_level 8 ${f%%.flac}.wv &
done
wait
This will encode all files in the current directory in parallel. Depending on how powerful your computer is, this might take a good while. If you don't want want it all to happen in parallel, rather you want to have it done in sequence, just remove the '&' from the end of the ffmpeg line.

The option -compression_level 8 enables -hh -x6, as described in https://ffmpeg.org/ffmpeg-codecs.html#Options-15

I suggest putting it in .sh file and have it somewhere that is seen by $path, so you can just run it from whatever directory you have there. This will also not get rid of the original .flac files, it wasn't exactly clear from your question, if this is what you want, i.e. replacing each .flac file with its corresponding .wv file.

Crude, but works ¦D

 

Re: Is there an easy way to do FLAC<>WavPack on Linux?

Reply #6
parallel ffmpeg -i {} -c:a wavpack -compression_level 3 {.}.wv ::: ./*.flac

Seems to work best for me that way.

Turning all of the WavPack into Opus (128k VBR) is then:

parallel ffmpeg -i {} -c:a libopus -b:v 128 {.}.opus ::: ./*.wv

The actual Linux Command Line tools don't seem to work out very well because everyone is all NIH about their own formats. FFMPEG sorts out the mess and can transfers tags too.

The documentation suggests compression level 3 should be similar to -hh on the WavPack command, but actually results in files that are a few kbps smaller, but it encodes more slowly.

The only caveats I could find in the FFMPEG documentation suggest that their Vorbis encoder is crap and so is the native "opus" one, but not "libopus" (which a wrapper for the reference software).

The only note I saw of interest for WavPack is that the lossy mode isn't implemented, but I won't be using that.