libvlcnet - .NET library based on libvlc

This forum is about all development around libVLC.
Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 28 Oct 2009 08:17

elwood, sorry for the false alarm: that was my fault.

I have one more question. What is the right way to recreate the player that is situated at Winforms User Control? Now I have added a special method that disposes the player (but not the User Control) and sets IsIntialized to false. Are there any other ways?

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 29 Oct 2009 09:21

Some new questions :) elwood, is there any way to communcate with you more dynamically?

1. I have a PlayerOutput that renders the picture to the form (the MediaInput is camera using rtsp). I want to store this video, so I add a file to PlayerOutput.Files collection. But then rendering cease to work: I see just static picture (I think this is the first shot.

2. The second question is not as critical for me... but I found the following code at your library:
if ((volume < 0) || (volume > 100)) {
throw new ArgumentException("Argument is out of range.", "value");
As I remember, VLC player allows to set volume to 400. And sometimes this feature is really useful.

elwood
Blank Cone
Blank Cone
Posts: 24
Joined: 04 Oct 2008 15:28

Re: libvlcnet - .NET library based on libvlc

Postby elwood » 29 Oct 2009 13:29

> elwood, when PlayerOutput.Files should be saved to disk? At Stop or realtime? It seems they are not saved at all.
It is handled by vlclib native code, we can't monitor this behavior.
>I have one more question. What is the right way to recreate the player that is situated at Winforms User Control? Now I have added a special method that disposes the player (but not the User Control) and sets IsIntialized to false. Are there any other ways?
It is not recommended to reinitialize libvlcnet in one process because libvlc native dll does not handle this situation 100% correctly.
But if your case will work well, you can use this way.

>1. I have a PlayerOutput that renders the picture to the form (the MediaInput is camera using rtsp). I want to store this video, so I add a file to PlayerOutput.Files collection. But then rendering cease to work: I see just static picture (I think this is the first shot.
I think it may be caused of incorrect parameters set. Transcoding is not tested yet as well as we want. We tried to hardcode the most compatible parameters to encode the output files. May be in another topic you can find the most suitable options set for your problem.
>if ((volume < 0) || (volume > 100))
May be you're right. You can patch this by *= 4 multiplication in method implementation.

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

Re: libvlcnet - .NET library based on libvlc

Postby MidnightCoder » 30 Oct 2009 04:00

This looks like a good alternative to the other wrappers. I'm pretty exicited to see this post. However, the license you are using is GPL? The other wrappers are all using LGPL. Any chance of changing to license to LGPL? TIA.

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 30 Oct 2009 10:11

One more question.

Is there any possibility to renew the screen when you change player.Time or player.Position if it is in Paused state?

elwood
Blank Cone
Blank Cone
Posts: 24
Joined: 04 Oct 2008 15:28

Re: libvlcnet - .NET library based on libvlc

Postby elwood » 31 Oct 2009 11:26

This looks like a good alternative to the other wrappers. I'm pretty exicited to see this post. However, the license you are using is GPL? The other wrappers are all using LGPL. Any chance of changing to license to LGPL? TIA.
It is LGPL too.
Is there any possibility to renew the screen when you change player.Time or player.Position if it is in Paused state?
What screen ?
Position if it is Paused - it is possible, but can work with some delay.

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

Re: libvlcnet - .NET library based on libvlc

Postby MidnightCoder » 31 Oct 2009 22:45

It is LGPL too.
Perfect! Next question: it doesn't seem to support VLC 1.x, is this true? Based on what I saw, VLC 0.9x is supported but no 1.x, can you confirm?

elwood
Blank Cone
Blank Cone
Posts: 24
Joined: 04 Oct 2008 15:28

Re: libvlcnet - .NET library based on libvlc

Postby elwood » 01 Nov 2009 00:06

Perfect! Next question: it doesn't seem to support VLC 1.x, is this true? Based on what I saw, VLC 0.9x is supported but no 1.x, can you confirm?
We will update to current stable version asap.
If you need this immediately, you can do this by yourself, you only need to recalculate hashes or disable integrity verification in VlcDeployment module.
I hope the latest version 1.x of native libraries is compatible with current version of libvlcnet.

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 02 Nov 2009 06:34

What screen ?
Position if it is Paused - it is possible, but can work with some delay.
When you pause VLC player and change the position, the picture doesn't change. The same I see using libvlcnet changing Position or Time. But I need to show the current position picture (at paused mode). Of course, I can implement some workaround using the second libvlc instance for making snapshots, but may be there is a normal way to implement this behaviour?

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 02 Nov 2009 06:38

I think it may be caused of incorrect parameters set. Transcoding is not tested yet as well as we want. We tried to hardcode the most compatible parameters to encode the output files. May be in another topic you can find the most suitable options set for your problem.
I have just removed the "transcode" part from sout - and it works. So, as I understand, the WMV2 (that is used by default) coder can't convert MPEG4 video stream from ip-camera.

elwood
Blank Cone
Blank Cone
Posts: 24
Joined: 04 Oct 2008 15:28

Re: libvlcnet - .NET library based on libvlc

Postby elwood » 02 Nov 2009 19:29

When you pause VLC player and change the position, the picture doesn't change. The same I see using libvlcnet changing Position or Time. But I need to show the current position picture (at paused mode). Of course, I can implement some workaround using the second libvlc instance for making snapshots, but may be there is a normal way to implement this behaviour?
Well, if there are VLC player behavior is the same, you should only try to hack the library using non-well documented features like manual enumeration of Vlc core objects and manipulations with it. May be you just can find an API interface allows to enumerate movie's frames.
Also, there are dirty method possible like this : showing the next 1-2 seconds after position to pause and then changing position back, to target point. Then "press" pause.
I have just removed the "transcode" part from sout - and it works. So, as I understand, the WMV2 (that is used by default) coder can't convert MPEG4 video stream from ip-camera.
Good, congratulations :)

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 03 Nov 2009 04:48

Also, there are dirty method possible like this : showing the next 1-2 seconds after position to pause and then changing position back, to target point. Then "press" pause.
It was the first workaround I tried to implement:
1. Call Play(mediaInput)
2. Call Time = requiredTimeSpan
3. Call Pause
But during this operations vlc has time to shom 2-3 seconds of video... so it is not what I want.

I'll try some other ways and be back :)

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 06 Nov 2009 08:29

The solution was pretty easy: I just upgraded VLC from 0.86 to 1.03.

But now I'm observing a strange behaviour of Stop method: it can't switch from FORWARD to ENDED state. As I use video camera as MediaInput, it looks not senseless: my video stream doesn't have the end :) As a temporary decision I just commented some code... but may be you have more information about such behaviour.

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 24 Nov 2009 08:50

I need to add an option "--loop". But this is a playlist option. How can I do this using libvlcnet?

noyogi
New Cone
New Cone
Posts: 1
Joined: 28 Nov 2009 18:39

Re: libvlcnet - rtsp usage

Postby noyogi » 28 Nov 2009 18:51

Hello,

can someone post a piece of code showing how to stream with the library? I tried:

MediaInput input = new MediaInput(MediaInputType.NetworkStream, "rtsp:\\winterfeldt.webhop.org\\live.sdp");
vlcPlayerControl.Play(input);

but that was not really successfull. We are having a bunch of network cameras and would like to make use of the client inour c# applications.

Greatest would be source code as I haven't really got into the c++ part of the application.

Regards,
Götz

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 29 Nov 2009 09:06

noyogi, try to change the url to "rtsp://winterfeldt.webhop.org/live.sdp".

nik.jav
New Cone
New Cone
Posts: 2
Joined: 02 Dec 2009 09:05

Re: libvlcnet - .NET library based on libvlc

Postby nik.jav » 02 Dec 2009 10:40

Request for .Net library function which records videos. Currently there is no method in .net bindings which can be used to record video clips.
Two places come in for changes I think.
Tough one:- basic necessity will be the Vlc code which needs to provide a libvlc interface method to record.
Easy:- Second would be to add an interop method in the .Net library for the recording interface method.

It would be great if this can be taken up by VLC.


Rgds,
Nik

nik.jav
New Cone
New Cone
Posts: 2
Joined: 02 Dec 2009 09:05

Re: libvlcnet - .NET library based on libvlc

Postby nik.jav » 02 Dec 2009 13:02

Or if there is any simple way to do it. please do let me know. i.e if ther is a simpler way to call the recording function from the existing vlc code via the .net bindings.

Thanks
Nik

Idsa
Blank Cone
Blank Cone
Posts: 78
Joined: 22 Oct 2009 10:59

Re: libvlcnet - .NET library based on libvlc

Postby Idsa » 02 Dec 2009 13:08

Or if there is any simple way to do it. please do let me know. i.e if ther is a simpler way to call the recording function from the existing vlc code via the .net bindings.
Nik
It would be better to start from that ;)

To record you just need to add item to PlayerOutput.Files. Here is the code of player with PlayerOutput creating:
player = mediaLibraryFactory.CreatePlayer(playerOutput);

vikasjkmcs2005
New Cone
New Cone
Posts: 1
Joined: 10 Dec 2009 06:25

Re: libvlcnet - .NET library based on libvlc

Postby vikasjkmcs2005 » 10 Dec 2009 09:38

Hi,
@Idsa
Can you tell me the exact code for recording in file, i tried a lot with your hint but could't hv done.

Thanks

urza
New Cone
New Cone
Posts: 2
Joined: 12 Dec 2009 23:25

Re: libvlcnet - .NET library based on libvlc

Postby urza » 12 Dec 2009 23:33

Hi,
is there some quick tutorial about how to play adio files? Lets say I have list of mp3/ogg/flac files (files on harddisc) that I want to play in my application. What do I do? I looked into the solutions exapmles downloaded from the sourceforge page, but they seem rather complex for this simple task. I expect something like this: (pseudocode)
Player p = new Player();
foreach(song s in songs){ p.play(s); }

or something extra simple like this.. I need no gui no nothing, just play some audio files in my app.

Thanks a lot.

EDIT:

Ok, I got the basic example running:

VlcPlayerControl vlcPlayerControl = new VlcPlayerControl();
vlcPlayerControl.Initialize();
vlcPlayerControl.Visible = false;
MediaInput input = new MediaInput(MediaInputType.File, @"C:\Users\Public\Music\Sample Music\Sleep Away.mp3");
vlcPlayerControl.Play( input );


now.. what is the best way to play more files in random order? Should I use the EndReached event? Or is there some Playlist Class?

EDIT2:

The EndReached event is not working for me..

I tried to add this:
...
vlcPlayerControl.EndReached += new EventHandler(vlcPlayerControl_EndReached);
...

void vlcPlayerControl_EndReached(object sender, EventArgs e)
{
MediaInput input = new MediaInput(MediaInputType.File, @"C:\Users\Public\Music\Sample Music\Kalimba.mp3");
vlcPlayerControl.Play(input);
}

and it seems fine, except that when the code reaches to the
vlcPlayerControl.Play(input);
in the handler, the app crashes on exception because I am trying to acces the element from different thread. Maybe its because of WPFs (my app is WPF) stricts rules about threads. Any workaround ideas?

urza
New Cone
New Cone
Posts: 2
Joined: 12 Dec 2009 23:25

Re: libvlcnet - .NET library based on libvlc

Postby urza » 14 Dec 2009 22:39

Ok, so it seems I need to call .Invoke method in the handler, but still it doesnt work, because to my limited knowledge, the winforms component (vlcplayer) has problem that it was created in wpf thread..

is there some playlist? or will the input accept also folder? (and somehow files in random order?)

ideas? anything? anyone?

Antivirusvivente
New Cone
New Cone
Posts: 2
Joined: 19 Dec 2009 21:40

Re: libvlcnet - .NET library based on libvlc

Postby Antivirusvivente » 20 Dec 2009 19:20

I've so and so the same problem.. with a for cycle, i add the items into the playlist, then i play, and the COM plays only the 1st track in the playlist. To play the 2nd and the others song in the playlist, i must click on the next button.

So, if i have understand, this component doesn't working fine, especially for this method ( playlist ).

People and developers of VLC, how we can do to play the playlist without stopping it?

linhnd
New Cone
New Cone
Posts: 1
Joined: 16 Dec 2009 02:37

Re: libvlcnet - .NET library based on libvlc

Postby linhnd » 21 Dec 2009 09:13

hi elwood

I add some method in your sample project for navigation DVDs files
NextChapter, PreChapter, Get(Set)Title. Get(Set)Chapter in folowing files:
1 .Media_Player_VCL/Internal/Interop/LibVlcInterop.cs

Code: Select all

/// <summary> /// Next Chapter /// </summary> [DllImport("libvlc", CallingConvention = CallingConvention.StdCall, ExactSpelling = true)] [SuppressUnmanagedCodeSecurity] public static extern void libvlc_media_player_next_chapter(IntPtr libvlc_mediaplayer_t, ref libvlc_exception_t exception); /// <summary> /// Previous Chapter /// </summary> [DllImport("libvlc", CallingConvention = CallingConvention.StdCall, ExactSpelling = true)] [SuppressUnmanagedCodeSecurity] public static extern void libvlc_media_player_previous_chapter(IntPtr libvlc_mediaplayer_t, ref libvlc_exception_t exception);
2 .Media_Player_VCL/Internal/VlcmediaPlayerInternal.cs

Code: Select all

public void NextChapter() { VerifyObjectIsNotDisposed(); // libvlc_exception_t exc = new libvlc_exception_t(); LibVlcInterop.libvlc_exception_init(ref exc); LibVlcInterop.libvlc_media_player_next_chapter(descriptor, ref exc); if (exc.b_raised != 0) { throw new VlcInternalException(exc.Message); } } public void PreviousChapter() { VerifyObjectIsNotDisposed(); // libvlc_exception_t exc = new libvlc_exception_t(); LibVlcInterop.libvlc_exception_init(ref exc); LibVlcInterop.libvlc_media_player_previous_chapter(descriptor, ref exc); if (exc.b_raised != 0) { throw new VlcInternalException(exc.Message); } }
3. Media_Player/Player.cs
4. Media_Player_Vlc/VlcPlayer.cs
5. Media_Player_Vlc_Vinforms/ VlcPlayerControl.cs

but them have error wheen running with Exception Message:
"Unable to find an entry point named 'libvlc_media_player_next_chapter' in DLL 'libvlc'."

is this vlclib not support upon methods?
please help me

Helkaraxe
New Cone
New Cone
Posts: 4
Joined: 14 Jan 2010 15:53

libvlcnet - .NET library based on libvlc

Postby Helkaraxe » 14 Jan 2010 16:09

When I am recording from a Ip camera, very often I obtain unseekable files, it seems to be caused for a wrong duration of the recorded file (too much long than the real duration). Please if any body knows how to fix this bug, post the solution here or tellme where to find it.

Thanks!!!


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 12 guests