DirectShow graph not able to capture the frames from actual camera - directshow

I wrote an Directshow application for capturing the video frames from camera. My capture graph looks like the below mentioned graph :
SourceFilter ------> SampleGrabberFilter -----------> NULLRenderer
My application is capable to capture the frames from several virtual cameras ( i.e. OBS, DroidCam ). InCase of Nikon web cam utility - It always shows me the default Nikon web cam utility frame. If I connect the Nikon camera with my system, then also it was showing me default web cam screen. If I select Nikon web cam utility as a source in some other application like OBS then OBS can capture actual frames.At that moment If I open my application and select Nikon web cam utility as source , my appliaction can't capture frames(It is expected as camera was used by OBS). If I change the source in OBS (Select any other source) at that time my application can render the actual captured frames.
It looks like, my application automatically not able to capture the frames from the device. If the capture frame is started by any other application and switch to my application, then only it can capture video frames from device.
How can I solve this problem?

Related

Any way to distinguish between virtual and physical camera

Using Directshow.NET I have developed an application which grabs some pictures from camera and save it on disk. Everything is going fine but if in case some virtual camera is registered(installed) For eg. Cyberlink YouCam then directshow receiving following frame: (GraphStudio screenshot)
So, to avoid this I want to detect whether video device(s) found by FilterCategory.VideoInputDevice is virtual or physical webcam. Is there any way to distinguish between both?
Physical camera are implemented by WDM Video Capture Filter. Virtual cameras mimic those, some - better and some - worse.
Those virtual cameras implemented without a driver do not typically implement some interfaces of WDM Video Capture Filter. The one implemented via a driver can be filtered out (black listed) by their hardware path. The task is harder with the latter because WDM Video Capture Filter wraps such driver and implements a filter pretty much similar to physical device filter, but hardware path should reveal its virtual nature.
Use the following piece of code while iterating your filterInfo collection:
if(FilterInfo.MonikerString.StartsWith("#device:pnp:\\\\?\\root", StringComparison.OrdinalIgnoreCase))
{
// virtual camera found
}

Twain driver concurrent requests

It's possible to use one twain driver to manage concurrent request to two different multifunction printer?
I mean, if I have two MFPs , can I do two scan request in paralel using the same twain driver?
It depends on if your driver supports it.
From the TWAIN Spec page 125:
If an application attempts to connect to a Source that only supports a single connection when the source is already opened, the Source should respond with TWRC_FAILURE and TWCC_MAXCONNECTIONS.
Also from the spec on page 212:
The Source is responsible for managing this, not the Source Manager (the Source Manager does not know in advance how many connections the Source will support).
I tested this with a Fujitsu fi-7260 scanner and got the TWCC_MAXCONNECTIONS error with Twacker:
It could be possible. The reason being TWAIN just sits between the application and the images fed to it.
Imagine a scenario something on the below lines:
1) User clicked on the scan button.
2) You initiate the network layer calls to start the scan job.
3) Now instead to one printer you start scan jobs on two printers from two threads.
4) Let's say each of those threads populate the raw BMP data to a single data structure that is shared.
5) Once both threads are complete iterate over that shared data structure to pass the images to the application via the XFERIMAGE call.
Basic idea is to create an abstraction of two printers behind the scene.
Please let me know if my understanding of your question was not correct or you need other clarification.
If you implement it in the described way, it usually works only with two different MFP's as the majority of TWAIN drivers do not support two different USB devicves at the same time.

Finding a Programable Stand-Alone QR Scanner

Here's what I need to do:
Select a single parameter from a screen (preferable) OR enter a code for that single parameter.
Scan a QR code
Update my MySQL database with the data.
Return 'success' or 'failure' in some form (Preferably with bit of explanation)
--
What I can't find is a scanner that communicates directly with my remote server.
I'm considering a smartphone app, but nobody's thrilled to use their personal phone for work.
I've looked at many scanners, but they all connect to a smartphone or computer. I need a programmable standalone device to talk directly with my server.
I'm considering building the scanner out of an arduino or Rhaspberry Pi. It sounds simple enough (not that I have experience in such), but I have a hard time believing this product doesn't already exist.
I'm open to any advice/direction.

How to create a local virtual IP camera that can be accessed from other software

I need to create several local virtual IP Cameras for a project I'm making. I have tried several software, and the closest I have gotten was with magic camera, because it would let me create a virtual camera, but it wont let me assign a source to that camera. I need to assign an IP address and a username with a password, so that I access the IP camera's video and use that virtual camera in a program I'm developing. the thing is that the Camera's brand is not supported by Labview, so I need to use a virtual local camera to use these cameras (3S Vision IP Cameras).
Thanks in advance!
From the National Instruments Support Knowledgebase:
Connecting to an Arbitrary MJPEG IP Camera with IMAQdx Using Third Party Virtual Camera Emulator
http://digital.ni.com/public.nsf/allkb/9446A8C25CC99F7586257A56004D513D
Here are the options for using an IP cameras in LabVIEW as of 2019:
(in case someone like me still need this)
Use Vision Acquisition Software 14.5 (February 2015)
(with LabVIEW 2014 SP1 and Vision Development Module 2014-2017 SP1)
Pros:
Official, native support;
Any # of cameras.
Cons:
You lose all the features introduced in newer versions of LabVIEW;
Cameras must support and be configured to stream in MJPEG over HTTP.
Additional info:
It's the last version to support arbitrary IP cameras. Basler and Axis IP cameras were supported until VAS 19.0.
Cameras in the same subnet should be detected automatically. If cameras are in another network, you can try to add them manually as follows:
Go to the %Public%\Documents\National Instruments\NI-IMAQdx\Data\ folder;
Open or create a file IPCameras.ini in a text editor;
If creating, place an IPCameras section on a first line:
[IPCameras]
Add a line for each camera in a following format:
cameraSerialNumber = IPAddress, MJPEG stream URL, camera brand, camera description
Save your changes and restart NI MAX.
Use DirectShow device (webcam) emulator
NI-IMAQdx driver supports USB 2.0 cameras through the DirectShow interface. By using software which creates such interface for IP cameras, they can be used as regular USB 2.0 cameras.
There are multiple tools available:
IP Video Source
Pros:
Free;
Any # of cameras.
Cons:
Each camera must be added manually through emulator's settings;
Each camera's resolution must be set manually in emulator's settings;
Cameras must support and be configured to stream in MJPEG over HTTP(S);
32/64-bit versions work independently of each other. NI MAX is a 32-bit application, so it won't show cameras emulated by 64-bit tool. However, they are still detected and can be used in LabVIEW with IMAQdx VIs.
Additional info:
Camera's alias displayed in LabVIEW can be changed in a following way:
Go to the %Public%\Documents\National Instruments\NI-IMAQdx\Data\ folder;
Select one of camX.iid files and open it in a text editor;
Find an attribute InterfaceName and set its value to a desired name. See Vendor attribute's value for a name you set to that camera in emulator's settings;
Save your changes and rename this file to the same name;
Restart LabVIEW.
Moonware Universal Source Filter [more info]
Pros:
Supports JPEG/MJPEG/MPEG4/H264 over HTTP/RTSP;
Hardware decoding;
Low latency;
Multiple cameras.
Cons:
32-bit only. 64-bit version is not likely to happen;
Adds a watermark to an image (free version) / Paid: $49 per PC (no watermark);
Each camera must be added manually through emulator's settings.
and more
Use Multimedia for LabVIEW add-on
Pros:
Native interface (LabVIEW API for FFmpeg libraries);
Supports most codecs and protocols;
Any # of cameras;
Full control over data acquisition and processing (down to individual FFmpeg options).
Cons:
Paid: $949 per PC (developer license), $19 per PC (runtime license), 30 days trial;
Lower-level analog of NI-IMAQdx driver (see more complicated).
Use libVLC to receive images from a camera
(or another similar library)
Pros:
Free;
Supports most codecs and protocols;
Possibility of hardware decoding (depends on library usage);
Any # of cameras.
Cons:
You'll have to interface with libVLC library directly through the Call Library function node;
To receive video frame by frame you'll have to write a simple C library which will be called by libVLC to provide a frame (see example below in a linked thread).

Flex streaming data

I have a streaming server (for pushing data not video) setup with GraniteDS and it works great.
I have to include multiple swf files in a web page. Each of these swf files has a data table which includes streaming data(this is a specific requirement - so I really cant combine all data tables into 1 huge data table/swf file). All the swf files however, connect to the same gravity channel/streaming endpoint.
How many connections are there from the web page to the streaming server? Does each swf file start a new streaming connection? Or do all them share the same connection since they are just connecting to a single channel?
Regards,
Ravi.
Ah, very good question grasshoppa.
Essentially, each one of them has their own dedicated connection. So, if you have 6 swfs, each one would have a connection to the streaming server, so 6 connections. The problem with this is that if you're using RTMPT, your browser might block (or cycle) the extra connections since there's a limit (IE used to have a 2 connections per domain limit, FF is 10 I believe).
The question however is are they all getting streaming data at the same time? Is the data different from swf to swf? One possible solution for this would be to have one of the swf be the 'main' swf which connects to the service, gets all the data and sends it to the other swfs either with Javascript or using LocalConnection.
But, I don't know enough about your specs or why you have multiple swfs in the first place...

Resources