zhaojiahai / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

Add built in support for VLC sources #242

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
VLC supports mp4, rtsp streams, asf etc. Using the nVLC library (from 
codeproject) i've written a new stream type called VLCStream which lets AForge 
work with a massive amount of different video sources. This code has been 
working in iSpy for months and is being used to connect to video sources from 
an enormous amount of cameras - so I thought it might be worthwhile suggesting 
it for inclusion in AForge proper. This does require installation of VLC to 
work and inclusion of the nVLC DLLs as well (nVLC DLLs included) I haven't 
updated the documentation in the class files. The VLCStream.cs code file 
includes a few weird hacks which prevent VLC crashing under some circumstances 
(repeated restarting of streams for one). If you do include it please give me 
some credit :)

using it:

string NL=Environment.NewLine;
string vlcargs="-I" + NL + "dummy" + NL + "noaudio" + NL + "--ignore-config" + 
NL + "--plugin-path=\"" + VlcHelper.VlcPluginsFolder + "\"";

string[] inargs = vlcargs.Split(Environment.NewLine.ToCharArray(),
  StringSplitOptions.RemoveEmptyEntries);
                    var vlcSource = new VlcStream("http://username:password@ipaddress/videostream.asf", inargs);
                    vlcSource.ResizeWidth = 640;
                    vlcSource.ResizeHeight = 480;
                    OpenVideoSource(vlcSource);
... etc

Original issue reported on code.google.com by ad...@activeunlimited.com on 13 Aug 2011 at 3:13

Attachments:

GoogleCodeExporter commented 8 years ago
This part I just love :) lol

        public VlcStream()
        {
            throw new Exception("Not Implemented");
        }

Original comment by andrew.k...@gmail.com on 5 Sep 2011 at 12:07

GoogleCodeExporter commented 8 years ago
That's been auto-generated :( Helpful eh

Original comment by ad...@developerinabox.com on 5 Sep 2011 at 11:54

GoogleCodeExporter commented 8 years ago
this looks interesting - do you have a sample line that could be used for 
connecting to a camera that is using rtsp to stream mjpeg?

thanks,
sid

Original comment by sidcon...@gmail.com on 19 Sep 2011 at 7:27

GoogleCodeExporter commented 8 years ago
you should just be able to pass it the rtsp url - if you can get it working in 
VLC then it'll work through this 

Original comment by ad...@activeunlimited.com on 19 Sep 2011 at 10:34

GoogleCodeExporter commented 8 years ago
The code/solution does not seem to be clean to me.

Original comment by andrew.k...@gmail.com on 8 Feb 2012 at 10:02

GoogleCodeExporter commented 8 years ago
here's an updated version of it.

Original comment by ad...@activeunlimited.com on 9 Feb 2012 at 1:58

Attachments:

GoogleCodeExporter commented 8 years ago
Interesting… I'll have to try it someday.

You should update the XMLDoc, it still says MJPEG in several places. Maybe 
replace the sample code with what you put here.
It will also probably be better to use AForge coding conventions (no leading 
underscore on private members for example), and create properties instead of 
having public members.

I will try to integrate it in my app when time permits. Support for network 
cameras doing MPEG4 streaming is interesting.

Original comment by j...@kinovea.org on 10 Feb 2012 at 11:11

GoogleCodeExporter commented 8 years ago
Some news about it?

I'm trying to make it working but I receive always this message:
"The command line options could not be parsed. Make sure they are valid."
and
"Failed to initialize libVLC. Possible reasons : Some of the arguments may be 
incorrect. VLC dlls' version mismatch".

I tried for many libvlc.dll versions and args.
Some help?

####################################################################
string NL = Environment.NewLine;
string vlcargs = ""
    + "-I" + NL
    + "dummy" + NL
    + "--ignore-config" + NL
    + "--plugin-path=\"" + VlcHelper.VlcPluginsFolder + "\""
    + "";

string[] inargs = vlcargs.Split(Environment.NewLine.ToCharArray(), 
StringSplitOptions.RemoveEmptyEntries);
var vlcSource = new VlcStream(form.URL, inargs);
####################################################################

Original comment by t...@tera.net.br on 5 Jun 2013 at 6:21

GoogleCodeExporter commented 8 years ago
>> Some news about it?
No. The suggested implementation is not something I would ever put into the 
framework. So if someone needs it, then I would suggest resolving any issues on 
your own.

Original comment by andrew.k...@gmail.com on 5 Jun 2013 at 6:41

GoogleCodeExporter commented 8 years ago
Maybe the author of this suggestion can create a new project as extension to 
aforge, since this will not be implemented into aforge.

Thank you all.

Original comment by t...@tera.net.br on 5 Jun 2013 at 7:12

GoogleCodeExporter commented 8 years ago
Is there a C# project that is available to compile the class so that I can 
debug a problem on the image been passed to the event that is not changing, the 
event is firing perfectly but the image remains "stuck" from a basler IP camera.

Thanks for now

Original comment by terencew...@gmail.com on 17 Jul 2014 at 8:07