Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are piping the output of the <code>ffmpeg</code> call(s) into the <code>rm</code> command. Since <code>ffmpeg</code> produces no interesting output and <code>rm</code> does not read any input, this doesn't do anything.</p> <p>I'm not sure what you're trying to do. I think you want to remove the flac file after processing. You have several choices: you can first convert all the ffmpeg files, then remove them all; or you can remove each file after it's been processed. I advise the latter, otherwise it will be difficult to only remove the flac file if the conversion succeeded.</p> <p>Rather than use <code>xargs</code>, it's simpler to use <code>find … -exec</code> here. For each flac file, call <code>ffmpeg</code>, and then delete the file if ffmpeg succeeded. If your find doesn't have the <code>-delete</code> action, use <code>-exec rm {} \;</code> instead. Use an intermediate shell to construct the output file name.</p> <pre><code>find . -type f -name '*.flac' \ -exec sh -c 'ffmpeg -i "$0" -acodec libmp3lame -ab 320k "${0%.*}.mp3"' {} \; \ -delete </code></pre> <p>You can use the <code>rm</code> command inside the shell snippet instead.</p> <pre><code>find . -type f -name '*.flac' \ -exec sh -c 'ffmpeg -i "$0" -acodec libmp3lame -ab 320k "${0%.*}.mp3" &amp;&amp; rm "$0"' {} \; </code></pre> <p>With some versions of <code>find</code>, if you want the output file to be called <code>foo.flac.mp3</code>, you can skip the intermediate shell.</p> <pre><code>find . -type f -name '*.flac' \ -exec ffmpeg -i {} -acodec libmp3lame -ab 320k {}.mp3 \; \ -delete </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload