Closed ruimarinho closed 3 years ago
@uvjustin I don't get the error now but the video sent to telegram is just completely gray:
2021-02-20 10:47:49 INFO (MainThread) [homeassistant.components.automation.record_video_when_hall_front_door_is_opened] Record video when hall front door is opened: Executing step call service
2021-02-20 10:47:49 INFO (MainThread) [homeassistant.components.stream] Started stream: rtsp://xxx:xxxx@xxx:554/Sms=4.unicast
2021-02-20 10:47:50 ERROR (stream_worker) [libav.h264] error while decoding MB 50 63, bytestream -19
2021-02-20 10:48:01 INFO (MainThread) [homeassistant.components.stream] Stopped stream: rtsp://xxx:xxx@xxx:554/Sms=4.unicast
2021-02-20 10:48:01 ERROR (recorder_save_worker) [libav.h264] error while decoding MB 50 63, bytestream -19
2021-02-20 10:48:02 ERROR (recorder_save_worker) [libav.h264] error while decoding MB 50 63, bytestream -19
2021-02-20 10:48:02 ERROR (recorder_save_worker) [libav.h264] error while decoding MB 90 47, bytestream -21
I think the new error might be related to the other issue you opened. If you can, try using TCP instead of UDP. Otherwise, have a look here: https://stackoverflow.com/questions/50063707/ffmpeg-rtsp-error-while-decoding-mb. We might have to have an option to send the buffer size to ffmpeg.
Got it. I don’t think I have an option to configure UDP vs TCP on Synology though...
Just found it's actually possible, but I get the exact same error.
2021-02-20 12:01:47 INFO (MainThread) [homeassistant.components.stream] Started stream: rtsp://xxx:xxx@192.168.1.8:554/Sms=4.unicast
2021-02-20 12:01:49 ERROR (stream_worker) [libav.h264] error while decoding MB 80 14, bytestream -5
2021-02-20 12:02:00 INFO (MainThread) [homeassistant.components.stream] Stopped stream: rtsp://xxx:xxx@xxx:554/Sms=4.unicast
2021-02-20 12:02:00 ERROR (recorder_save_worker) [libav.h264] error while decoding MB 80 14, bytestream -5
2021-02-20 12:02:01 ERROR (recorder_save_worker) [libav.h264] error while decoding MB 80 14, bytestream -5
Actually, the issue is still manifesting itself:
2021-02-20 15:40:00 ERROR (recorder_save_worker) [libav.mp4] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 1698302 >= 1698220
2021-02-20 15:40:00 ERROR (recorder_save_worker) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
File "/usr/src/homeassistant/homeassistant/components/stream/recorder.py", line 68, in recorder_save_worker
output.mux(packet)
File "av/container/output.pyx", line 204, in av.container.output.OutputContainer.mux
File "av/container/output.pyx", line 227, in av.container.output.OutputContainer.mux_one
File "av/container/core.pyx", line 257, in av.container.core.Container.err_check
File "av/error.pyx", line 336, in av.error.err_check
av.error.ValueError: [Errno 22] Invalid argument: '/tmp/camera_nas_1_hall_20210220-153947.mp4'; last error log: [mp4] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 1698302 >= 1698220
2021-02-20 15:40:20 ERROR (MainThread) [root] Uncaught exception
Traceback (most recent call last):
File "av/container/output.pyx", line 25, in av.container.output.close_output
TypeError: 'NoneType' object is not iterable
TypeError: 'NoneType' object is not iterable
@ruimarinho See if the PR that just got merged fixes the issue
@uvjustin it's running beautifully now! I'll be moving the cameras to auto transport (they are in TCP now, but prior to your fix that didn't change anything) and test it again.
The problem
As pointed out by @uvjustin, there seems to be a thread concurrency issue when streaming and recording video at the same time from a Synology Surveillance Station server.
The use case is the following: whenever someones rings at the door, an automation calls
camera.record
and sends a short video to a telegram group.What is version of Home Assistant Core has the issue?
2021.2.1
What was the last working version of Home Assistant Core?
N/A
What type of installation are you running?
Home Assistant Container
Integration causing the issue
SynologyDSM, Stream
Anything in the logs that might be useful for us?