Streaming Webcam with VLC in C#

This forum is about all development around libVLC.
MarkoP
New Cone
New Cone
Posts: 2
Joined: 09 Feb 2021 13:09

Streaming Webcam with VLC in C#

Postby MarkoP » 09 Feb 2021 13:19

Hello,

I'm currently doing an school project where I have to start a stream of my webcam using VLC in C#.
The main problem I am facing is that i think the codec (the media options) are wrong.
Everytime i try to view my Stream in VLC i get an error or a just a blackscreen without any audio.

Code:

Code: Select all

public void StartStream() { var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); var libDirectory = new DirectoryInfo(Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64")); using (var mediaPlayer = new VlcMediaPlayer(libDirectory)) { var mediaOptions = new[] { ":sout =#transcode{vcodec=h264,scale=Auto,acodec=s16l,ab=128,channels=2,samplerate=44100,scodec=none}", ":rtp{sdp=rtsp://" + _ip + ":8554/live.sdp}", ":no-sout-all", ":sout-keep" }; //_ip = Local IPv4 Address mediaPlayer.SetMedia(new Uri(@"dshow://"), mediaOptions); mediaPlayer.Play(); MessageBox.Show("Streaming on rtsp://" + _ip + ":8554/live"); } }

Kind regards,

Marko

Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 16 guests