Video stream from a images.

Topics: Question
May 25 at 1:49 PM
Edited May 25 at 5:30 PM
Hi there, excellent project!

I am struggling to understand what is the best way to broadcast dynamically created images.
The current encoder I use (RFC2435Media) works with VLC but is very jittery and unstable.
If I use RFC6184Media the "packetize" method take several seconds which is an unreasonable rate for me, and this is only for 640x480 images... What is the best encoder to use in the given scenario? Or am I doing something totally wrong here? An advice on how to deliver audio packets will also be very helpful.

Your help is very appreciated. Thanks.
    public partial class Form1 : Form
    {
        private RtspServer server;
        private RFC2435Media media;
        private Timer timer;

        public Form1()
        {
            InitializeComponent();

            timer = new Timer();
            timer.Interval = 100;
            timer.Enabled = false;
            timer.Tick += Timer_Tick;
        }

        private void Timer_Tick(object sender, EventArgs e)
        {
            Bitmap bmp = new Bitmap(640, 480);

            using (Graphics g = Graphics.FromImage(bmp))
            {
                g.Clear(Color.Blue);
                g.DrawString(DateTime.Now.ToString("hh:mm:ss:fff"), new Font("Arial", 40), Brushes.Red, new Point(10, 10));
            }

            media.Packetize(bmp);
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            server = new RtspServer(System.Net.IPAddress.Any, 554)
            {
                Logger = new Media.Rtsp.Server.RtspServerConsoleLogger()
            };

            media = new RFC2435Media("test");
            media.ForceTCP = false;
            server.TryAddMedia(media);
            server.Start();


            timer.Enabled = true;
        }
    }
Another note..

In the output window of visual studio, I get a lot of these messages. Is there any chance that they are the reason for the bad streaming I am experiencing?

For Session:565ded0d-69da-4171-8551-5663a3cb95e7
The thread 0xaf30 has exited with code 0 (0x0).
RestartFaultedStreams
DisconnectAndRemoveInactiveSessions
Session:565ded0d-69da-4171-8551-5663a3cb95e7 Attempting to complete previous mesage with buffer of 4 bytes.
Session:565ded0d-69da-4171-8551-5663a3cb95e7 used 4 of buffer bytes
Received Invalid Message: * RTSP/0.0


For Session:565ded0d-69da-4171-8551-5663a3cb95e7
Session:565ded0d-69da-4171-8551-5663a3cb95e7 Attempting to complete previous mesage with buffer of 4 bytes.
Session:565ded0d-69da-4171-8551-5663a3cb95e7 used 4 of buffer bytes
Received Invalid Message: * RTSP/0.0


For Session:565ded0d-69da-4171-8551-5663a3cb95e7
Session:565ded0d-69da-4171-8551-5663a3cb95e7 Attempting to complete previous mesage with buffer of 4 bytes.
Session:565ded0d-69da-4171-8551-5663a3cb95e7 used 4 of buffer bytes
Received Invalid Message: * RTSP/0.0


For Session:565ded0d-69da-4171-8551-5663a3cb95e7
Session:565ded0d-69da-4171-8551-5663a3cb95e7 Attempting to complete previous mesage with buffer of 4 bytes.
Session:565ded0d-69da-4171-8551-5663a3cb95e7 used 4 of buffer bytes
Received Invalid Message: * RTSP/0.0


For Session:565ded0d-69da-4171-8551-5663a3cb95e7
The thread 0x70e8 has exited with code 0 (0x0).
RestartFaultedStreams
DisconnectAndRemoveInactiveSessions
Session:565ded0d-69da-4171-8551-5663a3cb95e7 Attempting to complete previous mesage with buffer of 4 bytes.
Session:565ded0d-69da-4171-8551-5663a3cb95e7 used 4 of buffer bytes
Received Invalid Message: * RTSP/0.0