brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ffmpeg -an removes the sound from a video without touching the picture

Ffmpeg
~/tips/tip-ffmpeg-an-strip-audio

ffmpeg -i clip.mp4 -c:v copy -an clip-silent.mp4

Makes a silent copy of a video, with the video stream copied as it is.

Screen recordings with a noisy fan in the background, a clip for a slide, a GIF-like loop for a web page: sometimes the audio just has to go.

ffmpeg -i clip.mp4 -c:v copy -an clip-silent.mp4

-an means “no audio”: ffmpeg leaves every audio stream out of the output. -c:v copy copies the video stream bit for bit, so this takes a second even for a long file and the picture loses nothing.

There are siblings with the same pattern. -vn drops the video, -sn drops subtitles and -dn drops data streams. I like that they are short and easy to remember, and they combine, so -an -sn gives you only the picture.

The thing to watch is that -an applies to the output file that follows it. If you write two outputs in one command, put it in front of the one you want silent. And if your goal is to keep one of several audio tracks rather than none, -an is the wrong tool; use -map to pick the track you want.

Further reading: ffmpeg documentation

More Ffmpeg tips ffmpeg -stream_loop 2 -i in.mp4 -c copy out.mp4 ffmpeg -i in.mp4 \ ffmpeg -i video.mp4 -i video.en.srt -map 0 -map 1 -c copy -c:s mov_text -metadata:s:s:0 language=eng video-subs.mp4 ffmpeg -i film.mkv -map 0:v -map 0:a:0 -c:v copy -c:a aac -b:a 192k -ac 2 film-stereo.mkv ffmpeg -i talk.mp4 -vn -c:a copy talk.m4a All Ffmpeg tips (38) All topics

Link