Usage of libvlc.dll in C#

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
mohanaryal
Blank Cone
Blank Cone
Posts: 15
Joined: 07 Feb 2007 11:25
Contact:

Could you please help me also for Same Problem

Postby mohanaryal » 08 Feb 2007 07:24

Hello Odysee,

can you guide me to control Aspect ratio, and Crop via code.
aryalm@vri.co.in
Thanks
Mohan Raj Aryal
Last edited by mohanaryal on 09 Feb 2007 07:55, edited 3 times in total.
Valuable Reserve India

mohanaryal
Blank Cone
Blank Cone
Posts: 15
Joined: 07 Feb 2007 11:25
Contact:

Can you help me to Control Aspect Ratio and Crop from .net

Postby mohanaryal » 08 Feb 2007 07:44

Hello Tappen

I became able to play the MP4 video to my picturebox within windows form. Now I want to change the aspect ratio and crop for the same. The aspect ratio, and crop control i found in vlc player simple by right clicking on it.

thank you
Valuable Reserve India

mohanaryal
Blank Cone
Blank Cone
Posts: 15
Joined: 07 Feb 2007 11:25
Contact:

Postby mohanaryal » 09 Feb 2007 06:57

Hi,

can you provide me the Chris Meadowcroft's VLC code in vs 2003 in c#.

Please you will be thankful

Mohan
Hi everybody, I made a project in VS 2005 to use LibVlc.cs.

I first created a Windows Application (containing Form1.cs and Program.cs), then I made a class called LibVlc.cs.

In Form1.cs, I only have:

Code: Select all

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace CustomVlcPlayer { public partial class Form1 : Form { public Form1() { InitializeComponent(); LibVlc.LibVlc vlc = new LibVlc.LibVlc(); vlc.Initialize(); MessageBox.Show(vlc.LastError); vlc.VideoOutput = pictureBox1; vlc.PlaylistClear(); vlc.AddTarget("F:\\....\\matrix.mpg"); vlc.Play(); } } }
I cannot import the libvlc.dll file, when i did right click on the project then "add reference...", search the libvlc.dll file and "ok" i have the error message :

Une reference a "D:\....\libvlc.dll" n'a pas pu etre ajoutee. Assurez vous que le fichier est accessible et qu'il s'agit d'un assembly valide ou d'un composant COM

If I run the project without libvlc.dll in my project, I have this error :
could not find libvlc
This is normal !

Am I doing something wrong ? if yes, can someone help me with that and give me the correct solution to succeed?

thank you very much.

ParKiN
Valuable Reserve India

adilfazal
New Cone
New Cone
Posts: 1
Joined: 18 Feb 2007 07:09
Location: Faisalabad
Contact:

Video conferencing For Deaf People

Postby adilfazal » 18 Feb 2007 07:28

Hi Odysee,
I m working on Video conferencing solution for deaf people for charity purpose. I m using Window Media Video Codec 9 but it not give desire result. I have experince in C# please send me C# wraper at this address adilfazal@yahoo.com
and please tell me using this can i receive 20 frps at 128Kbps

Regards,
Adil Fazal

olixelle
New Cone
New Cone
Posts: 9
Joined: 08 Feb 2007 20:32

Postby olixelle » 19 Feb 2007 19:32

hello :)

well i used ur code to display rtsp stream.
It works.
But...
Display quality is not really good and channel changing is very slow.
I do not use any options to read a stream.
Before, i used vlc activex and it worked greatly

do u have any idea ?

thanks :)

kevint03
New Cone
New Cone
Posts: 2
Joined: 19 Feb 2007 21:37
Location: USA

Read DVD folder using libvlc

Postby kevint03 » 19 Feb 2007 21:49

Hi Odysee,

First, thank you for your good work.

I am new to VideoLan. After reading your post regarding C# wraparound for libvlc, I am interested in creating a little video player for fun. I have a question for you. In you wrapper, there is a TargetAdd function that allows us to add a file to the playlist to play. I wonder if it can accept the whole directory, and inteligently fill the playlist with with only media files. In other word, I would like to create the same feature that VideoLan player's Open Directory function does.

Thanks,
Kevin

olixelle
New Cone
New Cone
Posts: 9
Joined: 08 Feb 2007 20:32

Postby olixelle » 19 Feb 2007 21:52

hello kevin,

addtarget can only receive a file or a playlist
u have to parse files in directory by yourself and then u add each item to the playlist usin addtarget wrapper

kevint03
New Cone
New Cone
Posts: 2
Joined: 19 Feb 2007 21:37
Location: USA

Loading dvd folder

Postby kevint03 » 20 Feb 2007 08:53

Hi Odysee,

Yes, I can read the folder and fill in the playlist with media files one by one, but I don't have the ability to jump from one chapter to another. It seems that there are dvd navigation file in the folder that help link all the media files together. I guess I need to look at the VideoLan player source code to find out how it does with its function Open Directory.

Thanks,
Kevin

mohanaryal
Blank Cone
Blank Cone
Posts: 15
Joined: 07 Feb 2007 11:25
Contact:

Problem On Multiple Playbacks (in Win XP)

Postby mohanaryal » 28 Feb 2007 11:40

Hi,
I am using Odysee's LibVlc class for my customized player. The output video I am displaying on a picturebox. when i play one time or for some time like 1 hour, 2 hour etc. it works fine. But if I do the continuous play then the picturebox displays nothing sometimes after 3 hour sometimes after 5 hours etc. My other contentent are working properly within my player.

I have few doubts:

- Is there any log provision ??
- I have reinitialized the LibVlc object each time changing video, is it the right way of doing? because on simple stop and play the error comes earlier than above.
- is there any windows problem when we use vlc control continuously.
- Is there any services to be enabled or disabled in windows XP which are disturbing?

My contents are MPEG4 HD contents. I am using VLC 8.5. my OS is WINXP.

Please help me, i tried forum search but didn't find any possible answer. If it is already answered please pass me the url because i m getting trouble on search.

Mohan
Valuable Reserve India

tvproducer
New Cone
New Cone
Posts: 4
Joined: 09 Jul 2007 15:53

Re: Usage of libvlc.dll in C#

Postby tvproducer » 09 Jul 2007 18:16

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

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

Re: Usage of libvlc.dll in C#

Postby publicENEMY » 20 Sep 2007 10:29

tappen

there are no implementation for VlcUserControl_Resize() event in VlcUserControl.Designer.cs. have anyone ACTUALLY try this?

can you provide a simple tutorial to interface VLanControl or more information on VLanControl.

from what i understand, thera are two way to use VLanControl. one is from VlcUserControl, a inherited UserControl class and the other one is from NativeLibVlc class. NativeLibVlc is the VideoLan interop class. VlcUserControl is a class that you can treat like any other windows forms. VideoLan usage documentation applies to NativeLibVlc. While there are no usage documentation for VlcUserControl. for example, do i need to explicitly initialize VlcUserControl?

thanks in advance.

sarahwyt
New Cone
New Cone
Posts: 3
Joined: 04 Dec 2007 03:48

Re: Usage of libvlc.dll in C#

Postby sarahwyt » 15 Dec 2007 18:00

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

arogan
New Cone
New Cone
Posts: 3
Joined: 17 Dec 2007 03:16

Re: Usage of libvlc.dll in C#

Postby arogan » 17 Dec 2007 03:19

Is there any way to get/set the current title using libvlc? I'm talking about when you are playing a dvd iso I need to be able to get/set the current dvd title #.

mikele
New Cone
New Cone
Posts: 1
Joined: 04 Jan 2008 08:39

Re: Usage of libvlc.dll in C#

Postby mikele » 04 Jan 2008 08:47

First of all, thanks for your work Odysee, it works like a charm, it's very clean and easy to understand.

I've been reading libvlc's documentation but my programming skills are not enough to find a solution, so I hope someone here can help me. I'm using Odysee's code to play some audio and video online streams, and I'd like to ask libvlc a couple of things about those streams, for example which codecs are being used and the bitrate of the stream. Since VLC shows this info, I think I should be able to get it from libvlc, but I don't know which function I should use.

Any help will be really appreciated!
Thanks in advance!

equitel
New Cone
New Cone
Posts: 6
Joined: 19 Oct 2007 11:47

Re: Usage of libvlc.dll in C#

Postby equitel » 14 Jan 2008 16:08

Hello,

Anybody kowns how to get the bit-rate and packets recived?.

Please, write me caddress at gmail.com

Thanks,

howdini
New Cone
New Cone
Posts: 9
Joined: 13 Aug 2007 09:53

Re: Usage of libvlc.dll in C#

Postby howdini » 16 Jan 2008 07:58

Hi, i've been struggling with this bitrate issue myself. I can see that the vlc player can retrieve the current bitrate of a stream in real time. How can one emulate this. Below is my c# code written in an attempt to do this. So far it just bugs out on the dll call. Where am i going wrong.
Also, is one supposed to use the mediacontrol_get_stream_information() library function to retrieve this info.
(Placed this code in the nativelicVlc.cs)

[StructLayout(LayoutKind.Sequential)]
struct strInfo
{
public IntPtr width;
public IntPtr height;
public IntPtr aspect_ratio;
public Int64 bitrate;
public IntPtr codec;
public IntPtr author;
}

static extern strInfo mediacontrol_get_stream_information(IntPtr vlc, mediacontrol_PositionKey pKey, VlcError err);

public long GetStreamInfo()
{
strInfo sif;
sif.bitrate = 0;
try
{
using (VlcObject vobj = new VlcObject(this.vlcHandle, ObjectType.VLC_OBJECT_PLAYLIST))
{
if (vobj.SubObject != IntPtr.Zero)
{
sif = mediacontrol_get_stream_information(vobj.SubObject, mediacontrol_PositionKey.mediacontrol_MediaTime ,
VlcError.Exception);
return Convert.ToInt64(sif.bitrate);
}
}
}
catch (Exception)
{ }
return lng;
}

equitel
New Cone
New Cone
Posts: 6
Joined: 19 Oct 2007 11:47

Re: Usage of libvlc.dll in C#

Postby equitel » 16 Jan 2008 10:48

Hello,

I have error, I haven`t more ideas, I try with the folow code but ocurrs the same.

sif = mediacontrol_get_stream_information(p_input, mediacontrol_PositionKey.mediacontrol_MediaTime, ref vpobj.exception);

Do you have more ideas?

Andrés

ssssssssssss
Blank Cone
Blank Cone
Posts: 12
Joined: 14 Nov 2007 06:05

Re:

Postby ssssssssssss » 19 Jan 2008 08:32

Hi,
here is a sample for c#.

I have also written a wrapper in managed c++ (assembly)! If you want, i can mail you the project!

ciao Odysee
Hi, could you share it with me ?
My Email: wanliyou@gmail.com
Thanks!

Cheetah
New Cone
New Cone
Posts: 6
Joined: 19 Jan 2008 12:25

Re: Usage of libvlc.dll in C#

Postby Cheetah » 19 Jan 2008 12:28

Hi there,

Does anyone have a full project for use of VLC in Visual Studios?

Could you please email it to me: ruudbarron@hotmail.com

Thanks.

EDIT: Or upload it here?

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: Usage of libvlc.dll in C#

Postby Jean-Baptiste Kempf » 19 Jan 2008 19:46

You can't compile VLC in Visual Studio, btw...

Any VS guru ?
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.

Cheetah
New Cone
New Cone
Posts: 6
Joined: 19 Jan 2008 12:25

Re: Usage of libvlc.dll in C#

Postby Cheetah » 20 Jan 2008 16:32

So I can't use this within my C#.NET application?

All I want to do is play videos through VLC player? - I thought that was what this thread was for :s

sr55
New Cone
New Cone
Posts: 2
Joined: 28 Jan 2008 18:38

Re: Usage of libvlc.dll in C#

Postby sr55 » 28 Jan 2008 20:41

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.

iamnotgeorge
New Cone
New Cone
Posts: 6
Joined: 29 Jan 2008 03:54

Re: Usage of libvlc.dll in C#

Postby iamnotgeorge » 30 Jan 2008 05:12

Hi All,

I am writing an application in C# which is using VLC(libvlc.dll) to play internet radio. The player is nice and able to play. I can get the now playing event or poll the playing state ram, but how can I get any "Fail to play event"?? For example, invalid link, network disconnect, cannot decode etc etc ....

Thanks you for any reply and hints.

equitel
New Cone
New Cone
Posts: 6
Joined: 19 Oct 2007 11:47

Re: Usage of libvlc.dll in C#

Postby equitel » 30 Jan 2008 09:16

Hello,

I am interested playing internet radio, now I can only visualize video stream.

Can you share the code?

Send me at caddress@gmail.com

Regards, Andrés

iamnotgeorge
New Cone
New Cone
Posts: 6
Joined: 29 Jan 2008 03:54

Re: Usage of libvlc.dll in C#

Postby iamnotgeorge » 31 Jan 2008 11:03

Hello,

I am interested playing internet radio, now I can only visualize video stream.

Can you share the code?

Send me at caddress@gmail.com

Regards, Andrés
I am using the sample code on the first page... nothing special for internet radio... just add the radio link by addtarget like open other media file, so I would say the player is "nice" as I do nothing to handle...


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 22 guests