ffmpegaudioffmpeg-anmute-videovideo-processingbucket-doc

How to Remove Audio from Video with FFmpeg

·Javid Jamae·6 min read
How to Remove Audio from Video with FFmpeg

You have a product demo with terrible microphone hum, a social clip that needs a music swap, or a background loop that should just be silent. The fix in FFmpeg is one flag: -an.

This post covers three ways to strip audio from video with FFmpeg, from the simplest one-liner to batch processing hundreds of files. Then we will do the same thing with the FFmpeg Micro API so you can automate it without managing a server.

The `-an` flag: remove all audio in one shot

The -an flag tells FFmpeg to drop every audio stream from the output. No re-encoding of the audio track, no codec selection. It just disappears.

ffmpeg -i input.mp4 -an -c:v copy output-silent.mp4

That is it. The video stream gets copied byte-for-byte (-c:v copy), so the operation finishes in seconds regardless of file length. The output file will have no audio track at all.

Use -c:v copy whenever you can. It avoids re-encoding video, which means no quality loss and fast execution. The only time you need to re-encode is when you are also changing the video (resizing, trimming, changing format).

When `-c:v copy` won't work

If you are also applying video filters (scaling, cropping, watermarking), you need to re-encode:

ffmpeg -i input.mp4 -an -c:v libx264 -crf 23 -pix_fmt yuv420p output-silent.mp4

This re-encodes the video with H.264 at a reasonable quality (CRF 23) while stripping audio. It takes longer but gives you full control over the output.

Replace audio with silence instead of removing it

Some platforms reject videos without an audio track. Instagram, TikTok, and certain ad networks expect audio to exist, even if it is empty. Instead of removing the audio entirely, you can replace it with silence:

ffmpeg -i input.mp4 -f lavfi -i anullsrc=r=44100:cl=stereo -c:v copy -c:a aac -shortest output-silent-track.mp4

Breaking this down:

  • -f lavfi -i anullsrc=r=44100:cl=stereo generates a silent audio stream at 44.1kHz stereo
  • -c:v copy copies the video without re-encoding
  • -c:a aac encodes the silent audio as AAC (widely compatible)
  • -shortest stops when the video ends, so the silent track matches the video length exactly

The output file has a valid audio track that happens to be completely silent. Players and platforms treat it as a normal video with audio.

Batch-process: mute all videos in a folder

When you need to strip audio from dozens or hundreds of files, a shell loop handles it:

mkdir -p muted
for f in *.mp4; do
  ffmpeg -i "$f" -an -c:v copy "muted/${f%.mp4}-silent.mp4"
done

This processes every .mp4 in the current directory, copies the video stream, drops audio, and writes the result to a muted/ subfolder. Each file finishes in under a second because there is no re-encoding.

For mixed formats (MP4, MOV, WebM), adjust the glob:

for f in *.mp4 *.mov *.webm; do
  [ -f "$f" ] || continue
  ffmpeg -i "$f" -an -c:v copy "muted/${f%.*}-silent.${f##*.}"
done

Remove audio via the FFmpeg Micro API

If you are building an automation pipeline (n8n, Make, Zapier, or custom code), you probably don't want to manage an FFmpeg installation on a server. FFmpeg Micro lets you send a transcode job with the -an flag through a REST API.

curl -X POST https://api.ffmpeg-micro.com/v1/transcodes \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [{"url": "https://example.com/video.mp4"}],
    "outputFormat": "mp4",
    "options": [
      {"option": "-an"},
      {"option": "-c:v", "argument": "copy"}
    ]
  }'

The API queues the job, processes it on cloud infrastructure, and gives you a download URL when it finishes. No server to maintain, no FFmpeg binary to install, no scaling to worry about.

You can combine -an with any other supported FFmpeg option. Want to strip audio AND resize to 720p? Add the scale options:

curl -X POST https://api.ffmpeg-micro.com/v1/transcodes \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": [{"url": "https://example.com/video.mp4"}],
    "outputFormat": "mp4",
    "options": [
      {"option": "-an"},
      {"option": "-vf", "argument": "scale=-2:720"},
      {"option": "-c:v", "argument": "libx264"},
      {"option": "-crf", "argument": "23"}
    ]
  }'

Common pitfalls

"The output still has audio." You probably used -c copy instead of -c:v copy. The shorthand -c copy copies ALL streams including audio. Use -c:v copy -an to copy only video.

"The output file is huge." If you dropped -c:v copy and forgot to set a CRF value, FFmpeg defaults to CRF 23 for libx264, which is fine. But if you accidentally used a lossless codec or a very low CRF, file sizes balloon. Stick with -c:v copy unless you need to re-encode.

"My player shows the video as having no duration." Some players struggle with video-only MP4 files. Add -movflags +faststart to move the moov atom to the beginning of the file:

ffmpeg -i input.mp4 -an -c:v copy -movflags +faststart output-silent.mp4

"Instagram/TikTok rejects the video." Use the silent audio track approach from the second section instead of -an. These platforms often require an audio stream to exist.

FAQ

Does `-an` remove audio without re-encoding the video?

Yes. When combined with -c:v copy, the video stream is copied byte-for-byte. Only the audio stream is dropped. There is no quality loss and the operation completes in seconds.

What is the difference between `-an` and `-vn`?

-an removes audio and keeps video. -vn does the opposite: it removes video and keeps audio. Use -vn when you want to extract an audio file from a video.

Can I remove audio from MKV, WebM, or MOV files?

Yes. The -an flag works with any container format FFmpeg supports. Just change the output filename extension: output.mkv, output.webm, or output.mov.

How do I remove audio from a video using an API?

Send a POST request to the FFmpeg Micro API at https://api.ffmpeg-micro.com/v1/transcodes with {"option": "-an"} in the options array. The API handles FFmpeg execution in the cloud. Get a free API key to try it.

Will removing audio reduce the file size?

Yes, by exactly the size of the audio stream. For a typical 1080p video, audio is about 5-15% of the total file size. With -c:v copy, the video portion stays identical.

Last verified: July 2026 against FFmpeg 7.x and FFmpeg Micro API v1.

About Javid Jamae

Founder & CEO at FFmpeg Micro

Javid is a software engineer, author, and entrepreneur with over 25 years of professional software development experience across enterprise, startup, and consulting environments. He founded FFmpeg Micro to make video processing accessible to developers through a simple, automation-first REST API.

Software EngineeringVideo ProcessingFFmpegCloud ArchitectureAPI DesignAutomation

Ready to process videos at scale?

Start using FFmpeg Micro's simple API today. No infrastructure required.

Get Started Free