How to record a video repeatedly?

RVMedia support and discussion (components for displaying and controlling IP cameras, webcams, video conferencing, video chats, recording audio and video files)
Post Reply
Kyung chul Jung
Posts: 3
Joined: Tue Sep 22, 2020 8:57 am

How to record a video repeatedly?

Post 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.
Kyung chul Jung
Posts: 3
Joined: Tue Sep 22, 2020 8:57 am

Re: How to record a video repeatedly?

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: How to record a video repeatedly?

Post 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;
Post Reply