Closed MiraPurkrabek closed 1 year ago
Hi! I see that you added a bit more functionality over the concat/trim features, specifically the onedrive integration. Can I create another PR for you where I cherry pick only your 6a6e247ee85242576d3f07c04138a315b18771c0 commit? Thanks.
Hi,
I intented to only PR the first commit, other ones are additional work for my specific use. I just forget to switch branches, sorry. I will revert that later in the weekend.
The code is ready for review again ;)
Adding the concatenation and trim features described in #24 . Closes #24
Please, test the changes on other Hikvision model. I tested with my NVR but it has some limitations.
main changes:
Details
Below i shortly explain the approach for reviewers to understand the code faster.
1. downloadDict
Since I need to store metadata for each channel and the session, I use the downloadDict instead of former downloadQueue. The main cons is the added complexity in both processing and coding but it enables us to store more than just individual recordings.
2. Saving true startTime and endTime
Since the IS API does not return the true startTime and endTime for border recordings, I bypassed the problem by listing more recordings than required by the timespan. It slows down the discovery process as we load more recordings than necessary but the difference is smaller than 1s which I think is not important when downloading and concatenating videos take tens of minutes.
I hard-coded the additional 2 days to the search query. The approach would fail when the video is in such a low quality that one recording spans more than one day. This is a tradeoff between universality and speed. We can always list all recordings available but that takes time in tens of seconds.
3., 4. Concat and trim
As outlined in the issue #24 , the approach is to always create a new video when processing recordings with FFmpeg. It means temporarily storing some videos but it speeds up the process as we can copy videos and encodings. The temporary videos are deleted after the end of session.
There was a problem with video audio. See the code for details.
5. Videoname
The --videoname option is nor directly related to the concat and trim problem. It is possible to implement the feature without it. The main question then would be how to uniquely name the concatenated video.
Notes