2013-10-08 36 views
0

我使用VlcDotNet來傳輸視頻,我最近遇到了一個奇怪的問題。當我使用VLC播放器從我的webcamera流式傳輸視頻時,我可以很好地觀看它。但是當我嘗試使用VlcControl進行流式處理時,出現VLC無法連接到源的錯誤。我使用在VLC和VlcControl相同的選項:VlcControl流式傳輸不正確

:SOUT =#{轉碼了vcodec = H264,VB = 0,標度= 0,acodec = MPGA,AB = 128,信道= 2,採樣率= 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(); 

回答

0

我想Vlc無法連接到您的攝像頭,因爲您沒有通過它的相機名稱 它裏德它,我在另一個aption了

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

嘗試,但一定要改變攝像機名稱
PS。你可以找到這個選項,當你打開打開捕捉設備 - >勾選顯示更多選項
我認爲這將解決您的問題:)