find tracks by exact length

Asked by Panos

How do i finds all the tracks in the library that have a certain length?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu amarok Edit question
Assignee:
No assignee Edit question
Solved by:
Jakob Hilmer
Solved:
Last query:
Last reply:
Revision history for this message
Best Jakob Hilmer (jakob-hilmer) said :
#1

With help of the mp3info package you can find the length of a mp3 file.
The following command return the minute : seconds of music.mp3

  mp3info -p "%m:%s" music.mp3

Use find and sort to order your mp3 by length

  find /home/jh/music -name \*.mp3 -exec mp3info -p "%m:%02s\t" \{\} \; -print | sort -n

Or to find those files there are excatly 3:04 long:

  find /home/jh/music -name \*.mp3 -exec mp3info -p "%m:%02s\t" \{\} \; -print | grep "^3:04"

Hopefully this will help you.

Cheers,

Jakob Hilmer

Revision history for this message
Panos (vets) said :
#2

Thanks Jakob Hilmer, that solved my question.