You are not logged in.

#1 2012-07-01 17:32:31

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,678
Website

Help combining find with ffmpeg for audio conversion [solved]

My goal - convert library of flac files to alac formatted m4a files in a recursive fashion.

I'm almost there using the following but am unsure of the right syntax to allow me to discard to old .flac extension.  in the output file.  Here is what I'm using:

find -name *.flac -exec ffmpeg -i "{}" -acodec alac "{}".m4a \;

So, 01-name.flac becomes 01-name.flac.m4a -- I want to adjust my line to omit the old extension ".flac" from the filename.

The following is incorrect and only writes out "{%.flac}.m4a" to the root of my library where I started.

find -name *.flac -exec ffmpeg -i "{}" -acodec alac {%.flac}.m4a \;

Advice is appreciated.

Last edited by graysky (2012-07-01 18:32:55)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#2 2012-07-01 18:00:12

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,678
Website

Re: Help combining find with ffmpeg for audio conversion [solved]

...perhaps more efficient would be using xargs or parallel but since the output of the first command becomes the last thing on the shell to xargs and parallel...

find -name *.flac | parallel -X echo {} goes to {.}.m4a

works but when I change the echo command to the ffmpeg command it does not.

Last edited by graysky (2012-07-01 18:16:18)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2012-07-01 18:24:32

satanselbow
Member
Registered: 2011-06-15
Posts: 538

Re: Help combining find with ffmpeg for audio conversion [solved]

Got a not dissimilar project on the go myself - and immediately bottled it and did a rename at the end big_smile

From my (not particularly exhaustive) investigations at the time I found most "gui converters" write out to a temp file and then rename after the event...

Last edited by satanselbow (2012-07-01 18:24:48)

Offline

#4 2012-07-01 18:31:26

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,678
Website

Re: Help combining find with ffmpeg for audio conversion [solved]

Got it!  My mistake was using the -X switch with parallel; this works as expected (and amazingly fast on quad core):

find -name *.flac | parallel ffmpeg -i "{}" -acodec alac "{.}".m4a

Last edited by graysky (2012-07-01 18:33:30)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2012-07-01 18:33:09

satanselbow
Member
Registered: 2011-06-15
Posts: 538

Re: Help combining find with ffmpeg for audio conversion [solved]

Good work that man :thumb: ... might have to steal that one big_smile

Offline

#6 2012-08-08 03:53:38

duke11235
Member
Registered: 2009-10-09
Posts: 221

Re: Help combining find with ffmpeg for audio conversion [solved]

Thank you for this command! Switched it for the inverse and it works great. Super speedy on my quad core too!

Offline

Board footer

Powered by FluxBB