How to resize Video capture in DirectShow? - 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

Related

Is there any way to record a video of website using headless Chrome?

I know there is a way to make screenshots, using many available APIs, such as Puppeteer
https://github.com/GoogleChrome/puppeteer
but what about recording videos? my goal is to capture a CSS animation into an mp4 file.
Or am i doing it all wrong, are there better tools for that on the server side?
https://www.npmjs.com/package/puppeteer-recorder
Something like this can work, it takes lots of screenshots and stitches them together
For recording video with audio, try puppeteer-stream:
https://github.com/Flam3rboy/puppeteer-stream

How to get image from preview panel, DirectShow.Net

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?

Play video from an intermediate point

I am in the middle of an application that has a module to play videos from a directory on the same web-server. Everything is fine, except for the point that, while video is streaming, if I try to drag the player tip to an intermediate point, it either drags back to where it was(in flex player) or keeps loading un-till the video actually approaches that point(in case of jw-player or html5 player) or does nothing(in some other online players available). My client wants to be able to play or start buffering from any desirable point. I read something about RTMP to be used for such thing, but wasnt able to find a direct guide over how to do it.
Help appreciated!
If you're talking about being able to load a video file from x seconds in to the video, you should look into http pseudo-streaming. Here's a link to the jwplayer page about it: jwplayer pseudo-streaming

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