EmguCV和OpenCV:白名单RTP协议

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

我试图从Parrot Bebop 2无人机接收一些视频。我正在使用这个由Parrot提供的Bebop.sdp文件。

我之前在Python中尝试过将环境变量OPENCV_FFMPEG_CAPTURE_OPTIONS设置为protocol_whitelist;file,rtp,udp。这适用于Python。从那时起,我们将该项目主要移植到C#。但是当试图连接到流时,我们得到这个错误Protocol 'rtp' not on whitelist 'file,crypto'!。我看过其他例子,这个-protocol_whitelist "file,rtp,udp"通过ffmpeg参数传递,但在这种情况下它似乎不是一个解决方案,因为我不能传递它。

首先,我从一个简单的测试开始:

VideoCapture videoCapture = new VideoCapture(0);
var frame = videoCapture.QueryFrame();

while (frame != null)
{
    using (frame)
    {
        CvInvoke.Imshow("frame", frame);
        CvInvoke.WaitKey(1);
    }

    frame = videoCapture.QueryFrame();
}

此代码获取来自网络摄像头的流并且有效。

当我使用SDP文件运行它时出现错误:

VideoCapture videoCapture = new VideoCapture(@"./bebop.sdp");

var frame = videoCapture.QueryFrame();

while (frame != null)
{
    using (frame)
    {
        CvInvoke.Imshow("frame", frame);
        CvInvoke.WaitKey(1);
    }

    frame = videoCapture.QueryFrame();
}

我试图添加两个:

Environment.SetEnvironmentVariable("OPENCV_FFMPEG_CAPTURE_OPTIONS", "protocol_whitelist;file,rtp,udp");

并采取更积极的方法:

Environment.SetEnvironmentVariable("OPENCV_FFMPEG_CAPTURE_OPTIONS", "protocol_whitelist;file,rtp,udp", EnvironmentVariableTarget.User);

由于我得到同样的错误,它们似乎都没有影响。

我希望在设置环境变量时,OpenCV会将所需的协议列入白名单,这样流就会降低,并显示在框架中。

c# emgucv rtp sdp
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.