Page 3 of 3

Re: Usage of libvlc.dll in C#

Posted: 31 May 2008 08:04
by ravi_andhra
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 ?

Re: Usage of libvlc.dll in C#

Posted: 11 Jul 2008 20:29
by Kin
Hi,

I am using the sample code on the first page too and I need to capture, display and send a video stream that is being caught by my web camera

to capture and diplay, I did something like this...It's woks fine

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();
but, to send a stream I try and this didn't work:

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}}");
What's wrong?
How can I handle the duplicate stream and sent it over the net?

Thanks in advance

Re: Usage of libvlc.dll in C#

Posted: 08 Oct 2008 19:18
by shooter
can u pls mail me the c# wrapper i need it...
:)

Re: Usage of libvlc.dll in C#

Posted: 19 Nov 2008 17:04
by Franko73
I am trying to get the video to play slower using vlc.SpeedSlower() but it dont seem to make any difference, the video plays at normal speed no matter how many vlc.SpeedSlower() I use, any help. If I put the vlc.SpeedSlower() in a seperate button code it works but I want the video to play at slowest speed from the start. Any help appreciated, thanks

I am also trying to capture a single image from the picturebox but there is no method to grab a snaphot, any ideas?

LibVlc vlc = new LibVlc();
vlc.Initialize();

vlc.VideoOutput = pictureBox1;
vlc.PlaylistClear();
vlc.AddTarget("C:\\test.avi");

vlc.Play();
vlc.SpeedSlower() ;

Re: Usage of libvlc.dll in C#

Posted: 31 Dec 2008 18:06
by ChrisHolmesOnline

Code: Select all

Functions.LibVlc vlc = new Functions.LibVlc(); vlc.Initialize(); vlc.VideoOutput = pictureBox1; vlc.PlaylistClear(); vlc.AddTarget("S:\\test.avi"); vlc.Play();
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.

That code just when inside the button clicked code.

Hope that helps.
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:

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();[
The MessageBox displays because the LibVlc fails to initialize. So I dug down into that code and wrapped the Initialize() method in a try-catch block. It fails on the call to VLC_Create, around line 520:

Code: Select all

m_iVlcHandle = VLC_Create();
The Exception is a EntryPointNotFoundException: Unable to find an entry point named 'VLC_Create' in DLL 'libvlc'. Anyone have any idea why this is happening?

Re: Usage of libvlc.dll in C#

Posted: 11 Jan 2009 04:04
by illogique
@ChrisHolmesOnline:

I presume that you are using the new version of VideoLAN - something from the 0.9 tree?

If so, the old methods created by Odysee will no longer work. The exports (functions/data within a DLL) which exist in the libvlc.dll have changed. For example, libvlc_new has replaced VLC_Create which was around in version 0.8.6.

There are two choices I see: updating the .Net wrappers to support the new code, or using an older version of VLC to get what you need done.

Hope this helps!

Re: Usage of libvlc.dll in C#

Posted: 22 May 2009 12:04
by kryptonite
Is there some documentation listing the API mappings to those in the newere 0.9 x releases?

Thanks!

Re: Usage of libvlc.dll in C#

Posted: 28 Oct 2009 09:55
by stiwan
hey there folks.

great work.

i had to deal with the "could not find libvlc" issue. and it appears to me that you have to copy older files (like version 0.8.6i) from the program directory (c:\program files\videolan\vlc\)
are there any plans to make it work with the 1.0 series?

thanks for the great c# class :)
stiwan

Re: Usage of libvlc.dll in C#

Posted: 07 Mar 2010 11:47
by hishwest
hello , plz i try this sample but it doesn't work ;this error is shown "'LibVlc.Form1.Dispose(bool)': no suitable method found to override i'm; interested of your code

Re:

Posted: 16 Mar 2010 17:13
by Umer_Zahid
Hi Odysee, you have done a fantastic job. you have written that you have written wrapper in managed c++ (assembly)! can you email me that code.... i will be very grateful to you. my email is (umi729@gamil.com)
regards
Umer Zahid

Re:

Posted: 10 Sep 2010 09:22
by qontranami
Hi Odysee,

Please email me a copy of the wrap-around code at

qontranami [at] yahoo [dot] com

Thanks.

Re: Usage of libvlc.dll in C#

Posted: 13 Sep 2010 21:12
by Jaco
WHY WHY WHY!!!! ????

// init libvlc
Error errVlcLib = VLC_Init(m_iVlcHandle, strInitOptions.Length, strInitOptions);

A call to PInvoke function 'WindowsFormsApplication1!LibVlc.LibVlc::VLC_Init' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

Im gona start coding in C again if no one helps me with this frustrating wrapper !!! I am using VLC 0.8.6 in Windows 7 and coding in C# obviously !??

Why is it not workinggngngggn!!!!!!!!!!!!!!!!!

Re: Usage of libvlc.dll in C#

Posted: 14 Sep 2010 10:25
by Titanic
Had a similar problem. Solved it by changing the calling convention to Cdecl instead of Winapi/Stdcall for all InterOp functions

Example:
[DllImport("libvlc", CallingConvention=CallingConvention.Cdecl)]
internal static extern IntPtr libvlc_new(int argc, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)]string[] argv);

Re: Usage of libvlc.dll in C#

Posted: 14 Oct 2010 07:53
by siolor
Hi guys,

I'm trying to play some RTSP stream by using the libvlc.dll.
I'm able to display the stream without any problem but when it comes to a stream that require a user/password i got stuck.
Is there any option to define ?!?

any idea ?

edit : I finally found the ealier "libvlcnet - .NET library based on libvlc". It's based on a earlier version of VLC and i can now run my RTSP stream without any problem.

Re: Usage of libvlc.dll in C#

Posted: 18 Mar 2011 18:58
by Mudita
hi Odysee.....

will u please mail me...the wrapper c++ project that u had made..
my id is: mudita7538 at gmail dot com

thanx in advance..

Re: Usage of libvlc.dll in C#

Posted: 25 Jul 2014 14:06
by ARUNCB
Did someone got an answer for this? I am stuck by this :cry:
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!!

Re: Usage of libvlc.dll in C#

Posted: 30 Jul 2014 06:16
by ARUNCB
Some one please help. I am stuck in this case, I would like to know how VLC player get the data of stream video, but LibVLC.net not. I tried the "libvlc_media_player_get_fps " method,

It give me 0.0 for stream video

Re: Usage of libvlc.dll in C#

Posted: 26 Aug 2014 08:22
by ARUNCB