Jump to content

Banner.jpg.b89429c566825f6ab32bcafbada449c9.jpg

New Webcam capture software


rwg

Recommended Posts

The last time I was out imaging I finally got fed up with Amcap, Open Video Capture and the like - particularly the way you have to keep opening the Video Filter & Pin dialogs to change anything....

So I decided to write my own capture program - the key feature is that it shows all the controls for the camera in a handy window next to the preview window that is visible all the time (see screenshot).

Additionally, it automatically gives a new filename to each new capture, there are no limits on capture length and it has a facility to load and save 'capture profiles' - that means quickly storing and then reloading a complete set of camera settings. Handy for if you need completely different settings for different targets or for focusing.

The program is very small - just download the attached zip and run the .exe inside it. You need to install the Microsoft .NET Framework (2.0) first. You can download it here : http://www.microsoft.com/downloads/details.aspx?familyid=79BC3B77-E02C-4AD3-AACF-A7633F706BA5&displaylang=en

So far I've tested it with all 3 webcams I have to hand and it works reasonably with all of them. If it doesn't work for you, let me know and I'll look into fixing it... However, as with all free software it comes with no warrantee of any kind whatsoever. If it breaks, you get to keep both halves :)

Robin

SharpCap.zip

post-18322-133877429862_thumb.jpg

Link to comment
Share on other sites

  • Replies 79
  • Created
  • Last Reply

What a brilliant program! I've just been looking for capture software after failing to get proper frame rates with astrocapture for my quickcam 4000 pro Very simple layout easy to use. I take it the exposure settings are on a 1-10 scale rather than secs?

Link to comment
Share on other sites

Hi, I've tried your prog on my XP laptop and get two separate windows with camera in one and a blank one where the control panel should be. I also get an error :- Unhandled exception has occured in you application, and Object reference not set to an instance of an object. .Net framework is installed also. I can see the camera working but not the controls. Any ideas?

Ron

Link to comment
Share on other sites

What a brilliant program! I've just been looking for capture software after failing to get proper frame rates with astrocapture for my quickcam 4000 pro Very simple layout easy to use. I take it the exposure settings are on a 1-10 scale rather than secs?

Glad to like it!

I was going to put a tooltip on the slider for exposure to show the actual time of exposure, but never got round to it. According to the spec it's supposed to be 1s for a value of 0 and halving each time you add 1 (so exposure =5 is 1/32s for instance). However some cameras don't actually work that way - in fact a lot of logitech cameras work in reverse! (Questions about accessing the exposure time through DirectShow — QuickCam Team).

Robin

Link to comment
Share on other sites

Hi, I've tried your prog on my XP laptop and get two separate windows with camera in one and a blank one where the control panel should be. I also get an error :- Unhandled exception has occured in you application, and Object reference not set to an instance of an object. .Net framework is installed also. I can see the camera working but not the controls. Any ideas?

Ron

Hi Ron,

sorry it's not quite working right - I'll make up a new version in the next day or two that will show a friendlier message when something like this goes wrong, and (in particular) will show some details that might help me track down exactly what the problem is and fix it.

cheers,

Robin

Link to comment
Share on other sites

One minor totally unimportant thing I've notice thus far in my two minutes of giving it a once over... Your help about menu item throws a not implemented exception.

:)

Yep, well spotted, that's another one on my TODO list! Once I've tidied up the code a bit more I'll make that available too for anyone who wants to customize it or just have a play. At the moment it's still a bit of a mess - I started with the Amcap sample from the Windows SDK and converted it from C/C++ to C#, which left me with quite a lot of spaghetti code to clean up.

Robin

Link to comment
Share on other sites

Glad to like it!

I was going to put a tooltip on the slider for exposure to show the actual time of exposure, but never got round to it. According to the spec it's supposed to be 1s for a value of 0 and halving each time you add 1 (so exposure =5 is 1/32s for instance). However some cameras don't actually work that way - in fact a lot of logitech cameras work in reverse! (Questions about accessing the exposure time through DirectShow — QuickCam Team).

Robin

Thanks for the link. I will have a play with it when I next get a chance at Mars and Saturn :)

Link to comment
Share on other sites

Here is an updated version, which won't be much different for those of you who have got the initial version working properly.

If you're having trouble with the program crashing, please give this version a try. It will still crash, but before it does it should show a dialog full of information about exactly what it was trying to do when it crashed. If you can post that information here, I have a fighting chance of fixing it for you :)

cheers,

Robin

SharpCap_1.0.1.zip

Link to comment
Share on other sites

Hi Robin

Had this when i started.

SharpCap, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null

System.NullReferenceException: Object reference not set to an instance of an object.

at SharpCap.StreamConfigPropertyControl.PopulateModeList(IAMStreamConfig streamConfig)

at SharpCap.StreamConfigPropertyControl.Initialize()

at SharpCap.PropertyControls.CaptureControl.AddPinControl(IDiscreteValuePropertyControl rpc)

at SharpCap.PropertyControls.CaptureControl.BuildPinControls(IAMStreamConfig videoConfig, IBaseFilter baseFilter)

at SharpCap.PropertyControls.CaptureControl..ctor(IPreviewControl previewControl, IBaseFilter iBaseFilter, IAMStreamConfig videoConfig)

at SharpCap.ControlForm.InitControls(IPreviewControl previewControl, IBaseFilter iBaseFilter, IAMStreamConfig videoConfig)

at SharpCap.SharpCap.OnStartPreview()

at SharpCap.SharpCap.m_cap_OnPreviewStart(Object sender, EventArgs e)

at SharpCap.Capture.StartPreview()

at SharpCap.Capture.ChooseDevices(IMoniker pmVideo, IMoniker pmAudio)

at SharpCap.Capture.ChooseDevices(String szVideo, String szAudio)

at SharpCap.Capture.Initialize()

at SharpCap.SharpCap.SharpCap_Shown(Object sender, EventArgs e)

at System.Windows.Forms.Form.OnShown(EventArgs e)

at System.Windows.Forms.Form.CallShownEvent()

at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)

at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)

at System.Threading.ExecutionContext.runTryCode(Object userData)

at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)

at System.Windows.Forms.Control.InvokeMarshaledCallbacks()

Link to comment
Share on other sites

Hi Brett,

Ok, here's v1.0.2 - I dont think it will crash any more (at least not at the same place), but I'm also not sure if it will give much functionality on your camera (what sort of camera is it, btw?).

If you unpack both the .exe and the .pdb file into the same folder, any crash information should be more complete (i.e. it will contain line numbers in the code to tell me exactly where to look for the problem)

cheers,

Robin

SharpCap_1.0.2.zip

Link to comment
Share on other sites

Hi Robin, just a quick question about the GUI... I will be looking to run this on a netbook, so 1024 x 600 resolution, will the app fit? It appears that the main window is resizable, but I'm not sure if the video control panel is perhaps going to be too tall for the limited resolution. Of course when you release the source code for this I can fix it up myself...

Link to comment
Share on other sites

Hi Sam,

the video control panel is resizable, although it has a minimum width. If it is too short for everything to fit, you get a scroll bar down the right hand side.

Robin

Link to comment
Share on other sites

Here is version 1.0.4, another attempt to track down why the software is working nicely for some and failing for others.

The software now keeps track of just about everything important that it does relating to starting/stopping/configuring preview or capture. There's a log window you can show from the help menu that shows this info. Most people will find nothing of interest in this window :headbang:

If you've had problems with previous versions, please give this one a try and PM me the full error window text if it crashes or the full log window text if it doesn't crash, but is still not working properly. Hopefully this info will allow me to find (or at least home in on) the problem area.

thanks,

Robin

SharpCap_1.0.4.zip

Link to comment
Share on other sites

Right!

thanks to a very detailed bug report from Mike, I think I have finally solved the bug that was causing crashing for some people on startup. :headbang:

Hopefully, you'll also get control over the camera properties in the right hand panel now (failing to set those up properly was causing the crash).

Here's v1.0.5, give it a go and let me know if it works or it still breaks :p

cheers,

Robin

SharpCap_1.0.5.zip

Link to comment
Share on other sites

DemonPerformer helpfully pointed out that SharpCap didn't work with his Mintron camera. This turned out to be because I hadn't got around to porting the code that should support analogue capture devices. I've now done this, although since I don't have a suitable device to test it on, the chances of it working are, erm, slight. Along the way, I fixed a bug for capture on a DV camcorder I had hiding in a cupboard and got the code into a state where I'm happy to release it in case anyone else wants to tinker.

Enjoy,

Robin

SharpCap_1.0.6.zip

SharpCap_Source_1.0.6.zip

Link to comment
Share on other sites

Not working for me too :/

SharpCap, Version=1.0.6.0, Culture=neutral, PublicKeyToken=null

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at DirectShowLib.IAMVideoControl.GetFrameRateList(IPin pPin, Int32 iIndex, Size Dimensions, Int32& ListSize, IntPtr& FrameRates)

at SharpCap.FrameRatePropertyControl.PopulateValueList() in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\FrameRatePropertyControl.cs:line 68

at SharpCap.StreamConfigPropertyControl.Initialize() in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\StreamConfigPropertyControl.cs:line 73

at SharpCap.PropertyControls.CaptureControl.AddPinControl(IDiscreteValuePropertyControl rpc) in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\CaptureControl.cs:line 147

at SharpCap.PropertyControls.CaptureControl.BuildPinControls(ISampleCaptureGraphBuilder builder, IAMStreamConfig videoConfig, IBaseFilter baseFilter) in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\CaptureControl.cs:line 139

at SharpCap.PropertyControls.CaptureControl..ctor(ISampleCaptureGraphBuilder graphBuilder, IPreviewControl previewControl, IBaseFilter iBaseFilter, IAMStreamConfig videoConfig) in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\CaptureControl.cs:line 76

at SharpCap.ControlForm.InitControls(ISampleCaptureGraphBuilder graphBuilder, IPreviewControl previewControl, IBaseFilter iBaseFilter, IAMStreamConfig videoConfig) in D:\Documents\Source Code\SharpCap\SharpCap\UI\ControlForm.cs:line 63

at SharpCap.SharpCap.OnStartPreview() in D:\Documents\Source Code\SharpCap\SharpCap\UI\SharpCap.cs:line 270

at SharpCap.SharpCap.m_cap_OnPreviewStart(Object sender, EventArgs e) in D:\Documents\Source Code\SharpCap\SharpCap\UI\SharpCap.cs:line 315

at SharpCap.Capture.StartPreview() in D:\Documents\Source Code\SharpCap\SharpCap\Capture.cs:line 1252

at SharpCap.Capture.ChooseDevices(IMoniker pmVideo, IMoniker pmAudio) in D:\Documents\Source Code\SharpCap\SharpCap\Capture.cs:line 2211

at SharpCap.Capture.ChooseDevices(String szVideo, String szAudio) in D:\Documents\Source Code\SharpCap\SharpCap\Capture.cs:line 2315

at SharpCap.Capture.Initialize() in D:\Documents\Source Code\SharpCap\SharpCap\Capture.cs:line 2952

at SharpCap.SharpCap.SharpCap_Shown(Object sender, EventArgs e) in D:\Documents\Source Code\SharpCap\SharpCap\UI\SharpCap.cs:line 108

at System.Windows.Forms.Form.OnShown(EventArgs e)

at System.Windows.Forms.Form.CallShownEvent()

at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)

at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)

at System.Threading.ExecutionContext.runTryCode(Object userData)

at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)

at System.Windows.Forms.Control.InvokeMarshaledCallbacks()

===============================================================

Application Log (from start)

20:40:42.3593750 GetDeviceMenuItems :: Started

20:40:42.4687500 GetDeviceMenuItems :: Getting list of available decives

20:40:42.6406250 GetDeviceMenuItems :: Device enumerator created OK

20:40:42.6875000 GetDeviceMenuItems :: Video class enumerator created OK

20:40:42.7500000 GetDeviceMenuItems :: Investigating device : @device:pnp:\\?\usb#vid_04f2&pid_a133&mi_00#6&1d973872&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global

20:40:42.7500000 GetDeviceMenuItems :: Adding device : USB Video Device to menu

20:40:42.7500000 GetDeviceMenuItems :: Completed video enumeration - found 1 devices.

20:40:42.7500000 GetDeviceMenuItems :: Ended

20:40:42.7656250 Initialize :: Started

20:40:42.7656250 ChooseDevices :: Started

20:40:42.7656250 ChooseDevices :: Choosing default (first) video device

20:40:42.7656250 ChooseDevices :: Started

20:40:42.7656250 ChooseDevices :: Preview stopped, graph torn down

20:40:42.7656250 FreeCapFilters :: Started

20:40:42.7656250 FreeCapFilters :: Ended

20:40:42.8125000 InitCapFilters :: Started

20:40:42.8125000 MakeBuilder :: Started

20:40:42.8437500 MakeBuilder :: CaptureGraphBuilder created OK

20:40:42.8437500 MakeBuilder :: Ended

20:40:42.8593750 InitCapFilters :: InitCapFilters - we have a valid pmVideo

20:40:42.8593750 InitCapFilters :: pmVideeo is a USB Video Device

20:40:43.0156250 InitCapFilters :: Created a video capture filter OK

20:40:43.0156250 MakeGraph :: Started

20:40:43.0468750 MakeGraph :: FilterGraph created OK

20:40:43.0468750 MakeGraph :: Ended

20:40:43.0781250 InitCapFilters :: Looking for video compression interface

20:40:43.0781250 InitCapFilters :: gcap.pVC (VideoCompression) is null

20:40:43.0781250 InitCapFilters :: trying to get default capture format

20:40:43.1093750 ResizeWindow :: Resizing Window to 640x480

20:40:43.1562500 InitCapFilters :: Success!

20:40:43.1718750 InitCapFilters :: Enumerating video pins

20:40:43.1718750 InitCapFilters :: doing audo capture initialization

20:40:43.1718750 InitCapFilters :: InitCapFilters - complete, success

20:40:43.1718750 InitCapFilters :: Ended

20:40:43.1718750 ChooseDevices :: Capture filters freed and re-initialized

20:40:43.1718750 BuildPreviewGraph :: Started

20:40:43.1718750 BuildPreviewGraph :: render AVI preview

20:40:43.3281250 BuildPreviewGraph :: Interleaved preview failed, trying video only

20:40:43.9531250 BuildPreviewGraph :: Got video only AVI preview (faked via the capture filter

20:40:43.9531250 BuildPreviewGraph :: Trying to setup size/location of video window

20:40:43.9531250 BuildPreviewGraph :: setting up notificatin for preview events

20:40:43.9531250 BuildPreviewGraph :: Ended

20:40:43.9531250 StartPreview :: Started

20:40:43.9531250 StartPreview :: Starting preview

20:40:44.1093750 InitControls :: Started

20:40:44.7187500 System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at DirectShowLib.IAMVideoControl.GetFrameRateList(IPin pPin, Int32 iIndex, Size Dimensions, Int32& ListSize, IntPtr& FrameRates)

at SharpCap.FrameRatePropertyControl.PopulateValueList() in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\FrameRatePropertyControl.cs:line 68

at SharpCap.StreamConfigPropertyControl.Initialize() in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\StreamConfigPropertyControl.cs:line 73

at SharpCap.PropertyControls.CaptureControl.AddPinControl(IDiscreteValuePropertyControl rpc) in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\CaptureControl.cs:line 147

at SharpCap.PropertyControls.CaptureControl.BuildPinControls(ISampleCaptureGraphBuilder builder, IAMStreamConfig videoConfig, IBaseFilter baseFilter) in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\CaptureControl.cs:line 139

at SharpCap.PropertyControls.CaptureControl..ctor(ISampleCaptureGraphBuilder graphBuilder, IPreviewControl previewControl, IBaseFilter iBaseFilter, IAMStreamConfig videoConfig) in D:\Documents\Source Code\SharpCap\SharpCap\PropertyControls\CaptureControl.cs:line 76

at SharpCap.ControlForm.InitControls(ISampleCaptureGraphBuilder graphBuilder, IPreviewControl previewControl, IBaseFilter iBaseFilter, IAMStreamConfig videoConfig) in D:\Documents\Source Code\SharpCap\SharpCap\UI\ControlForm.cs:line 63

at SharpCap.SharpCap.OnStartPreview() in D:\Documents\Source Code\SharpCap\SharpCap\UI\SharpCap.cs:line 270

at SharpCap.SharpCap.m_cap_OnPreviewStart(Object sender, EventArgs e) in D:\Documents\Source Code\SharpCap\SharpCap\UI\SharpCap.cs:line 315

at SharpCap.Capture.StartPreview() in D:\Documents\Source Code\SharpCap\SharpCap\Capture.cs:line 1252

at SharpCap.Capture.ChooseDevices(IMoniker pmVideo, IMoniker pmAudio) in D:\Documents\Source Code\SharpCap\SharpCap\Capture.cs:line 2211

at SharpCap.Capture.ChooseDevices(String szVideo, String szAudio) in D:\Documents\Source Code\SharpCap\SharpCap\Capture.cs:line 2315

at SharpCap.Capture.Initialize() in D:\Documents\Source Code\SharpCap\SharpCap\Capture.cs:line 2952

at SharpCap.SharpCap.SharpCap_Shown(Object sender, EventArgs e) in D:\Documents\Source Code\SharpCap\SharpCap\UI\SharpCap.cs:line 108

at System.Windows.Forms.Form.OnShown(EventArgs e)

at System.Windows.Forms.Form.CallShownEvent()

at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)

at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)

at System.Threading.ExecutionContext.runTryCode(Object userData)

at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)

at System.Windows.Forms.Control.InvokeMarshaledCallbacks()

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.