Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 具有MJPG馈送的视频缓冲延迟_Java_Processing_Mjpeg - Fatal编程技术网

Java 具有MJPG馈送的视频缓冲延迟

Java 具有MJPG馈送的视频缓冲延迟,java,processing,mjpeg,Java,Processing,Mjpeg,我试图将我的mjpeg视频直播延迟10秒 我正在尝试修改此代码,但我无法合并mjpg url。 当我尝试将url放入时,它不断地说“构造函数CaptureMJPEG(String,int,int,int)未定义” 原文是这样写的: capture=新的CaptureMJPEG(这个,Capturexsize,capture_ysize,capture_frames) 我把它改成: capture=newcapturemjpeg(“http://url.com/feed.mjpg”,capture

我试图将我的mjpeg视频直播延迟10秒

我正在尝试修改此代码,但我无法合并mjpg url。 当我尝试将url放入时,它不断地说“构造函数CaptureMJPEG(String,int,int,int)未定义”

原文是这样写的: capture=新的CaptureMJPEG(这个,Capturexsize,capture_ysize,capture_frames)

我把它改成: capture=newcapturemjpeg(“http://url.com/feed.mjpg”,capture大小,capture大小,capture帧)

导入处理。视频。*;
导入它。lilik.capturemjpeg.*;
捕获我的捕获;
CaptureMJPEG捕获;
视频缓冲区;
int display_xsize=800;//显示大小
int-display_-ysize=600;
int capture_xsize=320;//捕获大小
int-capture_-ysize=240;
int delay_time=10;//以秒为单位的延迟
int capture_frames=20;//每秒捕获帧数
无效设置(){
大小(显示大小、显示大小、P3D);
//警告:视频缓冲区必须在捕获或电影事件开始之前启动
monBuff=新的视频缓冲区(延迟时间*捕获帧、捕获大小、捕获大小);
capture=newcapturemjpeg(“http://url.com/feed.mjpg”,capture大小,capture大小,capture帧);
}
无效捕获事件(捕获){
capture.read();
monBuff.addFrame(捕获);
} 
作废提款(){
PImage bufimg=monBuff.getFrame();
PImage tmpimg=createImage(bufimg.宽度,bufimg.高度,RGB);
tmpimg.副本(bufimg,0,0,bufimg.宽度,bufimg.高度,0,0,bufimg.宽度,bufimg.高度);
调整大小(显示大小,显示大小);
图像(tmpimg,0,0);
} 
类视频缓冲区
{
PImage[]缓冲区;
int inputFrame=0;
int outputFrame=0;
int frameWidth=0;
int frameHeight=0;
/*
参数:
frames—缓冲区中的帧数(fps*持续时间)
宽度-视频的宽度
高度-视频的高度
*/
视频缓冲区(整数帧、整数宽度、整数高度)
{
缓冲区=新的PImage[帧];
对于(int i=0;i=this.buffer.length)
frr=0;
其他的
frr=此.outputFrame;
返回此.buffer[frr];
} 
//将新帧添加到缓冲区。
void addFrame(PImage frame)
{
//将新帧复制到缓冲区中。
System.arraycopy(frame.pixels,0,this.buffer[this.inputFrame].pixels,0,this.frameWidth*this.frameHeight);
//提高投入产出指标
这个.inputFrame++;
这个.outputFrame++;
//包装这些值。。
if(this.inputFrame>=this.buffer.length)
{
this.inputFrame=0;
}
if(this.outputFrame>=this.buffer.length)
{
this.outputFrame=0;
}
}  
} 

阅读参考文档:

这是仅有的两个构造函数:

CaptureMJPEG(PApplet父项,字符串url) 创建不带HTTP身份验证凭据的CaptureMJPEG CaptureMJPEG(PApplet父项、字符串url、字符串用户名、字符串密码) 使用HTTP身份验证凭据创建CaptureMJPEG

因此,第一个参数必须始终指向处理小程序实例。所以

capture = new CaptureMJPEG (this, "http:/url.com/feed.mjpg", capture_xsize, capture_ysize, capture_frames);
capture = new CaptureMJPEG (this, "http:/url.com/feed.mjpg", capture_xsize, capture_ysize, capture_frames);