1

i'm trying to broadcast a stream using IP camera inside a web page.I want to get the stream from the camera in my backend, to send it via an api. So it's look like an RTSP conversion to HTTP.

I read tens of topic and the most mentionned solution is FFMPEG.

So related to this topic and a different ffmpeg command i'm stuck on how to convert RTSP to HTTP, maybe should i convert ffmpeg content to bytes?

Here is my service method to get the camera stream :

public async Task<bool> GetStreamFromCamera(int cameraID)
        {
            Camera camera = await _context.Cameras.FirstOrDefaultAsync(m => m.Id == cameraID);
            var process = new Process()
            {
                StartInfo = new ProcessStartInfo()
                {
                    FileName = "ffmpeg",        
                    Arguments = String.Format("-i rtsp://whatever -f mpeg1video -b 800k -r 30 http://{ip}", camera.IP),
                    UseShellExecute = false,
                    CreateNoWindow = true,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true
                },
                EnableRaisingEvents = true
            };

            process.ErrorDataReceived += (sender, data) => Console.WriteLine(data.Data);

            process.Start();
            process.BeginErrorReadLine();
            return true;
        }

I take care of any suggestions, help, related topics, thanks in advance.

Q.Rey
  • 305
  • 4
  • 18

0 Answers0