0
votes

I'm using VlcDotNet to stream video and I faced a strange issue recently. When I stream video from my webcamera with VLC player I can perfectly watch it. But when I try to stream it using VlcControl I get an error that VLC couldn't connect to the source. I'm using the same options in VLC and 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-keep

Maybe I missing something, please look at my code:

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();
1

1 Answers

0
votes

I think Vlc could not connect to your webcam because you didn't pass it the name of the camera i tried it and i got

 :dshow-vdev=USB2.0 Camera :dshow-adev=  :live-caching=300

try at as another aption but make sure to change the camera name
PS. you can find this option, when you open Open Capture device --> tick the Show More Options
i think this will solve your problem :)