开发者

Efficient way to stream Webcam from client to a server C#

开发者 https://www.devze.com 2022-12-19 16:38 出处:网络
I\'ve set up a custom tcp connection between my client and the server. I\'m making a simple chat program. So far the users are able to talk to each other and send files.

I've set up a custom tcp connection between my client and the server. I'm making a simple chat program. So far the users are able to talk to each other and send files. I'm adding a webcam chat and I've used AForge.Net for grabbing the frames from my webcam. But sending these captured frames from the client to the server is taking too long and uses up too much bandwidth. the server is receiving about 1 frame 开发者_运维技巧every 2~4 seconds.

I've tried using a Jpeg encoder and setting the quality to 30 but that doesn't improve anything

Do you guys know a good way of encoding a webcam stream for sending to a server?

Cheers Roman


You need to send the webcam content as a video stream, not a series of images. I would recommend H264 as it's compact and is the most common video codec used on the web today. Encoding, streaming, receiving, and displaying the video is not simple though. There are plenty of open source projects that can help like X264 and VLC, but this is definitely a lot more complicated than grabbing jpgs and sending them. It would be a lot easier to use an existing video chat component that supports webcams.

Flash apps with an RTMP server can support webcams and there are many open-source/free RTMP servers available (I'm not 100% they support live webcam streams though--the commercial Adobe Flash Media Server definitely does). A Flash video component can be integrated into another app, either windows or web.

0

精彩评论

暂无评论...
验证码 换一张
取 消