Combine AUDIO and VIDEO on OSX – NOT using a NLE/DAW – part 2 – FFMPEG
Simple methods to combine Audio & Video files.
For example, update a video file with a new mix, resulting in a single new MOV file.
*This will work on OSX, Windows, Linux – as long as ffmpeg has the codecs for the files you wish to work with.
Part 2 – FFmpeg (**part 1 shows how to do this with QuickTime7 in OSX)
Steps:
1. Open Terminal
2. Navigate to the directory where your media is (makes the command easier to parse visually)
1 2 3 4 | #mapping outputs ffmpeg -i video.mov -i audio.wav -c:a copy -c:v copy -map 0:v:0 -map 1:a:0 output.mov #when there is no audio in the video file, converting audio to aac ffmpeg -i video.mov -i audio.wav -c:v copy -c:a aac output.mov |
keys:
-i indicates input file (there are two, so it is used twice)
-c:a indicates AUDIO CODEC command, which in this case is COPY (no trans-coding)
-c:v indicates VIDEO CODEC instruction, same usage as above
-map 0:v:0 instructs to copy the video of the first input to the output (0 is first, 1 is second, 2 is third…)
-map 1:a:0 instructs to copy the audio of the second input to the output.
Source: GeekyHacker.com