Click here to Skip to main content
14,336,236 members
Rate this:
Please Sign up or sign in to vote.
Hello!
I have been working on the solution to develop video streaming services on server side using C#. In my case I need to implement videostream from file (or other stream, not any devices) to local network via Ethernet for clients. I try use AForge.NET Framework and AForge.FFmpeg.dll namespace. I convert my images to mp4 video.

My code for converting images to video file

using (var vFWriter = new VideoFileWriter())
        {
            // Create file
            vFWriter.Open("VideoMaker.avi", width, height, framRate, VideoCodec.MPEG4);

            foreach (var imageEntity in lstImg)
            {
                //var bmp = ToBitmap(ImageToByteArray(lstImg));
                var bmp = new Bitmap(imageEntity);
                vFWriter.WriteVideoFrame(bmp);
            }

            Debug.WriteLine($"Images quantity: {lstImg.Count}");
            vFWriter.Close();
        }


So I think I need to use VideoFileReader class to read my video.
using (var fileReader = new VideoFileReader())
      {
          fileReader.Open("VideoMaker.avi");

          Debug.WriteLine("width:  " + fileReader.Width);
          Debug.WriteLine("height: " + fileReader.Height);
          Debug.WriteLine("fps:    " + fileReader.FrameRate);
          Debug.WriteLine("codec:  " + fileReader.CodecName);
       }


AForge.NET Framework does not provide any API for streaming video to network.
I think about FFmpeg and Gst-sharp(gstreamer), but I can't find any solution to create stream.
Any suggestions?

What I have tried:

AForge.NET
using (var fileReader = new VideoFileReader())
      {
          fileReader.Open("VideoMaker.avi");

          Debug.WriteLine("width:  " + fileReader.Width);
          Debug.WriteLine("height: " + fileReader.Height);
          Debug.WriteLine("fps:    " + fileReader.FrameRate);
          Debug.WriteLine("codec:  " + fileReader.CodecName);
       }
Posted
Updated 20-Jul-18 9:46am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Comments
Ledrunning 24-Jul-18 9:28am
   
Hello! You saved a lot of time for me. But I have next question. Does MS Expression support converting images to video?
Ledrunning 25-Jul-18 9:36am
   
How can I play stream video from Microsoft expression and how generate broadcast link?
Gerry Schmitz 25-Jul-18 15:58pm
   
Did you install it? It has all the samples you need; plus there's an SDK.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100