StartRecordingCommand / StopRecordingCommand

The manual Start/Stop Recording event times… they are not accurately depicted when returning recorded videos in the SequenceData results. Such as, the EventSequence.StartDateTime of the recorded video, is stored in SequenceData as the ending time of the video. This makes no sense. The EndDateTime doesn’t actually exist at all.

The end of my video recording is marked as the StartTime.. but it isn’t the time I stopped the recording. It is 33 seconds AFTER I stopped the recording.

Am I missing something as to how StartRecordingCommand is used, and how returning SequenceData is retrieved? All I’m looking for is the video I ‘thought’ I recorded.

https://developer.milestonesys.com/s/article/About-start-and-stop-recording-in-MIP-SDK-c-library

Sorry, that doesn’t help at all. Oddly, I knew those rules.

For our camera we are testing with, it is streaming 24/7. It is not set to ever record, except manually. It does indeed record video, that we are able to playback. However,

I know there is a difference between e-code and c-code, so first a quick question: What is the XProtect product and version?

We connect to XProtect Professional/Corporate/Enterprise. I am using SDK version 2018 R1. This is the only way to start and stop recording, that I use and have found:

EnvironmentManager.Instance.SendMessage(

 new VideoOS.Platform.Messaging.Message(MessageId.Control.StartRecordingCommand), \_currentItem.FQID);

EnvironmentManager.Instance.SendMessage(

 new VideoOS.Platform.Messaging.Message(MessageId.Control.StopRecordingCommand), \_currentItem.FQID);

I have seen no difference anywhere between e and c code for recording.

Is there a way to get the Starting time of the manually recorded video?

There is no difference in the SendMessage between e-code and c-code.

There is a big difference in how the VMS has implemented the SequenceData. In e-code sequence data is always based on motion detection.

I think a workaround, perhaps where you submit an Analytics Event (or other form of event) when starting and when stopping, is a idea to consider.

Instead of me guessing, then searching, then guessing some more. EXACTLY what is the event call to perform an Analytics Event? I already mentioned how I send in the Start/Stop Recording Event. The camera this is performed on, is not a motion camera. Start/Stop Recording on this camera, works for every other video integrator we have, other than Milestone.

Also, this exactly what is happening to us:

  1. Start Recording video at 8:00.000000 am
  2. Stop Recording video at 8:10.000000am
  3. Retrieve Sequence Data, to see that manually recorded video has a START TIME of either 8:10.0000000am… or a start time of 8:10.500000.
  4. The End Time of the video doesn’t exist

WHY is the START TIME in the Sequence Events showing the END TIME of the manually recorded video? IF the End Time was actually the End Time of the video, I could calculate the start time using the Duration. But they are incorrect.

Look at the AnalyticsEventTriggerViaLibrary sample for Analytics Events.

Ok, that seemed to fix the StartRecording issue.

Now however, when I attempt the StopRecording… it doesn’t actually stop recording. I’ve noticed that if I wait 20 seconds, then execute Stop Recording a second time, it then stops recording.

Is this a bug in the SDK?

If there is a failproof method to StopRecording, please let me know what it is (also, please direct to me where that answer is in the form of code examples or demo code)

I currently use:

EnvironmentManager.Instance.SendMessage(

           new VideoOS.Platform.Messaging.Message(MessageId.Control.StopRecordingCommand), \_currentItem.FQID);

It does not fit any known issue in MIP SDK or XProtect. I would suspect the XProtect server first, and do an extra go-through of the configuration surrounding this. In e-code camera setup and recording setup, in c-code camera setup, recording rules. What is the XProtect product and version you are developing against and testing with currently?

For testing and easy implementation I recommend the VideoViewer sample and the start and stop recording buttons in that sample. It would be very interesting whether this sample works for you in the setup you have.

Since the VideoViewer program only records, and doesn’t show the results, I modified it to do the video search and display the results of the search in a ListBox. Each row of the listbox shows (Recording StartDateTime - Camera Name - Duration) Each video was recorded at least 30 seconds. Two of the videos, running on my server, show a duration of 0 seconds. Regardless of that, it takes several minutes for a video to show up in the Video Search, after recording is stopped.

The camera I am video searching against, is a motion camera, but is not setup to be one. It is setup as a regular camera. I am running this under XProtect Professional, using MIP SDK 2018 R1. I was able to mimic my StopRecording issue, simply by searching for the videos immediately following StopRecording. It is as if the server is in the midst of stopping the record, but hasn’t quite stopped yet… so the EndTime of the video increases until the server actually stops recording.

(Please note: The modified VideoViewer below doesn’t have any files in the bin folder. I was not able to upload the additional 246mb of files in that)

Also, here is a screenshot of the modified VideoViewer, with the two recorded videos I made that still show up with a duration of 0 seconds.

Also, the camera I am having all this trouble with, is an e-code

For historical reasons; sequence data in e-code is always based on motion detection.

This is the reason for my workaround suggestion using events. You might find you need the workaround for e-code while c-code is capable of giving useful sequence data.

I did implement your suggestion. The results are the same. I can’t imagine our customer being satisfied with your explanation, in attempting to tell them that they cannot manually start recording, then stop recording, when the feature is available, and actually receive the recorded video they are expecting.

We have a camera that has the ability to be a motion camera, but isn’t setup to record on all motion events, unless recording is manually turned on.

Can I please request Peter to look a this thread as well. I don’t hardly believe that an e-code camera is incapable of recording manually, and actually outputting the correct start/end times.

Based on experiments I assumed that footage was recorded, but only the datasource does not reflect that there is recording. If this is a bad assumption please correct me.

Please clarify -

The camera is recorded but the data in datasource does not show it?

The camera is not recorded?

If you experience the same as I; that video is recorded and the datasource fails to tell, I have found a workaround.

I assume you have a call like this -

override List VideoOS.Platform.Data.SequenceDataSource.GetData (DateTime dateTime, TimeSpan maxTimeBefore, int maxCountBefore, TimeSpan maxTimeAfter, int maxCountAfter )

(or the equivalent GetDataAsync)

This uses the default type of sequences.

For e-code you can use something different. Use instead

override List VideoOS.Platform.Data.SequenceDataSource.GetData (DateTime dateTime, TimeSpan maxTimeBefore, int maxCountBefore, TimeSpan maxTimeAfter, int maxCountAfter, Guid sequenceTypeGuid )

and put in VideoOS.Platform.Data.DataType.SequenceTypeGuids.TimelineRecording

as the SequenceTypeGUID

I did a test and made standalone application with

SequenceDataSource dataSource2 = new SequenceDataSource(_item);
List<object> list2 = dataSource2.GetData(DateTime.Now, new TimeSpan(24, 0, 0), 5, new TimeSpan(24, 0, 0), 5, VideoOS.Platform.Data.DataType.SequenceTypeGuids.TimelineRecording);

Because of e-code server inability to do a sequence data source this sequence type has been made. You will notice that all sequences are of duration one minute from this type of source, in essence the source is made from asking whether there is any recorded data within the minute.

References

http://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_data_1_1_sequence_data_source.html&tree=tree_search.html?search=sequencedatasource

http://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_data_1_1_data_type_1_1_sequence_type_guids.html&tree=tree_search.html?search=sequencedatasource

Bo, that is the most detailed response you have ever given me. I’m so proud of you. And, video recording now works acceptably. Great find. Great fix. I think I am now done with this integrator. Thanks for the assistance.