No streaming video and audio after some seconds

I’m using an ameba mini for streaming video and audio. I have uploaded the example configuration. Video and audio are only sent for a few seconds, then I don’t receive any video or audio. I can ping the card regularly, the wifi signal is strong.
On the serial terminal I noticed this error: “rtp started (UDP)
[RTSP Err]Receive request len ​​<=0, close socket
[Local] Socket closed
rtp stopped (UDP)”

Hi @stefano.masotti,

Can I check with SDK version are you using and which example are you running?

Would you mind sharing the code that you have uploaded?

Thank you.

Thanks for answer, i have upload code from arduino ide v2 from menu examples, amebamultimedia, streamrtsp, singlevidowithaudio. I d’nt use sdk only arduino ide.
Below is the modified code I uploaded for wifi authentication:
*

Example guide:
Multimedia – RTSP Streaming – Realtek IoT/Wi-Fi MCU Solutions
*/

#include “WiFi.h”
#include “StreamIO.h”
#include “VideoStream.h”
#include “AudioStream.h”
#include “AudioEncoder.h”
#include “RTSP.h”

#define CHANNEL 0

// Default preset configurations for each video channel:
// Channel 0 : 1920 x 1080 30FPS H264
// Channel 1 : 1280 x 720 30FPS H264
// Channel 2 : 1280 x 720 30FPS MJPEG

// Default audio preset configurations:
// 0 : 8kHz Mono Analog Mic
// 1 : 16kHz Mono Analog Mic
// 2 : 8kHz Mono Digital PDM Mic
// 3 : 16kHz Mono Digital PDM Mic

VideoSetting configV(CHANNEL);
AudioSetting configA(0);
Audio audio;
AAC aac;
RTSP rtsp;
StreamIO audioStreamer(1, 1); // 1 Input Audio → 1 Output AAC
StreamIO avMixStreamer(2, 1); // 2 Input Video + Audio → 1 Output RTSP

char ssid = “Network_SSID”; // your network SSID (name)
char pass = “Password”; // your network password
int status = WL_IDLE_STATUS;

void setup() {
Serial.begin(115200);

// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 2 seconds for connection:
    delay(2000);
}

// Configure camera video channel with video format information
// Adjust the bitrate based on your WiFi network quality
//configV.setBitrate(2 * 1024 * 1024);     // Recommend to use 2Mbps for RTSP streaming to prevent network congestion
Camera.configVideoChannel(CHANNEL, configV);
Camera.videoInit();

// Configure audio peripheral for audio data output
audio.configAudio(configA);
audio.begin();
// Configure AAC audio encoder
aac.configAudio(configA);
aac.begin();

// Configure RTSP with identical video format information and enable audio streaming
rtsp.configVideo(configV);
rtsp.configAudio(configA, CODEC_AAC);
rtsp.begin();

// Configure StreamIO object to stream data from audio channel to AAC encoder
audioStreamer.registerInput(audio);
audioStreamer.registerOutput(aac);
if (audioStreamer.begin() != 0) {
    Serial.println("StreamIO link start failed");
}

// Configure StreamIO object to stream data from video channel and AAC encoder to rtsp output
avMixStreamer.registerInput1(Camera.getStream(CHANNEL));
avMixStreamer.registerInput2(aac);
avMixStreamer.registerOutput(rtsp);
if (avMixStreamer.begin() != 0) {
    Serial.println("StreamIO link start failed");
}

// Start data stream from video channel
Camera.channelBegin(CHANNEL);

delay(1000);
printInfo();

}

void loop() {
// Do nothing
}

void printInfo(void) {
Serial.println(“------------------------------”);
Serial.println(“- Summary of Streaming -”);
Serial.println(“------------------------------”);
Camera.printInfo();

IPAddress ip = WiFi.localIP();

Serial.println("- RTSP -");
Serial.print("rtsp://");
Serial.print(ip);
Serial.print(":");
rtsp.printInfo();

Serial.println("- Audio -");
audio.printInfo();

}

Hi @stefano.masotti ,

Go to Boards Manager → search realtek. There should be an SDK version 4.0.x installed.
Please let me know which version you are using. If you are just running the example, it should not have any problems.

Thanks for the reply, the installed version is 4.0.5. I also tried another card (I have two) but I have the same problem. I also uploaded an example for streaming audio only, but even in this case after about 5-10 seconds I no longer hear anything. I have to relaunch the streaming application (vlc, ffplay) and listen again for another 5-10 or 15 seconds). I don’t need to restart the card. I also see that it is always connected to the wifi (mikrotik) in tx at 1Mb and in rx 75 Mb. I don’t know what else to do. Sin.

Another fact that I forgot to mention, I also tried on another wifi network with ubiquiti ap but I have the same problem.

Hi @stefano.masotti,

I have tested this in 4.0.5 and the example SingleVideoWithAudio.ino is working as expected. Please take note that this example is very reliant on network as you are streaming over WIFI. In line 55 of the attached image, you can uncomment that line and set your bit rate in order to configure for RTSP streaming.

Thank you.

Thank you for the help you gave me. I tried different values ​​as you indicated from 1 to 5, but it doesn’t solve the problem. Sorry but I will have to find another hardware platform. Thank you

Hi @stefano.masotti,

Sorry that I am not able to solve your problem, because there should not have any problem with this example as it has been tested many times. If you would like to further debug this issue, let me know of further information if you changed line 35 and 36 to your network credentials etc.

You can also do a speedtest on your network to check the download speed and upload speed.

Thank you.

Yes, the network credentials are correct. The download speedtest is approximately 80 Mb and up 30 Mb. I have other devices on the network (managed by a mikrotik) but I don’t have these problems. I also use ESP32 with webcamera but they don’t give me any problems. The network is not congested. I will let you know if I solve the problem. Thank you.

Hi @stefano.masotti ,

Can you try to set your Wifi to use 5GHz and give it a try? Use a network with 5GHz instead of 2.4GHz.

Thank you.

It was one of the first tests I had done, but it didn’t solve the problem. As soon as I can I’ll try to put an AP outside my LAN network to also exclude the router and see what happens. Thank you.