You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to send my device camera stream to a srt server I have on my laptop. The code I am using is the following:
Srt srt = new Srt();
srt.startUp();
// create SRT socket to send stream
Socket clientSocket = new Socket();
clientSocket.setSockFlag(SockOpt.TRANSTYPE, Transtype.LIVE);
// connect socket to srt server (vMix running on my laptop)
clientSocket.connect("192.168.43.50", 11001);
// create udp listening on 0.0.0.0:7800
new Thread(new Runnable() {
@Override
public void run() {
byte[] data;
try{
byte[] buffer = new byte[1316];
DatagramSocket socketUDP = new DatagramSocket(7800);
while(true){
DatagramPacket udpPacket = new DatagramPacket(buffer, buffer.length);
socketUDP.receive(udpPacket);
data = udpPacket.getData();
// send received data to srt server
clientSocket.send(data);
}
}catch (Exception ex){}
}
}).start();
// I use ffmpeg to capture android camera, and stream it to socketUDP
int rc = FFmpeg.execute("-f android_camera -video_size 320x240 -input_queue_size 60 -i 0:0 -r 30 -f h264 udp://0.0.0.0:7800");
As you can see, the code is pretty simple. I do not know why it doesn't work. I think that the problem is on the srt socket settings.
If I send the android camera directly by udp to my laptop, and use ffplay on my laptop to see it, it works fine. So I think the ffmpeg command is ok.
Another interesting thing is that if I stream my android camera using the app Larix Broadcaster, it works fine (I can see the camera on my laptop using vMix)
Last but not less important, when I run the code above, It doesn't crash, and despite I can't see the camera on vMix, if I open on vMix the statistics dialog, I can see that the vMix is receiving data from my device.
The text was updated successfully, but these errors were encountered:
Dear ThibaultBee, thanks for your answer. Yesterday I solved the problem. The problem was the ffmpeg command I was using. I repleace the command with a new one, and now it works perfectly. This is the new ffmpeg command I am using:
By the way, you can use: socket.getSockFlag(SockOpt.PAYLOADSIZE)
to get the payload size
Also, you can use OutputStream instead of send() which is the Java/Android way to send network packet.
I am trying to send my device camera stream to a srt server I have on my laptop. The code I am using is the following:
As you can see, the code is pretty simple. I do not know why it doesn't work. I think that the problem is on the srt socket settings.
If I send the android camera directly by udp to my laptop, and use ffplay on my laptop to see it, it works fine. So I think the ffmpeg command is ok.
Another interesting thing is that if I stream my android camera using the app Larix Broadcaster, it works fine (I can see the camera on my laptop using vMix)
Last but not less important, when I run the code above, It doesn't crash, and despite I can't see the camera on vMix, if I open on vMix the statistics dialog, I can see that the vMix is receiving data from my device.
The text was updated successfully, but these errors were encountered: