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
    JavaScript Promise API

    While synchronous code is easier to follow and debug, async is generally better for performance and flexibility. Why "hold up the show" when you can trigger numerous requests at once and then handle them when each is ready?  Promises are becoming a big part of the JavaScript world...

  • By
    Responsive and Infinitely Scalable JS Animations

    Back in late 2012 it was not easy to find open source projects using requestAnimationFrame() - this is the hook that allows Javascript code to synchronize with a web browser's native paint loop. Animations using this method can run at 60 fps and deliver fantastic...

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!