pc android rtp,Android Camera RTSP/RTP Stream?

How can I send Android camera video using RTP/RTSP and play it in PC(using vlc or any other player).

I googled this and found two answers:

1) using mediarecorder (http://sipdroid.org/ using VideoCamera.java)

How to work with it i tried it but no result :(

2) using PreviewCallback() - onPreviewFrame(data, camera) method.

by using sipdroid's (Rtppacket,Rtpsocket,sipdroidsocket) I am able to send Rtp Packets containing each frame as data and I am able to catch it via Wireshark.

But I am not able to play my packets in VLC :(

This is my code:

mCamera.setPreviewCallback(new PreviewCallback() {

public void onPreviewFrame(byte[] data, Camera camera) {

int width= 320;

int height=240;

eth=getInterfaces();

Log.v("Connected to ","Ethernet"+eth);

if(eth!=null){

try{

InetAddress serverAddr = InetAddress.getByName("IP Address of My PC");

Log.v("trying to ","connect with"+serverAddr);

SipdroidSocket soc = new SipdroidSocket(9954);

Log.v("trying to ","connect with Sipdroid Socket");

soc.connect(serverAddr, 9954);

Log.v("Socket ","Connected");

RtpPacket rtpp=new RtpPacket(data,height);

//rtpp.setPayloadType(125);

Log.v("RTPPacket","Created");

RtpSocket rtps= new RtpSocket(soc,serverAddr,9954);

Log.v("RTPSocket","Created");

rtps.send(rtpp);

Log.v("Packet","Sent");

}

catch(Exception e){e.printStackTrace();Log.v(TAG, "Socket");}

}

}

});

How can I play the packets? Please give some suggestions!!!

I am totally confused:( I am new to android development!! need help from experts!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值