strip audio from mp4 on ubuntu

To strip audio from an MP4 file on Ubuntu, you can use the command-line tool FFmpeg. This program is very versatile and can handle a wide range of audio and video conversions.


1. Install FFmpeg

First, you’ll need to install FFmpeg if you don’t already have it on your system. You can do this by opening a terminal (press Ctrl + Alt + T) and running the following command:

sudo apt update
sudo apt install ffmpeg

You may be prompted to enter your password to proceed.


2. Strip the Audio

Once FFmpeg is installed, you can use a single command to extract the audio from your MP4 file. The most common format for extracted audio is MP3.

The basic command is as follows:

ffmpeg -i input.mp4 -vn -acodec libmp3lame output.mp3

Here’s a breakdown of the command:

  • -i input.mp4: This specifies the input file. You should replace input.mp4 with the actual name of your video file.
  • -vn: This stands for “video no” and tells FFmpeg to disable the video stream. This is what effectively strips the audio.
  • -acodec libmp3lame: This specifies the audio codec to use for the output file. libmp3lame is the library for encoding MP3s.
  • output.mp3: This is the name of the output audio file. You can name it whatever you like, but it should end with .mp3.

For example, if your video file is named vacation_video.mp4, you would use this command to create an audio file named vacation_audio.mp3:

ffmpeg -i vacation_video.mp4 -vn -acodec libmp3lame vacation_audio.mp3

After running the command, FFmpeg will process the file, and you will find the new .mp3 file in the same directory as the original video.