我正在尝试从IP摄像头流式传输视频。它显示错误:
线程中的异常" main" java.io.IOException:服务器返回HTTP 响应代码:401为URL: http://192.168.43.1:8080/snapshot.cgi?user=admin&pwd=123456"
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import javax.imageio.ImageIO;
import com.googlecode.javacv.CanvasFrame;
public class TestconnectionCamera {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
CanvasFrame CamWindow = new CanvasFrame("Camera");
String Cam1Jpeg_url = "http://192.168.43.1:8080/snapshot.cgi?user=admin&pwd=123456";
URL url = new URL(Cam1Jpeg_url);
while(true){
InputStream is = url.openStream();
BufferedImage image = ImageIO.read(is);
CamWindow.showImage(image);
is.close();
}
}
}
:::如果有人帮我解决问题,我会很高兴。:::