M: i have an AVI and AC3 file. i'd like a cli command using ffmpeg to replace the audio in the avi file with the ac3, preferably with no stream processing, just direct copy.
G: Here’s the cleanest, minimal-processing FFmpeg command for that:
ffmpeg -i input.avi -i input.ac3 -c:v copy -c:a copy -map 0:v:0 -map 1:a:0 output.aviExplanation:
-i input.avi → your source video file-i input.ac3 → the new audio track-c:v copy → copies the video stream directly (no
re-encoding)-c:a copy → copies the AC3 audio directly (no
re-encoding)-map 0:v:0 → take the video stream from the first input
(the AVI)-map 1:a:0 → take the audio stream from the second
input (the AC3)output.avi → new file with replaced audioIf you want to replace instead of add, this command ensures only one audio track is kept.
Note: Some AVI containers don’t officially support
AC3 audio.
If playback causes issues, use .mkv or .mp4
instead (same command, just change the extension).