我想尝试从这个rtsp网址流式传输视频。当我运行应用程序时,我没有收到任何错误,但视频没有渲染。我可以在其他应用程序上查看此流,但不能查看此流。请参阅下面的代码:
private void Form1_Load(object sender, EventArgs e)
{
vlcControl1 = new VlcControl();
vlcControl1.BeginInit();
vlcControl1.VlcLibDirectory = new DirectoryInfo(@"C:\Program Files (x86)\VideoLAN\VLC");
vlcControl1.VlcMediaplayerOptions = new[] { "-vv" };
vlcControl1.EndInit();
//Controls.Add(this.vlcControl1);
string[] options = { ":network-caching=30" };
vlcControl1.Play(new Uri("rtsp://Admin:[email protected]:554/cam/realmonitor?channel=1&subtype=1&unicast=true&proto=Onvif"), options);
}
因为你看起来像是在使用Vlc.Dotnet,所以我强烈建议你抓住像this one这样的简单样本并从那里开始。
此外,使用已安装的VLC库创建应用程序也是不好的做法。更新本地VLC应用程序将更新libvlc以用于依赖它开发的所有应用程序(这是一个坏主意的众多原因之一)。
使用此https://www.nuget.org/packages/VideoLAN.LibVLC.Windows/而不是Program Files中的dll。