Skip to content
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

Camera Stream to Google Hub has wrong orentation #36290

Closed
silfa718 opened this issue May 30, 2020 · 52 comments
Closed

Camera Stream to Google Hub has wrong orentation #36290

silfa718 opened this issue May 30, 2020 · 52 comments

Comments

@silfa718
Copy link

silfa718 commented May 30, 2020

The problem

When streaming a camera live view to the Google Hub Display the camera is shown in the wrong orientation (landscape instead of portrait)

Environment

  • Home Assistant Core release with the issue: .110.4
  • Last working Home Assistant Core release: .108
  • Operating environment (Home Assistant/Supervised/Docker/venv):
arch x86_64
chassis desktop
dev false
docker true
hassio true
host_os Ubuntu 18.04.4 LTS
installation_type Home Assistant Supervised
os_name Linux
os_version 5.3.0-53-generic
python_version 3.7.7
supervisor 225
timezone America/New_York
version 0.110.4
virtualenv false

Problem-relevant configuration.yaml

Traceback/Error logs

No errors stream related. 

Additional information

I can confirm this was working up until .108, I can't remember if it worked on .109.
Tested with two different cameras (Axis and reolink) and two different Google Hubs, which I know worked up before.
If I log into the camera's web UI the orientation is correct and it is shown correctly in HA Lovelace UI.
My doorbell camera (Doorbird) streams correctly.

@probot-home-assistant
Copy link

cast documentation
cast source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @emontnemery, mind taking a look at this issue as its been labeled with a integration (cast) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@Codelica

This comment has been minimized.

@silfa718
Copy link
Author

silfa718 commented Jun 7, 2020

I'm able to stream, but it still has the wrong orientation.

@cydia2020

This comment has been minimized.

@silfa718
Copy link
Author

Seeing the same results in 0.111.0b5.

@emontnemery
Copy link
Contributor

@silfa718 Which is same result, that the stream still has wrong orientation or do you now see same issue as cydia2020 and codelica?

@emontnemery

This comment has been minimized.

@Codelica

This comment has been minimized.

@cydia2020
Copy link

This seems to only happen to specific cameras, namingly Hikvision ones.

@silfa718
Copy link
Author

@silfa718 Which is same result, that the stream still has wrong orientation or do you now see same issue as cydia2020 and codelica?

Wrong orientation.

@Codelica
Copy link

Are your cameras configured directly (no NVR) using Home Assistant's Generic IP Camera configuration (vs ONVIF) ?

I have Hikvision cameras and NVRs connected via Generic IP Camera config and they all have the correct orientation in Google Hub streams. So trying to see if it's maybe a certain HA integration, or certain newer/older Hikvision models, etc.

For configuration I use URLs like:
rtsp://hass:<some-password>@192.168.1.60:554/Streaming/Channels/101

And have the following Hikvision models:
DS-2CD2T42WD-I5
DS-2CD2042WD-I
DS-2CD2432F-IW
DS-7716NI-SP16 (NVR)

@cydia2020
Copy link

cydia2020 commented Jun 11, 2020

Are your cameras configured directly (no NVR) using Home Assistant's Generic IP Camera configuration (vs ONVIF) ?

I have Hikvision cameras and NVRs connected via Generic IP Camera config and they all have the correct orientation in Google Hub streams. So trying to see if it's maybe a certain HA integration, or certain newer/older Hikvision models, etc.

For configuration I use URLs like:
rtsp://hass:<some-password>@192.168.1.60:554/Streaming/Channels/101

And have the following Hikvision models:
DS-2CD2T42WD-I5
DS-2CD2042WD-I
DS-2CD2432F-IW
DS-7716NI-SP16 (NVR)

Manual Configuration works (streams) fine using RTSP streams, only Hikvision cameras added using the Onvif integration stream in wrong orientation.

I have these cameras:
Hikvision DS-2CD3T46DWD-L
Hikvision DS-2CD3T46WD-I5

@lstg
Copy link

lstg commented Jun 11, 2020

Similar orientation issue for me using ONVIF with Reolink E1 Pro

@silfa718
Copy link
Author

Are your cameras configured directly (no NVR) using Home Assistant's Generic IP Camera configuration (vs ONVIF) ?

I have Hikvision cameras and NVRs connected via Generic IP Camera config and they all have the correct orientation in Google Hub streams. So trying to see if it's maybe a certain HA integration, or certain newer/older Hikvision models, etc.

For configuration I use URLs like:
rtsp://hass:<some-password>@192.168.1.60:554/Streaming/Channels/101

And have the following Hikvision models:
DS-2CD2T42WD-I5
DS-2CD2042WD-I
DS-2CD2432F-IW
DS-7716NI-SP16 (NVR)

Mine are configured with the Axis integration (official) and Reolink via a custom integration.

@emontnemery
Copy link
Contributor

emontnemery commented Jun 14, 2020

@silfa718 Can you confirm the orientation is correct if you go back to 0.108?

@silfa718
Copy link
Author

@silfa718 Can you confirm the orientation is correct if you go back to 0.108?

@emontnemery Went back to .109 and.108 and the issue is still happens, wrong orientation.

Restored my oldest snapshot which was .103 and the issue still happens, wrong orientation.

Perhaps something changed with how Google Hub handles the stream?

@cydia2020
Copy link

@silfa718 Can you confirm the orientation is correct if you go back to 0.108?

@emontnemery Went back to .109 and.108 and the issue is still happens, wrong orientation.

Restored my oldest snapshot which was .103 and the issue still happens, wrong orientation.

Perhaps something changed with how Google Hub handles the stream?

Temp. solution is to add the camera's rtsp stream with the ffmpeg integration

@quacka6
Copy link

quacka6 commented Jun 20, 2020

I also have this problem with hikvision camera I just purchased. Old cheaper TP-Llink camera works fine using ONVIF.
Tried adding a generic camera using RTSP ffmpeg but it still don't work? Do I need to completely remove the device with its ONVIF integration for this to work?

@cydia2020
Copy link

Yeah you should remove the onvif integration and use the camera with an rtsp stream only before the problem is fixed

@quacka6
Copy link

quacka6 commented Jun 20, 2020

just did that and still getting rotated videos.

camera:
  - platform: ffmpeg
    name: hikvision
    input: rtsp://username:password@192.168.12.14:554/Streaming/Channels/101

@Codelica
Copy link

Not sure if this is Hikvision model/firmware dependent, but you may want to try the Generic IP Camera route -- https://www.home-assistant.io/integrations/generic_ip_camera/ That works for me without rotated video on Google Hubs.

@quacka6
Copy link

quacka6 commented Jun 22, 2020

I got Hikvision DS-2CD2347G1-LU camera.
Tried generic camera same problem. I can cast to my Sony Android TV fine though. Too bad it takes like 1 minute to startup as the TV is too slow to switch input.

@quacka6
Copy link

quacka6 commented Jul 12, 2020

no update on how to overcome this? tried generic and ffmpeg without success. Would love to have a front door camera display without changing to a new camera.

@timmo001
Copy link
Contributor

timmo001 commented Aug 16, 2020

I've also noticed this happened. Although now, I am unable to play the stream on the cast device at all. I'll open another issue on this one, it could well be a setup issue on my part

What was the last version of HA that streamed correctly for you?

Unsure, I would assume the version mentioned above, where the image was rotated 90° but now doesn't show at all. The camera is the Reolink RLC-420 5MP

@leofuscaldi

This comment has been minimized.

@probot-home-assistant
Copy link

onvif documentation
onvif source
(message by IssueLinks)

@balloob
Copy link
Member

balloob commented Oct 1, 2020

Labeled this as ONVIF because #36290 (comment) shows that configuring the camera as a generic camera works, but when streamed via ONVIF the orientation is wrong.

@hunterjm
Copy link
Member

hunterjm commented Oct 2, 2020

Turn debug logging for stream on and configure the generic camera with the RTSP stream URL from the logs. Also check that stream URL in VLC. Lastly, did this clear up with the latest version using the new Home assistant cast app?

@timmo001
Copy link
Contributor

timmo001 commented Oct 11, 2020

I've found that generic camera and onvif are both the same in this case. Both cast streams with the image rotated clockwise.

Maybe the ffmpeg arguments are not being passed correctly?

async_handle_play_stream_service camera stream options: (camera.stream_options)

{'rtsp_transport': 'tcp'}

stream request_stream options:

{'rtsp_flags': 'prefer_tcp', 'stimeout': '5000000', 'rtsp_transport': 'tcp'}

This could be an issue with the stream/media_player component (or maybe even its a bug with the Chromecast itself) as whenever I play a recorded camera video via the new media player functionality, the video is rotated. Images are oriented correctly

@stboch
Copy link
Contributor

stboch commented Oct 12, 2020

@timmo001 When I play the lower resolution video I get the correct rotation is this something you experience as well _substream
-- Edit:
It looks like this issue is with the google.cast.media receiver, VLC uses the same receiver and experiences that same ratio / rotation issue. I think this is an artifact of it trying to handle the higher resolution video but poorly.

@timmo001
Copy link
Contributor

timmo001 commented Oct 12, 2020

@timmo001 When I play the lower resolution video I get the correct rotation is this something you experience as well _substream

Yep, the lower resolution and bitrate seems to solve it. (with the fix above)

-- Edit:
It looks like this issue is with the google.cast.media receiver, VLC uses the same receiver and experiences that same ratio / rotation issue. I think this is an artifact of it trying to handle the higher resolution video but poorly.

Is there a place to raise this to Google? Unless we are planning to workaround this somehow with our own implementation of a receiver which I've seen mentioned for media playback.

@Codelica
Copy link

FWIW, I'm using 1080P 5 Mbit h.264 primary (aka "clear") streams from Hikvision cameras and a Hikvision NVR to my Google Home Hubs just fine -- proper rotation. I see other brands mentioned here (Reolink), but as far as Hikvision goes, it seems like it's probably firmware/model/etc dependent. I'm using the Generic IP camera integration. Also, probably a long-shot, but Hikvision's do have a "rotate" option in their camera configuration parameters in case that's somehow involved.

@kintaroju
Copy link

Hi,

I'm having this rotation issue, when casting to my google nest hub max, but when i cast to a regular device, like my vizio p55 cast enabled device, it is buffering indefinitely.

The way I have the cameras streaming to my devices is via the synology_dsm plugin that has been recently been updated to allow streaming cameras via surveillance station natively, so now it exposes my camera easily and natively via google home.

@PhilRW
Copy link
Contributor

PhilRW commented Oct 21, 2020

I can confirm that using the lower-resolution substream on my Hikvision cameras is a workaround.

@TazUk
Copy link

TazUk commented Nov 29, 2020

I came across this issue today after upgrading one of my UnifiProtect cameras and casting to a Google Nest Home Hub Max.
I'm using the UnifiProtect custom component and with a UVC-G4-Bullet rtsp stream of 2688x1512 (max resolution) enabled the stream is rotated 90 degrees on the hub but plays in the correct orientation on various Gen2+ Chromecasts.

The workaround for UnifiProtect was to disable the maximum RTSP resolution stream in the controller and enable the medium resolution (1280x720) in it's place.

@royduin
Copy link
Contributor

royduin commented Dec 3, 2020

I've the same issue with a Hikvision DS-2CD2142FWD-I. With all options I've tried and mentioned the rotation is incorrect except with the substream, but that's low quality.

@Codelica
Copy link

Codelica commented Dec 3, 2020

@royduin I'm using a variety of Hikvision DS-2CD models including several DS-2CD2042WD-I. (notice no F) set to 1080P/30fps for the full stream which work fine with my Google Hub Minis. I am using HA's Generic IP Camera route though, not ONVIF. Might be worth a try if you're not using that.

@royduin
Copy link
Contributor

royduin commented Dec 4, 2020

Using the generic camera now with the substream as the main stream has a higher resolution for Zoneminder. Main stream is rotated.

@adamoutler
Copy link
Contributor

I'm just here to me too!
I have 7 cameras.
2- 4k cameras are rotated 90°
3- 1080 cameras are not rotated and display fine
1- 1080 camera is expected to be rotated 90° and does not display at all
1- 1024x768 does not display at all via Google

All cameras come from a shinobi instance from my own server and display properly within Home Assistant.

@stboch
Copy link
Contributor

stboch commented Jan 18, 2021

The rotation bug is an issue with the Google chromecast media app, as of right now it appears the intent is "Won't fix"

@adamoutler
Copy link
Contributor

After further examination of the problem, I've found this issue to be related to Google Home Hub and not necessarily the Cast functionality. My cameras are working properly on Chromecast
PXL_20210118_143433489 MP

@sh00t2kill
Copy link

sh00t2kill commented Feb 10, 2021

Also having this problem with a google nest hub.

using generic camera platform and an rtsp stream source. Cameras are Dahua and the rstp stream is from an NVR

I have a cheap camera of whic h i dont have the model on me at the moment, also using rstp but directly from the camera, and it works.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 11, 2021
@eloebl
Copy link

eloebl commented May 11, 2021

This is still a problem for me with HA 2021.5.2 ,the ONVIF cameras seem to be the most problematic for me, however a single Amcrest (non-ONVIF) camera seems to be working fine.

@jjmuriel
Copy link

jjmuriel commented Jul 8, 2021

It is a problem for me with Hikvision DS-HD1 via ONVIF Integration and Amcrest Camera IP4M-1051 via Amcrest Integration, when casting to Google Home Hub with firmware 241809 and cast firmware 1.52.241809. I don't have this issue with a Wyze Cam V2 with the Official RTSP firmware and ffmpeg Integration.

Version | core-2021.7.1

Installation Type | Home Assistant Supervised

@github-actions
Copy link

github-actions bot commented Oct 6, 2021

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests