title: C# wpf how to stream webcam to ip address (possibly with Vlc)
body: <p>I need to stream a webcam to an ip address.
  After days of googling I decided that the easiest way was to embed Vlc.
  That said I am also still open to other solutions.</p>
  
  <hr>
  
  <p>Step1 - OK!: I can see my webcam in a form by using that code:</p>
  
  <pre><code>vlcPlayer.MediaPlayer.VlcLibDirectory = new DirectoryInfo(@"c:\Program Files (x86)\VideoLAN\VLC\");
  vlcPlayer.MediaPlayer.EndInit();
  vlcPlayer.MediaPlayer.Play(new Uri(@"dshow://");
  </code></pre>
  
  <hr>
  
  <p>Step2 - OK!: Now trying to make a step forward and using this <a href="https://www.cnet.com/how-to/how-to-privately-stream-video-with-vlc-for-windows/" rel="nofollow noreferrer">tutorial</a> I can send a video locally 127.0.0.1:5004 using 2 instances of Vlc: one to transmit and one to receive.</p>
  
  <hr>
  
  <p>Step 3 - NOT OK: it should seem simple to configure vlc for changing the source from file to webcam and to transmit it via ip.
  So what I do is to operate as before only changing the source:
  1. Menu "Media" --> Stream. That opens the "open media" window.</p>
  
  <blockquote>
    <p>Here I click the tab capture device --> video device name --> I choose "integrated webcam"</p>
  </blockquote>
  
  <p>Then all the rest is as before. But nothing happens. The receiver is black with nothing inside. Also If I try to save the flow from the receiver I only get a few bytes.
  The afore mentioned settings for the transmitter are the following:</p>
  
  <blockquote>
    <p>Capture device tab --> integrated webcam. Then the stream button --> the window opens correctly with dshow:\ --> next --> new destination RTP,MPEG transport stream ---> add button --> address = 127.0.0.1 port = 5004 StreamNAme=test</p>
  </blockquote>
  
  <p>So the strange is that when I stream a file with whatever name from the transmitter, it immediately is recognized by the receiver. Instead try as I might, nothing happens when the webcam is the source.</p>
  
  <hr>
  
  <p>That being said the problem above is not crucial to the solution.
  What I care for is not how to use vlc stand alone but how to use it from my wpf application in order to send the webcam stream. </p>
  
  <p>Thanks for any help</p>
  
  <p>Patrick         </p>