gpt4 book ai didi

java - 在 java 中加载 mp3 文件时面临的问题无法从输入文件中获取音频输入流

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:35:19 24 4
gpt4 key购买 nike

我有以下代码:

String fileName="D:/downloads/song.mp3";
File soundFile = new File(fileName);
AudioInputStream audioInputStream = null;
try {
audioInputStream = AudioSystem.getAudioInputStream(soundFile);
} catch (Exception ex) {
ex.printStackTrace();
}

但是代码引发了以下异常:

javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file

我该如何解决这个问题?

最佳答案

听起来您缺少 MP3 编解码器。看这个thread可能的解决方案。他们提到了一个可能了解更多的 Java 声音邮件列表 - http://java.sun.com/products/java-media/sound/list.html

关于java - 在 java 中加载 mp3 文件时面临的问题无法从输入文件中获取音频输入流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8624803/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com