Search code examples
ffmpegmp3xargs

xargs: unterminated quote


I'm trying to convert some .flac files to .mp3, that can I import into iTunes. I tried with find, xargs and ffmpeg, but xargs give me a unterminated quote error (because I have quotes in filename).

That`s my command line:

MacKassner:Geto Boys kassner$ find . -type f | egrep "\.flac$" | xargs -I {} ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {}.mp3

It`s stop and raise an error in filename "Talkin' Loud Ain't Saying Nothin'.flac".

Some tricks to make this one work?

-- Solved with find only -- find . -type f -name "*.flac" -exec ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {}.mp3 \;


Solution

  • Use GNU Parallel. It is specifically built for this purpose:

    MacKassner:Geto Boys kassner$ find . -type f | egrep "\.flac$" | parallel ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {}.mp3
    

    You may also want to use {.}.mp3 to get rid of the .flac:

    MacKassner:Geto Boys kassner$ find . -type f | egrep "\.flac$" | parallel ffmpeg -i {} -ab 192k -acodec libmp3lame -ac 2 {.}.mp3
    

    Watch the intro video to learn more: http://www.youtube.com/watch?v=OpaiGYxkSuQ