How to get image from preview panel, DirectShow.Net - directshow

i am writing an app that preview then capture video from a Video Device (ex:Cam), i didn't found a solution to take a snapshot during capturing with a ASF format.
so i thought i could take a picture from the preview panel but the background-image didn't contain it, and the image property of is null if i use a Picturebox .
do anyone knew how Directshow use the panel or Picturebox to preview video?

Typical solution for capture with preview is to add a tee (smart tee) and then do writing and presentation on the outputs of that tee respectively. PlayCap DirectShow.NET sample shows how to visualize video feed. Video renderer provides methods to read back last presented video frame, so that you could make a snapshot out of it.
Separate parts of this task have been discussed many times, including here:
Preview a camera in DirectShow and capture a still image - in VB.net
VB.Net Directshow Webcam Snapshot
Capturing pictures from webcam at high resolution while previewing at a lower one using DirectShow.Net
DirectShow - Capture Webcam While Viewing It?

Related

Directshow video render to two windows

I am using a directshow player which renders onto a panel using C++ Builder. I wish to duplicate what is playing onto a second monitor. Does directshow support any sort of events to say when a frame has been rendered by the renderer?
I am using the standard Microsoft player example which chooses the first available renderer which will work for the AVI file EVR, VRM9 this plays and renders fine. I would like to copy the rendered images as they update (50fps or 60fps max) and put them on a second screen which doesn't have all my other associated buttons and panels.
You need to configure EVR or VMR9 to use windowless render mode and implement a Custom Presenter for EVR which will be responsible for rendering of each received frame (texture). You'll then be able to render this texture on separate windows.
Here is a link to implementing a Custom Presenter for VMR9 as well, but IMO EVR is better to be used especially in Win 7 and higher.

TWAIN video capturing

I tried to implement a video capture program in c# with TWAIN and a Leica DFC295 camera.
The problem I have is the Twain lib on internet only allows me to capture an image from the camera and is not able to capture the video directly from the camera.
Unfortunately I tried other technologies like Microsoft Directshow and the camera doesn't support those tools so it ends up not even able to select from the data source.
Is there any possible way to implement the video capture feature with TWAIN?
Thanks!
The answer is no. TWAIN can only capture images or a series of images but not video.

How to resize Video capture in DirectShow?

I've look around in the documentation but can't find a good way to do this.
I capture video from my webcam and connect it to a ISampleGrabber filter to take screenshots. Which works fine but I would like to be able to scale the resolution on the video.
Thanks for any guidance!
Resizing in software is a relatively expensive operation, for which you also don't have an out of the box working component in DirectShow. You are typically more interested in setting proper capture resolution in first place, so that you don't need to resize.
Can't change video capture resolution using c#
Video Capture output always in 320x240 despite changing resolution
To resize video on runtime, you need either third party filter, or a custom filter, or instead copy a video from DriectShow pipeline and resize it there e.g. using StretchBlt API.
You can do the re-sizing job by manipulating the bitmaps you captured from directshow and then push them to new video file. However I generally do not recommend that .
FFmpeg already have this function integrated.
ffmpeg -i input.avi -s [width]x[height] output.avi

Can we have different resolutions for Preview and Capture of the same DirectShow graph?

I have 2 streams, one for Preview and one for capture in my DirectShow application. Right now, we observe that the Preview is slow for 1080P video and 1280*720 video. I would like to know if we have any method to have different resolutions for the capture and preview streams. If we have any, I can use the high resolution at capture side alone and at Preview, I am OK to display low resolutions.
Thanks
You can connect the capture output to a Infinite Tee filter. Use one output of the tee filter to capture, connect the second output to a resize filter, and use that to preview.
On some hardware you can use preview output directly in a different resolution. But not all hardware supports that. for example some hardware does not scale the preview, so if you use a lower resolution, you only see the top left part of the video. And other hardware does not have a preview pin at all...

Apply a Filter to a Camera video stream publishing to Media Server

I am Trying to Apply some information Like text and An Image as an overlay to create a overlay effect as lice a security camera with time and date on the video along with a png based Logo.
I can record VIDEO Using Flex and FMS or any other Media Server. But I want to save a modified version of the stream being uploaded.
Use camTwist (mac) or webcammax (pc) as your video input...you can use that program to use the webcam and then add whatever over it (text, date). Use Flash Media Live Encoder and select camTwist as your video source. Stream and save your recordings using that FMLE.
Sorenson Squeeze is pretty awesome for this and is cross platform. Camtwist is cool but it's not really a 'pro' app, that makes me sound way snobbish. It's actually pretty fun and a good suggestion for a simple result but I haven't found anything better than Sorenson Squeeze for the features and control it gives you.

Resources