adding silent audio in ffmpeg
Here's a command for the latest ffmpeg, works with MP4 (H264/AVC):
ffmpeg -f lavfi -i aevalsrc=0 -i input.mp4 -c:v copy -c:a aac -map 0 -map 1:v -shortest output.mp4
anullsrc audio filter
You can use ffmpeg
to create the silent audio and combine it with a video in one step. This example will use the anullsrc audio filter to generate stereo silent audio with a sample rate of 44100:
ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -i video.mov -c:v copy -c:a aac -shortest output.mov
channel_layout=stereo:sample_rate=44100
is the default, but I included it just as an example of how to use these options.
Ignoring existing audio
If your video input file has audio that you want to ignore then use the -map
option to override the default stream selection behavior:
ffmpeg -f lavfi -i anullsrc -i video.mov -c:v copy -c:a aac -map 0:a -map 1:v -shortest output.mp4
-map 0:a -map 1:v
can be translated as: from the first input (0
) use the audio (a
), and from the second input (1
) use the video (v
).
Notes
These examples will stream copy the video so it does not get re-encoded (like a "copy and paste").
It is always recommended to use a recent
ffmpeg
. Links to recent builds are on the FFmpeg Download page or you can refer to a step-by-step guide to compileffmpeg
.