如何用Java保存MJPEG流中的图片?
如何在 Java 中保存 MJPEG 流中的图片? 我想调用 HTTP MJPEG 地址并将每一帧保存到单独的图片文件中。
How is it possible to save the pictures from a MJPEG Stream in Java?
I want to call a HTTP MJPEG address and save every single frame to a seperate picture file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
VLCj 应该能够播放该流。如果您只想经常保存屏幕截图,则应该可以使用 DirectMediaPlayer (这将为您提供一个 BufferedImage),然后使用 ImageIO 保存它。
请注意,尽管它不是世界上最容易使用的 API,并且需要本机代码;如果您是初学者(从问题来看您可能是初学者?)那么这不是最简单的任务!
VLCj should be able to play that stream. If you want to just save screenshots every so often, you should be able to use DirectMediaPlayer (which will give you a BufferedImage) then use ImageIO to save it.
Note though that it's not the easiest API in the world to use and requires native code; if you're a beginner (which from the question it seems you might be?) then this isn't the simplest of tasks!
以下代码可以帮助您:
http://www.walking-products.com/notslop/2010/04/20/motion-jpeg-in-flash-and-java/
Here is a code that could help you:
http://www.walking-productions.com/notslop/2010/04/20/motion-jpeg-in-flash-and-java/
我的流服务器在Linux上运行,我使用wget命令来rec
然后使用将outputfile.mjpg转换为outputfile.mp4
My stream server running on linux ,I used wget command to rec
then converted outputfile.mjpg to outputfile.mp4 using
请参阅 http://wiki.bitplan.com/index.php/MJpegStreamer 这是几年前出版的。
该项目中有多个实现。这是一个例子:
See http://wiki.bitplan.com/index.php/MJpegStreamer which was published by a few years ago.
There are multiple implementations in that project. Here is one example:
您只需解析出 Jpeg 字节并将它们保存到文件中即可。
You can just parse out the Jpeg bytes and save them into files.