blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
17.78k stars 1.62k forks source link

Record main stream and substream #2652

Open ceandraka opened 2 years ago

ceandraka commented 2 years ago

It would be nice if recording could occur on two streams at once. My system has a low res substream (under 480 lines) that can be used for detection, and is also more than suitable for phone checks. The high res stream (main) is a 4k stream, and is great for archival recording or police reports. However, if I set the 4k stream to record, my Android devices cannot play i in the browser (Samsung Internet, Chrome, Opera, Firefox) nor in the HA App. I can download it and it play sin VLC or MXPlayer. Even if it did play, 4k is overkill on the phone.

My current camera setup will not allow me to reduce the main stream to 1080, which may help solve the non-viewable issue.

However, it would be "best" to have an archival record of "clips" in 4k, but be able to select the secondary stream clips for remote review, saving data bandwidth.

A solution form a user perspective would be to record clips in multiple streams, and then be able to select in the app which stream to view. In notifications I can send the link to the correct (Low res) stream.

I have tried changing camera resolutions, but I am using my old NVR as a switch with POE, and the NVR is preventing me form changing resolutions. And such a solution (record 1080i) would still use more bandwidth than necessary for a phone.

Thanks!

NickM-27 commented 2 years ago

If I had to guess I'd say not being able to play has nothing to do with the resolution and likely due to the compression that is being used,. For example this note in the docs about H.265: H265 recordings can be viewed in Edge and Safari only. All other browsers require recordings to be encoded with H264.

ceandraka commented 2 years ago

If I had to guess I'd say not being able to play has nothing to do with the resolution and likely due to the compression that is being used,. For example this note in the docs about H.265: H265 recordings can be viewed in Edge and Safari only. All other browsers require recordings to be encoded with H264.

Thanks for commenting. I suppose this is possible, even though VLC reports H264 AVC. However, this may be just wrapper information that frigate puts on a stream that is really h265? I will see if I can see anything in the camera settings that may shed light. I thought the cameras were 4k, but they are 4MP, 2688x1520. The stream does play in Chrome on the PC.

Nonetheless, regardless of my display issues, it would make sense to store both streams and allow low res stream viewing on mobile devices, high res for archival or viewing on a PC.

ceandraka commented 2 years ago

The camera has the same settings for main and substream, for the most part. The only encoding option is h264. The main stream has an additional option of h264+, but that is off. Main stream is set to max bitrate 5120kbps, while substream is 512kbps. Resolution selected is 640x360 substream, main is 2688x1520. Otherwise the same. Not seeing h265 as an option.

ceandraka commented 2 years ago

I did manage to reset one camera. Tried different resolutions. 1080p displays on mobile, anything higher does not. No other camera settings changed between tries.

But, still would like to see two streams record.

ceandraka commented 2 years ago

As an alternative to recording both streams, how about an option to pass the playback of a clip through ffmpeg and allow re-encoding with all ffmpeg options? This way the notification could have a link to the raw (4MP) clip, and another link that passes through ffmpeg, and re-encodes on the fly to a lower resolution. This would use a little CPU to encode, but only when a low-res replay is selected.

Maybe there is already a way to do this with creative link?

blakeblackshear commented 2 years ago

This may make sense for those that don't have a low res stream to record, but for most people it will be much better to just save a secondary stream. Constantly re-encoding will require more CPU than most would want.

ceandraka commented 2 years ago

I did not intend constant re-encoding. Rather, save the stream (high res as is done now), and re-encode on the fly when a clip is requested for review. Typically 30 second clip. Sorry if I was not clear. So just the API call to assemble a clip for review, either through a notification or by clicking on the event in Frigate view.

blakeblackshear commented 2 years ago

That isn't possible today, but could be one day.

ceandraka commented 2 years ago

OK, thanks for taking a look

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ghgeiger commented 1 year ago

Following this request as I would like to be able to record both hi & low res streams with frigate. Specifically, I'd like frigate to be able to continue to function as it currently does, but I would also like it to archive unprocessed high res streams on any motion event, so that I could go back and get a better look at my scene. In my case, I wouldn't even care if the recordings were not available via UI, I'd just like to be able to retrieve them from the drive if I need them... Or perhaps just a 'Download' button for the high res recording.

spacebares commented 1 year ago

Or what about record streams with tags? Highres / Lowres.

- path: rtsp://highreslink
  tag: highres
  roles:
    - record
- path: rtsp://lowreslink
  tag: lowres
  roles:
    - record

and the events browser will have a dropdown box or buttons that allows you to show recordings from a tag? Would be great for mobile, and you still have highres if your willing to wait for the load.

aewfrsh

would be awesome to have

NickM-27 commented 3 months ago

the next version of frigate (0.14) supports previews which are a low fps low resolution video that is easily scrubbable and likely solves this issue for most use cases