-
-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live view not working #31
Comments
Can you share the specific Reolink camera you’re using? As you mentioned, I think this is identical to the other issue, but since I don’t have one myself, I can’t debug much on my own. Does recording work but not the live view? |
I'm using the RLC-410-5MP with latest firmware. I even tried downgrading one version, because I thought maybe the new firmware was the problem. With both versions I had similar issues. Next thing I saw was that the small ReoLink couldn't handle the 3-4 simultaneous rtsp streams as the cpu usage went straight to 100% and stayed there. I then setup rtsp proxy servers. First off I tried the Live555Proxy. With that, it seemed, that the live view worked, but I couldn't tell, because maybe 200 pixels from the top were visible, the rest was just green artifacting. I thought maybe just an issue with Live555. So I setup a rtsp Proxy with ffmpeg and simple-rtsp-server. The proxying worked flawless, the stream worked in VLC on two different machines. When I entered the proxy stream into the unifi-cam-proxy, I had the same issue as when I connected directly to the cameras. I think, there might be some codec issues... I played around with ffmpeg, the rtsp server and some codecs, and after some time I got the same behaviour as with the Live555. However, when I got this behaviour, ffmpeg was full of errors because of the encoding. CPU of the host was only at around 10-20%, so that wasn't the issue. I can send you the commands I used for the proxy server and ffprobe output if you want later, just hit me up. I could even setup a VM to let you connect and test something if you want. I appreciate your project and your help. If I can do something of the above for you, just tell me. |
The commands you ran plus ffprobe output of the original stream after you set the camera to the baseline profile for both the Clear and Fluent streams would be useful. |
Yeah, sure. Here you go: I then used this command to start the unifi-cam-proxy: This is the ffprobe output (baseline/clear): And the ffprobe output for baseline/fluent: |
UPDATE: After playing around with ffmpeg, the (rtsp) proxy server and the unifi-cam-proxy I finally got it to work with the fluent stream (max resolution 640x480). And then I use this command to start the unifi-cam-proxy: After that, playback works fine. I think, that this could also work with the main (2560x1440 resolution) stream, but my mini-computer that I'm currently running the proxy on couldn't handle the (re-)encoding with this stream. I am going to try it out on a bigger system and post an update here. Sure, this solution is not optimal as it requires quite a bit of power to re-encode the stream, but hey, at least I can use my cameras with the UniFi protect system now. //Update: this method also works with the main stream, but requires quite some CPU/GPU power to encode. Does it work? Yes. Would I recommend this method? No. I'll be testing a few different things to see, if I find any other workaround. If I find anything else, I'll post a new comment here. |
Thanks for the output! Re-encoding into H264+AAC should make every camera compatible with Protect, but can be prohibitive without a GPU or a ton of compute power, especially for a 2k or 4k stream. If you can, do you mind sharing a raw video segment from the camera while it's set to the baseline profile? Running the following for 15-20s and ctrl-c'ing should dump a file that you can upload or email:
|
No problem! I like to help :) I'll send you the raw files tomorrow, I'm not getting home until tomorrow morning (CEST). |
While not perfect, I think adding the following option to the unifi-cam-proxy call makes it work without re-encoding.
The Reolink stream seem to not include VUI info in the h264 stream which makes the Protect side think the video stream is 0 FPS and discards it. This uses a bitstream filter to re-introduce this metadata with ffmpeg, but it'll need to match the actual original video parameters or it can throw things off. Assuming you have FPS set to 30 in the Reolink UI, Can you give this a go and see what happens? Edit: you can probably reduce the cost by adding these options to the stream feeding rtsp-simple-server instead:
|
Thank you for your reply. I just wanted to test it, but it didn't work because ffmpeg doesn't recognize the "h264_metadata" bitfilter. Which version are you using? Maybe I need to upgrade. I'm currently on |
I installed a newer ffmpeg version now, which fixed the problem with the unknown bitfilter. However, I now have the next problem :( When I try to run the ffmpeg command you stated above I get this error: |
Is that an error or warning? For me, I saw that but the stream still worked anyway. |
Ah, sorry, I didn't post the full error. The error(s) displayed are below. |
Having this same issue on a honeywell/dahua dvr: recordings seems to work fine but the live view doesn't show up. I tried the I also saw the Let me know if there's anything that would be useful for debugging. |
So, I tested your command with the h264_metadata injection on another system with Debian 10 and latest ffmpeg. Here it worked flawlessly. I still have the issue stated above with ffmpeg on Debian 9. But it seems to be just an issue on this specific system. I don't care, as long as it runs on my other system :D So, long story short: With the injecting of the h264_metadata the playback and recording works flawlessly. Thank you very much for your help and this project. The metadata injecting is way more efficient then re-encoding, on my system injecting the metadata for 3 cameras requires around 10-15% CPU. |
Did you look at the CPU usage of your system while trying this option? I had similar issues on a low-power device. |
Originally I tried the After switching to the I don't have audio so I replaced the audio related flags with FWIW I'm on debian 10 as well. I'd say throw this workaround in the @nxtByte Switching to 1080p15 from 720p30 seemed to reduce the load significantly. I suspect it could be reduced even more if I could specify the low res rtsp substream for video2/video3 separately but that's a convo for a different issue. @keshavdv I second the donation sentiment, perhaps you could take a look at the Github Sponsors platform or something like that. |
I updated the readme with this workaround. If you'd like, we could create a Reolink (non-nvr) implementation that adds these ffmpeg args under the hood by default, but is also smarter about selecting the correct substream for the various video resolutions that Protect requests (see https://github.com/keshavdv/unifi-cam-proxy/blob/main/unifi/cams/lorex.py#L68-L70 as an example). Since I don't have one personally, I'd need somebody to share the correct urls to use. |
I seem to be having this same issue with my FOSCAM cameras. I can see recordings but live view doesn't work. Interestingly, the Android App does show live view fine. I'm running the following command: Any ideas? //edit:
|
@guido331 Can you save a raw 15-30s clip from your camera with ffmpeg and share via email or other means? |
Forgive my ignorance, I'm having trouble getting a file saved with Ubuntu: ffmpeg -rtsp_transport tcp -i rtsp://user:[email protected]:80/videoSub abc.mp4 -acodec copy -vcodec copy -t 00:00:15:00
|
I just usually do the following and press ctrl-c after 15-30s: ffmpeg -rtsp_transport tcp -i rtsp://user:[email protected]:80/videoSub -acodec copy -vcodec copy out.mp4 |
Interesting, I'm beginning to suspect the stream from the camera itself:
|
Instead of ‘-acodec copy’, can you replace that with ‘-ar 32000 -ac 2 -codec:a aac -b:a 32k’ to force audio transcoding. |
Thanks, I finally got the file saved. What's the best way to securely provide it to you? It's just the corner of my living room but still... |
You can find my email attached to any of the commits in the repo if you’d like to send it over directly. |
Sent, thanks for taking a look. I'm happy to help if we want to test adding support for FOSCAM cameras |
I've noticed motion detection doesn't work either, not sure if it's my camera or because live view doesn't work. I wasn't counting on smart detection to work but was at least hoping for motion detection. (the FOSCAM does motion detection natively) Also, I can go back through the timelapse and view up to current but can't actually view the live video. (just stays on "Connecting to Live Feed"). Live view does work through the Android app though. |
Can you try the following args? ‘’’ With the RTSP implementation, neither motion or smart detections are supported because there is no standard implementation across cameras (perhaps we can build an ONVIF implementation). You’ll need to create a foscam specific implementation that interacts with the endpoints that are available to do this on your particular camera (see the Lorex implementation for motion examples or the Frigate implementation for smart detections). |
That was it, live view is working with my FOSCAM cameras over RTSP. Thank you so much for the assistance. |
Forgive the drive-by; I'm having a similar issue with a (dirt cheap) Hiseeu device. I'd assumed that it wasn't working because it hasn't got enough oomph to deliver >1 RTSP stream (which is true), so I've added an rtsp-simple-server proxy on the front (which seems to work, I can VLC from my laptop and the timelapse data still works). However, 'live view' for me also doesn't work in the web app (but does in the iPhone protect app). The (proxied) stream is 29.97fps 1920x1080p video, but has no audio. One thing I notice when trying 'live view' on the app is there's a lot of entries:
ffprobe:
ffprobe (proxied):
Any ideas on things I could try? |
@magnayn Have you tried providing us with the |
Ah, interesting - I missed that bit in the thread. It's now working if I add
It is, however, taking quite a lot of CPU to do it (2x ffmpeg streams, ~30% CPU on each) ? |
From your ffprobe output, the camera output is 20fps, not 29.97, so you should try |
Serves me right for reading the VLC information window and trusting it! I think it's 30% of one vCPU if I'm reading it right, so it's probably liveable. It's in a proxmox LXC container. I assume then that basically the reason the 'live' (web) view streams don't work is my camera isn't sending the right metadata about the stream (or it's in a format the protect app isn't happy with) ? Either way, my cheapo camera seems to work a treat, thanks! |
I have the same issue on Debian 10 / ffmpeg version git-2021-07-16-cf12a47. Removing the :fixed_frame_rate_flag=1 from the args made 1 out of 4 cameras work however. |
Can you share a paste of the ffmpeg output you see when this fails? |
pi@raspberrypi:~ $ ffmpeg -nostdin -y -timeout 15000000 -rtsp_transport tcp -i "rtsp://192.168.1.19:554/11" -c:v copy -vbsf "h264_metadata=tick_rate=50:fixed_frame_rate_flag=1" -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=MmRZhrkm7NfV7oMf -f flv - |
+#define infer(name, value) do { \
|
I am having the same issue where live view does not work and I can not view records from the UI.
Any feedback on what I can tweak so I can see records from the web UI? Live view and recordings do work from the iPhone app. |
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. |
This issue has resurfaced for me after being forced to re-image my pi4 onto the latest rasperry pi os bullseye with ffmpeg 4.3.3. Live view is broken without
I'm attaching the full ffmpeg report: ffmpeg-20211223-194638.log I suspect this is related to #124 as it appears to be an issue with the 4.3 version of ffmpeg: the exact same command worked previously on Using a |
try
|
No change to the error, ffmpeg 4.3.3 still crashes in the same way. |
i wonder if its actually a bug then.
was the magic sauce for me on ffmpeg 4.1.8 on debian buster |
@acortelyou Do things start working if you remove the |
@keshavdv ffmpeg doesn't error out if you omit Currently I'm happily using ffmpeg 4.1.4, although I do still get a few frames of video corruption/green bars/blips every couple of minutes that I don't see when using VLC to view the stream. |
I am also running into the same issue, I can see snapshots being updated however live streaming does not work on either web/mobile app. My NVR is some generic brand with analogue cameras being exposed over RTSP. These streams work perfectly with Home Assistant. I have tried the suggested ffmpeg args in this thread, none of them change anything. Main Command: I'm running this in Docker. Based on the logs, the video streams keep being respawned after a couple of seconds. Can provide additional info if required. EDIT:
|
So I am trying this with my UDM Pro and a vStarcam C29 This sort of works for me: I have next to fluid video with a bit of lag of about 1sec. Framerate of the C29 is 7.5fps at high res 1080p (if it even has that). But I keep getting this in the log: "Invalid data found when processing input". Then ffmpeg restarts and it does the same thing over again. By the looks there is minimal impact on video.
Anyone have any idea what is going on there? |
Dang, upgraded the UDM Pro to Protect v1.21.3. Now what was working before no longer does. The picture gets updated but no more streaming. Returning with the following error:
|
Just as FYI - in latest EA Protect 2.0.0-beta.5 - the /devices/add trick does not work anymore to get new adoption tokens. |
If the browser does not work real-time viewing and recording, but they are written. At the same time, everything is in order in the android application. |
Hello, can somebody explain to me how could I use arguments in Docker on Synology NAS? I try to figure it out how to use this arguments bellow to maybe have stream in protect: Thanks in advance. |
yeah, this is a a problem caused by data being interrupted by a broken pipe. I'm thinking Unifi changed something again to thwart 3rd party streams. More in issue 344. #344 |
Hey y'all,
today I tried setting up the proxy server. I have two Reolink cameras. I tried the command for the Reolink NVR and also the "normal" RTSP command as mentioned in the readme. When I look into the protect interface I can see snapshots in the "About" section. However, live view/streaming won't work. I can hear the live audio, but the video feed is stuck on one frame. I read through a bunch of different issues, tried setting the Reolink H264 Profile to "base" and some other tips I read, but nothing seems to fix my issue.
Do you have any ideas/suggestions? Can you please help me out?
//Edit: The BigBuckBunny (Readme) stream works flawless... it's just my cameras that won't work. Btw: resolution is 2560x1920. Does that make a difference? The g3's are 1920x1080 iirc
The text was updated successfully, but these errors were encountered: