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
Hello! I am writing a program to conduct a video broadcast from the camera. I decided to transmit data via RTSP. Requests are sent to the server and responses begin to arrive, after receiving, I translate the Frame into a byte[] array and try to convert it to a bitmap, but it gives an error. Can you tell me how I can make a broadcast?
public static async void RTSPClient(CancellationToken token)
{
//параметры и запросы
var serverUri = new Uri("rtsp://192.168.0.94:554/cam0_0");
var credentials = new NetworkCredential("root", "root");
var connectionParameters = new ConnectionParameters(serverUri, credentials);
connectionParameters.RtpTransport = RtpTransportProtocol.TCP;
RtspClient rtspCl1 = new RtspClient(connectionParameters);
try
{
await rtspCl1.ConnectAsync(token);
//the process of obtaining frames
rtspCl1.FrameReceived += (sender, frame) =>
{
switch (frame)
{
case RawH264IFrame h264IFrame:
Console.WriteLine("Формат RawH264IFrame");
//the process of obtaining frames
byte[] cv1 = frame.FrameSegment.Array;
MemoryStream memoryStream = new MemoryStream(fileBytes);
//an error pops up here, the obviously received array is not an image, although the format is RawH264IFrame
Bitmap bitmap = new Bitmap(memoryStream);
break;
default:
Console.WriteLine("Формат неизвестен");
break;
}
Hello Egor,
you cannot take a rawh264iframe and write directly in a bitmap.
there is an example SimpleRtspPlayer that you can use as reference on how to archive your needs.
I think you need the RawFramesDecoding folder.
Hello! I am writing a program to conduct a video broadcast from the camera. I decided to transmit data via RTSP. Requests are sent to the server and responses begin to arrive, after receiving, I translate the Frame into a byte[] array and try to convert it to a bitmap, but it gives an error. Can you tell me how I can make a broadcast?
public static async void RTSPClient(CancellationToken token)
{
//параметры и запросы
var serverUri = new Uri("rtsp://192.168.0.94:554/cam0_0");
var credentials = new NetworkCredential("root", "root");
var connectionParameters = new ConnectionParameters(serverUri, credentials);
connectionParameters.RtpTransport = RtpTransportProtocol.TCP;
RtspClient rtspCl1 = new RtspClient(connectionParameters);
try
{
await rtspCl1.ConnectAsync(token);
};
await rtspCl1.ReceiveAsync(token);
}
catch (SocketException ex)
{
Console.WriteLine("Подключение не установлено");
Console.WriteLine("Код ошибки:");
Console.WriteLine(ex.Message);
}
}
The text was updated successfully, but these errors were encountered: