Page 1 of 1

How to record a video repeatedly?

Posted: Mon Oct 12, 2020 11:53 am
by Kyung chul Jung
Hi.
I am making a program to save IP Camera's video for a certain period of time.
You can start the program for the first time, connect to the camera, and record.
But during the second recording, I can access the camera, but the video is not shown.
And it doesn't record.
What should I do?
Below is the command I used.

// Camera Connect
if not RVCamView.IsVideoPresent then
Begin
if DoPing (CAM_IP) then
VIPCam.PlayVideoStream;
end;

// Camera Record
if RVCamView.IsVideoPresent then
Begin
File_Name := 'Test_Cam1.mp4';
VideoWriter.OutputFileName := IMG_Folder + '\' + File_Name;
VideoWriter.Active:=True;
SaveTimer.Enabled := True; // Record 5 Minutes
end;

// SaveTimer
VideoWriter.Active:= False;
SaveTimer.Enabled := False;
SleepTimer.Enable := True; // wait 5 seconds while recording files.


// SleepTimer
SleepTimer.Enable:= False;
VIPCam.Abort; // Terminate Camera Connection


Repeat this sauce after 1 hour.
Please let me know if there is anything wrong.

Please let me know if there is a videoWriter component setting or inside of the RVCamera component.

Re: How to record a video repeatedly?

Posted: Wed Oct 14, 2020 4:25 am
by Kyung chul Jung
Strangely, if the video does not appear on the screen, the video cannot be recorded.
But capture is possible.
Do I have to reset video streaming?

Re: How to record a video repeatedly?

Posted: Fri Oct 16, 2020 10:13 am
by Sergey Tkachenko
You use undocumented method of TRVCamView: IsVideoPresent.

If you need to determine if the camera is active, use RVCamera.IsVideoPlaying instead.
But, unfortunately, this method must be fixed.
The correct code is:

Code: Select all

function TRVCamera.IsVideoPlaying: Boolean;
begin
  Result := Assigned(MJPEG);
  if Result then
    exit;
  case FDeviceType of
    rvdtWebCamera:
      Result := (Assigned(WebCam) and WebCam.IsVideoPlaying) or
        IsStoppingDevice;
    rvdtDesktop:
      Result := Assigned(Desktop) and Desktop.IsVideoPlaying;
    rvdtFile:
      Result := Assigned(Player) and Player.IsVideoPlaying;
    rvdtRTSP, rvdtHTTP:
      Result := (GStreamerProperty.UseGStreamer and Assigned(GST) and
        IsSupportedGStreamer and GST.IsPlaying) or Assigned(FThreadHTTP) or
          Assigned(FThreadRTSP);
    rvdtUserData:
      Result := Assigned(UserThread) and UserThread.IsVideoPlaying;
    else
      Result := Assigned(FThreadHTTP) or Assigned(FThreadRTSP) or Assigned(MJPEG);
  end;
end;