[FFmpeg-user] [FFMpeg user] scripting help: find > xargs ffmpeg

Dagfinn Stangeland jodgipost at gmail.com
Thu Mar 17 21:36:34 CET 2011


I've tinkered with manpages and searches hunting for an effective way to
batch convert files using ffmpeg, specifically flac to alac.

The idea is to have flac files in a folder: music/flac/ and convert them to
alac and put the output files in: /music/m4a/
Schematically I was thinking searching for .flac files using find, pipe to
xargs that runs each file through ffmpeg.

This is as far as I've come:

find  music/flac/ -iname *.flac -print0 | xargs -0 -I sourcefile ffmpeg -i
> sourcefile -acodec alac -map_meta_data 0:0,s0 "`basename "sourcefile"
> .flac`.m4a"
>

The above takes care of the batch processing but I can't figure out an
elegant way to put the files in the separate folder. I can always find and
mv the files after the fact, but that feels so… crude;)

Dagfinn


More information about the ffmpeg-user mailing list