我对Vlc.DotNet(Wpf)说道! 我想开发一个CCTV应用程序,在一个页面上支持100个摄像机实时视图! 我有一个10x10网格,可以在单元格中显示视频。
问题是应用程序变慢并在36个视频片段后停止。
这是我的测试:
XAML:
<Window x:Class="vlc_stream_test.videoGrid"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Wpf="clr-namespace:Vlc.DotNet.Wpf;assembly=Vlc.DotNet.Wpf" Title="Video Lan Grid" Height="500" Width="525" Loaded="Window_Loaded">
<Grid Name="root" ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
</Grid>
代码背后的代码:
try
{
VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64;
VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_AMD64;
}
catch
{
VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_X86;
VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_X86;
}
VlcContext.StartupOptions.IgnoreConfig = true;
VlcContext.StartupOptions.LogOptions.LogInFile = false;
VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = false;
VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.None;
Vlc.DotNet.Core.VlcContext.StartupOptions.AddOption("--network-caching=1000");
Vlc.DotNet.Core.VlcContext.StartupOptions.AddOption("--no-skip-frames");
Vlc.DotNet.Core.VlcContext.StartupOptions.AddOption("--no-video-title");
Vlc.DotNet.Core.VlcContext.StartupOptions.AddOption("--live-caching=10000");
VlcContext.Initialize();
InitializeComponent();
root.Background = Brushes.DarkGreen;
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
{
var visBrush = new VisualBrush() { Stretch = Stretch.UniformToFill };
Grid g = new Grid() {Background = visBrush, Margin = new Thickness(1) };
g.PreviewMouseDown += (sender, e) =>
{
VlcControl vlc = new VlcControl() { Media = new LocationMedia("file:///C:/Users/Public/Videos/wildlife.wmv") };
Binding binding = new Binding("VideoSource") { Source = vlc };
var imgBox = new Image();
imgBox.SetBinding(Image.SourceProperty, binding);
visBrush.Visual = imgBox;
};
root.Children.Add(g);
Grid.SetColumn(g, j);
Grid.SetRow(g, i);
}
我使用的视频规范:
分辨率:128x96
bitRate:72 kb / s
音频:无
视频格式:wmv1
我需要一个解决我问题的解决方案...... 感谢。
答案 0 :(得分:0)
最后,我使用AForge.Net在一个页面中显示了100个不同的视频流。 AForge更快更快比VLC更轻!
要在wpf中使用Aforge.Net,请查看此answer!