libvlcnet - .NET library based on libvlc

This forum is about all development around libVLC.
carlesls
Blank Cone
Blank Cone
Posts: 24
Joined: 17 Jun 2011 13:42

Re: libvlcnet - .NET library based on libvlc

Postby carlesls » 03 Nov 2011 13:54

I am interesting in using this library to replace a current video implementation using DirectShowLib. The reason I am using DirectShowLib is that I must be able to do frame-stepping. I have a data file linked to each video which contains a distance-frame pairing. The distance is sequential, but the speed at which the distance changes is variable.

Code wise this looks something like the following example:

Code: Select all

long current = GetCurrentFrame(); long desired = GetDesiredFrame(distance); if (desired > (current + 50)) { JumpToFrame(desired); } else { StepOne(); }
Internally this uses the IVideoFrameStep interface defined by DirectShowLib. This function is also called as fast as possible.

The main reason I am interested in using VLC is that it would allow me to specify a codec directory. DirectShowLib uses any codec installed on the user's system. If they have some custom codec pack installed I can no longer guarantee that my video files will be played correctly. Unfortunately, without similar frame-stepping support any chance of using VLC is already out of the question.
Did you get still images with that frame-stepping process? I mean... are you sure VLC doesn't makes frame-stepping?

carlesls
Blank Cone
Blank Cone
Posts: 24
Joined: 17 Jun 2011 13:42

Re: libvlcnet - .NET library based on libvlc

Postby carlesls » 04 Nov 2011 12:54

Hi everyone! I'm having problems with libvlcnet, specifically while trying to get a single video frame (for a batch console thumbnailing application).

Being a console app, NO window, or anything related to any window, controls, etc. is acceptable... So, i made alittle program to test:

(Warning: CODE FRAGMENT)

Code: Select all

VlcDeployment vd = VlcDeployment.Default; vd.Install(true); Console.Write("VLC Deployed."); var mediaLibraryFactory = new VlcMediaLibraryFactory(new string[] { "--no-snapshot-preview", "--ignore-config", "--no-osd", "--plugin-path", Path.Combine(System.Diagnostics.Process.GetCurrentProcess().StartInfo.WorkingDirectory, "plugins") }); var output = new DZ.MediaPlayer.Io.PlayerOutput(); var player = mediaLibraryFactory.CreatePlayer(output); var input = new DZ.MediaPlayer.Io.MediaInput(DZ.MediaPlayer.Io.MediaInputType.File, fileName); player.SetMediaInput(input); player.Play();
This works. Ok, it didn't work at first, because the library kept insisting that i MUST create a window, contrary to the documentation of the PlayerOutput class parameterless constructor, "Creates a player output without window, which can be used to transcode or streaming".... YES that's what i need.

But:
I had to change line 1059 of VlcPlayer.cs to this (the if was not there at all):

Code: Select all

if(playerOutput.IsWindowDefined) ((DoubleWindowBase) playerOutput.Window).PlayerVisibleInternal = true;
and line 1048 to this:

Code: Select all

if(playerOutput.IsWindowDefined) getCurrentMediaPlayerInternal().SetDisplayOutput((int) ((DoubleWindowBase) playerOutput.Window).GetActiveWindowHandleInternal());
After that, it WORKED. But not as expected. A Window is automatically (hey, i didn't asked for that!) created, titled "VLC - Direct3D output".

ALSO (unrelated): It would be nice if the API could play files from System.IO.Stream. Then i could plug in a NetworkStream, FileStream, or any other.

Ok, now the question... How do i play a file and grab a frame out of it (the frame must stay in memory, not as a file. Yeah, VlcPlayer.TakeSnapshot(file, witdth, height) is not acceptable, i'm post processing the thumbnails adding watermarks and overlays, then drawing them over another in-memory image. Only then, saved as a PNG with alpha. I wonder why the library FORCES the developer to save a file).

Thanks in advance!!!!
It happens to me too. I am trying to capture frame by frame with the emgu so I can process image data and detect... moment or faces or people.

carlesls
Blank Cone
Blank Cone
Posts: 24
Joined: 17 Jun 2011 13:42

Re: libvlcnet - rtsp usage

Postby carlesls » 04 Nov 2011 13:24

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
Which is the problem??

sirbow2
New Cone
New Cone
Posts: 7
Joined: 13 Jun 2011 22:44

Re: libvlcnet - .NET library based on libvlc

Postby sirbow2 » 23 Nov 2011 05:43

Hi everyone.
i admit im not very good a C# at all, but i want to use the .net libvlc library (libvlcnet-0.3.1.0-bin-net-2.0.zip from http://sourceforge.net/projects/libvlcn ... t-0.3.1.0/).

i don't want a fancy C# form, i just want to trigger the vlc play or stop button etc through a C# command line program. I'm making a remote control for my computer with a Arduino, and i didn't want to emulate keyboard output with the Arduino for the play etc functions because i would have to be "in" the VLC window for the key presses to trigger in VLC. Using the library i can be in any app, and as long as the C# app is running, it will trigger VLC when i press a button on the remote.

i found DZ.MediaPlayer.Vlc.VlcPlayer which has play, pause etc functions. how do i use them? do i jsut need to create a new VLC object and something like

Code: Select all

VLCObject.Play();
i saw the sample in the source zip, but that was way over my head, and i had no clue what was going on.

thanks, i learn best by reading code, i think, so even if someone posted/linked to some simpler code, i could figure it out.

spider58
Blank Cone
Blank Cone
Posts: 91
Joined: 28 Jun 2011 14:39

Re: libvlcnet - .NET library based on libvlc

Postby spider58 » 24 Jan 2012 10:31

in VB.NET im using.

video scrren is not refreshing when i change position on paused mode.

For example.

Pausing video and using this command to go center of video

.position = 0.5

going to center of video without problem but cannot refresh video screen. Refreshing when i send to play command again.

spider58
Blank Cone
Blank Cone
Posts: 91
Joined: 28 Jun 2011 14:39

Re: libvlcnet - .NET library based on libvlc

Postby spider58 » 24 Jan 2012 15:28

how can i get

Video total duration
video height
video width

inadvance thanks.

malcomm
New Cone
New Cone
Posts: 1
Joined: 04 Apr 2012 02:46

Problem / bug with sample code.

Postby malcomm » 04 Apr 2012 02:56

Hi
I've just downloaded the code etc and am running the SimplePlayer app with mods.
Latest VLC installed.

Problem I have found is when multipole clips are loaded and the player is left in a looping condition, it fail showing this error -
Image

I'm not a C expert so perhaps someone can tell me how to fix the sample?

thanks

gfafriends
New Cone
New Cone
Posts: 1
Joined: 24 Oct 2013 13:54

Re: libvlcnet - .NET library based on libvlc

Postby gfafriends » 24 Oct 2013 13:58

Hi

I need to capture mousemove and mouse down events of VlcPlayerControl, or at least WndProc... which i cant after video has started playing...

how can i do that

thanks

ARUNCB
Blank Cone
Blank Cone
Posts: 11
Joined: 23 Jul 2014 13:35

Re: libvlcnet - .NET library based on libvlc

Postby ARUNCB » 04 Aug 2014 07:54

How can I get the fps,bitrate informations on a URI/stream video?

I tried the

Code: Select all

GetBasicVideoInfo()
method. But I came to know that HTTP stream not implemented in that API,

Then I tried too expose

Code: Select all

libvlc_media_player_get_fp()
in the code and it returns 0.0 for streams. I wonder then how the VLC player gets the fps , bitrate info in codec information tab. Any help?

ARUNCB
Blank Cone
Blank Cone
Posts: 11
Joined: 23 Jul 2014 13:35

Re: libvlcnet - .NET library based on libvlc

Postby ARUNCB » 26 Aug 2014 08:21

I am so lucky to have no reply on this post so far. Still I am able to find a solution.

BTW, VLC have a minor issue :https://forum.videolan.org/viewtopic.ph ... 40#p404509

So to get the exact/ closest frame rate you have to use the DecodedFrame property. store the previous one and subtract it with current value.

mhheydarchi
Blank Cone
Blank Cone
Posts: 10
Joined: 23 Jun 2015 17:30

Re: libvlcnet - .NET library based on libvlc

Postby mhheydarchi » 17 Aug 2015 10:30

How i can run some services of a TS Stream on c# simultaneity.

Taldrit
New Cone
New Cone
Posts: 4
Joined: 27 Aug 2015 16:36

Re: libvlcnet - .NET library based on libvlc

Postby Taldrit » 28 Aug 2015 12:03

libvlcnet also without loop-method?
There is no event I can use to capture the player right before the "EndReached".
There I could set the position to the start again (first millisecond or something like that).
Is there some method, event, etc. I could use to loop the video without delay?

vikram.taneja
New Cone
New Cone
Posts: 1
Joined: 15 Feb 2016 15:20

Re: libvlcnet - .NET library based on libvlc

Postby vikram.taneja » 15 Feb 2016 15:38

Hello

I have query related to vlc dlls.
I am currently using VLC version vlc-2.2.1, while using the axvlc.dll I am in loop connecting, disconnecting, play and stop the audio.
I can clearly see the memory leak and crash in dll as soon as the user object increased beyond 10,000.

Please let me know if anything else is required.

Looking forward for your reply.

Thanks
Vikram


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 3 guests