koush / nvr.scrypted.app

15 stars 0 forks source link

Downloading clips does not work #18

Closed jonathanjsimon closed 1 year ago

jonathanjsimon commented 1 year ago

When I create clip in the camera view, the file that is downloaded is ~1.25kb and contains no video data. I've tried this on my Android phone as well as my Linux desktop. Same as if I visit the camera instance in config and download clips from the history there. The video file is empty aside from mp4 header info.

Current docker image running scrypted 0.39.0. Cameras are all Reolink RLC-810As. The historical rtsp data is definitely available in storage as stored by Scrypted NVR.

https://github.com/koush/scrypted/assets/1076597/663c8be0-7b12-4c1d-b630-5d562e601074

Is there any additional info needed?

koush commented 1 year ago

What browser on Desktop?

jonathanjsimon commented 1 year ago

Brave in all cases

koush commented 1 year ago

Can you try Chrome to see if it's a browser specific issue?

NVR sends a streaming mp4 (unbound length) which may be causing issues with Brave. That way it doesn't need to write the whole thing to disk prior to export.

jonathanjsimon commented 1 year ago

Understood. I have tried Chrome and Firefox without success.

koush commented 1 year ago

Can you attach a console log from the camera after attempting to export?

jonathanjsimon commented 1 year ago

Separate instances of the problem but here are logs from the browser and the docker container

javascript console.log docker.log

koush commented 1 year ago

Ok I see the export issue now. Incidentally may want to reload the NVR Plugin. There seems to be something stuck on a camera that you added then deleted?

koush commented 1 year ago

Should be fixed with the plugin update. Please confirm.

jonathanjsimon commented 1 year ago

Yep, I saw those logs about the failed camera. One of my cameras was autodiscovered as a Hikvision instead of Reolink and I backed that out but I suppose it didn't get all the way out.

I definitely get data now but the download now fails after some data has transferred. I am not on my local network at the moment so I will retest when I am. However, broadband internet at home and at work.

koush commented 1 year ago

Please provide another log of the recording download

jonathanjsimon commented 1 year ago

scrypted_logs.txt

I think the interesting bits start around 2023-06-29T00:00:55.435474214Z

Having done it at home instead of over the internet, my experience is slightly different. The selection to download was about 5 seconds of video. It streamed over 800mb to my computer locally as a download before I bailed on it. The logs were full of packet loss entries and lowest resolution entries.

koush commented 1 year ago
2023-06-29T00:01:16.148099525Z [Garage RLC-810A] Input #0, rtsp, from 'rtsp://127.0.0.1:43397/10237e8a11d29acd':
2023-06-29T00:01:16.148166627Z   Duration: N/A, start: 0.000000, bitrate: N/A
2023-06-29T00:01:16.148176847Z   Stream #0:0: Video: hevc (Main), yuv420p(tv), 3840x2160, 24.92 tbr, 90k tbn, 90k tbc
2023-06-29T00:01:16.148184857Z   Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
2023-06-29T00:01:16.148194287Z Output #0, mp4, to 'pipe:3':
2023-06-29T00:01:16.148232268Z   Metadata:
2023-06-29T00:01:16.148240328Z     encoder         : Lavf58.76.100
2023-06-29T00:01:16.148250148Z   Stream #0:0: Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv), 3840x2160, q=2-31, 24.92 tbr, 90k tbn, 90k tbc
2023-06-29T00:01:16.148257969Z   Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp
2023-06-29T00:01:16.148267359Z Stream mapping:

Oh, just noticed you're using HEVC/h265. Please set your cameras to h264. There's a codec guide you can follow. You may need to use the reolink plugin rather than ONVIF. Not sure what Reolink exposes via ONVIF. It may only send the h265 stream.

koush commented 1 year ago

Have confirmed the issue where mp4 export on hevc stream is goes on forever. Fixing this, but NVR codec guide recommends using h264 since that is the only supported browser codec (otherwise it transcodes). As mentioned, need to maybe use reolink plugin to do that. Will follow up again once publish the hevc export issue shortly.

koush commented 1 year ago

hevc export resulting in a large (never ending) download has been fixed in the new plugin update. Please note that the HEVC mp4 is valid, but Quicktime can not play HEVC mp4. You will need a tool like VLC or ffplay to view it.

Again, the correct user resolution is to set the camera to h264 to avoid transcoding on export/playback.

jonathanjsimon commented 1 year ago

Unfortunately, the RLC-810A only supports h265 and the Reolink plugin seems to only show snapshots (maybe as a result?). I'll reproduce tomorrow and get you the logs. If I have to transcode, that's fine, I have the hardware for it.

https://reolink.com/product/rlc-810a/#specifications

koush commented 1 year ago

Might be worth checking this out. https://www.reddit.com/r/homeassistant/comments/sopd9a/hidden_h264_stream_in_reolink_rlc_810a_probably/

It supportsedly support h264 if you lower the resolution. You'll have a much better experience with h264 due to regular keyframes and reduced system load. Let me know what you discover.