Remove Unwanted Audio Tracks from Video Files

AVI Files

AVI Files

It is now possible to have multiple audio tracks in a single video. This is becoming common for Movies and Documentaries. This way a single video is good for serving people of different lingual backgrounds. However, like me you might not be interested in all those tracks. In this tutorial, we will remove all the unwanted tracks.

The tool we will be using is avconv and in a previous post I have mentioned how to install it in Ubuntu, so I will not be going into the installation part again.

Check how many Tracks are there

First of all we need to check on the track details and for that, run the following command (the extension can be mp4, mov, mkv, avi or any other):

avconv -i file_name.mkv

In my case, I got the following output:

avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
  built on Mar 30 2013 22:20:06 with gcc 4.7.2
[matroska,webm @ 0xc31d40] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska,webm, from 'file_name.mkv':
  Duration: 00:46:15.28, start: 0.000000, bitrate: 768 kb/s
    Stream #0.0(eng): Video: h264 (High), yuv420p, 1280x720, PAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0.1(rus): Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s (default)
    Stream #0.2(eng): Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
At least one output file must be specified

The lines in bold tell us how many tracks are there.

Removing the track

Since I have no interest in Russia audio, I would like to remove it. In my case I would like to keep the second track. Here is the command:

avconv -i file_name.mkv -map 0:0 -map 0:2 -acodec copy -vcodec copy output.mkv

If your track is different, for instance you want to keep the first track, replace -map 0:2 with -map 0:1 and it will work.

Another advantage you will get is a reduction in file size, which is always a good news. 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s