#!/usr/bin/env bash set -euo pipefail # ensure existence of destination folder dir="$(pwd)" dest=${dir%/*}/${dir##*/}_reencode if [[ !(-d $dest) ]]; then mkdir $dest fi for file in ./*.$1; do echo "ffmpeg -i '$file' -c:a copy -map 0:0 '$dest/$file'"; ffmpeg -i "$file" -c:a copy -map 0:0 "$dest/$file"; done