Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EMGU QueryFrame returns "streaky" Image over RTSP

I have a HD network camera that I am trying to grab frames over rtsp and using the following code:

//in Form_Load
Application.Idle += getNextFrame;

And the Event Handler:

private void getNextFrame(object sender, EventArgs ags)
{
        //where _imgCount is the total image Grabs
        lbl_Count.Text = _imgCount++.ToString(); 
        // and ibLive is a Emgu ImageBox
        ibLive.Image = capAxis.QueryFrame().Resize(640, 480, INTER.CV_INTER_AREA);
}

When I start the program, it'll grab 20-40 frames before the "streakiness" appears at the bottom of the screen. It's always on the bottom of the image, but some times it takes up half the screen.

enter image description here

The stream resolution is 1920x1080 and it's using mjpeg. I tried switching to h.264 but had the same results.

I am using Emgu version x86-2.4.0.1717

Any Ideas? Thanks.

like image 433
Tom Avatar asked Oct 04 '22 05:10

Tom


1 Answers

I know this is an old question but I ran into the same problem recently. I would recommend using another streaming library. Eg.

  • http://net7mma.codeplex.com/
  • http://www.fluorinefx.com/

If you really need to stream using EMGU then create a stream profile with a lower resolution or higher compression. I set compression to 30 and used the same resolution then provided the stream profile name in the rtsp url. (Assuming you're using an Axis camera like me capAxis)

Capture cap = new Capture(@"rtsp://10.0.0.1/axis-media/media.amp?videocodec=h264&streamprofile=rtspstream");
like image 177
Charlie Avatar answered Oct 17 '22 11:10

Charlie