LEADTOOLS Support
Multimedia
Multimedia SDK Examples
HOW TO: Streaming of Live Video Screen Capture to a Different PC using C#
#1
Posted
:
Tuesday, November 29, 2022 1:55:29 AM(UTC)
Groups: Manager, Tech Support
Posts: 367
Was thanked: 1 time(s) in 1 post(s)
The code below shows how to use the streaming features of LEADTOOLS Multimedia SDKs to implement live video screen capture from one PC and stream the captured video to a different PC, using 2 different network protocols.
Video capturing is achieved using the LEAD Screen Capture Video Source which is easily accessed by the LEAD CaptureCtrl. The CaptureCtrl then sends the data over the network, and it can be received and displayed at the second PC using the LEAD PlayCtrl.
The 2 approaches are:
1. Lossless video streaming with LTSF:
The LEAD Screen Capture video encoder supports lossless compression of video frames and is especially suited for screen capture videos.
This encoder can be used in conjunction with the proprietary LTSF streaming protocol as follows:
Code:
// Sender-side code
// First, select the LEAD Screen Capture video source
captureCtrl.VideoDevices[@"@device:sw:{E2B7DFB2-38C5-11D5-91F6-00104BDB8FF9}\{E2B7DE13-38C5-11D5-91F6-00104BDB8FF9}"].Selected = true;
// Specify format and compression
captureCtrl.TargetFormat = TargetFormatType.NET;
captureCtrl.VideoCompressors.ScreenCapture.Selected = true;
// Specify protocol and IP address
captureCtrl.TargetFile = "ltsf://" + ipAddress;
// Next line is important to build the filter graph
captureCtrl.ReadyCapture(0);
captureCtrl.StartCapture(CaptureMode.Video);
// Receiver-side code
playCtrl.SourceFile = "ltsf://" + ipAddress;
playCtrl.Run();
2. Standard video streaming with UDP and MPEG4:
If there's a need to use the common UDP protocol for streaming, standard MPEG4 video compression can be used as follows:
Code:
// Sender-side code
// First, select the LEAD Screen Capture video source
captureCtrl.VideoDevices[@"@device:sw:{E2B7DFB2-38C5-11D5-91F6-00104BDB8FF9}\{E2B7DE13-38C5-11D5-91F6-00104BDB8FF9}"].Selected = true;
// Specify format and compression
captureCtrl.TargetFormat = TargetFormatType.MPEG2Transport;
captureCtrl.VideoCompressors.Mpeg4.Selected = true;
// Specify protocol and IP address
captureCtrl.TargetFile = "udp://" + ipAddress;
// Next line is important to build the filter graph
captureCtrl.ReadyCapture(0);
captureCtrl.StartCapture(CaptureMode.Video);
// Receiver-side code
playCtrl.SourceFile = "udp://" + ipAddress;
playCtrl.Run();
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Multimedia
Multimedia SDK Examples
HOW TO: Streaming of Live Video Screen Capture to a Different PC using C#
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.