[英]Use of Gstreamer RTSP server with Android
我有一个能够打开UDP套接字,连接到服务器,接收数据(h264流),解码接收到的数据并将其显示在智能手机屏幕上的android应用程序。
我现在想做的是用以下管道替换服务器:
gst-launch-1.0 filesrc location=toystory.h264 ! h264parse ! video/x-h264,stream-format=byte-stream,alignment=nal ! rtph264pay ! udpsink host=x.x.x.x port=5000
当我启动android时,屏幕上什么都没有(客户端未接收到数据,客户端与服务器之间未建立连接)。
要打开套接字,我正在使用以下java代码:
try
{
IPAddress = InetAddress.getByName(dstAddress);
socket = new DatagramSocket(PORT);
socket.connect(IPAddress,PORT);
sendPacket = new DatagramPacket(buff, buff.length, IPAddress, PORT);
if (socket.isConnected()) {
socket.send(sendPacket);
}
receivePacket = new DatagramPacket(buffr, buffr.length, IPAddress, PORT);
socket.receive(receivePacket);
}
catch(IOException e) {
e.printStackTrace();
}
你能指导我解决这个问题吗?
对于Androud上的rtsp服务器,您应该使用gstreamer rtsp lib。
简而言之:
在服务器端使用此管道:
filesrc location=toystory.h264 ! h264parse ! rtph264pay name=pay0 pt=96
在rtsp服务器“包装器”代码中使用它。 (在回购中检查)。
供客户使用此管道:
rtspsrc location=rtsp://host_address:host_port/host_mount ! " "rtpjitterbuffer ! " "rtph264depay ! " "h264parse ! " "avdec_h264 ! " "autovideosink
例如,您可以查看此存储库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.