bashshellaudiovideoffmpeg

Script for muxing audio and video files with same name using FFmpeg


I have a folder that contains audio and video files named like file001.wav and file001.mp4 and i want them to be muxed automatically. I've found a script for windows, but do not know how to alter it for OS X/Linux. Could someone help? Here's the windows script:

for %%a in ("*.mp4") do ffmpeg -i "%%~na.wav" -i "%%~na.mp4" -acodec copy -vcodec copy "newfiles\%%~na.mp4"

Solution

  • The following script should do the job:

    for f in *.avi; do ffmpeg -i "${f%.*}.wav" -i "${f%.*}.avi" -acodec copy -vcodec copy "newfiles/${f%.*}.avi"; done