简体   繁体   English

将 YUV 网络摄像头图像转换为 java 字节数组

[英]Convert YUV webcam image to java byte array

In Java, what is the most efficient way of converting a frame of PC webcam image data in YUV (I420 or YUY2) format to a byte (or integer) array?在 Java 中,将一帧 YUV(I420 或 YUY2)格式的 PC 网络摄像头图像数据转换为字节(或整数)数组的最有效方法是什么?

Don't know about java, but this is how you can solve it using ffmpeg不知道 java,但这是使用 ffmpeg 解决的方法

ffmpeg -i in.avi -vcodec rawvideo -pix_fmt yuv420p -o out.yuv

Converts any input to 420 planar yuv.将任何输入转换为 420 平面 yuv。

You can try this project:你可以试试这个项目:

http://code.google.com/p/java-yuv/ http://code.google.com/p/java-yuv/

I believe it has some code you can use我相信它有一些你可以使用的代码

SOLVED.解决了。 It may not be the MOST efficient, but PixelGrabber class seems to work with what I think is just a block data copy.它可能不是最有效的,但 PixelGrabber class 似乎适用于我认为只是块数据副本的内容。 Having said that, I'll still be happy to hear any more efficient methods.话虽如此,我仍然很高兴听到任何更有效的方法。 Thanks for your suggestions.感谢您的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM