Glam Prestige Journal

Bright entertainment trends with youth appeal.

I have a bunch of video files with 2 audio tracks. They are avi files. The audio tracks have no labels and when I try to play them the default track has no audio. There are 2 more tracks, the second is the one with audio.

Is there a command I could run that would remove tracks 1 and 3 from every file?

They are on a Ubuntu server. CLI only.

avprobe version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2007-2014 the Libav developers built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
[mpeg4 @ 0xd1dac0] Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, from 'Video004.avi': Metadata: encoder : VirtualDubMod 1.5.10.2 (build 2540/release) Duration: 00:49:16.99, start: 0.000000, bitrate: 1937 kb/s Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 23.98 tbn, 23.98 tbc Stream #0.1: Audio: mp3, 32000 Hz, 1 channels, s16p, 96 kb/s Stream #0.2: Audio: mp3, 32000 Hz, 1 channels, s16p, 96 kb/s Stream #0.3: Audio: mp3, 32000 Hz, 1 channels, s16p, 96 kb/s
# avprobe output

2 Answers

avconv seems to be the solution

avconv -i $file -map 0:0 -map 0:2 -acodec copy -vcodec copy $outfile

I put this into a loop

dir="*.avi"
for file in $dir
do avconv -i $file -map 0:0 -map 0:2 -acodec copy -vcodec copy $outfile
done

I did not try saving to the same file name but I assume it would not work. You can easily have this delete the old file and rename the new one. I just output to a temp directory with the same names and then moved them all overwriting the originals.

To explain The map arg. tells avconv what tracks to copy. 0:0 is the video and 0:2 is the second audio track. Then acodec and vcodec are set to copy meaning it copies the audio and video without changing it.

1

Try this link. Scroll down until you reach Convert Mono Audio to Stereo and Vice Versa and try that. It allows you to turn a stereo track into a Mono track by choosing one of the channels.

6

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy