All posts

Remove audio from video via CLI

ffmpeg: copy the video stream and drop all audio tracks.

Open online converter

Packages to install

Only ffmpeg is required. Stream copy keeps the original video quality.

ffmpeg
apt install
sudo apt-get update
sudo apt-get install -y ffmpeg

How to run the command

Use -c copy to remux without re-encoding and -an to strip every audio stream.

ffmpeg
ffmpeg -y -i input.mp4 -map 0:v -c copy -an output.mp4

Dockerfile example

Build a minimal Ubuntu image with the required packages and run the conversion inside the container.

Dockerfile
FROM ubuntu:24.04

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        ffmpeg && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /work
docker build && docker run
docker build -t remove-audio-from-video .
docker run --rm -v "$PWD:/work" -w /work remove-audio-from-video \
  ffmpeg -y -i input.mp4 -map 0:v -c copy -an output.mp4

Example commands

Run these locally after installing the packages, or inside the container from the Dockerfile.

Example 1
ffmpeg -y -i input.mp4 -map 0:v -c copy -an output.mp4
Example 2
ffmpeg -y -i input.webm -map 0:v -c copy -an output.webm
Example 3
ffmpeg -y -i input.avi -map 0:v -c copy -an output.avi