In our project, we would like to access the webcam image programmatically.
The main problem we have is that the webcam automatically adjusts the sensitivity depending on the brightness of the captured image.
Is there any (platform-independent) way to change this kind of parameters for the webcam (preferably any model)?
We're currently using Ubuntu 10.04, Microsoft Windows XP & 7. Programming language is C/C++.
Any idea is appreciated.
Thanks and regards
Tobias
There most likely won't be any platform independent way to do what you need. If there is, it's probably by using some high level language, which likely won't suit.
I don't know about the linux platform, but I'm a C++/windows/COM/DirectShow developer who works on internet based video applications.
On the Windows platform, capture devices are communicated with via COM and DirectShow.
For a general overview of video capture on windows, see the Video Capture section of MSDN.
Have a look at Selecting a Capture Device for information on how to enumerate the capture devices on your system. You'll need to enumerate the devices in the CLSID_VideoInputDeviceCategory, in order to discover (programmatically) the webcam as a video input device - there may be many devices in this category.
Video capture devices have a "FriendlyName" to help identify your webcam that you can store and retrieve the device for later use.
Once you've got the device, your query said you'd wanted to configure the device. Check out the Configuring a Video Capture Device for this.
DirectShow is one of Microsoft's most comprehensive (and difficult) APIs to learn. The MSDN developer forum on DirectShow is very active and beginner friendly and I highly recommend you check it out.
Finally, capture graphs aren't the easiest thing to build in DirectShow, I'd start off with a simple playback graph - e.g. playback a media file from disk and progress from there to capture graphs.
The VLC project is open source and cross-platform and it uses DirectShow for playback on the windows platform.
Good luck!
Related
I need to do some basic video processing from the Webcam in Windows Phone 8.1.
I cannot find any examples of how to access the webcam preview buffer. The Microsoft examples (very few) all have a video preview frame activate, I can find none that show how to subscribe to a 'new frame ready' event, or where the buffer is.
The MediaCapture, and CaptureDevice appear to be the main ways of reaching the camera in this api.
Can anyone point to a specific example? For instance, a QR code reader, or maybe a program that adds video effects, like greyscale, would need to attach an event to every frame.
Thanks.
It sounds like you need to access the buffer from the preview stream of the phone cameras. If you absolutely need to target 8 and 8.1, then you should look into GetPreviewBufferArgb(out int[] pixels). See here: https://msdn.microsoft.com/en-us/library/windows.phone.media.capture.cameracaptureframe.getpreviewbufferargb.aspx
But if you can instead target Windows 10, you get the benefit of fully universal APIs, and you don't take a dependency on the likely soon to be deprecated (if not already) Windows.Phone.Media.Capture namespace. I would strongly recommend doing this instead, as the APIs will be easier to work with, and any 8.1 device can upgrade to 10 for free.
Here is a fully working Windows 10 sample: http://aka.ms/2015buildgetpreviewframesample, which was shown off at the last Build conference (video here: http://channel9.msdn.com/Events/Build/2015/2-730).
I need to add webcam video capture to a legacy MFC C++ application. The video needs to be saved as MP4. Did a bit of googling but didn't come across anything that looked promising. Any suggestions on the best approach?
EDIT:
Windows platform.
EDIT:
Must be compatible with XP
There are a few popular options to choose from:
DirectShow API - it does not have stock MPEG-4 compressors for video and audio, neither it has a stock multiplexor for .MP4 format, though there is an excellent free multiplexor from GDCL: http://www.gdcl.co.uk/mpeg4/. Also there is decent documentation, a lot of samples
Media Foundation API - it has everything you need (codecs, multiplexor) but only in Windows 7 (maybe even not all edtions)
FFmpeg and libavcodec/libavformat are definitely relevant, however H.264 encoder is only available under GPL license, not sure about video capture part right there, and you might have hard time looking for documentation and samples.
I'd say look at OpenCV as a library, hook into their video capture for that aspect, it can write out to mp4 but you'll need a couple of other libs for handling the output stream (on Linux I'd say ffmpeg and x264), that should get the buffer into the container with a reasonable amount of hassle.
I want to capture all audio that is played to the user (all sounds together). Currently I'm working on Windows but it would be nice if the code was cross-platform (but not necessarily). Is it possible to do it with OpenAL? How? Code examples would be great.
Language: C++
The only way to do this I believe is to create a replacement audio device driver that receives all audio requests, and then forwards them to the original device driver. There are a number of existing applications that work in this way including Freecorder, MP3myMP3 Recorder, SoundTap and Wondershare to name but a few (Google "Streaming Audio Recorder").
As for cross-platform, I would say not a chance since it is OS driver model dependent.
Depending on what you have in your system, some (not all) sound cards offer a "Stereo Mix" feature, which can be used like any other recording device. This is basically exactly what you want, as it is literally a mix of all stereo sounds being played.
I have a Windows native desktop app (C++/Delphi), and I'm successfully using Directshow to display live video in it from a 'local' video capture device.
The next thing I want to do is display video from a 'remote' capture device, streamed over the LAN.
To stream the video, I guess I can use something like Expression Encoder or VLC, but I'm not sure what's the easiest way to receive/decode the streamed video. Inserting an ActiveX VLC or Flash player might be one option (although the licensing may be an issue then), but I was wondering if there's any way to achieve this with Directshow...
Application needs to run on XP, and the video decoding should ideally be royalty free.
Suggestions, please!
Using Directshow for receiving and displaying your video can work, but the simplicity, "openness" and performances will depend on the video format and streaming method you'll be using.
A lot of open/free source filters exist for RTSP (e.g. based on live555), but you may also find that creating your own source filter is a better fit.
The best solution won't be the same for H264 diffusion through RTP/RTSP and for MJPEG diffusion through simple UDP.
I want to capture all audio that is played to the user (all sounds together). Currently I'm working on Windows but it would be nice if the code was cross-platform (but not necessarily). Is it possible to do it with OpenAL? How? Code examples would be great.
Language: C++
The only way to do this I believe is to create a replacement audio device driver that receives all audio requests, and then forwards them to the original device driver. There are a number of existing applications that work in this way including Freecorder, MP3myMP3 Recorder, SoundTap and Wondershare to name but a few (Google "Streaming Audio Recorder").
As for cross-platform, I would say not a chance since it is OS driver model dependent.
Depending on what you have in your system, some (not all) sound cards offer a "Stereo Mix" feature, which can be used like any other recording device. This is basically exactly what you want, as it is literally a mix of all stereo sounds being played.