Get a stream of video from gstreamer to a directshow pipeline? - c++

I would like to render a video stream from a gstreamer pipeline into a directshow one. I was wondering if I had to write a directshow filter source getting data from the pipeline or if it was simpler? If I have to, I don't really see where I could get an idea of what to do.

Related

How to to add additional metadata to individual frames, DDB's, when creating an AVI file with ffmpeg

I'm creating avi videos from device dependent bitmaps, DDB's.
The pipeline is quite simple, a GigE camera provides frame by frame, and each frame, a DDB, is piped to a ffmpeg process creating a final AVI file, using h264 compression.
These videos are scientific in nature, and we would like to store/embed experimental hardware information, such as the states of a few digital lines, with each frame.
This information need to be available in the final avi video
Question is, is this possible?
Looking at this: https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmap it does not seem that adding additional data to the DDB themselves is possible, but I'm not sure.

how to get raw mjpg stream from webcam

I have logitech webcam, which streams 1080p#30fps using MJPG compression via USB2.0. I need to write this raw stream to hard drive or send via network. I do NOT need to decompress it. OpenCV gives me decompressed frames, so i need to compress them back. This leads to heavy CPU utilization waste. How to get raw MJPEG stream instead as it comes from camera? (Windows 7, Visual Studio, C++)
Windows native video capture related APIs DirectShow and Media Foundation let you capture video from a webcam in original format. It is a natural task for these APIs and is done in a straightforward way (specifically, if a web camera gets hardware compressed M-JPEG feed, you can have that programmatically).
About Video Capture in DirectShow
Audio/Video Capture in Media Foundation
You are free to do whatever you want with the data afterwards: decompress, send over network, compose a Motion JPEG over HTTP response feed etc.

Write to Directshow source filter

I have got a directshow source filter which is based on http://tmhare.mvps.org/downloads/vcam.zip. I want to write the webcam frames that has been manipulated using opencv by my (separate) application, to this virtual webcam (Directshow filter). How can I do this?
Any helpful code snippets please?
A good practice for manipulating frames in Directshow is adding a SampleGrabber filter after your source filter. see
The SampleGrabber purpose is to manipulate frames.

Use DirectShow to capture to an AVI from a non DirectShow source

This may be a dumb question but I'm having a hard time conceptualizing what I need to do here...In the past I've used DirectShow to connect to a camera and capture an AVI using a source filter, AVI mux, compression filter, run the graph, etc...piece of cake.
In this particular case I am getting notified when my non DirectShow camera driver has a buffer ready. I get notification and then I go and grab the BYTE* and render it using GDI. I now also need to create an AVI with these buffers.
Conceptually it makes sense for me to use something like vfw and write to an AVI stream every time I receive a buffer, of course vfw is old technology and I was also having some problems getting that to work (as I posted in a different forum).
How can I push these buffers into a DirectShow AVI Mux and write to a file? Do I have to create my own source filter to receive these buffers, then add my source filter and avi mux to a filter graph?
Thanks for any tips
So you have BYTE* with video frame data. It is very close to what you supposed. Your choices are to either use VFW AVIFileOpen and friends to write into AVI file, or inject data into DirectShow pipeline. To do the latter, you typically make your PushSource-like filter and push video frames from there (through AVI Mux to File Writer).

How to capture video out of stream in c/c++ in windows?

What's the most recommended way to go?
This is a pretty big topic. Try looking at OpenCV. It is nice for image and video manipulation, and you can stream video from files and webcams.
Take a look at DirectX "Filter Graphs". You can use a simple tool from the DirectX SDK called 'Graph Edit' to construct a sequence of DirectShow Filters which can do things like capture video streams from a TV card or decode an MPEG/AVI file and then operate on the data stream and ultimately render it to video/audio or a file.
Most of the DirectShow samples are in VC++.