Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm looking for something that can take advantage of my GPU or at the very least, multiple cores of my CPU to convert a few terabytes of FLAC to mp3 (VBR v0) very quickly while preserving all of the tags.

Any advice is greatly appreciated.

share|improve this question
1  
@Anthon: I believe the post was better before the edit. It was implicitly asking for advice. Now it is just a statement. –  Evan Teitelman Jun 21 '13 at 2:29
    
@EvanTeitelman The OP is still 'looking for' something (implicitly asking for us to find thing), I did not see how an inappropriate statement primarily about appreciation did help, I should have changed that line, not just delete it. –  Anthon Jun 21 '13 at 2:48
add comment

3 Answers

Depending on the directory structure (is the data flat?) you could kick of a number of pacpl in parallel. It does a reasonable job at preserving tags when converting.

It won't utilise GPU, but with some parallelisation you should be able to make use of several cores (disk might become the bottle-neck).

share|improve this answer
    
Data flat meaning one directory? Nope, it's all nested in multiple directories. I'd love to be able to retain those directories or script the directories they're put into from regexes on the tags. –  switz Jun 20 '13 at 23:00
    
@switz - that's what I meant by flat, yah. So w/ pacpl you should be OK. –  tink Jun 20 '13 at 23:06
add comment

OK, so this is actually several problems.

Utilizing several cores wouldn't be too hard, this could be achieved with a shell script and forking.

Here's a very simple example in zsh:

for f in *flac; do
    sox $f ${f%%.flac}.mp3 & 
done

Of course you could optimize that to the number of your cores and make the conversions in batches.

Now, preserving tags is a different thing, I'd probably start with SoX, and see if that can help you. If not, I'd use metaflac to dump the data into a little script, that would set my tags of the MP3 (my favorite program for that is eyeD3). They have to be "translated" by yourself as FLAC tags (which are actually just Vorbis comments) to ID3 tags.

Something like this:

for f in *flac; do
    eyeD3 -a $(metaflac --show-tag-name=ARTIST $f) ${f%%.flac}.mp3
done

This is of course just one tag, etc., it's just for demonstration. You could combine both snippets, of course.

However, I can't help you with optimizing the problem to be solved by a GPU. I don't quite see how this would help much, as GPUs are optimized for vector calculation.

share|improve this answer
1  
If you want to process many objects across several cores than I would recommend the use of xargs -P n where n is the number of cores in your system. Firing off 1,000s of parallel processes with the ampersand will slow everything down. Better to ls *.flac |xargs -P 8 -I{} nice my_command {}. –  PP. Jun 21 '13 at 11:28
    
@PP. To be honest, I'm not absolutely sure what the more important task is at hand. I assumed the parallel optimization is the less important thing, preserving the tags seems to be more important to me. –  polemon Jun 22 '13 at 4:56
add comment

I've not used this tool but it sounds like what you're looking for. It's called flac2all. Specifically this bullet:

  • CPU/Core detection, for automatic selection of # of threads.

Usage

flac2all.py with "-h" to get an overview, like so:

Usage: 
flac2all [convert type] [input dir] <options>
where 'convert type' is one of:
         [mp3]: convert file to mp3
         [vorbis]: convert file to ogg vorbis
         [flac]: convert file to flac
         [aacplusnero]: (NO TAGGING SUPPORT) convert file to aacplus using the proprietery (but excellent) Nero AAC encoder.

Options:
  -h, --help            show this help message and exit
  -c, --copy            Copy non flac files across (default=False)
  -v OGGENCOPTS, --vorbis-options=OGGENCOPTS
                        Colon delimited options to pass to oggenc,for example:
                        'quality=5:resample 32000:downmix:bitrate_average=96'.
                        Any oggenc long option (one with two '--' in front)
                        can be specified in the above format.
  -l LAMEOPTS, --lame-options=LAMEOPTS
                        Options to pass to lame, for example:
                        '-preset extreme:q 0:h:-abr'. Any lame option can be
                        specified here, if you want a short option (e.g. -h),
                        then just do 'h'. If you want a long option (e.g. '--
                        abr'), then you need a dash: '-abr'
  -a AACPLUSOPTS, --aacplus-options=AACPLUSOPTS
                        AACplus options, currently only bitrate supported.
                        e.g: " -a 64 "
  -o DIR, --outdir=DIR  Set custom output directory (default='./')
  -f, --force           Force overwrite of existing files (by default we skip)
  -t THREADS, --threads=THREADS
                        How many threads to run in parallel (default:
                        autodetect [found 2 cpu(s)] )
  -n, --nodirs          Don't create Directories, put everything together

Video Demo

There's even a video on Youtube demonstrating it saturating a 16 core system, titled: flac2all saturating 16 CPU machine (dual quad core + HT).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.