使用java代码将视频从网络摄像头流式传输到服务器 [英] Streaming video from webcam to server using java code

查看:1155
本文介绍了使用java代码将视频从网络摄像头流式传输到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是这个项目的新手,但我想要的是使用java代码将视频从外部网络摄像头流式传输到服务器,并使用android mobile(客户端)查看实时视频。任何人都可以指导我开始这个项目。我正在为这个项目使用eclipse sdt java。



到目前为止,我所做的是使用java类代码在内部显示来自外部网络摄像头的视频。我需要通过url使用我的android活动代码捕获实时视频吗?



package com.example.webcam;



Hi i am new in this project, but what i want is to Stream video from external webcam to server using java code and use android mobile(the client) to view the live video. can anyone please guide me to start on this project. I am using eclipse sdt java for this project.

so far what i had done was to display the video from the external webcam internally using the java class code. I need to capture the live video through url with my android activity code?

package com.example.webcam;

import javax.swing.JFrame;
import java.awt.*; 
import javax.media.*; 
import javax.media.format.YUVFormat;
import java.awt.event.*; 
import java.io.IOException;
import java.util.Vector;

public class Camfeed {
	
String Video_Device = "vfw:Microsoft WDM Image Capture:0";
JFrame frame = new JFrame(" Hello JMF Player"); 
static Player player = null; 

	public Camfeed() throws NoPlayerException, CannotRealizeException, IOException
	{
		// Get the device list and store it in a vector

		Vector		CaptureDeviceInfo device = (CaptureDeviceInfo) deviceList.firstElement();

		MediaLocator ml = device.getLocator();	
                // Create the player 	
		player = Manager.createRealizedPlayer(ml);		
                //Get the visual component
		Component videoScreen = player.getVisualComponent();
		// Put the visual component inside a frame 
		frame.getContentPane().add( videoScreen, BorderLayout.CENTER); 
		frame.addWindowListener( new WindowAdapter() { 
			public void windowClosing(WindowEvent we) { 
				 Camfeed.stop();    System.exit(0); 
			} 
		}); 

                frame.pack(); 
		frame.setSize( new Dimension(400,400) ); 
		frame.setVisible(true); 
		player.start(); 

	}
	public static void stop(){ 
		player.stop(); 
		 player.close();  

	} 

	public static void main(String as[]) throws NoPlayerException, CannotRealizeException, IOException
	{
		Camfeed c= new Camfeed();
	}

}

推荐答案

您好请使用libstreaming Library for android这将帮助您在我的代码中我成功实现了这个。



更多请参考此链接



https://github.com/fyhertz/libstreaming-examples
Hi please use the libstreaming Library for android This will help you to get a solution.In my code i have successfully implemented this.

Foe more please refer this link

https://github.com/fyhertz/libstreaming-examples


这篇关于使用java代码将视频从网络摄像头流式传输到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆