How to create a virtual display? - c#

The question is simple, but I guess the answer might not be.
I want to create a display device, on which the GPU would render a desktop or a video game. However, this device would not be connected to any physical screen on the video card port. The data rendered would be retrieved and streamed somewhere else over network.
A bit similar to what OnLive did, but I would like to stream that video output over LAN. Obviously it must be a full and real display so that existing applications or video games could work properly on it.
Is it even possible in C#?

surely you could link it up as an output stream with your processed frames, piped to a network socket or such?

Related

c#/.NET - Recording the current audio being played

Is there any way in c#/.net of recording the current audio being played? I've searched a lot on the internet but the only result I could find is recording using a microphone.
I dont want to record using microphone input, I want to record what is being played on the computer when I click a record button.
Thanks
You have two options here:
Hardware loopback device - virtual "Stereo Mix" audio device, which acts as a regular audio capture device and in the same time produces a copy of mixed audio feed played through default audio output device of the system. Since such device shows up as real audio input device, you can use standard APIs, libraries and even exitsing applications to record from such device.
Programmatic access to a virtual loopback device as if it was microphone-like device. API on the background will duplicate played audio content and make it available for reading back as it plays. The good news is that you can access the mixed audio feed for device of your interest.
Both options are described in detail in Loopback Recording article on MSDN and available via standard audio APIs, specifically WASAPI.
For C# development you are likely to use a wrapper like NAudio.
For option 1 you will find quite a few questions on StackOverflow, and for the other option the keyword is AUDCLNT_STREAMFLAGS_LOOPBACK.
The only way to be able to receive data from another application is if the developer provides an access point, normally through some SDK, API, or other means. Without this, there is no way for your application code to receive the bytes from the other application.
The reason a microphone works is because it is receiving the sound output bytes from the application and sending those soundwave bytes back into your PC to render and output the sound. Since you have access to these bytes from the microphone you are able to capture the sound.
See if there is an API or an SDK from the developer of the application you are trying to get sound from.

Delivering video stream from IP cameras

I have several IP cameras. I want to get their streaming video but using an additional server to centralize the cameras. This server should get the video stream from 2-5 cameras and then, deliver it again through a different url. thereby many streaming users wouldn't overload the IP cameras which can not hold a high number of viewers.
It the first time I'm facing video streaming that's why I'm a bit lost and I don't know where should I begin from. I've any restrictions about which protocol use, rtsp, http... I'm quite free about that.
I've found this project which looks like pretty similiar to my problem. Anyway, before going deeper in it, I would like to have the opinion of someone who has develop anything similar before. Any tip would be apreciated.

Record video from camcorder in C#

I need to be able to record video from an external camera in a C# application.
Unfortunately a webcam is pretty much out of the question as the application will record outside and during the evening/night. That is why I was thinking of a camcorder since it also has manual control over exposure and focus, lower noise and better sensor.
So far I would use the AV/S-Video output from the camcorder and send the signal to a USB capture card (the computer is a laptop so no PCI-E cards).
How would I be able to access the video stream from the C# application, now that it comes from the capture card ?
Does my proposed system seem feasible (achievable, good video quality, good fps)? Does anybody have another working solution?
Thanks
This Code Project Article could be of a good starting point.
The Author mentions :
The main goal of the application was to make it flexible and
extensible. The application itself can communicate with any video
source – it may be an IP video camera or a server, it may be a local
camera attached to USB, it may be an MMS stream from a remote server,
or it may be any other video source. And more of it, the application
can work with all these video sources simultaneously, displaying them
all on a single screen.
The solution I used in the end was Microsoft Expression Encoder.

Best image compression for C#

I'm currently working on some software which captures your monitor image and sends it over to clients over the internet.
So far I have it working in my local area network but when I go to test it over the internet, hardly any of the images get through to the client.
I am using Lidgren for my networking. At the moment, I get a Bitmap from the screen, convert it to a JPEG with 30 quality, G-zip it and send it on its way. Each image is about 80KB in size, and I try to send 10 images a second to the client. Now that's like a 7mbit upload connection required, mines is only 2mbit.
So basically, is anyone aware of any compression libraries or techniques which will dramatically decrease the file size of each image. This might be completely impossible but I thought that I would give it a go.
Any help is much appreciated, Thanks!
Do you really need to send the whole frame each time? Could you not just send what has changed between the current and the previous frame and then apply these changes to the client frame to bring it up to date? This should be pretty quick assuming the server isn't watching a video or some-such. This answer suggests this is what both RDP (Microsoft) and VNC use for remote desktop viewing.
See https://stackoverflow.com/a/4098515/171703 and https://stackoverflow.com/a/1876848/171703 for some ideas on how to do this.

stream video on computer through web camera

I think that this is a rather complex question, though I am not very familiar with the video world.
I have a video on my computer, I'd like to stream it through my webcamera, so that user's speaking to me on skype will see this video. I'd like to do this in c#.
Is this possible? Can I connect to the web camera port in a custom manner? If so how?
Thank you
If you want to stream a video from your computer to another, your webcam should not be involved unless you move it from the top of the monitor and you put it against the screen, then you start the webcam and your friend will see what you are watching.
What you seem to ask is more like: "How can I stream a video to another computer?" meaning that you would like to send some stream of data as if it was coming from your webcam, still I do not think you should hoock into the webcam at all because for what you would like to do it's not even required you have a webcam.

Categories

Resources