This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 15 - Pages: 2 [ 1 2 | Next ] - Last Post: 5 Jun 23, 13:26 Last Post By: JeffTucker Threads: [ Previous | Next ]
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 15:29
 
  Click to reply to this thread Reply
In jAlbum 30, MediaUtil.getDuration("something.mp3") returned the length of the audio file. In jAlbum 31, it returns null. It's crashing Jupiter, which tries to extract the audio length of MP3's for captions.
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 19:34   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I'm now seeing wildly inconsistent results, rather than a consistent crash. Sometimes, on the Mac, a 3-minute MP3 tells me that it's over 27 hours long. Delete the local album and make the album again, and it's now 1 hour, 29 minutes. But in Windows, the result is correct.

To be clear, when the audio player shows in the browser, its own control bar shows the correct length at all times, on either platform. It's just the getDuration() value that's screwy, and unpredictable.
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 19:42   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
And another little tidbit, which might point to an underlying cause....

I added three MP3's to a project and made the album, Got odd time results. Then I deleted two of the MP3's, and they disappeared from the Explore view. Deleted the local album, and made the album again. Still three MP3's!

This is familiar - Windows won't delete a file that's open, and something in the core is keeping those three MP3's open, so they don't get deleted from the image directory.
RobM

Posts: 3,802
Registered: 4-Aug-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 21:06   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Don't know if it is related but I can't list metadata for mp3 files, ok for .wav.
I get this error
com.drew.imaging.ImageProcessingException: File format could not be determined
	at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:185)
	at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:124)
	at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:204)
	at se.datadosen.jalbum.MetadataScoutPlugin$1.listMetadata(MetadataScoutPlugin.java:79)
	at se.datadosen.jalbum.MetadataScoutPlugin$1.actionPerformed(MetadataScoutPlugin.java:57)
	at se.datadosen.util.AliasAction.actionPerformed(AliasAction.java:79)
	at se.datadosen.jalbum.ActionTracker.actionPerformed(ActionTracker.java:20)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 21:23   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Attachment cantdo.mp3 (53.0 KB)
Interesting. I can list it for some, but not others. The attached MP3 is OK. (And it's an appropriate one for jAlbum.)

Things just get stranger and stranger. On the Mac, I've gone all the way back to jAlbum 29, and a year-old, BeanShell version of Jupiter, and I'm still getting bizarre durations.
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 21:30   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
BTW, if you want to experiment, use Jupiter, and head for Thumbnails > Captions > Image thumbnail caption and check Audio length.

I'm sorely tempted just to strip it out of the skin. It's a very minor "feature," one that I'll wager no one would miss.
RobM

Posts: 3,802
Registered: 4-Aug-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 21:45   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Yes, that sound works ok. Can't find a common thread,MPEG Audio Version 1 or 2, mono or stereo.

Tried a .wav and .m4a with Jupiter and the .wav shows no duration, the m4a does.
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 21:54   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
And I get the "null crash" with a WAV.

I've now gone back to jAlbum 28, which was the last one bundled with Java 14 instead of Java 19, and a similarly old version of Jupiter. Still getting bizarre durations on the Mac, but on Windows, things seem to have "settled down," even with the most recent releases, and I'm now getting correct results!

If this has been at least semi-broken for this long, and no one has mentioned it, I'm not sure how much time and attention it's worth. In the immortal words of a former boss of mine, as we decided to abandon a project that we loved, but that wasn't getting any traction, "We've got other dead horses to flog." ;)
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 22:17   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
At least some of this is readily reproducible. In the console:
File thisone = new File("/Users/JT/My Albums/ac/fuddlaw.mp3");
MediaUtil.getDuration(thisone);
Yields: 0.212s ==> 54:06:23.039. That MP3 is about 6 seconds long. But that's only on the Mac. In Windows, the duration is 00:00:06.791. So it's not my skin coding that's at fault. :)

And FWIW, that happens with either Groovy or BeanShell - that was one of my other suspicions. ;)

ETA: Same screwy values in jAlbum 28.
RobM

Posts: 3,802
Registered: 4-Aug-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 22:43   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
If this has been at least semi-broken for this long, and no one has mentioned it, I'm not sure how much time and attention it's worth. In the immortal words of a former boss of mine, as we decided to abandon a project that we loved, but that wasn't getting any traction, "We've got other dead horses to flog." ;)
Quickest way to see if it really used is to remove it and see if anyone does post about it. :)

Does this all seem like a misreporting of ready by the media player?
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 4 Jun 23, 22:56   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
Does this all seem like a misreporting of ready by the media player?

That would not surprise me, given the seeming randomness of the results. But only sometimes random - at other times, you get the wrong value repeatedly, but it's always the same wrong value. Given the internals of this method, with, among other things, a CountDownLatch, it's clearly a bit of a high-wire act.
davidekholm

Posts: 3,430
Registered: 18-Oct-2002
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 5 Jun 23, 11:40   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
I tried "cantdo.mp3" on my Mac and got 00:00:03.392. Seems, right, doesn't it? I was testing on jAlbum 31.0.1 on OS X "Monterey" (12.6.5 (21G531)). What OS X version did you test on Jeff?
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 5 Jun 23, 12:27   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Big Sur 11.7.7.
davidekholm

Posts: 3,430
Registered: 18-Oct-2002
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 5 Jun 23, 13:08   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
JeffTucker wrote:
Big Sur 11.7.7.

I suspect it's something related to older OS X versions.
JeffTucker

Posts: 8,000
Registered: 31-Jan-2006
Re: MediaUtil.getDuration() fails in jAlbum 31
Posted: 5 Jun 23, 13:18   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
I'm surprised I never ran into it before, but then again, this is very much a "niche" setting. Only Jupiter supports audio files (as album objects, not sound clip attachments), and displaying the duration in the thumbnail caption isn't the default setting. So, it could have been lurking in there for years, and I wouldn't have seen it.

My almost 10 year old Macbook Air can't go beyond Big Sur.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums