I suggest you append "_backup" to your input files first, then process the just renamed files with ffmpeg
:
Simple for-loop to process files in current directory:
for f in *.mp4; do
mv "$f" "${f%.*}_backup.mp4"
ffmpeg -i "${f%.*}_backup.mp4" -c copy "$f"
done
#or single-line:
for f in *.mp4; do mv "$f" "${f%.*}_backup.mp4"; ffmpeg -i "${f%.*}_backup.mp4" -c copy "$f"; done
find
to process files in current directory and sub directories:
find -name "*.mp4" -exec bash -c '
f="{}"
mv "$f" "${f%.*}_backup.mp4"
ffmpeg -i "${f%.*}_backup.mp4" -c copy "$f"
' \;
#or single-line:
find -name "*.mp4" -exec bash -c 'f="{}"; mv "$f" "${f%.*}_backup.mp4"; ffmpeg -i "${f%.*}_backup.mp4" -c copy "$f"' \;