Windows命名管道到EmguCV VideoCapture

问题描述 投票:0回答:1

我想用emguCVC#中显示h264视频流。我使用netcat + vcl发送流,如果使用netcat + vcl,则可以看到该流,但不能从c#程序中看到(我是emgucv的新手)。 NamedPipeServerStream ncatPipe = new NamedPipeServerStream( "ncatPipe", PipeDirection.InOut, NamedPipeServerStream.MaxAllowedServerInstances, PipeTransmissionMode.Message, PipeOptions.None, 1024, 1024 ); Process ncat = new Process(); ncat.StartInfo.FileName = "CMD.exe"; ncat.StartInfo.Arguments = "/C ncat -v -l 5000 >\\\\.\\pipe\\ncatPipe 2>nul"; ncat.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; ncat.Start(); ncatPipe.WaitForConnection(); VideoCapture videoCapture = new VideoCapture("\\\\.\\pipe\\ncatPipe"); videoCapture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FourCC, VideoWriter.Fourcc('h', '2', '6', '4')); videoCapture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps, 60); videoCapture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 480); videoCapture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameWidth, 640); Timer playerTimer = new Timer(); playerTimer.Interval = 1000 / 60; playerTimer.Tick += new EventHandler((object sender1, EventArgs e1) => { Bitmap captureBmp = videoCapture.QueryFrame().Bitmap; if (captureBmp != null) { picture.Image = captureBmp; } else { picture.Image = null; playerTimer.Stop(); ncatPipe.Disconnect(); ncatPipe.Dispose(); ncat.Kill(); ncat.Dispose(); videoCapture.Dispose(); } }); playerTimer.Start();

抛出异常:Emgu.CV.World.dll中的'Emgu.CV.Util.CvException'

[[ERROR:0]]全局D:\ bb \ cv_x86 \ build \ opencv \ modules \ videoio \ src \ cap.cpp(122)cv :: VideoCapture :: open VIDEOIO(CV_IMAGES):引发未知的C ++例外!

编辑1:现在我正在尝试使用FFMPEG从管道中获取位图帧。

编辑2:FFMPEG有效,但是我的延迟大约是4000ms。

我想用emguCV在C#中显示h264视频流。我使用netcat从树莓派发送流,如果使用netcat + vcl我可以看到该流,但不能从c#程序中看到(我是emgucv的新手)。 ...

c# windows pipe emgucv named-pipes
1个回答
0
投票
Mencoder解决方案延迟:200ms〜,结合了mplayer gpu acc的延迟更短。窗体中的窗口。Windows Mplayer和Mencoder构建:http://mplayerwin.sourceforge.net/downloads.html
© www.soinside.com 2019 - 2024. All rights reserved.