MP3 Duration Java -


having awful time trying accurate time set of mp3s. have these following properties generated using mp3spi 1.9.5 library.

//      mp3.crc=true //      mp3.copyright=true //      mp3.padding=false //      mp3.channels=1 //      mp3.version.mpeg=2.5 //      mp3.length.bytes=6425480 //      mp3.framerate.fps=27.777779 //      mp3.framesize.bytes=140 //      duration=1606356000 //      mp3.version.layer=3 //      mp3.length.frames=44621 //      mp3.frequency.hz=8000 //      mp3.header.pos=0 //      mp3.bitrate.nominal.bps=16000 //      mp3.vbr.scale=0 //      mp3.version.encoding=mpeg2dot5l3 //      mp3.mode=3 //      mp3.vbr=false //      mp3.original=false 

now file reading has duration of 47:35 reported itunes, , 48:50 using mac preview.

when duration in java using library 26:46:

audiofileformat fileformat = audiosystem.getaudiofileformat(f);             map<?, ?> properties = ((taudiofileformat) fileformat).properties();             string key = "duration";             long duration = ((long) properties.get("duration")) / 1000;             {                 string framebased = string.format("duration tag: %d hours, %d min, %d sec",                         timeunit.milliseconds.tohours(duration),                         timeunit.milliseconds.tominutes(duration),                         timeunit.milliseconds.toseconds(duration) - timeunit.minutes.toseconds(timeunit.milliseconds.tominutes(duration))                     );                     system.out.println(framebased);             } 

i'm not having luck, wondering if i'm doing dumb, or if can use information within mp3 tags calculate actual length? given itunes reporting correctly assume should able to.

given itunes reporting correctly assume should able to.

one fail-safe way determine length of track convert standard audioinputstream , measure ais.

or, per comment of @kilian foth:

unfortunately, only fail-safe way.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -