2010-01-11 127 views
8

我一直在研究使用C#開發視頻流Web服務的解決方案。我正在使用Windows XP和vlc 1.0.3的最新版本通過LAN網絡傳輸視頻。但是,目前,我只能通過自己的電腦傳輸視頻。現在問題是我需要在Web服務中執行此流按鈕。有沒有人有任何想法如何將其更改爲網絡方法?我怎樣才能將這個網絡服務鏈接到一個HTML網頁?如何使用C#創建視頻流#

以下代碼用於使用Windows應用程序流式傳輸視頻。

private void btnStream_Click(object sender, EventArgs e) 
    { 
     // Create process and command to run file 
     System.Diagnostics.ProcessStartInfo psi = 
      new System.Diagnostics.ProcessStartInfo(@"C:\videotest.bat"); 

     psi.RedirectStandardOutput = true; 

     psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; 

     psi.UseShellExecute = false; 

     System.Diagnostics.Process listFiles; 

     listFiles = System.Diagnostics.Process.Start(psi); 

     System.IO.StreamReader myOutput = listFiles.StandardOutput; 

     listFiles.WaitForExit(2000); 
     if (listFiles.HasExited) 
     { 
      string output = myOutput.ReadToEnd(); 
      //this.processResults.Text = output; 
     } 
    } 

----- C:\ videotest.bat ------

cd "C:\PROGRA~1\VideoLAN\VLC" 
vlc c:\alvinchipmunks.vob --sout "#transcode{vcodec=h264,vb=800,scale=1,acodec=mp4a,ab=128,channels=2,samplerate=44100}:duplicate{dst=std{access=udp,mux=ts,dst=152.226.238.64:1234},dst=std{access=udp,mux=ts,dst=152.226.238.59:1234},dst=display}" 

任何答覆將不勝感激。

謝謝! =)

回答

4

VLC是一個桌面應用程序。它不適合在服務器上使用。你真的想要一個流媒體服務器。對於網頁,我建議將視頻轉碼爲H264(使用ffmpeg),然後將RTMP服務器提供給可以嵌入網頁的Adobe Flash播放器。服務器有很多選項,包括商業和免費。

您還可以簡單地發佈視頻並使用http下載或一些假http流的實現。

開源:

FluorineFX http://fluorinefx.com/

的Red5 http://osflash.org/red5

RubyIZUMI http://code.google.com/p/rubyizumi/

Kaltura http://osflash.org/kaltura

haxeVideo http://code.google.com/p/haxevideo

商業:

Adob​​e Flash媒體服務器 http://www.adobe.com/products/flashmediaserver/

Wowza http://www.wowzamedia.com