In this article, we cover how to remove audio from the video in Linux using ffmpeg command-line utility. FFmpeg is quite a useful package through which we can easily manage our multimedia files.
Note: Following operations require Administrative Rights. Contact your System Administrator, if you don’t have the required rights to install a package.
Install FFmpeg on Ubuntu
First, install the package. If you are on Ubuntu, then open a terminal and update the repository:
sudo apt update
To install FFmpeg:
sudo apt install ffmpeg
How to remove audio from video in Linux?
It is worth mentioning here that, we don’t provide the preference to remove a specific audio track here. Understand it with the help of an example. Let’s say we have a video file: va.mp4 and now we want to remove the audio track from it.
As already discussed, we will be using the command-line tool ffmpeg. So, open a terminal and issue the following:
ffmpeg -i va.mp4 -c:v copy -an v.mp4
where -i is for the input file. In this case, it is va.mp4,
-c:v copy mainly copies all video streams,
-an blocks all the audio streams from the file.
v.mp4 is an output video that won’t have audio.
So, the syntax for the command:
ffmpeg -i <input-video-file> -c:v copy -an <output-video-file>
In conclusion, we have covered here how to remove audio from a video in Linux.
Additional Info:
So, we have got a video file that doesn’t have the audio. If we wish to add another audio file to it. Then, it can be done through the following command:
ffmpeg -i v.mp4 -i a.m4a -c:v copy -c:a copy output.mp4
where v.mp4 and a.m4a are video and audio files respectively,
output.mp4 is the file we get by combining audio and video,
-c:a copy mainly copies all audio streams.
Rest of the options we have already covered.