java使用JMF将多路音频/视频录制到文件中
我有一个使用JMF的项目,在短时间内(几秒钟到几分钟)记录网络摄像机和音频输入,然后将结果写入文件
我的项目的问题是,该文件从未正确生成,无法播放
虽然我已经找到了许多例子,说明如何通过RTP进行音频和视频的多路传输,或者如何将输入文件从一种格式转换为另一种格式,但我还没有看到一个可以捕获音频和视频并将其写入文件的工作示例
有没有人有这样的功能代码示例
你可以在下面搜索框中键入要查询的问题!
我有一个使用JMF的项目,在短时间内(几秒钟到几分钟)记录网络摄像机和音频输入,然后将结果写入文件
我的项目的问题是,该文件从未正确生成,无法播放
虽然我已经找到了许多例子,说明如何通过RTP进行音频和视频的多路传输,或者如何将输入文件从一种格式转换为另一种格式,但我还没有看到一个可以捕获音频和视频并将其写入文件的工作示例
有没有人有这样的功能代码示例
# 1 楼答案
我已经找到了我无法在JMF下从两个单独的捕获设备生成文件的原因,这与start命令的顺序有关。特别是,处理器将获取数据源,或合并数据源,分配和同步时基,并为您启动/停止数据源,因此我试图手动启动数据源所做的额外工作是完全多余的,并且会给工作带来麻烦
这是一个痛苦的尝试和错误,我建议您阅读每一行代码,了解顺序,了解包含了什么,遗漏了什么以及为什么,然后再尝试自己实现它。如果你不小心的话,JMF就是一只熊
哦,记住捕捉异常。由于长度限制,我不得不省略该代码
以下是我的最终解决方案: