I have a bunch of MP4s and Wav files in a folder with the same filenames, different file extension.
I want to replace the audio in the video files with the wav.
i.e. something like this:
for i in *.MP4;
do ffmpeg -i "$i" -i "${i%.*}.wav" -c:v copy -map 0:v:0 -map 1:a:0
"${i%.*}_merged.mp4"; done
Is this the right way to merge all the files?
1:a:0
: your shell may interpret"${i%.*}_merged.mp4"; done
as a separate command. Consider adding-movflags +faststart
if the videos are intended for progressive playback (such as on a web site hosted by you).