Hi,
I need to embed VLC into my C# application so as to display the live video that is being captured by my web camera.
Anyone can help?
Thanks!
Sarah
hi
have you found the solution to the above problem ?
Hi,
I need to embed VLC into my C# application so as to display the live video that is being captured by my web camera.
Anyone can help?
Thanks!
Sarah
Code: Select all
LibVlc vlc = new LibVlc();
vlc.Initialize();
vlc.VideoOutput = pictureBox1;
vlc.PlaylistClear();
vlc.AddTarget(""dshow://", ":dshow-vdev=\"<name of video device>\""");
//vlc.AddTarget(""dshow://", ":dshow-vdev=\"Dlink DSB-C320\"""); for instance
vlc.Play();
Code: Select all
vlc.AddTarget("dshow:// :dshow-vdev=\"\"Dlink DSB-C320\"\" :sout=#transcode{vcodec=mp4v,vb=1024,scale=1}:duplicate{dst=display,dst=std{access=udp,mux=ts,dst=192.168.0.107:5000}}");
I'm doing this exactly, but it doesn't work. So I decided to check if the Initialize() method was returning True, and it was not:Thats the code I used to make it work. I did change the namespace in my applicaiton to Fucntions.LibVLC though so that line would need changed. Also pictureBox1 needs to be changed to the name of your picturebox.Code: Select all
Functions.LibVlc vlc = new Functions.LibVlc(); vlc.Initialize(); vlc.VideoOutput = pictureBox1; vlc.PlaylistClear(); vlc.AddTarget("S:\\test.avi"); vlc.Play();
That code just when inside the button clicked code.
Hope that helps.
Code: Select all
LibVlc.LibVlc v = new LibVlc.LibVlc();
v.VlcInstallDir = VlcHelper.VlcInstallationFolder;
if(!v.Initialize())
{
MessageBox.Show("Could Not Initialize");
return;
}
v.VideoOutput = panel1;
v.PlaylistClear();
v.AddTarget("test.avi");
v.Play();[
Code: Select all
m_iVlcHandle = VLC_Create();
How can I get the Stats information?
For example, using the following I can get the Meta Information from your .NET control:
const String Meta_information = "Meta-information";
public string GetMetaInfo(string strMetaParam) {
using (VlcObject vobj = new VlcObject
(this.vlcHandle, ObjectType.VLC_OBJECT_INPUT)) {
if (vobj.SubObject != IntPtr.Zero) {
IntPtr resultString = IntPtr.Zero;
input_Control(vobj.SubObject,
input_query_e.INPUT_GET_INFO,
Meta_information, strMetaParam, ref
resultString);
string res = Marshal.PtrToStringAnsi
(resultString);
return BaseTools.UTF8ToIso8859(res);
}
}
return "";
}
But a similar approach does not work for the Statistical Data from a stream?
For example, I tried to get the Statistical data using this function but it doesn't work:
const String Stats_information = "Stats-information";
public string GetStatsInfo(string strStatsParam) {
using (VlcObject vobj = new VlcObject(this.vlcHandle,
ObjectType.VLC_OBJECT_STATS))
{
if (vobj.SubObject != IntPtr.Zero) {
IntPtr resultString = IntPtr.Zero;
input_Control(vobj.SubObject,
input_query_e.INPUT_GET_INFO,
Stats_information, "Decoded blocks", ref
resultString);
string res = Marshal.PtrToStringAnsi
(resultString);
return BaseTools.UTF8ToIso8859(res);
}
}
return "";
}
Could you tell me how to get any of Statistical Information above using your .NET interface?
/* Input */ "Input"
INPUT_ADD( "Read at media", read_bytes_text, "0" );
INPUT_ADD( "Input bitrate",
input_bitrate_text, " 0" );
INPUT_ADD( "Demuxed", demux_bytes_text ,"0");
INPUT_ADD( "Stream bitrate", demux_bitrate_text, "0" );
/* Sout */ "Streaming"
SOUT_ADD( "Sent packets",
sout_sent_packets_text, " 0" );
SOUT_ADD( "Sent bytes", sout_sent_bytes_text, "0" );
SOUT_ADD( "Send rate", sout_send_bitrate_text, "0" );
/* Vout */ "Video"
VIDEO_ADD( "Decoded blocks", video_decoded_text, "0" );
VIDEO_ADD( "Displayed frames", displayed_text, " 0" );
VIDEO_ADD( "Lost frames", lost_frames_text, "0" );
/* Aout */ "Audio"
AUDIO_ADD( "Decoded blocks", audio_decoded_text, " 0" );
AUDIO_ADD( "Played buffers", played_abuffers_text, "0" );
AUDIO_ADD( "Lost buffers", lost_abuffers_text, "0" );
thanks!!
Users browsing this forum: No registered users and 15 guests