我正在使用VlcDotNet流式传输视频,最近遇到了一个奇怪的问题。当我使用 VLC 播放器从我的网络摄像头流式传输视频时,我可以完美地观看它。但是当我尝试使用 VlcControl 流式传输它时,我收到一个错误,即 VLC 无法连接到源。我在 VLC 和 VlcControl 中使用相同的选项:
:sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=ffmpeg{mux=flv},dst=:10177 /} :sout-保持
也许我错过了一些东西,请看我的代码:
if (Environment.Is64BitOperatingSystem)
{
VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_AMD64;
VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_AMD64;
}
else
{
VlcContext.LibVlcDllsPath = CommonStrings.LIBVLC_DLLS_PATH_DEFAULT_VALUE_X86;
VlcContext.LibVlcPluginsPath = CommonStrings.PLUGINS_PATH_DEFAULT_VALUE_X86;
}
//Set the startup options
VlcContext.StartupOptions.IgnoreConfig = true;
VlcContext.StartupOptions.LogOptions.LogInFile = true;
VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = false;
VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.None;
VlcContext.CloseAll();
VlcContext.Initialize();
VlcControl player = new VlcControl();
var media = new LocationMedia("dshow://");
media.AddOption(":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=ffmpeg{mux=flv},dst=:10177/} :sout-keep");
player.Media = media;
player.Play();
Console.WriteLine("Translation started...");
Console.ReadLine();