libvlcnet - .NET library based on libvlc

This forum is about all development around libVLC.
parker
Blank Cone
Blank Cone
Posts: 39
Joined: 21 Sep 2010 05:25

Re: libvlcnet - .NET library based on libvlc

Postby parker » 16 Oct 2010 04:45

How to add controls (datagirdview, listbox, text) to control the video in VLC
Thank you!

siolor
New Cone
New Cone
Posts: 2
Joined: 14 Oct 2010 07:45

Re: libvlcnet - .NET library based on libvlc

Postby siolor » 18 Oct 2010 08:27

:x Hi,
I'm trying to use the libvlcnet to trancode a RTSP stream to a lower bitrate and then re-stream it.

Based on what i read on this thread

Code: Select all

private void stream(string VideoPath) { mediaInput = new MediaInput(MediaInputType.NetworkStream, VideoPath); MediaLibraryFactory mediaLibraryFactory; string set = @"#transcode{vcodec=h264,vb=1152,scale=1,width=640,height=480,acodec=mpga,ab=32,channels=1,samplerate=8000}"; mediaLibraryFactory = new DZ.MediaPlayer.Vlc.VlcMediaLibraryFactory(new string[] { ":no-sout-rtp-sap :no-sout-standard-sap :sout-keep", set, "--plugin-path", System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Environment.CurrentDirectory), "plugins") }); PlayerOutput po = new PlayerOutput(vlcWindowControl1.Window); OutputNetworkStream ons = new OutputNetworkStream(NetworkProtocol.RTP, "127.0.0.1", 5445); po.NetworkStreams.Add(ons); player = mediaLibraryFactory.CreatePlayer(po); player.SetMediaInput(mediaInput); player.Play(); }
This code is executed without any error. I got a preview of the stream inside the "vlcWindowControl". The process is using lots of ressources, so it seems that something like a transcoding is currently happening but unfortunately, the port 5445 is never bind to anything.

Anyone have an idea of what i'm doing wrong ?

stuckinthemire
New Cone
New Cone
Posts: 1
Joined: 06 Dec 2010 18:01

Re: libvlcnet - .NET library based on libvlc

Postby stuckinthemire » 06 Dec 2010 18:05

can somebody please help me. i have an asf stream which i have been able to open with regular vlc. i have also been able to display the audio and video in .net without any problems. what i'd like to do is rip the audio from the live stream (asf) to (wav file) in real time. does anybody know how i can do this? even if it is not with vlc?? thanks so much for any help you can provide.

dekelc
New Cone
New Cone
Posts: 2
Joined: 15 Dec 2010 22:55

Re: libvlcnet - .NET library based on libvlc

Postby dekelc » 15 Dec 2010 22:58

Hello,

Can I use libvlcnet in a commercial application?
If so, are there any restrictions? actions that needs to be done?
If not, is there a way to purchase a license to do that?

Thanks,
Dekel.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: libvlcnet - .NET library based on libvlc

Postby Jean-Baptiste Kempf » 16 Dec 2010 00:36

Can I use libvlcnet in a commercial application?
If so, are there any restrictions? actions that needs to be done?
If not, is there a way to purchase a license to do that?
Now, NO.

But, if you are really interested, please mail me.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

dekelc
New Cone
New Cone
Posts: 2
Joined: 15 Dec 2010 22:55

Re: libvlcnet - .NET library based on libvlc

Postby dekelc » 17 Dec 2010 09:36

OK, great. I'll do that.

dss2000
New Cone
New Cone
Posts: 1
Joined: 27 Dec 2010 18:14

Re: libvlcnet - .NET library based on libvlc

Postby dss2000 » 27 Dec 2010 18:40

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!!!!

rzar
New Cone
New Cone
Posts: 8
Joined: 13 May 2009 13:54

Re: libvlcnet - .NET library based on libvlc

Postby rzar » 01 Jan 2011 19:17

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

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"
....
Thanks in advance!!!!
Hi dss2000. This is behavior of VLC itself, but I think you can control that and disable it by using parameters to VlcMediaLibraryFactory constructor. Refer to vlc --help to find out that parameter.

don_ronara
New Cone
New Cone
Posts: 1
Joined: 17 Jan 2011 10:39

Re: libvlcnet - .NET library based on libvlc

Postby don_ronara » 17 Jan 2011 10:49

How do you use these parameters in VB.NET? I currently have a very basic playback going, but unsure how to modify things beyond play, pause, get and go to position, and set volume.

Heres what im using, its very basic.

Code: Select all

Dim VlcPlayerControl As New VlcPlayerControl Dim MediaInputx As New MediaInput(MediaInputType.File, "myvideo") VlcPlayerControl.Parent = me VlcPlayerControl.Dock = DockStyle.Fill VlcPlayerControl.Play(MediaInputx)
So how would I implement parameters into that to further customize the player? I have spent some time exploring other features but nothing would run.

sh4
New Cone
New Cone
Posts: 1
Joined: 27 Jan 2011 11:24

Re: libvlcnet - .NET library based on libvlc

Postby sh4 » 27 Jan 2011 11:30

Hi guys!
I'd like to make a small c# console app which can get some screenshot from rar files. Lookin' around for some solution but nothing good idea.
vlc can handle media files in rar so its a good point, but as i see, cannot configure to open the media and create some shots from it in different timecodes. Eg i'd like to create a 3x3-3x4 matrix image from the shots.
First idea was to create a local stream via http and then mediainfo can get the tech infos and mplayer can create snapshots from random places.
Is there an easy solution to using libvlc in c# for local streaming?
Thx

solud
Blank Cone
Blank Cone
Posts: 21
Joined: 15 Mar 2008 08:46

Re: libvlcnet - .NET library based on libvlc

Postby solud » 01 Mar 2011 01:04

I'm sure VLC can do this too, but FWIW I use FFMPEG in my C# app ("ffmpeg.exe -ss 5 -vframes 1 -i video.mpg -f image2 img.jpg") to grab snapshots 5 seconds into a clip and dump out a JPG.

over_2
New Cone
New Cone
Posts: 3
Joined: 03 Mar 2011 14:28

Re: libvlcnet - .NET library based on libvlc

Postby over_2 » 03 Mar 2011 14:38

hello everyone! i'm using libvlcnet.I used below code and there is a strange problem. When i compile my program it shows nothing but when i put a break point on mediainput line and resume it after a few seconds VLC Direct3d will show. What's wrong with my code?
private void Form1_Load(object sender, EventArgs e)
{
vlcPlayerControl1 = new VlcPlayerControl();
vlcPlayerControl1.Height = 50;
vlcPlayerControl1.Width = 50;
vlcPlayerControl1.Initialize();
MediaInput i = new MediaInput(MediaInputType.File, @"F:\f.mpg");
vlcPlayerControl1.Volume = 100;
vlcPlayerControl1.Play(i);
}
VS2010-Win7 X64

Bebel
New Cone
New Cone
Posts: 7
Joined: 25 Mar 2010 15:21

Re: libvlcnet - .NET library based on libvlc

Postby Bebel » 06 Apr 2011 11:41

Hi everybody! In have funded a bug in this wonderfull Wrapper.
When you set the video window at a specific size (in the sample project for exemple) and when you play a sevral video(a playlist), the n displayed video are not resing to the video window, at the end of the first one or if you click on Next .
If you want a good resizing you need to stop the player each time!!!!

Do Somebody find a solution?

Thank you for your help.....

rzar
New Cone
New Cone
Posts: 8
Joined: 13 May 2009 13:54

Re: libvlcnet - .NET library based on libvlc

Postby rzar » 14 Apr 2011 14:26

Anyone who want to participate (finding bugs/asking for new features/coding) on the wrapper, please feel free to contact me at zaripov [dot] rinat [at] gmail [dot] com. I don't have much time really for the project. I keep coding for libvlc.net when I have time.

I use forums very rarely, so it's better to contact me by e-mail.

Best regards,
rz.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: libvlcnet - .NET library based on libvlc

Postby Jean-Baptiste Kempf » 14 Apr 2011 14:36

How about making it official on git.videolan.org?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

ZeBobo5
Blank Cone
Blank Cone
Posts: 17
Joined: 17 Nov 2006 11:38

Re: libvlcnet - .NET library based on libvlc

Postby ZeBobo5 » 20 Apr 2011 11:54

What about this library :D

VideoLan DotNet for WinForm & WPF

This will be available for Winform and WPF

Next version will be available in the beginning of May with WPF full compatibility

ZeBobo5

rzar
New Cone
New Cone
Posts: 8
Joined: 13 May 2009 13:54

Re: libvlcnet - .NET library based on libvlc

Postby rzar » 20 Apr 2011 13:06

How about making it official on git.videolan.org?
If you want me to push somewhere else also - no problem. Please, feel free to contact me by e-mail I provided in previous post.

Also, I'd be great if I can discuss some problems I have. I'm working on 'crossplatforming' the library and I have unit tests which fails on Windows and go well on Mac. EndReached is not called on Windows when testing and works ok when using from Windows.Forms application. I came to thought that vlc EndReached event doesn't work without the main window. Is that true?

Best regards,
rz.

tyfius
New Cone
New Cone
Posts: 2
Joined: 11 May 2011 16:49

Re: libvlcnet - .NET library based on libvlc

Postby tyfius » 11 May 2011 16:58

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.

oddes
New Cone
New Cone
Posts: 1
Joined: 06 Jun 2011 18:19

Re: libvlcnet - .NET library based on libvlc

Postby oddes » 06 Jun 2011 18:23

Hi all,

I'm trying to get a Network Stream Output but haven't had much success yet. So how can I define a Player that gives me a Network Stream?
Thanks for your replay!

Best regards
Oddes

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

Re: libvlcnet - .NET library based on libvlc

Postby spider58 » 01 Jul 2011 14:30

Ok i made a player. Thanks for great wrapper. I have Question(s)

Video Screen is not changing when player position changed by user at pause mode.
time is changing good but screen is not. (need to press play again).

Is there anyway to video screen change on same time with (player.time) at pause mode

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

Re: libvlcnet - .NET library based on libvlc

Postby carlesls » 05 Jul 2011 16:08

The player works perfectely, as I can see and prove. However, there is no way to extract bitmaps from the player or by any class or method of this libvlcnet library??
I just would like to get some bitmap in order to manipulate them via emgu.

Thanks a lot.

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

Re: libvlcnet - .NET library based on libvlc

Postby carlesls » 05 Jul 2011 16:11

Hi all,

I'm trying to get a Network Stream Output but haven't had much success yet. So how can I define a Player that gives me a Network Stream?
Thanks for your replay!

Best regards
Oddes
That was easy...


Code: Select all

try { if((this.vlcpc.IsDisposed)||(this.vlcpc == null)) { this.vlcpc = new VlcPlayerControl(); this.vlcpc.Initialize(); this.vlcpc.Visible = true; } if (!this.vlcpc.IsInitialized) { this.vlcpc.Initialize(); } MediaInput input = new MediaInput( MediaInputType.NetworkStream, "rtsp://admin:admin@192.168.1.44:8557/video.mp4"); this.vlcpc.Visible = true; if ((VlcPlayerControlState.IDLE == this.vlcpc.State) || (VlcPlayerControlState.PAUSED == this.vlcpc.State)) { Rectangle rbmp = new Rectangle(); Bitmap bmp= new Bitmap(this.ClientSize.Width,this.ClientSize.Height * 1 / 3); rbmp.Location = new Point(0,this.ClientSize.Height * 1 / 3); rbmp.Size = new Size(this.ClientSize.Width,this.ClientSize.Height * 1 / 3); this.vlcpc.DrawToBitmap(bmp , rbmp); this.pb.Image = bmp; this.vlcpc.Play(input); } } catch (Exception e1) { MessageBox.Show("Carles Lloret: "+e1.ToString()); }

prakash122
New Cone
New Cone
Posts: 1
Joined: 05 Sep 2011 01:54

Re: libvlcnet - .NET library based on libvlc

Postby prakash122 » 05 Sep 2011 02:01

"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)" is the error i am getting when i run the solution from visual studio why? I have been breaking my head for 5 hours. :(

ncfuncion
New Cone
New Cone
Posts: 1
Joined: 24 Sep 2011 16:07

Re: libvlcnet - .NET library based on libvlc

Postby ncfuncion » 24 Sep 2011 16:37

I'm working on a project that can play streamed videos using rtsp protocol. Using the libvlcnet works great when streaming videos from youtube but fails to play videos from VideoNext server. Can anyone help me determine the cause based on the captured messages below?'

Thanks!


Code: Select all

[quote]OPTIONS rtsp://207.207.160.4:8554/xmedia?dev=103&objid=103&authorizationid=b39cea1565ce2444c9185a31afeb88574008 RTSP/1.0 CSeq: 1 User-Agent: VLC media player (LIVE555 Streaming Media v2009.03.22) RTSP/1.0 200 OK CSeq: 1 Date: Sat, Sep 24 2011 11:33:53 GMT Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, SET_PARAMETER DESCRIBE rtsp://207.207.160.4:8554/xmedia?dev=103&objid=103&authorizationid=b39cea1565ce2444c9185a31afeb88574008 RTSP/1.0 CSeq: 2 Accept: application/sdp User-Agent: VLC media player (LIVE555 Streaming Media v2009.03.22) RTSP/1.0 200 OK CSeq: 2 Date: Sat, Sep 24 2011 11:33:55 GMT Server: VideoNEXT v271 Content-Base: rtsp://207.207.160.4:8554/h264media/ Content-Type: application/sdp Content-Length: 429 v=0 o=- 1316576079161558 1 IN IP4 207.207.160.4 s=Media Presentation i=h264media t=0 0 a=tool:VideoNEXT streamer v2.7.1 a=type:broadcast a=control:* a=range:npt=0- a=x-qt-text-nam:Media Presentation a=x-qt-text-inf:h264media m=video 0 RTP/AVP 96 c=IN IP4 0.0.0.0 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1;profile-level-id=42001E;sprop-parameter-sets=Z0IAHuKQKDPz4C3AQEB4eJEV,aM48gA== a=control:track1 SETUP rtsp://207.207.160.4:8554/h264media/track1 RTSP/1.0 CSeq: 3 Transport: RTP/AVP;unicast;client_port=64768-64769 User-Agent: VLC media player (LIVE555 Streaming Media v2009.03.22) RTSP/1.0 200 OK CSeq: 3 Date: Sat, Sep 24 2011 11:33:55 GMT Transport: RTP/AVP;unicast;destination=180.190.232.217;client_port=64768-64769;server_port=53364-53365 Session: 1 PLAY rtsp://207.207.160.4:8554/h264media/ RTSP/1.0 CSeq: 4 Session: 1 Range: npt=0.000- User-Agent: VLC media player (LIVE555 Streaming Media v2009.03.22) RTSP/1.0 200 OK CSeq: 4 Date: Sat, Sep 24 2011 11:33:55 GMT Range: npt=0.000- Session: 1 RTP-Info: url=rtsp://207.207.160.4:8554/h264media/track1;seq=63388 TEARDOWN rtsp://207.207.160.4:8554/h264media/ RTSP/1.0 CSeq: 5 Session: 1 User-Agent: VLC media player (LIVE555 Streaming Media v2009.03.22) RTSP/1.0 200 OK CSeq: 5 Date: Sat, Sep 24 2011 11:34:01 GMT[/quote]

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:34

Today the first public version of library has been released. Library provides basic functionality to play a movies and music files. If you looking for a simple solution to implement features like playing mediafiles, transcoding into another formats or network streaming, it may be useful for you. Library includes .NET interop code, abstract classes, Windows Forms user controls and sample player written using Windows Forms.

Project homepage at SourceForge : https://sourceforge.net/projects/libvlcnet/

Works on Microsoft .NET 2.0, 3.5, releases for Linux planned in the future.

The sources and binaries is available under GPL at SourceForge:
https://sourceforge.net/project/showfil ... _id=242685

To build library using NAnt, execute command like this:
nant /t:net-2.0 clean build zip
To use library you should place libvlc dll files into the same folder as your program. See sample from 'trunk/samples' directory in the sources package.

Your opinion and feedback is more than greatly appreciated.
It allows users to get the video from the stream and watch it in a form or ImageBox... but what about capturing still images from a rtsp stream (an IP camera).


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 8 guests