I have an AVI file with two audio tracks that I am trying to edit. When I open it in Media Player, it plays fine (I can hear both). However, Windows Movie Maker and Adobe Premiere CS6 both seem to ignore the second audio track, and I can't find an option for multiple. Is there a way I could combine them or make Premiere recognise that two exist?
2 Answers
You can use the ffprobe
, and ffmpeg
tools. First, find out the numbers of the corresponding video, and audio streams using the ffprobe
tool:
$ ffprobe video.avi
ffprobe version 3.2.10-1~deb9u1 Copyright (c) 2007-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
...
Input #0, avi,webm, from 'video.avi':
Stream #0:0(eng): Video: mpeg4 (DX50 / 0x30355844), yuv420p, 704x480 [SAR 1:1 DAR 22:15], SAR 10:11 DAR 4:3, 23.98 fps, 23.98 tbr, 1k tbn, 30k tbc (default)
Stream #0:1(jpn): Audio: aac (HE-AAC), 44100 Hz, 5.1, fltp (default)
Metadata:
title : 5.1 HE-AAC
Stream #0:2(eng): Audio: vorbis, 48000 Hz, stereo, fltp
Metadata:
title : 2.0 Ogg Vorbis
In this case, we will want to retain the video stream 0:0 and mix the English, and Japanese audio streams 0:1, and 0:2 into a single audio stream. For this, we will use the ffmpeg
tool with the amerge
audio filter:
$ ffmpeg -fflags +genpts -i video.avi \
> -filter_complex '[0:1][0:2] amerge=inputs=2' \
> -c:v copy -c:a aac -ac 2 -q:a 128 video-converted.avi
Explanation of options:
-fflags +genpts
– We will not be re-encoding the video stream. However, if the video steam does not contain filestamps, the muxer may refuse this with an error message. Regenerating just the timestamps fixes this without having to re-encode the entire video stream, which would be slow and unnecessary.-i video.avi
– This specifies our input video file.-filter_complex '[0:1][0:2] amerge=inputs=2'
– This tells theamerge
filter to mix audio streams 0:1, and 0:2 into a single audio stream.-c:v copy
– We will keep the original video stream without re-encoding.-c:a aac -ac 2 -q:a 128
– We will encode the audio using the AAC codec with two channels and a bitrate of 128 kbps.video-converted.avi
– This specifies our output video file.
You could import the file into Audacity, verify that the tracks play as you wish there and then export the track into a file format that is flat and will play both tracks as one, for example .mp3.