#2089 closed enhancement (fixed)
mp3 support
Reported by: | anonymous | Owned by: | Don-vip |
---|---|---|---|
Priority: | major | Milestone: | 17.06 |
Component: | Core audio | Version: | |
Keywords: | java8 javafx mp3 linux javabug | Cc: | sebastic |
Description (last modified by )
I'm a big fan of the audio mapping. I find it really usefull.
I just find it a little bit painful to have to convert the mp3 files my audio recorder creates to wav.
Is it feasible to support mp3 directly ?
Can I help in some way ? Something I should look into to start with ?
Attachments (1)
Change History (70)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Type: | defect → enhancement |
---|
comment:3 by , 15 years ago
Component: | Plugin → Core |
---|
comment:4 by , 13 years ago
Description: | modified (diff) |
---|---|
Owner: | changed from | to
comment:5 by , 12 years ago
Component: | Core → Core audio |
---|---|
Summary: | the audio plugin lacks a mp3 support → mp3 support |
comment:6 by , 9 years ago
Keywords: | java8 javafx added |
---|---|
Milestone: | → 16.04 |
After we switch to Java 8 that's something we can do with JavaFX:
https://docs.oracle.com/javase/8/javafx/media-tutorial/overview.htm
comment:7 by , 9 years ago
Milestone: | 16.04 → 16.05 |
---|
comment:8 by , 9 years ago
Milestone: | 16.05 → 16.06 |
---|
comment:9 by , 9 years ago
Milestone: | 16.06 → 16.07 |
---|
comment:10 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:11 by , 9 years ago
Milestone: | 16.07 → 16.08 |
---|
comment:12 by , 9 years ago
Milestone: | 16.08 |
---|---|
Priority: | trivial → normal |
While Debian and its derivatives (Ubuntu, Mint, etc.) have openjfx-8 available for a long time, this is still not the case in the Fedora/Red Hat world: https://bugzilla.redhat.com/show_bug.cgi?id=1145303
So we should wait for this bug resolution until making JOSM depend on JavaFX.
comment:13 by , 9 years ago
@dirk: are you in contact with Fedora Java maintainers? This issue should really be solved...
comment:14 by , 9 years ago
No. I'm not. But I see that also for openSUSE there are no JavaFX packages available.
comment:15 by , 9 years ago
Oh yes sorry I didn't remember of the correct distribution :) is there a similar ticket for opensuse ?
comment:16 by , 8 years ago
JavaFX support in Fedora is finally coming soon, see https://bugzilla.redhat.com/show_bug.cgi?id=1145303 and https://bugzilla.redhat.com/show_bug.cgi?id=1438673
OpenSuse has two tickets but nobody seems interested in providing it yet: https://bugzilla.opensuse.org/show_bug.cgi?id=976102, https://bugzilla.opensuse.org/show_bug.cgi?id=991307
I think we will migrate to Java 9 before all the major Linux distributions provide JavaFX :D
comment:17 by , 8 years ago
Why not make it a soft dependency? If you have JavaFX in the classpath, you get to play mp3 files, otherwise not. The .wav
format is pretty dated.
follow-up: 19 comment:18 by , 8 years ago
I'm afraid this requires too many API calls to implement it fully by reflection. The Fedora package has been created, it will be available very soon. The question will be: do we wait for OpenSUSE or not? If Fedora provides RPMs, can they be used on SUSE?
comment:19 by , 8 years ago
Replying to Don-vip:
I'm afraid this requires too many API calls to implement it fully by reflection.
I was thinking more of restricting all JavaFX imports to a single class (JavaFXPlayer
), which implements an interface SoundPlayer
, then call it like this with javax.sound
implementation as fallback:
SoundPlayer p; try { p = new JavaFXPlayer(); } catch (ClassNotFoundException e) { p = new DefaultPlayer(); }
by , 8 years ago
Attachment: | 2089_alpha1.patch added |
---|
comment:24 by , 8 years ago
Keywords: | mp3 added |
---|---|
Milestone: | → 17.06 |
comment:25 by , 8 years ago
Priority: | normal → major |
---|
comment:27 by , 8 years ago
This is quite new to integrate Java FX in JOSM, so all feedback welcome! :)
comment:28 by , 8 years ago
Amazing!
When I click "play" for an mp3 file, it complains:
org.openstreetmap.josm.io.audio.AudioException: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player! at org.openstreetmap.josm.io.audio.JavaFxMediaPlayer.play(JavaFxMediaPlayer.java:86) at org.openstreetmap.josm.io.audio.AudioPlayer.run(AudioPlayer.java:289) Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player! at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146) at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511) at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414) at org.openstreetmap.josm.io.audio.JavaFxMediaPlayer.play(JavaFxMediaPlayer.java:72) ... 1 more Caused by: com.sun.media.jfxmedia.MediaException: Could not create player! at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:224) at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:104) at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:467) ... 3 more
(.wav file is working)
Build-Date:2017-06-08 00:13:19 Revision:12334 Is-Local-Build:true Identification: JOSM/1.5 (12334 SVN en) Linux Ubuntu 15.10 Memory Usage: 356 MB / 1764 MB (214 MB allocated, but free) Java version: 1.8.0_91-8u91-b14-3ubuntu1~15.10.1-b14, Oracle Corporation, OpenJDK 64-Bit Server VM Screen: :0.0 1366x768 Maximum Screen Size: 1366x768 Java package: openjdk-8-jre:amd64-8u91-b14-3ubuntu1~15.10.1 Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-3 VM arguments: [-Dfile.encoding=UTF-8, -Djosm.home=.josm-local]
comment:29 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Mmmm works for on Win 10 + 8u131, don't know what's going on here.
comment:30 by , 8 years ago
Ah, maybe MP3 support requires additional libraries on Linux? Can you play the file with another software?
follow-up: 33 comment:31 by , 8 years ago
Cc: | added |
---|---|
Keywords: | linux added |
@sebastic: with this change, JOSM has now an optional dependence on Java FX.
I wonder which package we should reference: openjfx (which seems to install /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar
) or libopenjfx-java (which seems to install /usr/share/java/openjfx/jre/lib/ext/jfxrt.jar
)?
follow-up: 34 comment:32 by , 8 years ago
@bastiK: I need some debug info. In PlatformManager.createMediaPlayer(Locator source)
:
public MediaPlayer createMediaPlayer(Locator source) { String mimeType = source.getContentType(); String protocol = source.getProtocol(); // go down the list until we get one that can be created for (Platform platty : platforms) { if (platty.canPlayContentType(mimeType) && platty.canPlayProtocol(protocol)) { MediaPlayer outPlayer = platty.createMediaPlayer(source); if (null != outPlayer) { return outPlayer; } } } return null; }
On my setup platforms
contains two entries:
- com.sun.media.jfxmediaimpl.platform.java.JavaPlatform ==> does not support
audio/mpeg
content type - com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform ==> supports MP3 and creates the player
What happens on your side?
comment:33 by , 8 years ago
Replying to Don-vip:
I wonder which package we should reference: openjfx (which seems to install
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar
) or libopenjfx-java (which seems to install/usr/share/java/openjfx/jre/lib/ext/jfxrt.jar
)?
libopenjfx-java
is probably more appropriate because this package provides the library (in /usr/share/java
), not the utilities and JDK specific libraries:
$ apt-file show openjfx openjfx: /usr/bin/javafxpackager openjfx: /usr/bin/javapackager openjfx: /usr/lib/jvm/java-8-openjdk-amd64/bin/javafxpackager openjfx: /usr/lib/jvm/java-8-openjdk-amd64/bin/javapackager openjfx: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar openjfx: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/javafx.properties openjfx: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jfxswt.jar openjfx: /usr/lib/jvm/java-8-openjdk-amd64/lib/ant-javafx.jar openjfx: /usr/lib/jvm/java-8-openjdk-amd64/lib/javafx-mx.jar openjfx: /usr/lib/jvm/java-8-openjdk-amd64/man/ja_JP.UTF-8/man1/javafxpackager.1.gz openjfx: /usr/lib/jvm/java-8-openjdk-amd64/man/ja_JP.UTF-8/man1/javapackager.1.gz openjfx: /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javafxpackager.1.gz openjfx: /usr/lib/jvm/java-8-openjdk-amd64/man/man1/javapackager.1.gz openjfx: /usr/share/doc/openjfx/TODO.Debian openjfx: /usr/share/doc/openjfx/changelog.Debian.gz openjfx: /usr/share/doc/openjfx/copyright openjfx: /usr/share/man/man1/javafxpackager.1.gz openjfx: /usr/share/man/man1/javapackager.1.gz $ apt-file show libopenjfx-java libopenjfx-java: /usr/share/doc/libopenjfx-java/changelog.Debian.gz libopenjfx-java: /usr/share/doc/libopenjfx-java/copyright libopenjfx-java: /usr/share/java/openjfx/jre/lib/ext/jfxrt.jar libopenjfx-java: /usr/share/java/openjfx/jre/lib/javafx.properties libopenjfx-java: /usr/share/java/openjfx/jre/lib/jfxswt.jar libopenjfx-java: /usr/share/java/openjfx/lib/ant-javafx.jar libopenjfx-java: /usr/share/java/openjfx/lib/javafx-mx.jar libopenjfx-java: /usr/share/java/openjfx/lib/packager.jar
follow-up: 42 comment:34 by , 8 years ago
Replying to Don-vip:
@bastiK: I need some debug info. In
PlatformManager.createMediaPlayer(Locator source)
:
public MediaPlayer createMediaPlayer(Locator source) { String mimeType = source.getContentType(); String protocol = source.getProtocol(); // go down the list until we get one that can be created for (Platform platty : platforms) { if (platty.canPlayContentType(mimeType) && platty.canPlayProtocol(protocol)) { MediaPlayer outPlayer = platty.createMediaPlayer(source); if (null != outPlayer) { return outPlayer; } } } return null; }On my setup
platforms
contains two entries:
- com.sun.media.jfxmediaimpl.platform.java.JavaPlatform ==> does not support
audio/mpeg
content type- com.sun.media.jfxmediaimpl.platform.gstreamer.GSTPlatform ==> supports MP3 and creates the player
What happens on your side?
Same, except it doesn't create the player, instead in GSTMedia.init()
, the line
ret = MediaError.getFromCode(gstInitNativeMedia(loc, loc.getContentType(), loc.getContentLength(), nativeMediaHandle));
returns (com.sun.media.jfxmedia.MediaError) "ERROR_MEDIA_AUDIO_FORMAT_UNSUPPORTED"
. Same for Oracle Java 8.
On the site Oracle Certified System Configurations , there are requirements listed for Linux on the bottom. I do not have version 2.28 of GLib installed, it is quite unusual to demand such a specific version of that library. It also says:
You must install the following in order to support AAC audio, MP3 audio, H.264 video, and HTTP Live Streaming:
libavcodec53 and libavformat53 on Ubuntu Linux 12.04 or equivalent.
I'm assuming 2012 is the last time they updated that paragraph and it still applies. (Haven't installed that either, libavcodec-ffmpeg56
is the closest package from the repository.)
Caveat: My Ubuntu is a bit outdated (15.10), we should also check if it is fixed on more recent versions.
comment:35 by , 8 years ago
The result of this change is that I can't compile JOSM anymore at all because of the missing deps for JavaFxMediaPlayer.java!
The build must work in case the optional dependency is not fulfilled.
follow-ups: 38 39 comment:36 by , 8 years ago
I don't see how to do that. It would be simpler to install Java FX on your machine, either from source or Oracle binaries.
Also, as you are more familiar than me with OpenSuse if you're using it, maybe you could get in touch with the OpenSuse Java maintainers to package it?
comment:37 by , 8 years ago
By the way, once you have installed it, I'd like to know if it works on your setup :) The only Linux feedback I got until now is from Paul.
follow-up: 40 comment:38 by , 8 years ago
follow-up: 41 comment:39 by , 8 years ago
Replying to Don-vip:
Also, as you are more familiar than me with OpenSuse if you're using it, maybe you could get in touch with the OpenSuse Java maintainers to package it?
This essentially means I have to make the package. I'll see what I can do.
comment:40 by , 8 years ago
Replying to stoecker:
Replying to Don-vip:
I don't see how to do that.
In this case it should become a plugin!
Only developers on OpenSuse are impacted, not the users. I assume all Java developers are able and willing to install Java FX when it is not provided by default. If you're OK, I can update the developer's guide for this point.
comment:41 by , 8 years ago
Replying to stoecker:
Replying to Don-vip:
Also, as you are more familiar than me with OpenSuse if you're using it, maybe you could get in touch with the OpenSuse Java maintainers to package it?
This essentially means I have to make the package. I'll see what I can do.
Thanks! You can have a look at #comment:16 links: the openjfx rpm package is now available in fedora 25 testing / fedora 26 stable. Should be useful for OpenSuse.
comment:42 by , 8 years ago
Replying to bastiK:
Caveat: My Ubuntu is a bit outdated (15.10), we should also check if it is fixed on more recent versions.
Tried with Ubuntu 17.04 and I get the same error and stack trace. Btw., the openjfx
package seems to be required. With only libopenjfx-java
installed, JOSM goes into fallback mode (not sure why).
comment:43 by , 8 years ago
I got it to work by creating a symlink from /usr/lib/x86_64-linux-gnu/libavcodec.so.53
to /usr/lib/x86_64-linux-gnu/libavcodec.so
. You also need to install the libavcodec-dev
(and openjfx
) package.
(Technical detail: You don't need libavcodec-dev
as such, but the dependency, which is libavcodec57
|libavcodec-extra57
on Ubuntu 17.04 and libavcodec-ffmpeg56
|libavcodec-ffmpeg-extra56
on Ubuntu 15.10. The libavcodec-dev
conveniently adds a symlink /usr/lib/x86_64-linux-gnu/libavcodec.so
to whatever version is currently installed.)
follow-ups: 45 48 comment:44 by , 8 years ago
For Ubuntu 15.10 where did you install openjfx from? The package is only available since 16.04.
Concerning the symlinks, it seems to be a packaging bug on Debian side? @sebastic: should we create a bug report?
comment:45 by , 8 years ago
Replying to Don-vip:
For Ubuntu 15.10 where did you install openjfx from? The package is only available since 16.04.
It is available in Wiley (15.10) and possibly earlier, but the website does not list Ubuntu versions that far back.
Concerning the symlinks, it seems to be a packaging bug on Debian side? @sebastic: should we create a bug report?
Possible, but eventually it should be fixed in openjdk, we should open a bug report similar to this one: JDK-8094633.
The symlink is just a crude hack, what needs to be done is that JavaFX recognizes and loads versions 55, 56 and 57 of the avcodec
library. I don't know if any changes have to be made for the new versions, but it appears to be sufficiently backwards compatible to play an .mp3 file without error.
comment:47 by , 8 years ago
Keywords: | javabug added |
---|
Done: javabug:8181922
javabug:8150503 was the last I found on the subject. Only version 57 seems to be missing in current development branch.
comment:48 by , 8 years ago
Replying to Don-vip:
Concerning the symlinks, it seems to be a packaging bug on Debian side? @sebastic: should we create a bug report?
No, the -dev packages always contain the .so symlink, but not the shared library itself.
To link to the shared libraries during build you need the .so symlinks from the -dev packages, once the software is built it should load the library using its SONAME (libfoo.so.1), and hence to need the .so symlink.
comment:50 by , 8 years ago
For the record, the openjfx
package, as added in [12397], is enough: The libavcodec*
package is a dependency of that.
Replying to Don-vip:
javabug:8150503 was the last I found on the subject. Only version 57 seems to be missing in current development branch.
Then the LTS version xenial (16.04) may be the sweet spot where it is working out of the box as the version of libavcodec is <= 56 and the Java version >= 8u102b03 (untested).
comment:51 by , 8 years ago
Update: It works with Oracle Java 1.8.0_131 and libav* <= 56 (tested on Ubuntu 15.10). However, if you have added symlinks, as described in comment 43, they must be removed! Unlike the packaged openjdk, Oracle java cannot be fooled by renaming the library file name (or adding a symlink to it). It seems to have additional scrutiny checks and fails with an error if the filename and true library version do not match.
comment:52 by , 8 years ago
Good news from Oracle regarding our bug report:
Abdul Kolarkunnu added a comment - Yesterday
Ubuntu 16.10 is a supported platform for JDK9
Kevin Rushforth added a comment - Yesterday
This needs to be done for JDK 10 and then backported to a JDK 9 and JDK 8 update release.
comment:53 by , 8 years ago
It would be nice if we could announce mp3 support for all platforms.
That would be the case if JDK-8181922 was fixed and Oracle released a new Java 8 build.
follow-up: 56 comment:54 by , 8 years ago
Well, it's too late for 8u141 (release date: 18 July 2017), but there's hope for 8u152 (release date October 2017) as they're not yet in rampdown. If the fix is backported to 8u before end of July, we should get it in October. I hope by then, OpenSUSE package will be available.
follow-up: 61 comment:56 by , 8 years ago
Replying to Don-vip:
Well, it's too late for 8u141 (release date: 18 July 2017), but there's hope for 8u152 (release date October 2017) as they're not yet in rampdown. If the fix is backported to 8u before end of July, we should get it in October. I hope by then, OpenSUSE package will be available.
Hm, interesting ... well we've done our part.
Replying to Don-vip:
In 12406/josm:
In case you aren't aware, it shows this error with Java 9 ea173:
2017-06-15 00:27:30.766 SEVERE: Handled by bug report queue: java.lang.IllegalAccessError: class org.openstreetmap.josm.io.audio.JavaFxMediaPlayer (in unnamed module @0xcb360d2) cannot access class com.sun.javafx.application.PlatformImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to unnamed module @0xcb360d2 java.lang.IllegalAccessError: class org.openstreetmap.josm.io.audio.JavaFxMediaPlayer (in unnamed module @0xcb360d2) cannot access class com.sun.javafx.application.PlatformImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to unnamed module @0xcb360d2 at org.openstreetmap.josm.io.audio.JavaFxMediaPlayer.initFxPlatform(JavaFxMediaPlayer.java:53) at org.openstreetmap.josm.io.audio.JavaFxMediaPlayer.<init>(JavaFxMediaPlayer.java:42) at org.openstreetmap.josm.io.audio.AudioPlayer.<init>(AudioPlayer.java:238) at org.openstreetmap.josm.io.audio.AudioPlayer.getInstance(AudioPlayer.java:209) at org.openstreetmap.josm.io.audio.AudioPlayer.play(AudioPlayer.java:125) at org.openstreetmap.josm.gui.layer.markerlayer.AudioMarker.play(AudioMarker.java:60)
comment:58 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:61 by , 8 years ago
Replying to bastiK:
Replying to Don-vip:
Well, it's too late for 8u141 (release date: 18 July 2017), but there's hope for 8u152 (release date October 2017) as they're not yet in rampdown. If the fix is backported to 8u before end of July, we should get it in October. I hope by then, OpenSUSE package will be available.
Hm, interesting ... well we've done our part.
Support for libav version 57 has been fixed in JDK10 and backported to 8u162, 8u172, 9.0.4 and 9.0.6 :) Most of these versions should be released in January.
comment:63 by , 7 years ago
OpenSUSE closed the enhancement request to bring in JavaFX as wontfix...
So if we look at Linux support in general, we have:
- Debian: OK
- Ubuntu: OK
- Fedora: OK
- RedHat: Not yet. RHEL8 has not been announced yet, but it will include Fedora's openjfx
- CentOS: Needs RHEL8 first
- Slackware: OK
- Gentoo: OK
- Mint: OK (Ubuntu fork)
- Arch: OK
So basically once RHEL8 and CentOS8 are released, all major Linux distributions (except OpenSUSE which plays solo) will provide JavaFX out of the box.
comment:65 by , 7 years ago
One more issue is JavaFX support for Java 9. On my system (Ubuntu 17.04) it is not working.
comment:66 by , 7 years ago
Packaging OpenJFX for OpenJDK 9 is a bit of a challenge, as discussed recently on the debian-java list, see: OpenJFX 9 integration
Sure you can help. Write a plugin to support different audio formats.