Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Using Accord.Video.FFMPEG to receive RTSP stream #2220

Open
1 of 3 tasks
miker1423 opened this issue Oct 12, 2020 · 0 comments
Open
1 of 3 tasks

Using Accord.Video.FFMPEG to receive RTSP stream #2220

miker1423 opened this issue Oct 12, 2020 · 0 comments

Comments

@miker1423
Copy link

  • question
  • bug report
  • feature request

Issue description
I'm trying to use the Accord.Video.FFMPEG to receive video from a RTSP source, with the VideoFileSource class, but when I try to replace the image from a picturebox in winforms with every frame that I receive in the NewFram event, it throws an ArgumentException. The code is the following:

    public partial class Form1 : Form
    {
        private VideoFileSource source;

        public Form1()
        {
            InitializeComponent();
        }

        private async void button1_Click(object sender, EventArgs e)
        {
            source = new VideoFileSource(urlBox.Text);
            source.NewFrame += Source_NewFrame;
            source.Start();
        }

        private void Source_NewFrame(object sender, Accord.Video.NewFrameEventArgs eventArgs)
        {
            ChangeFrame(eventArgs.Frame);
        }

        private void ChangeFrame(Bitmap bitmap) 
        {
            if (imageBox.InvokeRequired)
            {
                imageBox.BeginInvoke(new InvokeDelegate(ChangeFrame), bitmap);
                return;
            }

            try
            {
                imageBox.Image = bitmap; 
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        private delegate void InvokeDelegate(Bitmap image);
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant