Extract audio with mencoder

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
^rooker
Site Admin
Posts: 1481
Joined: Fri Aug 29, 2003 8:39 pm

Extract audio with mencoder

Post by ^rooker »

For a lossless video archive, it makes sense to split the files into minute-segments for several reasons. Mencoder is one of the few applications that actually manage to concatenate them back together without losing a single audio sample (Tested with PCM encoded audio tracks).

Now, how can I extract the audio-only of these minute-files, without having to glue these tons of gigabytes together into a single video first?

I've searched the web, but "concat and extract audio only" seems to require an extra step.

Here's what I've been doing, in order to keep this extra step as low-weight as possible:

Code: Select all

mencoder -o audio_only.avi -ovc frameno -oac copy input/*.avi
I know that it requires further demuxing in order to extract the audio as e.g. WAV file, but this intermediate step has the following advantages:
  • I can use mencoder's ability to concat audio sample-exact.
  • For videos with several hours duration, writing directly to WAV might easily break the 2GB boundary. This is not an issue with AVI as container.
The "frameno" codec is used as a video-placeholder, because any effort to try to have mencoder work without video seemed flawless and ended in the error message:
Video stream is mandatory!
After having glued together the minute-segments into "audio_only.avi", it's now possible to use any transcoding tool to extract the audio into some other format (e.g. FLAC).
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
Post Reply