[英]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.