2

Is there any way to play last N seconds of an mp3 file on bash commandline?

2
  • Do you know how long it is to start with and its sample rate? mpg123 -k $FOO skips $FOO number of frames. At that point it's just arithmetic to figure out...
    – Bandrami
    Commented May 19, 2014 at 7:52
  • 1
    @Bandrami, figured out, check answer.
    – user13107
    Commented May 19, 2014 at 7:54

1 Answer 1

4

Figured out. Similar to https://stackoverflow.com/questions/9667081/how-do-you-trim-the-audio-files-end-using-sox

Solution:

play nameOfMp3 reverse trim 0 N reverse

(where N is the number of seconds).

1
  • On Debian-based systems, you may need to install libsox-fmt-mp3 first. Commented May 19, 2014 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .