Thursday, 16 January 2020

linux - Remove Audio stream from XVID files


I have a bunch of Xvid files that each have an audio stream that I do not want. How can I strip the audio track I don't want using the Linux command line?


I don't need the whole script (loop), just what command I would use to process each avi file individually (unless the cmd itself has batch modification built into it).


I don't believe the file is in an mkv container, as mkvinfo doesn't find anything. Here is part of mplayer's output (thanks ~quack):


[aviheader] Video stream found, -vid 0
ID_AUDIO_ID=1
[aviheader] Audio stream found, -aid 1
ID_AUDIO_ID=2
[aviheader] Audio stream found, -aid 2
VIDEO: [XVID] 512x384 12bpp 25.000 fps 1013.4 kbps (123.7 kbyte/s)

Answer



Frankly, I think you'll prefer using the ffmpeg solution. But I figured mencoder (mplayer's encoder) could do this too ... and it can, but only as a side-effect -- since it's built on top of a player, it can only process one audio stream at a time. If you were reversing the process (adding a second audio stream to a file that only had one), you'd need a different tool.


The -aid X option selects the audio stream (replace X with the stream's ID number). It looks like the mplayer output you've quoted shows the proper ID numbers already, so try with those. This keeps the first audio stream (use -aid 2 if you want the second):


$ mencoder orig.avi -o new.avi -oac copy -ovc copy -aid 1

Other commandline AVI tools that might help are:



  • avidemux (you can script with -nogui)

  • transcode


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...