capture video from screen for stream - windows

i am looking for differnt solutions to capture video stream from monitor screen and send it to vidoestreaming server to broadcast in web. it must occuring in "live".
i'd not like to use external services like "procaster" for broad.
OS: Windows.
it will be great to know the ideas and expirience people have to accomplish that.
Thanks all.

Recently, I build a GoLang project called ScreenStreamer, is a tool to stream current active window or full screen (Linux's or Windows's) to other device, like phone or another PC, as MJPEG over http or FLV over rtmp, it's very realtime (delay < 100ms). It works on Windows and Linux.
After building it, you can run it as:
# enter the project root directory
cd ./src/ScreenStreamer
# run it
./mjpeg or .\mjpeg.exe
# use a web browser or other video player, open http://host:port/mjpeg
./rtmp or .\rtmp.exe
# use a video player, open rtmp://host:port/live/screen
Screenshot:

Windows SDK includes Push Source Filters Sample, which in turn contains CPushSourceDesktop filter/class.
CPushSourceDesktop: Copy of current desktop image (GDI only)
It captures desktop image and pushes it into DirectShow pipeline. From there on you can process it using video compression codec and stream it to remote location. A decent screen image compression codec is included with Windows Media subsystem, network streaming will have to be a custom or third party component. Alternatively, it is possible to make the capture class a virtual camera and have Windows Media Encoder broadcast it (or, it already has a simila feature built in).
Alternatively, you can check VNC (or one of the clones) source code and see how it hooks windows and captures image updates, then compresses them and makes it available for remote applications.
Note that you will have to specifically capture non-GDI images (such as coming from video/gaming applications, which use hardware acceleration and non-RGB surffaces).

Related

Outputting Audio to the Built-In output device (Not the Default One)

I need to do some system-wide audio processing in my app.
I have installed Soundflower and selected it as my default output device in order to get the system audio. I know that Soundflower merely copies the mix buffer to a ThruBuffer and passes it to the apps so they can get it in their AudioDeviceIOProc callback.
What I don't understand is how to route the audio back to the Built-In output device after I've done the audio processing. I have the Soundflower device as the default, and it produces silence as I try to route the audio to the default output unit. Maybe what I need is to create a Multi-Output device in my program but I'm not sure how to do that.
You can create a multi-output device on osx - they're called "aggregate devices". You can do it manually in Audio MIDI Setup app and use that device in your app, or do it programmatically in your app.
If you do do it in app, example code seems to be rare. I cribbed the info I needed from this blog post.
NB the post is very old, I had to go to the Internet Archive Wayback Machine to find it.

MJPEG stream via URL to webcam device on Mac

I have a video device that exposes an MJPEG stream via a URL. For windows there are utility apps that can "create" a system webcam device useable by Skype or any other application based on the URL this video device exposes.
Example: smart phone is broadcasting MJPEG URL. Windows computer can run a utility app to "create" a system webcam based off of the MJPEG stream and then that webcam be used via Skype. The video shown is what the phone is broadcasting.
I'm trying to do the same but for my Mac. I can't seem to find any utility that creates a system webcam from an MJPEG stream. Googling isn't helping either, I'm just not finding a solid solution or anything I recognize as a solution.
Thanks!
I've had success with obs-studio and its vlc and virtual camera plugins.
You can add a "Vlc Video Source" and then click "Start Virtual Camera".
If you want to use it as a web-cam I just recommend that you reduce the "Network Caching (ms)" setting in the vlc video source settings as much as possible.
The hard-coded minimal value is 100ms, you can reduce it by changing this line: https://github.com/obsproject/obs-studio/blob/7217671eb0812681a9f83858bb02065b671673e7/plugins/vlc-video/vlc-video-source.c#L1079
There is still significant delay with this method regardless, but it's better than not having it working at all.

Is it possible to grab a snapshot from a previously recorded video on Windows Phone 7?

I'd like to know if it's possible to grab snapshots from previously recorded videos. Those videos are recorded in the app itself.
By the way, I'd like to grab the snapshot from a video file saved in IsolatedStorage without having to play the video.
Is it possible? If so, how can I do it?
Cheers,
Rafael
I am not aware of an official platform feature to do this. However, if the video file is within your app's isolated storage, you might be able to:
Send the video to a server to do the processing
Add codecs/C# code to your app to process the raw MPEG4 frames.
Try using WriteableBitmap to capture a specific frame when using the media element. Since most media is handled in hardware, however, it is possible that the frame will be blank.
I solved the problem by creating the thumbnail while recording the video (captureSource.CaptureImageAsync()). To do that, I used the same instance of the CaptureSource I'm using to record the video.

Device driver to act as a virtual web camera

I'm looking for writing virtual camera drivers. Does anybody has idea?
Any book that would be helpful or any link.
Adding more details:
I have developed a device driver which saves the image to disk and the display uses the device driver to display the image. The performance does not seem good.
The fns. that I have used are:
//to capture
GetDesktopWindow()
CreateCompatibleBitmap()
Save()
//to display
WM_MOUSEMOVE
giving a call to capture and display every time
but the display is not continuous and appears only after window goes out of focus and comes in focus again
Should I use some other technique to record or display images, what will give fruitful results, please help.
Thanks,
-mitesh
What do you mean by virtual camera driver?
It is possible to write a virtual capture device using DirectShow. Such a virtual capture device can then be used by applications such as skype, etc. If that suffices for your needs, you can download vcam from http://tmhare.mvps.org/downloads.htm under the "Capture Source Filter" link.
Edit:
In order to use that capture device in the link I posted you need to download the Windows SDK. The Windows SDK has a tool called "GraphEdit" If you search online, I'm sure you can find a quick GraphEdit tutorial. Basically GraphEdit allows you to construct a multimedia pipeline by connecting a bunch of filters. (This is what happens in the background for instance when you play a movie on your computer. ) This could be something like
web cam -> renderer
or
file source -> some decoder -> renderer
and would result in you seeing the video captured by the web cam or the content of the file. The example download shows how you can construct a virtual capture device i.e. it looks like media is coming from a 'real' capture device, but actually you can generate any video you want if you adapt the code to your specific means i.e. take a screengrab and output that. Applications like skype can pick up you virtual capture device if it is registered correctly.
The easiest way to find out if this is sufficient for your needs is to download the capture source filter, register it with the regsvr32 command, and then to use GraphEdit to insert the capture source into a graph, connect the source to a video renderer and hit the play button. A lot of the above mentioned concepts/keywords might seem new to you, but you can do some reading on each topic, and perhaps this will give you a point to get started.
Edit 2:
Is the capture source filter approach not sufficient for your requirements?
1) AFAIR you stated in your (now deleted) answer that you would like to take a screen grab, and use that as a virtual camera device for use in applications such as skype.
If that is all you require, you do NOT have to write a device driver. DirectShow can do that perfectly well by means of the capture source filter. You would then need to
learn some basic DirectShow
modify the source code of the capture filter to take screen grabs etc.
As far as books are concerned to write device driver to accomplish the same, I have no idea. The point I'm trying to make, is that you need to determine whether you actually need to write a device driver or whether simply modifying the open source capture filter is sufficient.

QuickTime video codec configuration

So I'm porting an app from Windows to Mac, and part of the app deals with creating movie files. On Windows, there's a group of functions like ICOpen and ICConfigure, which signify to the video compression driver to open up a configuration box for the selected codec. Is there anything like that for QuickTime on Mac?
You will need to use straight Quicktime-C calls for this, but the function you want is called MovieExportDoUserDialog.
See the QTMovieExportSettings article on CocoaDev for the full details.

Resources