Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

This is basically a question involving parameters to mplayer (1). (Because I don't know where to look in the docs)

Given that one has a passage of audio starting at -ss 43:20, how does one extract an audio-dump (with -o pcm) starting at that point to a relative point ending at +1min, 30sec or ending at an absolute point at 44:50?

share|improve this question
@Ganesh R. thank you for the very reasonable edits, man I wish I could think so objectively in everyday life. – Ярослав Рахматуллин Oct 19 '12 at 17:14
up vote 1 down vote accepted

mplayer input.mp3 -ao pcm -ao pcm:file=tmp.wav -ss 5 -endpos 7

This will save from 5 to 7 seconds of the file to tmp.wav. I don't know how to do it with a relative end time, but if you put it in a script then you should be able to calculate that pretty easily.

Example script to convert a diff to an exact timestamp:

#!/usr/bin/env python

import sys
import datetime

start = sys.argv[1]
diff = sys.argv[2]

def parse_ts(x):
    bits = [int(a) for a in x.split(":")]
    while len(bits) < 3:
        bits = [0] + bits
    return datetime.timedelta(hours=bits[0],

end = datetime.datetime(2000, 1, 1) + parse_ts(start) + parse_ts(diff)

print end.strftime("%H:%M:%S")

If you call that, then this will save 42 minutes and 23 seconds of sound:

mplayer input.mp3 -ao pcm -ao pcm:file=tmp.wav -ss 1:23:5 -endpos $(python 1:23:5 42:23)

share|improve this answer
There it is! -endpos <[[hh:]mm:]ss[.ms]|size[b|kb|mb]> (also see -ss and -sb). Feel free to give us a couple of examples with both bytes and times. Thanks, buddy! – Ярослав Рахматуллин Oct 19 '12 at 17:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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