go2rtc icon indicating copy to clipboard operation
go2rtc copied to clipboard

MSE and MP4 based HLS streams render scaled down with a green backdrop on Safari and iOS apps

Open elarsson1 opened this issue 1 year ago • 4 comments

Using go2rtc Home Assistant add-on 1.9.2. Input streams are RTSP via Home Assistant camera entities. WebRTC renders well on all browsers and MSE/HLS render normally on Firefox and Chrome. On Safari and the Home Assistant iOS app, however, when selecting MSE or HLS, the video renders at about a quarter-scale size with a green background. This is reproducible with all MP4 formats, including MP4 snapshot, but not Legacy HLS/TS.

Home Assistant's built in HLS streaming from the Generic Camera RTSP source does not exhibit the issue.

See Safari screenshots below for examples. For these, I am manually selecting the stream type via the go2rtc Web UI:

WebRTC Screenshot 2024-06-01 at 23 25 37

MSE: Screenshot 2024-06-01 at 23 25 48

Modern HLS (MP4): Screenshot 2024-06-01 at 23 27 13

Legacy HLS TS Screenshot 2024-06-01 at 23 27 04

Home Assistant native HLS from the same camera entity: Screenshot 2024-06-01 at 23 40 39

elarsson1 avatar Jun 02 '24 03:06 elarsson1

I think it's camera related problem. I need access to stream or maybe mp4 record will be useful https://alexxit.github.io/go2rtc/api/#tag/Consume-stream/paths/~1api~1stream.mp4?src=%7Bsrc%7D/get

AlexxIT avatar Jun 02 '24 04:06 AlexxIT

Here is a five second clip pulled via /api/steam.mp4.

Interestingly, when this file is opened in Firefox or Chrome, it displays at the expected resolution from the DVR (944x480) If I open it in QuickTime Player or VLC locally, it seems to be a full HD 1920x1080 file with the extra space filled in with the green background.

If I open the RTSP stream directly from the DVR in VLC (same RTSP URL that go2rtc is pulling from), the resolution is recognized correctly as 944x480.

https://github.com/AlexxIT/go2rtc/assets/6099938/96d5ed07-ddfc-4833-bb09-c986b7127ed5

elarsson1 avatar Jun 02 '24 04:06 elarsson1

I have the same issue with my iPad when viewing the camera using the webrtc-camera custom card. It only started when I changed my encoding from H264 to H265. This was on UniFi Protect’s latest update that allowed you to run a new enhanced mode. It was working fine before that and the 2 cameras that were incompatible with the enhanced mode are still working fine. I use the same card on my desktop pc and the image is fine. I think it is some weird apple rendering thing, as the picture glance card from the same camera also displays fine. Hope this info helps

iJuiceman avatar Jun 03 '24 12:06 iJuiceman

Hi, I had the same problem my stream was H264H, I changed to H264 and now is working both in safari and in chrome

notjulian avatar Nov 19 '24 11:11 notjulian

Hi @AlexxIT what info do you need to record to help with this?

I have checked on the go2rtc dashboard, and the MP4 stream does also scale the same way, just like the MSE, with the green background as pictured above

I have 4x feeds into go2rtc (via frigate)

My DVR states the output of each RTSP stream as 1: 1920x1080 @ 25fps 2: 960x576 @ 25fps 3: 1920x1080 @ 25fps 4: 960x576 @ 25fps

The legacy MP4 stream page (loads in a decent timeframe) are all showing as 1920x1080, and it looks as if the program has not detected a smaller stream size on the two lower res feeds. Channel 2 and 4 are both showing as the images above - looks like the 960x576 video is just stuck top left in a green-screen view box with the size 1920x1080

I have checked all 4x streams in VLC (it uses ffmpeg under the hood, and easier with a GUI lol) and the size detected matches the DVR outputs listed above, so it definitely looks as if the streams are outputting the correct resolution as broadcasted.

I've not spotted anything funky when running ps aux | grep ffmpeg either, all pipes seem to be broadcasting the correct resolution image in the CLI commands, there's two of each resolution showing.

I've tried adding the #width=x#height=y filter to the stream, using both resolutions, and neither of those helped.

I am happy to provide any kind of debugging info about these streams, and even possibly realtime access to a stream (if necessary)

Thanks for an awesome program! <3

djpimp2010 avatar Jun 02 '25 21:06 djpimp2010

Today this is known problem https://github.com/AlexxIT/go2rtc/issues/1634

AlexxIT avatar Jun 03 '25 03:06 AlexxIT