DEV Community

Javid Jamae
Javid Jamae

Posted on • Originally published at ffmpeg-micro.com

How to Remove Audio from Video with FFmpeg

Originally published at ffmpeg-micro.com

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.

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
Enter fullscreen mode Exit fullscreen mode

That is it. The video stream gets copied byte-for-byte (-c:v copy), so the operation finishes in seconds regardless of file length.

Use -c:v copy whenever you can. It avoids re-encoding video, which means no quality loss and fast execution.

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
Enter fullscreen mode Exit fullscreen mode

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:

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

The output file has a valid audio track that happens to be completely silent.

Batch-process: mute all videos in a folder

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

Common pitfalls

  • "The output still has audio." Use -c:v copy not -c copy. The shorthand -c copy copies ALL streams including audio.
  • "Instagram/TikTok rejects the video." Use the silent audio track approach instead of -an.
  • "My player shows no duration." Add -movflags +faststart to the command.

FAQ

Does -an remove audio without re-encoding? Yes. With -c:v copy, the video is copied byte-for-byte. Only audio is dropped.

What is the difference between -an and -vn? -an removes audio, keeps video. -vn does the opposite.

Will removing audio reduce file size? Yes, by the size of the audio stream (typically 5-15% of total).

Read the full post with API examples on ffmpeg-micro.com.

Top comments (0)