Can FFmpeg encode multiple files at once?
<p>I'm working on a shell script to encode the audio files in a given directory and output .flac files to another directory. My proof of concept loops through each file one by one and runs it through ffmpeg. I suspect there's a way to pass the whole list of input files to ffmpeg in a single command, but haven't been able to figure it out.</p>

<p>My current version looks like this:</p>

<pre><code>#!/bin/sh

encode_album() {
    local artist=$1; shift
    local album=$1; shift
    local in_dir="${HOME}/Music/raw-imports/${artist}/${album}"
    local out_dir="${HOME}/Music/library/${artist}/${album}"

    mkdir -p "${out_dir}"

    find "${in_dir}" -type f -name *.aiff | while IFS= read -r in_file; do
        local track_name=$(basename "${in_file}" .aiff)
        local out_file="${out_dir}/${track_name}.flac"

        encode_track "${in_file}" "${out_file}"
    done
}

encode_track() {
    local in_file=$1; shift
    local out_file=$1; shift

    &lt;/dev/null ffmpeg -i "${in_file}" -codec:a flac "${out_file}"
}

encode_album "Rolf Lislevand" "La Mascarade"
</code></pre>

<p>This works, but do I need to feed these files into ffmpeg one by one, or is it capable of accepting a batch of files and processing them?</p>