RVCamera
RVCamera
We are trying the FMX DEMO version with Delphi 10.3.2. We wrote 3 version of the application, VCL/FMX version that works fine, a CONSOLE and a SERVICE version, we are having the following problem with the last two; the RVCamera component does not complete the SearchCamera function if we are in the CONSOLE or SERVICE version, independently of using rvsmWait or rvsmNoWait.
We need to save videos in fixed length (Example 8 minutes files), we have an RVCamera and two RVCamRecorder components, we switch from one Recorder to the other to create the videos, when we switch to the second recorder the video sort of stops for at least 10 seconds and then starts recording again.
We need to save videos in fixed length (Example 8 minutes files), we have an RVCamera and two RVCamRecorder components, we switch from one Recorder to the other to create the videos, when we switch to the second recorder the video sort of stops for at least 10 seconds and then starts recording again.
-
- Site Admin
- Posts: 17602
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RVCamera
Sorry for delay, I only yesterday returned from a hospital.
RVMedia uses threads that call Synchronize method from time to time.
This method works correctly only if the main process calls CheckSyncronize regularly. GUI applications do it themselves, when an application is idle.
But if you use the components in console or DLL, it becomes a problem.
There are workarounds.
The simplest is creating TTimer and call CheckSyncronize in it.
Another solution is assigning WakeMainThread, like it is shown here: https://edn.embarcadero.com/article/32756, at the first part of the article. But you need some class to provide a method for assigning to WakeMainThread, and you need some window (maybe hidden one) to send PostMessage. And I think it does not work in console, because in console the main thread always do something and never idle. Not sure about a service.
As for the second question, does the video stop, or does recording stop?
RVMedia uses threads that call Synchronize method from time to time.
This method works correctly only if the main process calls CheckSyncronize regularly. GUI applications do it themselves, when an application is idle.
But if you use the components in console or DLL, it becomes a problem.
There are workarounds.
The simplest is creating TTimer and call CheckSyncronize in it.
Another solution is assigning WakeMainThread, like it is shown here: https://edn.embarcadero.com/article/32756, at the first part of the article. But you need some class to provide a method for assigning to WakeMainThread, and you need some window (maybe hidden one) to send PostMessage. And I think it does not work in console, because in console the main thread always do something and never idle. Not sure about a service.
As for the second question, does the video stop, or does recording stop?
Re: RVCamera
Thanks for the response, and hoping you get well. I will work with the your suggestions and keep you inform. About the recording problem, is there something I can do. We really like your product and the prototypes we made work beautifully so we would like to complete the project.
-
- Site Admin
- Posts: 17602
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RVCamera
Please send me a simple sample project reproducing this problem.
Re: RVCamera
This project simulates the situation with the Camera and the two recorders. You will press Connect and when the camera is ready press Record and every 1 minute a avi file will be generated, the second one after a couple of second will show some distortions for about 10 seconds.
- Attachments
-
- Survillance.zip
- (63.67 KiB) Downloaded 2116 times
-
- Site Admin
- Posts: 17602
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RVCamera
I cannot reproduce the problem on your project. In my test, there are no omissions between files typically, or it is about 1 second. The maximal omission was about 4 sec.
But I'll try to investigate further...
But I'll try to investigate further...
-
- Site Admin
- Posts: 17602
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RVCamera
The maximal omission is between the first and the second video fragments.
It is because of VideoAutoSize property. The recorder starts recording video with VideoWidth x VideoHeight. But when the first frame is received, it restarts recording with the frame size (and updates VideoWidth and VideoHeight properties, so subsequent restarts are faster).
It can be avoided if you set the proper VideoWidth and VideoHeight initially. In this example, they are 320 x 240, you can get them in RVCamera1.OnGetImage, as img.Width and img.Height.
It is because of VideoAutoSize property. The recorder starts recording video with VideoWidth x VideoHeight. But when the first frame is received, it restarts recording with the frame size (and updates VideoWidth and VideoHeight properties, so subsequent restarts are faster).
It can be avoided if you set the proper VideoWidth and VideoHeight initially. In this example, they are 320 x 240, you can get them in RVCamera1.OnGetImage, as img.Width and img.Height.
-
- Site Admin
- Posts: 17602
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RVCamera
In the next update, I'll add a new event to TRVCamRecorder: OnFirstFrame. It will occur after recording the first video frame. You will be able to stop the previous recorder after this event in the new recorder.
Re: RVCamera
We updated with your latest announced RVMedia version and activated RVCamRecorder VideoAutoSize property and worked way better. Thanks.
-
- Posts: 22
- Joined: Thu Dec 03, 2009 11:58 am
- Location: HUll, UK
- Contact:
Re: RVCamera
Using TTimer in a Service is very problematic. A service does not have a normal message pump, because it does not have a main form. That issue has tripped me up a few times!
Re: RVCamera
Thanks, we created a thread just for time control and synchronization