Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, September 17, 2012 4:45:32 AM(UTC)
ming_ableengine

Groups: Registered
Posts: 11


I have 2 web cameras (call them A and B) and I want to stream to one unique destination. i.e.  the output should be like  AAAAABBBBBAAAAAAAAA....  not AAAAAAA<space>BBB<space>AAAA
(<space> means several missed frames)

I want to use the data from camera B (determined by users action) at anytime point and without any frame loss.

Here is what I have tried:

  captureCtrl1.TargetFormat = TargetFormatType.MPEG2Transport;
  captureCtrl1.TargetFile = "udp://127.0.0.1:9005";
  captureCtrl1.StartCapture(CaptureMode.Video);

  convertCtrl1.SourceFile = "udp://127.0.0.1:9005";
  convertCtrl1.TargetFile = xxxxx;
  convertCtrl1.StartConvert();

User Click Event

  captureCtrl2.TargetFormat = TargetFormatType.MPEG2Transport;
  captureCtrl2.TargetFile = "udp://127.0.0.1:9005";
  captureCtrl2.StartCapture(CaptureMode.Video);

  captureCtrl1.StopCapture();

Note: I have to start capturectrl2's capture process first to get a better result. But, in the output stream (from convert control), it looks like the switch between these 2 capture control is not that smooth. We don't want to lose any frame and want that switch in the output stream is invisible to end users.

Any idea on this ?

Thanks,

Ming

 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, September 17, 2012 6:43:46 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Ming,
If you call StopCapture() and StartCapture() repeatedly, you will definitely lose many frames with every time you do the switching.

A better approach is the following:
1. Use 2 capture controls to keep the 2 cameras running at the same time, and make the target format for each of them the NULL format (dummy output).
2. Use a convert control that takes from a dummy source and saves to the needed output file.
3. In each of the 3 controls, add a LEAD Video Callback filter and implement a callback function.
4. Make one of the capture controls copy its video frames to a global memory location in the callback function of that control. The other Capture control will not copy anything because it's not active (but it will keep capturing anyway).
5. Make the Convert control's callback function copy frames FROM the global buffer.
6. When the user makes the switch, the first capture control stops copying its frames, and the second capture control starts copying its frames to the same global memory location.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Monday, September 17, 2012 1:10:32 PM(UTC)
ming_ableengine

Groups: Registered
Posts: 11


Hi, Maen,

Thanks for your advice.

I was trying to run your callback demo. But I never got a chance to enter ReceiveProc method in the CallBack class.

Is this just because I'm using a evaluation copy ?

Thanks,

Ming
 
#4 Posted : Tuesday, September 18, 2012 5:27:39 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

Ming,

LEADTOOLS free evaluation SDK is fully functional and comes complete with documentation, code samples, full demo projects and the required DLLS to build your application. So the video callback should work correctly on your side.
Please answer the following questions:
1. Which LEADTOOLS callback demo that you use to test this issue?
2. If you try the video callback demo with our video files that ship with the SDK, does it work?

Please note that our video callback demos need our imaging toolkit to compile and run. However, the callback filter itself does not need the imaging toolkit and can be used without it.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Tuesday, September 18, 2012 6:08:16 AM(UTC)
ming_ableengine

Groups: Registered
Posts: 11


I installed MultiMedia Suite SDK first and then installed the Main Package( has ImageProcessing SDK inside).

I tried following 2 sample projects ( changed reference settings to get them run properly.) with my own WMV files.

  C:\LEADTOOLS Multimedia 17.5\Examples\Ltmm\Dotnet\CS\Callback
  C:\LEADTOOLS Multimedia 17.5\Examples\Ltmm\Dotnet\CS\DrawOnVideo

Both AddCallBack() in the main form class work well, but the breakpoints in ReceiveProc (in Call Back Class) never work.

Thanks,

Ming

 
#6 Posted : Tuesday, September 18, 2012 9:11:51 AM(UTC)
ming_ableengine

Groups: Registered
Posts: 11


Hi, Maen,

Please ignore last question. The breakpoints work fine on another PC.

Thanks,

Ming

 
#7 Posted : Wednesday, September 19, 2012 10:44:15 AM(UTC)
ming_ableengine

Groups: Registered
Posts: 11


Hi, Maen,

I have some problems with step 2 and step 4.

1) How to assign a dummy source to a convert control ?

    I could not find such an approach so I tried to use a WMV as SourceFile (in order to trigger the callback after invoke CaptureControl.StartConvert())

   Then I was able to enter callback function of this convert control and copied frames from global memory location. But I soon encountered another problem, the callback (of convert control) stopped working. I guess that's just because the convert control reached the end of that WMV file and everything not function after it.

2) How can I keep the convert control working unless the users tell it to stop ?

Thanks,

Ming


 
#8 Posted : Thursday, September 20, 2012 10:18:54 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

Was thanked: 1 time(s) in 1 post(s)

To answer your questions:
1) You can use our LEAD Still Image Reader filter and give it a bitmap image as source. In the filter settings, specify 0 for the loop count to indicate infinite loop.

2) After calling StartConvert, when the source is infinite loop the program will keep converting until you call StopConvert(). However, the form that contains the control must not close during that.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
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.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.177 seconds.