本文介绍了在JavaFX客户端中播放h265 HEVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个小型JavaFX应用程序在Windows / Linux客户端上播放一些GoPro视频。在过去,我使用过GoPro 4.我已经将视频下载到客户端并从本地存储中播放。像这样: 文件文件=新文件(AnyVideo.MP4); 媒体m =新媒体(file.toURI()。toString()); MediaPlayer mp = new MediaPlayer(m); mp.setAutoPlay(true); mediaView.setMediaPlayer(mp); 我现在尝试切换到新的GoPro 6。但它没有按预期工作。 问题可能是JavaFX MediaPlayer不支持新GoPro 6的编解码器。 GoPro 4:h264 AVC视频编解码器 GoPro 6:h265 HEVC视频编解码器 JavaFX MediaPlayer 仅支持h264编解码器。 有没有人知道如何使用我的JavaFX应用程序播放h265 HEVC视频。在最好的情况下,解决方案可以立即从摄像机播放视频,而无需先将视频下载到客户端。 GoPro有一个小型媒体服务器来通过HTTP获取视频。例如: http://10.5.5.9:8080/videos /DCIM/100/GPR10973.MP4 解决方案 原生JavaFX解决方案 也许这是重复或至少与以下内容有关: 为JavaFX 2.2添加其他视频编解码器/ DVD支持。 有关JavaFX错误跟踪系统中相关功能请求的链接,请参阅我对该问题的回答。 使用JavaFX中的非JavaFX技术的解决方案 还有其他解决方案中讨论的解决方案可能对你有用的问题。特别是如果您主要关注的是获得某种播放,即使它没有与JavaFX媒体系统进行深度集成。 例如,除了原生之外的其他方法JavaFX回放可以是: 使用 VLCJ 具有某种Swing集成(例如SwingNode,但可能有效或无效)。 将VLCJ视频渲染为JavaFX ImageView或Canvas。 见相关:使用vlcj api在Java FX中播放视频。 指向以下项目的链接: https://github.com/caprica/vlcj-javafx 。 如果您不需要嵌入视频,请启动原生视频播放器。 也许 Desktop.open()或 Process API 可以做到这一点。 致电ffmpeg 把h265转换成h264。 我对此并不太了解,但该主题的快速谷歌显示了对xuggle项目的引用。 目前 xuggler项目的状态为: Xuggler处于中断状态,因为没有人正在积极开发它。抱歉。也就是说,你总能找到源代码并开始自己攻击。祝你好运! 所以祝你好运; - ) 通过 HostServices.showDocument()调用以显示视频。 使用可集成到的第三方浏览组件JavaFX并包括对要播放的媒体类型的支持,例如JxBrowser: 在jxbrowser中支持H.265 在上面列出的选项中,我个人建议使用HostServices在本机浏览器中播放视频,如果这种解决方案可能适合你的话。 详细介绍各种选项可能超出了StackOverflow的范围(即使是abo列表开始看起来有时不赞成图书馆推荐)。 I had a small JavaFX application to play some GoPro videos on a windows / linux client. In the past I had using a GoPro 4. I've downloaded the video to the client and play it from the local storage. Like this: File file = new File("AnyVideo.MP4"); Media m = new Media(file.toURI().toString()); MediaPlayer mp = new MediaPlayer(m); mp.setAutoPlay(true); mediaView.setMediaPlayer(mp);I'll try to switch to the new GoPro 6 now. But it doesn't worked as expected.The problem is probably that the JavaFX MediaPlayer did not support the codec from the new GoPro 6.GoPro 4: h264 AVC video codecGoPro 6: h265 HEVC video codecThe JavaFX MediaPlayer supports only the h264 codec.Did anyone know a way how I can play a h265 HEVC video with my JavaFX application. In the best case a solution wich can play the video immediatly from the camera without download the video first to the client. The GoPro has a smal Media Server to get the video over HTTP. as example:http://10.5.5.9:8080/videos/DCIM/100/GPR10973.MP4 解决方案 Native JavaFX SolutionPerhaps this is a duplicate or at least related to:Adding other video codecs / DVD support to JavaFX 2.2.See my answer to that question for links to related feature requests in the JavaFX bug tracker system.Solutions using non-JavaFX tech from JavaFXThere are other solutions than those discussed in answers to that question which may work for you. Especially if your primary concern is just getting some kind of playback, even if it doesn't have deep integration with the JavaFX media system.For instance, other approaches than native JavaFX playback could be:Using VLCJ with some kind of Swing integration (such as a SwingNode, though that may or may not work).Rendering the VLCJ video into a JavaFX ImageView or Canvas.See related: Playing Video in Java FX using vlcj api.Which links to the following project: https://github.com/caprica/vlcj-javafx.Launch a native video player if you don't need the video embedded.Perhaps Desktop.open() or the Process API could do this.Call ffmpeg to convert h265 to h264.I don't know much about this, but a quick google of the topic shows up references to the xuggle project.Current status of the xuggler project is: Xuggler is on hiatus as no one is actively developing it anymore. Sorry. That said, you can always find the source code and start hacking yourself. Good luck!So I wish you good luck with that ;-)Launching the native browser through a HostServices.showDocument() call to display the video.Use a third party browsing component that can be integrated into JavaFX and includes support for the media type you want to play back, for example JxBrowser:H.265 support in jxbrowserOf the options outlined above, personally, I would recommend using HostServices to play the video in the native browser if that kind of solution will possibly work for you.Going into detail on various options is probably out of scope for StackOverflow (even the above list starts looking like a sometimes frowned upon library recommendation). 这篇关于在JavaFX客户端中播放h265 HEVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!