Author:David Bosch - Jan 12th, 2022
In this lesson I will summarize the most common ways of removing audio tracks from video files using FFMPEG. As always happens with FFMPEG, there's no a one fits-all approach and there are several ways of striping audio from video files. I tried to include the most common situations. If you miss your particular use case, drop me a message.
You can download the video files I will use for the examples:
Remove audio from video with FFMPEG
Remove audio from video
In some cases, you will need to remove one or more audio streams from a video file. There are multiple ways to achieve this with FFMPEG:
Remove all audio streams from a video file with -an
There is a specific FFMPEG parameter to filter out all audio streams called -an.
This parameter disables audio recording i.e. automatic selection or mapping of any audio stream
in the output file.
ffmpeg \
-i video1.mp4 \
-an \
-c copy \
-y output.mp4
The output.mp4 won't include any audio stream.
Remove all audio streams from a video file with map
In this example, I only keep the video streams, dismissing any other tracks (audio tracks, subtitles, data, etc). The final result is exactly the same the example above.
ffmpeg \
-i video1.mp4 \
-map 0:v \
-c copy \
-y output.mp4
The mapping refers only to -map 0:v meaning the video streams from input #0.
Remove a particular audio track
If the video file has more than one audio track, you can selectively remove any track.
For example, the following command removes the first audio track (0:a:0), but keeps the rest:
In the schema above, the Italian (0:a:1) and Spanish (0:a:2) audio tracks are copied to the output file,
but the English track (0:a:0) is not copied. Note that in the output file, the audio tracks are reassigned starting from 0.
The FFMPEG command to achieve this is:
ffmpeg \
-i video1.mp4 \
-map 0 -map -0:a:0 \
-c copy \
-y output.mp4
It maps/adds all streams (-map 0) but substracts the first audio track (-map -0:a:0).
The minus sign before 0:a:0 means substracting.
Remove audio from video and replace it with a silence audio track
In some cases you need to keep an audio stream in your video file to make it compatible with legacy systems or existing workflows. In this cases, the solution is to replace the audio track with a silent audio.
ffmpeg \
-i video1.mp4 -f lavfi -i anullsrc \
-c:v copy \
-shortest \
-map 0:v -map 1:a \
-y output.mp4
The -f lavfi -i anullsrc generates a virtual audio source with silence with infinite length.
That is why it's important to specify -shortest to limit the output duration to the video stream duration.
If not, an infinite output file would be created.
Remove audio from a MKV file
MKV is a very versatile format that can include video and audio streams in many encoding formats. This makes them a very easy and popular format to use in certain situations.
All examples above should work perfectly well in MKV just specifying the proper .mkv file in the FFMPEG input, for example:
ffmpeg \
-i video1.mkv \
-an \
-c copy \
-y output.mkv
Remove audio from a MP4 file
MP4 probably became the most popular video format in the Internet and it's defacto standard in most websites and platforms, like Youtube, Vimeo and others.
There are some MP4 video players that require specific parameters to correctly play the video, but others are more flexible and can play almost anything. In the first group you find MacOS Quicktime, in the second, VLC player.
All examples above are written to be used with MP4 video files, but if at some point you have any problem playing them with Quicktime, you should add these parameters:
ffmpeg \
-i video1.mkv \
-an \
-c copy \
-pix_fmt yuv420p -vcodec libx264 -acodec aac
-y output.mkv
These extra parameters (-pix_fmt yuv420p -vcodec libx264 -acodec aac) forces FFMPEG to use the pixel format and
the audio and video codecs that Quicktime can understand.
Remove the audio from a video with an API call (no FFmpeg install)
To remove the audio from a video with an API, send the video URL to JSON2Video in a movie with "muted": true on the video element.
The render returns a new MP4 with the sound silenced, and you don't install or run anything. This is useful when you can't install FFmpeg
(a serverless function, a no-code workflow, a browser app) or when removing the audio is one step of a larger job, such as adding
a voice-over, music or captions to the same video.
If you only need to strip the audio from files you already have on your computer, the FFmpeg commands above are simpler: -an -c copy
is free and doesn't re-encode the video. The API renders a new video file and uses credits (1 credit per second of output video).
Step 1: the movie JSON
A movie with one scene that holds one video element. muted silences the element's audio track
("volume": 0 does the same). The video must be at a public URL; the example uses the same video1.mp4 from above.
{
"resolution": "full-hd",
"scenes": [
{
"elements": [
{
"type": "video",
"src": "https://assets.json2video.com/how-to/add-audio-to-video/video1.mp4",
"resize": "contain",
"position": "center-center",
"muted": true
}
]
}
]
}
resolution sets the size of the output (full-hd is 1920×1080); resize: "contain" fits the whole video inside
that frame, with bars if the proportions differ. For another size, use "resolution": "custom" with width and height.
The scene lasts as long as the video. See the video element reference.
Step 2: send it to the API
curl -X POST https://api.json2video.com/v2/movies \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d @remove-audio.json
The response returns a project ID straight away, because rendering is asynchronous:
{
"success": true,
"project": "JkGxEoPRF9EgRb32",
"timestamp": "2026-05-12T10:49:52.924Z"
}
Step 3: check the status and get the video
curl "https://api.json2video.com/v2/movies?project=JkGxEoPRF9EgRb32" \
-H "x-api-key: YOUR_API_KEY"
The status goes from pending to running to done. When it is done, the movie.url field holds the link to the
MP4. Poll no more often than every 5 seconds, or add a webhook destination to the movie so JSON2Video calls
you when it is ready. Rendered videos are kept for 7 days, so download yours or have it delivered to your own storage.
You can get a key in the API key page; there is a quickstart in the docs.
Silent track or no track? muted silences the sound. The documentation doesn't say whether the output file also keeps an
(empty) audio stream, so if a downstream system needs a file with no audio stream at all, use FFmpeg with -an, as shown above.
Can I remove audio from a video with no watermark for commercial use?
Yes, with FFmpeg on any plan, and with the JSON2Video API on any paid plan. FFmpeg runs on your own machine and never adds a watermark. With the API, renders on the free plan may carry a JSON2Video watermark and the free plan is for personal, educational and evaluation use only, not commercial use (it also limits videos to 60 seconds). All paid plans render without a watermark and allow commercial use. See the pricing page and the content ownership and usage rights page.
Removing the sound doesn't change who owns the video: you still need the rights to the footage you process.
Final thoughts on removing audio from video using FFMPEG
In your day to day video operations you will face situations when you must remove one or more audio tracks from a file, replace them with a silent track or simply striping the audio. The above examples will do the trick for most of this situations.
Sources
- https://ottverse.com/add-remove-extract-audio-from-video-using-ffmpeg/
- https://dfarq.homeip.net/ffmpeg-can-remove-audio-heres-how/
- https://superuser.com/questions/268985/remove-audio-from-video-file-with-ffmpeg
Published on January 12th, 2022