Closed nettosama closed 4 years ago
Can you open up the master_playlist.m3u8 file and share what you are getting for the codec string? From @stboch 's comment in the other issue my suspicion is that the codec string corresponds to a profile > 4.1 and the home hub is just aborting there. It's more of a problem on their end but we can work around it by pinning the string to a lower profile number (maybe only to cast devices).
@uvjustin yeah I had tested one of my res public feed cameras they are working since they are a lower format level.
It looks like to get the better error need to handle the pychromecast error that is getting thrown. Code 110.
My higher level feeds are getting rejected tried on 3 different types of cameras all 2mp+
Thoughts on my end are this 1. Camera.play_stream has format option perhaps leveraging this for lower level feeds. Same thing on the trait definition, which ever feed getting assigned to the trait be a lower level feed.
This is inside master_playlist.m3u8:
#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=12390816,CODECS="avc1.640032,mp4a.40.2"
playlist.m3u8
And in playlist.m3u8:
#EXTM3U
#EXT-X-VERSION:7
#EXT-X-TARGETDURATION:2
#EXT-X-MAP:URI="init.mp4"
#EXT-X-MEDIA-SEQUENCE:47
#EXTINF:2.0100,
./segment/47.m4s
#EXTINF:1.9710,
./segment/48.m4s
#EXTINF:2.0000,
./segment/49.m4s
cast documentation cast source (message by IssueLinks)
Hey there @emontnemery, mind taking a look at this issue as its been labeled with an integration (cast
) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
@nettosama That's AVC profile 5, so this corroborates my suspicion. @stboch Since your lower resolution streams work this also goes along with the theory. It's either the codec profile or the bandwidth number. I'm guessing it's the codec profile - maybe the device doesn't support the max specs of a AVC profile 5 stream, but it can play a lower framerate avc profile 5 camera stream. I'll make a PR to work around this.
See whether this PR works
Just tested #41592, and now it works!
I still have an issue where all cameras are rotated 90 degrees when casting, but that must be something else.
@uvjustin Tested two camera feeds, first one doesn't play and cycles out, second one plays with no audio video. Let me know what other information I can provide to try and troubleshoot further
Does not play and presents an error in chromecast.
2020-10-10 18:39:32 DEBUG (Thread-11) [pychromecast.socket_client] [Master Bedroom TV 2(10.1.2.2):8009] Received: Message urn:x-cast:com.google.cast.media from bb7ee2d7-af14-4c04-aeb8-e9ba50d430c5 to *: {'type': 'ERROR', 'detailedErrorCode': 102, 'itemId': 1}
Plays but no video or audio is displayed
@stboch Both these streams worked on that chromecast device in 0.114?
I'll need to do a roll back test on the one ezviz doorbell as I installed it after the upgrade to .115 beta however the other reolink camera did work before.
So as I understand it, lower resolution streams work on this device, but these two higher resolution streams aren't working. The two non working streams have different types of errors. At least one of these streams did work on 0.114. Which model of chromecast device is it? Which stream corresponds to which error?
@uvjustin I have two chromecast based devices tested. Chromecast 2nd generation 1.42.172094 Vizio p65 chromecast built-in TV 1.40.169511
The Ezviz device was the second one listed where it didn't error but no video and audio was displayed but the cast.media frame made it appear it was playing.
The reolink camera is the one that provided the chromecast error shown above. And while the cast.media namesake loaded the video never played and errors during the loading phase.
So neither of the streams work on either the chromecast v2 or on the Vizio TV? But lower resolution streams work on both the chromecast v2 and the Vizio TV?
Correct and in the past the reolink camera had as well.
I have several low res public traffic cameras that still play fine.
Are you on 0.116.2?
No applied your fix to .116.1 I didn't see any other pr's that were merged that would affect this.
Also both camera's are ONVIF incase that helps you.
@stboch I'm stumped. It's strange that it's occurring both across different chromecasts and different cameras. Those devices seem fairly common so we should expect to see more people with the same issue soon. It's also strange that one of the cameras was working previously and that the things that we have investigated to address what has changed (master playlist + fmp4 format) don't work. I looked on the Google issue tracker and these issues might be related: https://issuetracker.google.com/issues/170471455 https://issuetracker.google.com/issues/162347588
What happens if you disable audio on the camera feeds?
Made a change which reduces the bandwidth we report in the master playlist. See if this helps at all.
Camera is a RLC-410-5MP I tried editing the stream settings on the camera side to see if I can bring them down to a workable level. The lowest resolutions, and max bandwidth did not get it to function also disabled audio and still non-functional.
both camera feeds have a low-res version and both these feeds work fine, btw so it is not a camera stream issue between those two things.
Let me know if you have any other places I should pull logs from that might give more insight into what's going on.
hey @timmo001 I noticed you said your was fixed with the RLC-420-5MP, what is your encoding settings set to and what version of the firmware are you runnning?
@stboch One more thing you can try is to change MIN_SEGMENT_DURATION
to something less than 1 (say 0.9) here: https://github.com/home-assistant/core/blob/f787289ea0e00c4dfa73ebba81d7367dcc726b8e/homeassistant/components/stream/const.py#L19 .
The old versions used a segment duration of 1 which is not optimal but might use less memory.
Not sure if the issue is the resolution, while the codec is getting the videos to play the final resolutions from the video are still well into and above the 4k range. not sure if there is any way to force the size scale down? not sure if this is it, as the min_segment didn't work. I don't know enough about the chromecast to know if it supposed built in downscale.
Given as you had the stream working previously, the player should be able to handle the codec/resolution, as that hasn't changed. But yes, your stream is probably close to the limits of the device (and the real codec profile given by the camera is above that supported by the chromecast) and maybe the changes we made were just enough to make it not work. Can you try rolling back and confirming that the old versions still work and whether they work with both of the problematic cameras? The stream component isn't going to do any video transcoding, but if you have the powerful enough hardware you could try transcoding with the ffmpeg component.
I can confirm that #41592 fixes this for me on Google Home Display and Google Chromecast devices for Reolink RLC-410-5M and RLC-520 cameras, using Synology DSM interation, reolink custom component, generic and ffmpeg integration. All are currently tested and working with sub stream (lower resolution). After I get back home from work I'll try main stream with higher resolution and with audio.
@BeardedTinker Honestly I'm surprised that @stboch had a 5MP stream working on the older chromecast devices. I wouldn't expect it to work, but it might work on the Nest devices (Those might be limiting their profiles based on their screen size and not on their processing power). For regular chromecast devices you'd think the supported profiles would be fairly indicative of what they are capable of, and a 5MP stream exceeds those specs by a lot (albeit with a lower framerate).
@stboch Mostly defaults. Bitrate 6144 kbps, High H.264 profile 2560x1920
Working with main feed on nest hub with #41592 fix (with audio)
@timmo001 Do you have the rotation issue? I just tested the high stream on my Nest Hub, (just hadn't tested there to date) it is working on this device. still waiting rolling back my dev instance. I think we can close this issue with the PR that was approved I will work to see if I can find some tweaks that will get the high stream to properly downscale for the chromecast.
@timmo001 Do you have the rotation issue?
Yes, I've detailed it here:
https://github.com/home-assistant/core/issues/36290#issuecomment-706729469
I think we can close this issue with the PR that was approved I will work to see if I can find some tweaks that will get the high stream to properly downscale for the Chromecast.
I think this will be a case of scaling the stream down based on the device:
The problem
After the changes in #40483, specifically commit cf15a32f59d44dcf7fd5373aa48fbf9ca6d9c5d1 on file components/stream/hls.py, streaming any of my cameras (generic, amcrest) starts the casting app on the Home Hub, but no video nor audio plays. Regular casting works, like images from the Media Browser and Lovelace panels.
Environment
Problem-relevant
configuration.yaml
Traceback/Error logs
Additional information
I copy pasted the file components/stream/hls.py before #40483, and the camera streams correctly again. so apparently something here breaks the stream, even if the log seems to indicate an error in the url.