home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.25k stars 30.59k forks source link

Cant stream generic camera "Header Missing" #22591

Closed winterscar closed 5 years ago

winterscar commented 5 years ago

Home Assistant release with the issue:

0.90.2

Last working Home Assistant release (if known): NA

Operating environment (Hass.io/Docker/Windows/etc.): Docker on Ubuntu

Component/platform: Stream Component with Generic camera component

Description of problem: When I call the code below, I expect the stream to start playing on my living room chromecast. The chromecast just buffers, and I get a "header missing" error in the logs.

{
  "entity_id": "camera.my_camera",
  "media_player": "media_player.living_room"
}

my_camera is a wyzecam 2 running dafang hacks.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

camera:
  - platform: generic
    still_image_url: https://dafang/cgi-bin/currentpic.cgi
    username: !secret cam_username
    password: !secret cam_pw
    stream_source: rtsp://dafang:8554/unicast
    verify_ssl: false
    name: my_camera
    framerate: 25

stream:

Traceback (if applicable):

Header missing
4:49 PM components/stream/worker.py (ERROR)

Additional information:

wilfredsmit commented 5 years ago

I have the same error message with my dafang cameras. I also have the following line in my home-assistant.log:

2019-04-08 08:51:51 ERROR (stream_worker) [libav.mp3float] Header missing

Besides that the stream is working, but my automations stops responding and the whole system becomes sluggish. My setup:

naitsimp commented 5 years ago

I have the same issue on a RPi3B+ (Hassio v0.91.3) and a dafang camera, my whole system becomes unresponsive. I need to unplug ang plug it in again. I have an automation to record 10 seconds of the stream. 2019-04-11 18:35:07 ERROR (stream_worker) [libav.mp3float] Header missing

At some point I get a file saved, but after a few saved files the system comes unresponsive again:

2019-04-11 18:37:06 ERROR (stream_worker) [libav.mp3float] Header missing
2019-04-11 18:37:06 ERROR (stream_worker) [libav.h264] error while decoding MB 68 13, bytestream -5
2019-04-11 18:37:07 ERROR (stream_worker) [libav.h264] error while decoding MB 34 52, bytestream -11
2019-04-11 18:37:07 ERROR (stream_worker) [libav.h264] error while decoding MB 44 5, bytestream -17
2019-04-11 18:37:07 ERROR (stream_worker) [libav.h264] error while decoding MB 95 19, bytestream -7
2019-04-11 18:37:08 ERROR (stream_worker) [libav.h264] cabac decode of qscale diff failed at 91 21
2019-04-11 18:37:08 ERROR (stream_worker) [libav.h264] error while decoding MB 91 21, bytestream -4
2019-04-11 18:37:08 ERROR (stream_worker) [libav.h264] error while decoding MB 95 17, bytestream -5
2019-04-11 18:37:09 ERROR (stream_worker) [libav.h264] error while decoding MB 16 5, bytestream -29
2019-04-11 18:37:09 ERROR (stream_worker) [libav.h264] error while decoding MB 95 9, bytestream -21
2019-04-11 18:37:09 ERROR (stream_worker) [libav.h264] error while decoding MB 90 19, bytestream -9
2019-04-11 18:37:09 ERROR (stream_worker) [libav.h264] error while decoding MB 90 5, bytestream -7
2019-04-11 18:37:10 ERROR (stream_worker) [libav.h264] error while decoding MB 99 10, bytestream -7
2019-04-11 18:37:11 ERROR (stream_worker) [libav.h264] error while decoding MB 75 18, bytestream -9
2019-04-11 18:37:11 ERROR (stream_worker) [libav.h264] error while decoding MB 86 19, bytestream -9
2019-04-11 18:37:12 ERROR (stream_worker) [libav.h264] error while decoding MB 56 52, bytestream -13
2019-04-11 18:37:12 ERROR (stream_worker) [libav.h264] error while decoding MB 32 4, bytestream -11
2019-04-11 18:37:12 ERROR (stream_worker) [libav.h264] error while decoding MB 40 21, bytestream -11
2019-04-11 18:37:14 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: No dts in packet
2019-04-11 18:38:16 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.dafang_1_take_save_video. Unknown error for call_service at pos 1: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/automation/__init__.py", line 380, in action
    await script_obj.async_run(variables, context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 131, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 210, in _handle_action
    action, variables, context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 299, in _async_call_service
    context=context
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 88, in async_call_from_config
    domain, service_name, service_data, blocking=blocking, context=context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1138, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1160, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 188, in handle_service
    self._platforms.values(), func, call, service_name
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 314, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 330, in _handle_service_platform_call
    await func(entity, data)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/camera/__init__.py", line 677, in async_handle_record_service
    blocking=True, context=call.context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1138, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1160, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/stream/__init__.py", line 114, in async_record
    await async_handle_record_service(hass, call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/stream/__init__.py", line 217, in async_handle_record_service
    .format(recorder.video_path))
homeassistant.exceptions.HomeAssistantError: Stream already recording to /config/www/dafang_1/video/2019-04-11_18.37.03.mp4!
nesty156 commented 5 years ago

Same for me on dafang. Header missing error while decoding MB 30 39, bytestream -21 9:38 components/stream/recorder.py (ERROR) 9:38 components/stream/worker.py (ERROR) I dont see any files saved in my tmp folder.

winterscar commented 5 years ago

UPDATE: Since creating this issue, I've updated to 0.91, and the stream now works. However, I still get Header Missing errors in my log.

JBassett commented 5 years ago

Home Assistant release with the issue: 0.91.3

Last working Home Assistant release (if known): NA

Operating environment (Hass.io/Docker/Windows/etc.): Docker on Unraid

Component/platform: Stream Component with Generic camera component

Description of problem: My dafang camera setup works fine without the stream component enabled. When I try to enable the stream component my Home Assistant system stops responding after viewing the stream. Removing the stream component fixes the issue. I haven't been able to find any errors in the logs, only the system becoming unresponsive.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

camera:
  - platform: generic
    name: Weston's Room
    still_image_url: !secret westons_cam_still
    stream_source: !secret westons_cam_video
    verify_ssl: false
    username: !secret westons_cam_user
    password:  !secret westons_cam_pass
    authentication: basic

stream:

Traceback (if applicable): 2019-04-13 10:08:31 ERROR (stream_worker) [libav.mp3] Header missing

Additional information:

BluGeni commented 5 years ago

@it1515 Do you happen to be using docker?

nesty156 commented 5 years ago

@blugeni Yes i am on docker, and some How Its everything working. files are saving and stream works on Apple TV like a charm. Just the error missing header is still in logs.

BluGeni commented 5 years ago

Oh I thought you were not seeing files saved. Nvm then. Was gonna remind you to add a volume if you want to see files inside a docker container.

BluGeni commented 5 years ago

Added this to my automation to prevent the already streaming error for now:

  condition:
    condition: and
    conditions:
    - condition: template
      value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.record_on_motion_detected_basement.attributes.last_triggered | default(0)) | int > 31)}}'
stale[bot] commented 5 years ago

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 now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

CodeFinder2 commented 4 years ago

UPDATE: Since creating this issue, I've updated to 0.91, and the stream now works. However, I still get Header Missing errors in my log.

Same here...

KennyStier commented 4 years ago

This issue has not been resolved.

I too am running a Wyze Cam with Dafang firmware and get 2020-04-19 14:11:33 ERROR (stream_worker) [libav.mp3float] Header missing in my HA log. The stream will play in Home Assistant, but without audio. The actual RTSP stream audio works.

My Camera Config

camera:
  - platform: generic
    name: Garage Camera
    stream_source: !secret garage_camera_rtsp
    still_image_url: https://192.168.0.181/cgi-bin/currentpic.cgi
    username: root
    password: !secret garage_camera_password
    verify_ssl: false

secrets.yaml

garage_camera_rtsp: rtsp://root:password@192.168.0.181:8554/unicast
garage_camera_password: password
CodeFinder2 commented 4 years ago

Can still confirm this issue, should be reopened.

dsyorkd commented 4 years ago

Same here, please reopen.

dorroddorrod commented 4 years ago

Same here..

madrose commented 4 years ago

I have the same error showing.

jezzamine commented 4 years ago

I have this error, please reopen

Flipsoo commented 3 years ago

pls reopen, same issue here - this is driving me crazy=( using ffmpeg as camera input increases the cpu load like hell so no workaround found yet

benleb commented 3 years ago

wow, maybe we can pass the one year mark with this 🎉

unosakk commented 3 years ago

Having the same issue with Wyze with Dafang camera. everything is working, but the error keeps coming up

Ulrar commented 3 years ago

Same with Dafang, video works but not audio regardless of the codec used.

DarkPark commented 3 years ago

same here

radinsky commented 2 years ago

Same with dafang and 2022.3.7