How to create video streaming using C#

orange24mint picture orange24mint · Jan 11, 2010 · Viewed 13.4k times · Source

I have been working on the solution to develop video streaming web services using C#. I am using Windows XP, with the latest version of vlc 1.0.3 to stream video over LAN network. However, currently, I could only manage to stream video on my own PC. Problem now is I need to perform this stream button in web services instead. Does anyone have any idea on how to change this to web method? How can I link this web services to a html webpage?

The following codes is use to stream a video using Windows Application.

    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}"

Any reply would be much appreciated.

Thanks! =)

Answer

Samuel Neff picture Samuel Neff · Jan 12, 2010

VLC is a desktop app. It's not appropriate for use on a server. You really want a streaming server. For the web I would suggest transcoding the video to H264 (use ffmpeg) and then serving with an RTMP server to Adobe Flash player which you can embed in a web page. There are many options for the server, including commercial and free.

You can also simply post the video and use http download or some of the implementations that fake http streaming.

Open Source:

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

Commercial:

Adobe Flash Media Server http://www.adobe.com/products/flashmediaserver/

Wowza http://www.wowzamedia.com