User Tools

Site Tools


find_audio_track_length

Finding Out the Length of An Audio Track

by Rill

If you want to find out the length of an audio track from the command line, there are at least two ways to do this.

  • Open a terminal "Ctrl+Alt+t" or or open a console "Ctrl+Alt+F1-F6".

Use ecasound

You will need to have the package "ecasound" installed.

sudo apt-get update
sudo apt-get install ecasound
  • Type the following command, substituting your actual file name for "file_name".
    ecalength file_name
  • Here is an example of your output.
    file_name 904.784s ( 5m4)

Using soxi

  • Note: It may be necessary to install a sox library for mp3 files.
    sudo apt-get update
    sudo apt-get install libsox-fmt-mp3
  • Type the following command, substituting file_name for your actual file name.
    soxi file_name | grep Duration
  • For the same file we used in the "ecalength" command, the output looks like this:
    Duration       : 00:15:03.70 = 19926497 samples ~ 67777.2 CDDA sectors

Storm Dragon and Willem van der Walt contributed to this article.

find_audio_track_length.txt · Last modified: 2013/07/03 14:27 (external edit)