0

I have a file that I created myself using "abcde". It is 11500Khz monaural mp3. No matter what I've tried, I can't find anything that gives me the correct play length. Except mplayer, but even then only while playing. Unfortunately, I have since fiddled further with the abcde.conf, and I'm not sure what it was set to.

mplayer gives, as the final line of output while playing:

A: 2.0 (01.9) of 1453.0 (24:13.0) 0.1%

This shows that it's 1453 seconds long, and it is correct. No other tool gives this number, that I have found.

mplayer -identify gives and ID_LENGTH of 290 seconds, or 4:49.9:

ID_DEMUXER=audio
ID_AUDIO_FORMAT=85
ID_AUDIO_BITRATE=40000
ID_AUDIO_RATE=11025
ID_AUDIO_NCH=0
ID_START_TIME=0.00
ID_LENGTH=290.00
ID_SEEKABLE=1
ID_CHAPTERS=0

ffprobe gives 6:39, but at least it warns this may not be accurate:

Input #0, mp3, from '1.mp3':
  Metadata:
    album           : Grip of the Shadow Plague
    artist          : Mull, Brandon and Stevens, E. B.
    track           : 19
    title           : Chapter 4 New Knights Part 1
    date            : 2008
  Duration: 00:06:39.64, start: 0.000000, bitrate: 29 kb/s
  Stream #0:0: Audio: mp3, 11025 Hz, mono, fltp, 29 kb/s

sox "$FILENAME" -n stat gives 393 seconds:

Samples read:           4341303
Length (seconds):    393.768980
Scaled by:         2147483647.0
Maximum amplitude:     0.796195
Minimum amplitude:    -0.790958
Midline amplitude:     0.002618
Mean    norm:          0.029145
Mean    amplitude:    -0.000003
RMS     amplitude:     0.051813
Maximum delta:         0.873437
Minimum delta:         0.000000
Mean    delta:         0.010020
RMS     delta:         0.020763
Rough   frequency:          703
Volume adjustment:        1.256

soxi gives 6:33

Input File     : 1.mp3
Channels       : 1
Sample Rate    : 11025
Precision      : 16-bit
Duration       : 00:06:33.77 = 4341303 samples ~ 29532.7 CDDA sectors
File Size      : 1.45M
Bit Rate       : 29.5k
Sample Encoding: MPEG audio (layer I, II or III)
Comments       : 
Tracknumber=19
Year=2008

I'm not certain what else to try. Do I really need to play this file with mplayer and grab the output in order to determine the correct play time?

John Gilmore
  • 426
  • 3
  • 5
  • 13
  • For those interested in parsing mplayer output to get the ACTUAL song length instead of incorrectly calculated nonsense, the incantation is LENGTH=\`mplayer -endpos 0.1 -ao null -nojoystick "$1" 2>/dev/null | stdbuf -i0 -oL tr '\r' '\n' | stdbuf -oL grep "^A: " | stdbuf -oL sed 's/^.* of \([0-9]*\).*$/\1/' | head -n 1\` The "-endpos" is technically not required, as "head -n 1" will cause it to terminate after the first matching line when used in conjunction with stdbuf forcing it to line buffering. – John Gilmore Nov 28 '22 at 18:23
  • Can you share that file? If possible... – pierpy Dec 12 '22 at 03:58
  • While it is a rip of an audiobook, and therefore protected by copyright, I think it would fall under fair use to give a sample, say the first megabyte. How would you like it conveyed? – John Gilmore Dec 13 '22 at 15:25
  • You can also go to my YouTube channel, and find the torrent of one I recorded myself (the arithmancer, a Harry Potter fanfic) it should have the same problem. – John Gilmore Dec 13 '22 at 15:28

0 Answers0