Powershell script

Hi people

We are working with a Powershell script to export the recordings in MKV format. We have detected that devices configured in H264 work fine but we cannot export those that work in H265.

Can someone help us? Any restrictions that we don’t know about?

Hi @Josh Hendricks

Someone in Milestone tell me that you can help us.

Allow me to ask some clarifying questions first.

Does it work if you export the same footage using the Smart Client?

Do you get an error?

Do you get a file as result of the export?

The file (if you get one) does not work in your media player?

Hi @Bo Ellegård Andersen (Milestone Systems)​

Thanks a lot for your reply.

Answering your questions a

Does it work if you export the same footage using the Smart Client? YES

Do you get an error? Not in the smart client only when using MilestonePSTools Start-Esport function

Do you get a file as result of the export? Yes a .mkv file

The file (if you get one) does not work in your media player? Yes, it works

To clarify a little bit more, the script is made using the MilestonePSTools module using powershell. The issue is that the cameras that have recordings in codec H265 cannot be exported. From the smart client we haven’t any issue. I copy here the error we get in the powershell script:

Start-Export : No video or audio in selected time period

At [E:\New](file:E:/New) Script Development\Script2.0.ps1:59 char:9

+ Start-Export -CameraIds $camera.Id -StartTime $startDate -En …

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (VideoOS.Platform.Data.MKVExporter:MKVExporter) [Start-Export], NoVideoInTimeSpanMIPException

+ FullyQualifiedErrorId : VideoOS.Platform.NoVideoInTimeSpanMIPException: No video or audio in selected time period

at VideoOS.Platform.SDK.Export.MKVExporter.StartExport(DateTime start, DateTime end)

at VideoOS.Platform.Data.MKVExporter.StartExport(DateTime start, DateTime end)

at MilestonePSTools.ExportCommands.StartExport.Export(IExporter exporter) in [D:\a\MilestonePSTools\MilestonePSTools\src\MilestonePSTools\ExportCommands\StartExport.cs](file:D:/a/MilestonePSTools/MilestonePSTools/src/MilestonePSTools/ExportCommands/StartExport.cs):line 260,Milesto

nePSTools.ExportCommands.StartExport

Seeing this error my suspicion is that your DateTime is wrong. I recently had a case where something like this was cause by language/culture. In my case there was a mixup on =01/02/2024 (2 Jan in US, 1 Feb in Europe). But regularly I also see a mixup as the time need to be UTC because the recording Server uses UTC internally. Please double-check the time and date..