Page 1 of 1

Decode H.264 with VLC in C# using VS2008

Posted: 25 Oct 2010 20:04
by hussam_2000
Hello everyone ,

im trying to stream H.264 MP4 from VLC player and decode the video in a client Vs2008 Winform in C#.

I finaly got libVLC to compile and run in windows forms (C#) . I'm using vlc 0.08.6c win32. but i still cannot display the encoded signal on the client side.

my project is setup as the following :

1) Computer(A) -server side- ( sending ): im just using the VLC player to encode a video to H.264 MP4 over UDP. i set the destination with the client IP and port number. the ouput string is :
":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:udp{dst=128.119.111.20:9510} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep"
2) computer(B) - Client side - (receiving) : i have C# windows forms with the following code :

Code: Select all

LibVlc.LibVlc vlc = new LibVlc.LibVlc(); vlc.initialize(); vlc.VideoOutput() = pictureBox1; vlc.PlayListclear(); string[] options = new string[]" I THINK I HAVE THE WRONG SETTINGS IN HERE " vlc.Addtarget("udp://9510",options); vlc.Play();
I think my problem is in the option string. what should i have in my option string ? can someone help me based on the output string on the server side ? if this works then i will share my project with anyone who wants it :) it is a simple one but i think it is worth posting .

Re: Decode H.264 with VLC in C# using VS2008

Posted: 25 Oct 2010 22:12
by Diamonddrake
I'm not sure about the necessary settings, possibly some cacheing needed, but I would like to add that encoding to h.264 is a slow process. I'm not sure its fast enough for live streaming like that. Maybe try a different codec? Or use a very small low bitrate video.

Re: Decode H.264 with VLC in C# using VS2008

Posted: 25 Oct 2010 23:20
by hussam_2000
Yes, i notice that encoding in H.264 is slow (Looking at it using wire Shark) but I’m just experimenting with VLC player in the mean time because I’m in the process of buying an expensive H.264 Hardware encoder with an amazing encoding latency. I want to use VLC to decode that signal in my app. the encoding has to be in h.264
How should I setup my option string to accommodate this stream? Any other examples in C#? I tried almost all the examples in this forum but without success.