MilestoneSystemsInc / PowerShellSamples

A collection of samples for managing your Milestone XProtect VMS using MilestonePSTools in PowerShell
https://www.milestonepstools.com
MIT License
36 stars 12 forks source link

Error in PSTool exporting Avigilon with codec H.265 to .mkv format #121

Closed MontseMunozFaus closed 7 months ago

MontseMunozFaus commented 7 months ago

Hello, we encountered an issue exporting video with PSTool from Avigilon with codec H.265 to .mkv format.

If we use code H.264, it works fine. If we export with Smart Client using H.265, it also works fine.

It only fails when exporting with PSTool using H.265.

XProtect Corporate version 2023 R2 PSTool version 23.2.1

Enclosed:

We have also a sample of video exported with Smart Client (14MB). Do you need it? We should send it privately (images of premises of end client can not be public). Thank you

ffmpeg-result.txt 03 Device information 04 Camera settings

joshooaj commented 7 months ago

Thanks @MontseMunozFaus, I will send you a direct message with a link to a password protected share where you can upload the MKV file.

Can you share an example of the Start-Export command used, and the error message received?

I tested MilestonePSTools and MipSdkRedist v23.2.1 against two different H.265 sources on my XProtect Corporate 2023 R3 system without issue. I'll also test against 2023 R2 later. It's possible the difference may come down to the way the video is encoded by your Avigilon cameras - for example, maybe the time between key frames is so long that the MKVExporter doesn't see the beginning and end of a single GOP or "group of pictures" between the start and end timestamps? I'll test that theory out later as well.

MontseMunozFaus commented 7 months ago

Our Start-Export command is: Start-Export -CameraIds $camera.Id -StartTime $startDate -EndTime $endDate -Path "$exportFolderPath\$cameraName" -Name $exportFileName -Format mkv

All parameters introduced should be fine since with H.264 it is exporting videos

The error message we are getting is: Start-Export : No video or audio in selected time period At E:\New Script Development\Script2.0.ps1:59 char:13

joshooaj commented 7 months ago

I haven't been able to reproduce an export failure on my test system yet, even when using the sample MKV you provided as a video source.

Can you check to see if you also get an error when exporting to MKV using the sample export tool from our MIP SDK samples repository? You can download the ExportSample tool from the link below. Make sure to open the properties of the downloaded ZIP file and "unblock" the file before extracting it, then extract it and run ExportSample.exe.

https://milestonesys365-my.sharepoint.com/:u:/g/personal/jh_milestone_dk/Eb3wTf_v2QZAoCEHdEQ-iwABCcPkDvpbrrWUBIsLwetR8Q?e=xAlbJE

This is compiled from the MIP SDK developer sample at https://github.com/milestonesys/mipsdk-samples-component/tree/main/ExportSample and if this also fails, it will demonstrate that the issue is with the MIP SDK rather than with MilestonePSTools and the issue can be assigned to the appropriate team to resolve it.

If the ExportSample succeeds in exporting the H.265 video, then it would be a good idea to install and try again with MilestonePSTools 23.3.1 which uses the same version of MIP SDK as the sample above.

joshooaj commented 7 months ago

Hi @MontseMunozFaus,

Have you had an opportunity to download and test the ExportSample program from our MIP SDK samples?

Let me know if you would like an invite for a call and remote session - I can be available at 7am pacific (GMT-8).

MontseMunozFaus commented 7 months ago

Hi @joshooaj Not yet because we need authorised access to client servers (all: Management, Recording, Export, AWS, etc.) I believe tomorrow evening (our time GMT+1) access will be granted. If so my colleague Jaume will test the ExportSample. Should there be any issue, we will contact you on Friday and organise the remote session if necessary. Thanks a lot for following the case.

MontseMunozFaus commented 7 months ago

Hi @joshooaj We tried you ExportSample and it worked, after changing the module version from 23.2.1 to 23.3.1 now it works and it's exporting the videos with codec H.265. Thanks for everything.