[software development] deepin下用javafx 编写音视频播放程序,为什么不支持MP3和MP4
Tofloor
poster avatar
187******68
deepin
2026-01-01 23:10
Author

用javafx编写了一个音视频播放程序,在windows和统信UOS下运行正常,但在deep23和deep25下播放MP3和MP4总是提示

07.mp3 com.sun.media.jfxmedia.MediaException: Could not create player!

但播放wav文件正常。

网上搜索了多次,说是不支持,但在javafx文档中说是支持的。

sudo apt install gstreamer1.0-libav libavcodec-extra libavformat-extra

sudo apt install -y libgl1-mesa-dev libasound2 libxtst6 libxxf86vm1 libgtk-3-0 libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-alsa

用gst-launch-1.0 playbin uri=file:/home/t430s/07.mp3播放也正常 这些做了仍旧不行。统信uos与deep23,deep25音频处理上有什么不一样吗?请高手指教。

Supported Encoding Types

An encoding type specifies how sampled audio or video data are stored. Usually the encoding type implies a particular compression algorithm. The following table indicates the encoding types supported by Java FX Media.

Media Encoding Table| Encoding | Type | Description |
| ------------------------------- | ------ | ------------- |
| AAC | Audio | Advanced Audio Coding audio compression |
| MP3 | Audio | Raw MPEG-1, 2, and 2.5 audio; layers I, II, and III; all supported combinations of sampling frequencies and bit rates. Note: File must contain at least 3 MP3 frames. |
| PCM | Audio | Uncompressed, raw audio samples |
| H.264/AVC | Video | H.264/MPEG-4 Part 10 / AVC (Advanced Video Coding) video compression |

Reply Favorite View the author
All Replies
deepin-superuser
deepin
an hour ago
#1

应该是你的 javafx 版本和系统的 ffmpeg(libavcodec) 版本不匹配,UOS 上的版本低。deepin25上的版本高 所以UOS支持,deepin25不支持

鉴于 ffmpeg 不好降级 所以只能升级你用的 javafx 版本

Reply View the author