Remove Audio From Video

By  on  

Sometimes I want to display live motion without the audio, since the audio is either bad quality or it's just extra load, which is especially important on mobile.  You could probably argue converting the video to GIF is more appropriate, but GIFs can be larger and more taxing on the device.  You also cannot pause or control animated GIFs.

The better solution may be to remove the audio from a video:

./ffmpeg -i MusicVideo.webm -vcodec copy -an MusicVideoNoAudio.webm

The -an option removes the the audio from the input file, producing a video without any audio.  The sample file below went from 5.4MB to 4.1MB and now you don't hear the annoying wind in the background.

Recent Features

  • By
    fetch API

    One of the worst kept secrets about AJAX on the web is that the underlying API for it, XMLHttpRequest, wasn't really made for what we've been using it for.  We've done well to create elegant APIs around XHR but we know we can do better.  Our effort to...

  • By
    How I Stopped WordPress Comment Spam

    I love almost every part of being a tech blogger:  learning, preaching, bantering, researching.  The one part about blogging that I absolutely loathe:  dealing with SPAM comments.  For the past two years, my blog has registered 8,000+ SPAM comments per day.  PER DAY.  Bloating my database...

Incredible Demos

Discussion

  1. If you wanted to you can extract the audio from the video. If you needed the audio for something else.

    ffmpeg -i sample.avi -vn -acodec 'copy' sample-audio.aac
    

    Thanks for the tutorial!

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!