VideoLan.Interop a .Net libvlc 0.9.x wrapper

This forum is about all development around libVLC.
akramh
New Cone
New Cone
Posts: 5
Joined: 27 Jun 2008 04:40

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby akramh » 28 Jan 2009 04:43

cool. thnx for a great job! i need to play multiple video streams from different source urls on one form (preferably in PictureBoxes). can't get how to do it, any working sample?
If you look at PublicEnemy's sample, you'll find that using the wrapper is quite simple. Create your form in the designer and place your pictureboxes. Link Kairos' interop DLL to your references (References -> Add reference) -- stick a using statement for the 'VLC' namespace in the top of your 'Form1.cs' (or whatever it is called) so you can get at the appropriate VLC objects. Finally create the requisite number of media player references in your Form's CTOR (or your choice of init function...). Binding to the picturebox is as simple as giving the mediaplayers the window handles of the pictureboxes (Handle is a property of the PictureBox). Each media player can play a different stream -- so each picture box can show a different video. I'll leave the guessing of how to add media items to you -- PublicEnemy's sample should be more than sufficient as an example.

~Akram.

dcam77
New Cone
New Cone
Posts: 1
Joined: 30 Jan 2009 11:10

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby dcam77 » 30 Jan 2009 11:40

Hi,

and thanks for this easy to use wrapper. I'm trying to test media stream performance and need to be able to access the statistics that are visible in VLC e.g. bitrates, lost frames etc. Also, when accessing FPS i am always receiving a value of 0.

Is this be beyond the scope of the wrapper?

Thanks,
dcam77

elund
Blank Cone
Blank Cone
Posts: 18
Joined: 22 Jan 2009 10:42

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby elund » 04 Feb 2009 13:22

Is there a bug in libvlc 0.9.8a?

I have tested with the VlcMediaListPlayer Sample and noticed that it only plays the first item in the MediaList in stead of all items in the MediaList.

I have the same problem with the Marx C# Wrapper: viewtopic.php?f=32&t=47385&start=105#p183011.

Please can anybody confirm if there is a bug libvlc 0.9.8a or not? I am a bit desperate now, please help :?

Best regards, Elund

zadam
New Cone
New Cone
Posts: 1
Joined: 06 Feb 2009 10:24

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby zadam » 06 Feb 2009 10:39

Hi, I am receiving an AccessViolationException when trying to run the VlcMediaPlayer.Sample project that accompanies the VideoLan.Interop library.


The steps I have taken:

1. Downloaded and extracted the tarball from here: http://meedios.svn.sourceforge.net/view ... n%200.9.0/

2. Downloaded and extracted vlc-0.9.8a-win32.zip from here: http://download.videolan.org/pub/vlc/latest/win32/

3. Copied libvlc.dll, libvlccore.dll and *.* from the plugins dir to the bin/debug dir of my extracted VideoLan 0.9.0 dir

4. Opened the VlcMediaPlayer.Sample and VideoLan.Interop projects in a vs2008 solution, compiled and ran

5. Receive a System.AccessViolationException at PlayerUI.btnPlay_Click, line 45: VlcMedia desc = Vlc.NewMedia(this.txtFileName1.Text);

What step(s) have I missed?

Note I have also tried creating the VideoLanClient passing the path of the vlc libs to no avail: Vlc = new VideoLanClient(@"C:\Apps\VideoLan 0.9.0\bin\debug\");

Thanks, Adam

MidnightCoder
Blank Cone
Blank Cone
Posts: 82
Joined: 08 Aug 2008 06:04

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby MidnightCoder » 07 Feb 2009 13:35

Any idea on why I get an exception when trying to get the video aspect ratio?
this.Text = VlcPlayer.Video.AspectRatio; ----> Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

MidnightCoder
Blank Cone
Blank Cone
Posts: 82
Joined: 08 Aug 2008 06:04

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby MidnightCoder » 09 Feb 2009 14:03

Hi, I am receiving an AccessViolationException when trying to run the VlcMediaPlayer.Sample project that accompanies the VideoLan.Interop library.


The steps I have taken:

1. Downloaded and extracted the tarball from here: http://meedios.svn.sourceforge.net/view ... n%200.9.0/

2. Downloaded and extracted vlc-0.9.8a-win32.zip from here: http://download.videolan.org/pub/vlc/latest/win32/

3. Copied libvlc.dll, libvlccore.dll and *.* from the plugins dir to the bin/debug dir of my extracted VideoLan 0.9.0 dir

4. Opened the VlcMediaPlayer.Sample and VideoLan.Interop projects in a vs2008 solution, compiled and ran

5. Receive a System.AccessViolationException at PlayerUI.btnPlay_Click, line 45: VlcMedia desc = Vlc.NewMedia(this.txtFileName1.Text);

What step(s) have I missed?

Note I have also tried creating the VideoLanClient passing the path of the vlc libs to no avail: Vlc = new VideoLanClient(@"C:\Apps\VideoLan 0.9.0\bin\debug\");

Thanks, Adam
Are you using 64-bit OS?

MidnightCoder
Blank Cone
Blank Cone
Posts: 82
Joined: 08 Aug 2008 06:04

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby MidnightCoder » 09 Feb 2009 14:04

The libvlc.dll exposes the "display_text" function. Anyone able to wrap around this? Also, where can I find the documentation regarding how to call exposed functions (i.e. function signiture)?

elund
Blank Cone
Blank Cone
Posts: 18
Joined: 22 Jan 2009 10:42

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby elund » 17 Feb 2009 21:28

Code: Select all

void vlcMediaPlayer_StateChanged(object sender, StateChangedEventArgs e) { if (InvokeRequired == true) Invoke(new EventHandler<StateChangedEventArgs>(vlcMediaPlayer_StateChanged), sender, e); else { if (vlcMediaPlayer.State == VlcState.Playing) { trackBar.Maximum = (int)vlcMediaPlayer.Length; } } }
'VlcMediaPlayer.State' threw an exception of type 'System.AccessViolationException' when I try to execute the above code.
Further information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

VlcMediaPlayer is created as VlcMedaiPlayer = Vlc.NewMediaListPlayer(VideoPanel.Handle);
If created as VlcMediaPlayer = Vlc.NewMediaPlayer(VideoPanel.Handle); no exception is thrown.

Any ideas? Is there a bug in VlcMediaListPlayer.cs? Or maybe even in libvlc? I am using version 0.9.8a.

Best regards, Elund

youpi
New Cone
New Cone
Posts: 3
Joined: 24 Mar 2009 17:51

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby youpi » 24 Mar 2009 18:04

Hello,

I have some trouble with "VlcMediaListPlayer" it never loads the next items in the playlist. I used the last library 0.9.8a.

the VlcMediaPlayer play correctly and everything goes normal, but not for the medialist. I tried also with previous 0.9.x version but it appears that it can't find the function (maybe they forgot the extern "C" in the dll)

Anyway am I the only one with this error?

Another question I would like to loop my media. can I do it directly with VlcMediaPlayer or should I loop in VlcMediaListPlayer.

Anyway it never loop or repeat with both on my side either either in the initialisation:

Code: Select all

public VideoLanClient() { string path = AppDomain.CurrentDomain.BaseDirectory; string[] args = {path, ":no-one-instance", ":loop", //also tried --loop, -L, -R,--repeat,:repeat,:L,:R ":no-drop-late-frames", ":disable-screensaver", ":vout=direct3d", "--plugin-path=" + Path.Combine(path,"plugins")}; Initalize(path, args); }
or with addoption

Code: Select all

private void btnPlay_Click(object sender, EventArgs e) { VlcMedia desc = Vlc.NewMedia(this.txtFileName1.Text); desc.AddOption("--loop"); //or desc.AddOption(":loop"); or desc.AddOption(":repeat"); or desc.AddOption("-R"); etc... VlcPlayer.Load(desc); desc.Dispose(); VlcPlayer.Play(); }
also tried with playerlist not working on my side.

youpi
New Cone
New Cone
Posts: 3
Joined: 24 Mar 2009 17:51

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby youpi » 24 Mar 2009 18:10

oups sorry elund
I have tested with the VlcMediaListPlayer Sample and noticed that it only plays the first item in the MediaList in stead of all items in the MediaList.
I confirm that I cannot play the other items...

youpi
New Cone
New Cone
Posts: 3
Joined: 24 Mar 2009 17:51

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby youpi » 25 Mar 2009 09:56

to answer to my previous post, I search in the 0.9.8a src how the arguments are deal...
you will find every arguments on init in 'libvlc.c' in src folder you will find:
*everything dealing with help: help, full-help,help-verbose
*version
*one-instance
*reset-plugins-cache
*verbose
*daemon
*ignore-config / reset-config / save-config
*main
*language
*list / list-verbose
*playlist-enqueue
*fpu / mmx/sse/...
*vlm-conf
*disable-screensaver
*log file: file-logging/logmode/etc....
*drawable
That's all after that everything is dealt in playlist
playlist_AddExt is called with the arguments left
so -loop and -repeat won't work on initialisation.
some how we have to put this in the options when playlist is initialize we will find this in 'libvlc-module.c' in src folder

Code: Select all

/* Playlist options */ .... add_bool( "loop", 0, NULL, LOOP_TEXT, LOOP_LONGTEXT, false ); change_short('L'); add_bool( "repeat", 0, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, false ); change_short('R'); ....
maybe somebody will help me to put loop and repeat in arguments for C# usage.
Thanks youpi

elund
Blank Cone
Blank Cone
Posts: 18
Joined: 22 Jan 2009 10:42

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby elund » 25 Mar 2009 11:48

Hi Youpi!

I would recommend you to managed your own playlist.
The author of VideoLan.Interop is actually doing the same: viewtopic.php?f=32&t=52021&p=176692&hil ... st#p176692.

With that said I still experience this wrapper - and the one made by Marx - as unstable.
They regularly stops playing videos (my application stops responding).
I have not been able to fix this issue yet, but when it happens it is always after a call to Play().
Unfortunately none of the authors seems to be active in this forum any longer.

So I am now using technologies like DirectX and Windows Media Player Control from Microsoft :-(
These components have significantly more CPU usage, but at least they are stable.

Best regards, Elund

MidnightCoder
Blank Cone
Blank Cone
Posts: 82
Joined: 08 Aug 2008 06:04

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby MidnightCoder » 25 Mar 2009 17:57

With that said I still experience this wrapper - and the one made by Marx - as unstable.
They regularly stops playing videos (my application stops responding).
I have not been able to fix this issue yet, but when it happens it is always after a call to Play().
Unfortunately none of the authors seems to be active in this forum any longer.

So I am now using technologies like DirectX and Windows Media Player Control from Microsoft :-(
These components have significantly more CPU usage, but at least they are stable.

Best regards, Elund
I believed TKaraoke is using this or the Marx wrapper and it's rock solid. Download it and queue up a few hundred songs and see if it's stable or not. You can download it at their website: http://www.tkaraoke.com

cokyc
New Cone
New Cone
Posts: 1
Joined: 26 Mar 2009 14:04

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby cokyc » 26 Mar 2009 14:18

Hi
I need to get an in memory snapshot.
I searched in this forum and I found this topic viewtopic.php?f=2&t=51008&p=165243&hili ... ot#p164713.
I am not a c++ programmer and I dont know how implement a wrapper for this specific call

Code: Select all

VLC_PUBLIC_API mediacontrol_RGBPicture * mediacontrol_snapshot( mediacontrol_Instance *self, const mediacontrol_Position *a_position, mediacontrol_Exception *exception );
.

Can someone help me to build a c# wrapper to return a System.Drawing.Image object for the above method and integrate it into the Videolan.Interop wrapper.

thank's

elund
Blank Cone
Blank Cone
Posts: 18
Joined: 22 Jan 2009 10:42

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby elund » 27 Mar 2009 09:24

I believed TKaraoke is using this or the Marx wrapper and it's rock solid. Download it and queue up a few hundred songs and see if it's stable or not. You can download it at their website: http://www.tkaraoke.com
Thank you very much for your tip :D
But as far as I can see the source code is not available.

Best regards, Elund

publicENEMY
Cone that earned his stripes
Cone that earned his stripes
Posts: 104
Joined: 14 May 2007 05:04
Location: Malaysia

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby publicENEMY » 30 Mar 2009 03:43

Hi Youpi!

I would recommend you to managed your own playlist.
The author of VideoLan.Interop is actually doing the same: viewtopic.php?f=32&t=52021&p=176692&hil ... st#p176692.

With that said I still experience this wrapper - and the one made by Marx - as unstable.
They regularly stops playing videos (my application stops responding).
I have not been able to fix this issue yet, but when it happens it is always after a call to Play().
Unfortunately none of the authors seems to be active in this forum any longer.

So I am now using technologies like DirectX and Windows Media Player Control from Microsoft :-(
These components have significantly more CPU usage, but at least they are stable.

Best regards, Elund
regarding playlist.
Yes. This wrapper does not support the vlc playlist properly. i believe, it never will. this is because, it is highly recommended that the playlist is manually managed using c#. why? because you can do a lot of things easily in c# compared to the limited functionality of native playlist.

regarding video play issue.
(Correct me if im wrong) I believe the problem is caused by the delay due to bindings. for example, if you call play, the vlc will actually play 1 seconds later(as i said, example). you will experience issue when you issue multiple command within short period of time. AFAIK, there are no good solution for this. only workarounds. one workaround that i know of is by adding a delay before any command can be issue consequently.

Hope this helps.
Thanks.

nicko
New Cone
New Cone
Posts: 6
Joined: 02 Apr 2009 10:27

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby nicko » 02 Apr 2009 11:18

Hi All,

I'm trying to use this wrapper to produce a multicast stream, and am having great difficulty doing so. The main trouble being I can't find a way to make the wrapper take command line arguments.

For example, the first example on:
http://wiki.videolan.org/Documentation: ... e_Examples

vlc -vvv input_stream --sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128,deinterlace}:rtp{mux=ts,dst=239.255.12.42,sdp=sap,name="TestStream"}

I've attempting to implement this as

Code: Select all

string[] options = { "--sout '#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128,deinterlace}:rtp{mux=ts,dst=239.255.12.42,sdp=sap,name=\"TestStream\"}'" }; client = new VideoLanClient(".", options); player = client.NewMediaPlayer(this.Handle); player.Load(client.NewMedia("c:\\myvideo.wmv")); player.Play();
But this only yields a black command prompt-ish window with the title "VLC media player version 0.9.8a" and the text "The command line options couldn't be loaded, check that they are valid"

Is there any way that command line options like I mentioned above can be used with this wrapper? I would prefer to do it this way as then I can enter the string above as a setting at run time so I can experiment with different settings without having to recompile the application.

I've had this working with the other wrapper (for 0.8.6) whose code is in this wiki, but that wrapper doesn't propagate events from VLC like this one, and I'd prefer to use VLC 0.9.x

Any help would be greatly appreciated.

Kind Regards,
Nick

nicko
New Cone
New Cone
Posts: 6
Joined: 02 Apr 2009 10:27

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby nicko » 02 Apr 2009 11:57

I may have rambled a little in my previous post. To boil down my question. Can somebody please explain why

Code: Select all

vlc -vvv c:\myvideo.wmv :sout=#transcode{vcodec=mp4v,vb=2048,scale=1,acodec=mp4a,ab=128,channels=2}:duplicate{dst=std{access=udp,mux=ts,dst=239.255.12.42:1234}}
On the command line produces different results to

Code: Select all

string[] options = { ":sout=#transcode{vcodec=mp4v,vb=2048,scale=1,acodec=mp4a,ab=128,channels=2}:duplicate{dst=std{access=udp,mux=ts,dst=239.255.12.42:1234}}", }; client = new VideoLanClient(".", options); player = client.NewMediaPlayer(this.Handle); player.Load(client.NewMedia("c:\\myvideo.wmv")); player.Play();
If I can work this out then that's all I need. Thanks in advance, and thanks for the wrapper!

-Nick

nicko
New Cone
New Cone
Posts: 6
Joined: 02 Apr 2009 10:27

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby nicko » 02 Apr 2009 12:07

OK, I RTFM'd (I had previously I just missed something) and realised the reason it wasn't working was because the options needed to be prefixed with a -- instead of a : because on the command line the : had a meaning that was lost in whatever way the wrapper invokes VLC. Thankyou for your time, sorry for the spam.

Regards,
Nick

nicko
New Cone
New Cone
Posts: 6
Joined: 02 Apr 2009 10:27

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby nicko » 17 Apr 2009 10:33

Hi All,

I've got VLC working with the VideoLan.Interop (meedios) wrapper, and everything works fine except I'm experiencing the oft-reported freezing problem when attempting to call Stop() on the VlcMediaPlayer. From the forums that I've read it appears as though this problem is not unique to the VideoLan.Interop wrapper and may be a problem within VideoLan itself.

Can someone clarify for me whether this is actually the case? do I need to just wait and hope that the problem will be fixed in VLC or is the problem in the wrapper. I downloaded VLC 0.99 recently in the hope it would fix the problem but it seems to exhibit exactly the same behaviour. The lock-up is definitely occurring inside the DLL code, whether that's due to an internal bug, or misuse by the myself or the VideoLan.Interop wrapper I'm not sure.

Any help would be greatly appreciated. Even a work-around would be nice.

PS. I'm not calling Stop() from an event handler thread as I know that will cause deadlock, I'm calling Stop from the same GUI thread that was used to create the player.

Cheers,
Nick

mohamnag
Blank Cone
Blank Cone
Posts: 11
Joined: 12 Mar 2009 16:04

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby mohamnag » 21 Apr 2009 10:32

Hi there,
it's a great wrapper for vlc. however when I use it in WPF using a windows forms host controller's child property to render the output. I get a very high memory consumption, nearly double of the same job in windows forms.
Has any one used this wrapper in WPF with better performance?

jstuardo
New Cone
New Cone
Posts: 8
Joined: 07 Apr 2009 16:07

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby jstuardo » 24 Apr 2009 02:42

Hello....

I am trying VlcMediaPlayer sample but when I try to play a MPG file (a music video), it plays nothing! but when I run VLC Media Player 0.9.8a, that video plays correctly.

After I compiled VlcMediaPlayer, I copied all plugins directory together with libvlc.dll and libvlccore.dll into Debug directory of vlcMediaPlayer but nothing happens with this video.

Any help will be greatly appreciated, (I'm not using WPF)

Thanks
Jaime

Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 24 Apr 2009 22:58

Hi guys, I've been away for a while on what you might call the opposite of a vacation (aka excessive work). I want to take care of the bugs first and stabilize the wrapper before adding new features. Can you summarize what the current bugs are?

am70
Blank Cone
Blank Cone
Posts: 12
Joined: 25 Apr 2009 06:02

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby am70 » 25 Apr 2009 07:29

Hi..

I am trying to stream multiple sources over the network to multiple targets. I'm aware of the fact that libvlc doesn't like multiple instances of itself, and suspect that VLM might be the answer.

I can see that there is code in VideoLan.Interop to support VLM. How complete is it?

Is there any chance some kind soul might post an example of using VLM with VideoLan.Interop..?

Andrew

Kairos
Blank Cone
Blank Cone
Posts: 45
Joined: 01 Mar 2008 01:49
Operating System: Windows
Location: Scottsdale, Az
Contact:

Re: VideoLan.Interop a .Net libvlc 0.9.x wrapper

Postby Kairos » 25 Apr 2009 17:49

yes, you can only use 1 instance of libvlc (VideoLanClient class in the interop) but you can use multiple VlcMediaPlayers. For each simultaneous stream you want you would need another player. The VLM stuff is not working yet but many people here have done just fine streaming using the VlcMediaPlayer class.

Code: Select all

VideoLanClient client = new VideoLanClient(".", options); VlcMediaPlayer player1 = client.NewMediaPlayer(Form1.Handle); VlcMediaPlayer player2 = client.NewMediaPlayer(Form2.Handle);


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 23 guests