Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an mp4 video file with multiple audio tracks. I would like to strip away the rest of the tracks and keep just one. How do I do this?

share|improve this question
up vote 47 down vote

First run ffmpeg -i file.mp4 to see which streams exists in your file. You should see something like this:

Stream #0.0: Video: mpeg4, yuv420p, 720x304 [PAR 1:1 DAR 45:19], 23.98 tbr, 23.98 tbn, 23.98 tbc
Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
Stream #0.2: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s

Then run ffmpeg -i file.mp4 -map 0:0 -map 0:2 -acodec copy -vcodec copy new_file.mp4 to copy video stream and 2nd audio stream to new_file.mp4.

share|improve this answer
On Windows this command gave the error Option map (set input stream mapping) cannot be applied to input file file.mp4 new_file.mp4 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.: to fix it simply change the order of the arguments thusly: ffmpeg -i file.mp4 -map 0:0 -map 0:2 -acodec copy -vcodec copy new_file.mp4 – MrLore Sep 29 '13 at 11:47
Same error as @MrLore on OS X. – Oskar Jul 25 '14 at 13:22
It's the same on Ubuntu! – Tommaso Aug 25 '14 at 7:32

Related issue—removing all audio tracks from an mp4 file can be done thus:

ffmpeg -i input_file.mp4 -vcodec copy -an output_file.mp4
share|improve this answer
Thanks for this helpful tip! – Ryan Feb 15 '14 at 23:13

You could try avidemux which handles only one audio file internally (and therefore forces you to select one specific track). I've never tried it with .mp4 but it works with other formats.

share|improve this answer
Doesn't work so well. Maybe it's a bug, but the audio comes back mangled, though it does do the job (remove the rest of the audio tracks). – Tshepang Jan 25 '11 at 20:32

Identify stream numbers:

$ ffmpeg -i in.mp4
   Stream #0:0: Video: ...
   Stream #0:1: Audio: ...
   Stream #0:2: Audio: ...

Use -map _file_:_stream_ to select which streams to process and output

$ ffmpeg -i in.mp4 -map 0:0 -map 0:2 -vcodec copy -acodec copy out.mp4

see: https://ffmpeg.org/ffmpeg.html#Advanced-options

share|improve this answer

I used Avidemux (GUI) several times, and ffmpeg (console).

In Avidemux, you choose "Audio" -> "Select tracks" in the main menu; then save you video as a new file.

Interestingly enough, in some cases Avidemux produced "better" output than ffmpeg.

just in case, Avidemux and ffmpeg are in the standard Fedora Linux repository. (I'm sure they are standard in other Linux flavors, too.)

share|improve this answer

-vn or -an will remove all the video or audio tracks. Supplying -vn -acodec copy will remove video; -an -vcodec copy will remove all audio.

-vcodec copy specifies that ffmpeg should do a straight copy the existing video track (and not do any processing/encoding of it). If you don't specify it, then it will still work but ffmpeg may re-encode the existing video track and the operation will use more CPU and may take considerably longer.

share|improve this answer

If you don't mind the program being GUI, with Blender's video editor you can do that and much much more.

share|improve this answer

FFMPEG might be a helpful solution for you.

$ man ffmpeg
share|improve this answer
I had a brief look, and it's quite dense. I searched for "audio" and "audio track" and nothing seemed obvious. – Tshepang Jan 25 '11 at 8:01

protected by Community Jun 17 '15 at 2:56

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.