在 Java Applet 中捕获用户的声卡输出
我正在寻找一种方法来捕获用户的声卡输出并通过 RTMP 将其实时流式传输到 red5 服务器。
使用音频重定向(例如,与 Windows Stereo Mix 一起使用)不是一种选择,因为它非常难以配置,并且在不同配置和 Windows 版本之间无法一致工作。
我对这个方向上的各种解决方案可能性持开放态度 - 甚至可能使用 JNI/JNA?
感谢您的建议!
I'm looking for a way to capture the sound card output of users and stream it to a red5 server via RTMP in real time.
Using audio redirecting, e.g. with the Windows Stereo Mix is not an option, as it is pretty difficult to configure and it doesn't work consistently across configurations and Windows versions.
I'm open for all sorts of solution possibilities in this direction - maybe even with JNI/JNA?
Thanks for your suggestions!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您愿意使用 JNI/JNA,为什么不通过 C++ 或 C 访问声音驱动程序,那会容易得多,因为无论如何您将用 Java 编写接口,但它们的实现将用 C++ 或 C 编写。
If you are open to using JNI/JNA why not access the sound driver via C++ or C, that would much be easier because anyway you are going to write the interface in Java but their implementation would be in C++ or C.
请参阅 Java 教程中的捕获音频。
小程序需要经过数字签名并受到最终用户的信任,然后才能拦截声音线路中的数据。
如果没有启用软件或硬件“音频环回”,则它可能会完全失败(即使在完全受信任的小程序中)。
See Capturing Audio in the Java Tutorial.
An applet will need to be digitally signed as well as trusted by the end user, before it will be possible to intercept the data in the sound lines.
If no software or hardware 'audio loop-back' is enabled, it might fail completely (even in a fully trusted applet).
好的 - Java 中绝对没有本地方法可以从浏览器中捕获声卡输出。可以使用 Java 本机接口编写特定于平台的代码来截取该行并将原始音频数据传递给小程序以进一步处理它。
Ok - there is definitely no native way in Java to capture the sound card output out of the browser. It is possible to use the Java Native Interface to write platform-specific code to intercept the line and pass the raw audio data to the applet to further process it.
这并不像看起来那么微不足道。
您需要做什么[第 1 部分 - 创建存储信息的位置]:
假设您想要上传到的最大大小为 1 mb 的文件(例如 .ogg)音频文件服务器数据库。如果您要创建一个自动上传器,您还可以创建一个可以手动使用的网页前端。
如果您希望问题得到解答,请提出明确的问题,以便人们可以回答。如果您不指定限制,那么在我看来,这是不专业的,至少我永远不会编写复杂的解决方案。
抱歉,我最初的回答对您没有用。我试图简化问题,但我过度简化了。
“一切都应该尽可能简单,但不能更简单。” A.爱因斯坦。
作为您问题的潜在解决方案,我可以推荐:
如果它不能解决您的问题,那么我希望它至少对您有用。
This is not as trivial, as it might seem.
What you need to do [ part 1 - creating a place to store the info ]:
Lets say you have maximum size of 1 mb file, (example .ogg) audio file, that you want to upload to a server database. If you are going to create a automation uploader, you might aswell create a webpage frontend, that you can manually use.
If you want your questions answered, then form clear question, that people can answer. If you do not specify the limits, then it is IMO nonprofessional, and at least I will never write a complex solution.
Sorry, that my initial answer was not useful for you. I tried to simplify the problem, but I over simplified it.
"Everything should be made as simple as possible, but not simpler." A. Einstein.
As a potential solution to your problem, I could recommended:
If it does not solve your problem, then I hope it's at least useful for you.