acgnhiki / blrec

Bilibili Live Streaming Recorder 哔哩哔哩直播录制
GNU General Public License v3.0
583 stars 40 forks source link

未能正确处理主播掉线、视频流404的情况。 #161

Closed Janet-Baker closed 1 year ago

Janet-Baker commented 1 year ago

在出现以下错误后,会出现后续视频流丢失、软件卡死的情况,不能触发切割,受影响的视频流不能完成元数据写入。不能开启该主播下一次的录制。

错误信息:

备注:该日志后半段During handling of the above exception, another exception occurred: 仅出现在控制台,不会输出到日志文件中。

Exception in thread SegmentFetcher::1070517:
Traceback (most recent call last):
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\blrec\hls\operators\segment_fetcher.py", line 100, in on_next
    data = self._fetch_segment(url)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\tenacity\__init__.py", line 289, in wrapped_f
    return self(f, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\tenacity\__init__.py", line 379, in __call__
    do = self.iter(retry_state=retry_state)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\tenacity\__init__.py", line 314, in iter
    return fut.result()
           ^^^^^^^^^^^^
  File "concurrent\futures\_base.py", line 449, in result
  File "concurrent\futures\_base.py", line 401, in __get_result
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\tenacity\__init__.py", line 382, in __call__
    result = fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\blrec\hls\operators\segment_fetcher.py", line 176, in _fetch_segment
    response.raise_for_status()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://c1--cn-gotcha208.bilivideo.com/live-bvc/210339/live_6689044_2849881/h1686556856.m4s

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "threading.py", line 1038, in _bootstrap_inner
  File "threading.py", line 975, in run
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\blrec\utils\operators\observe_on.py", line 26, in run
    queue.get()()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\blrec\utils\operators\observe_on.py", line 32, in <lambda>
    queue.put(lambda: observer.on_next(value))
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\observer\autodetachobserver.py", line 28, in on_next
    self._on_next(value)
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\blrec\hls\operators\segment_fetcher.py", line 144, in on_next
    observer.on_error(FetchSegmentError(exc))
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\observer\autodetachobserver.py", line 36, in on_error
    self._on_error(error)
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\operators\_do.py", line 64, in _on_error
    observer.on_error(exception)
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\observer\autodetachobserver.py", line 36, in on_error
    self._on_error(error)
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\operators\_do.py", line 64, in _on_error
    observer.on_error(exception)
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\observer\autodetachobserver.py", line 38, in on_error
    self.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\observer\autodetachobserver.py", line 57, in dispose
    self._subscription.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\singleassignmentdisposable.py", line 53, in dispose
    old.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\disposable.py", line 43, in dispose
    self.action()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\observer\autodetachobserver.py", line 57, in dispose
    self._subscription.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\singleassignmentdisposable.py", line 53, in dispose
    old.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\disposable.py", line 43, in dispose
    self.action()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\observer\autodetachobserver.py", line 57, in dispose
    self._subscription.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\singleassignmentdisposable.py", line 53, in dispose
    old.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\compositedisposable.py", line 69, in dispose
    disp.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\serialdisposable.py", line 58, in dispose
    old.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\disposable.py", line 43, in dispose
    self.action()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\observer\autodetachobserver.py", line 57, in dispose
    self._subscription.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\singleassignmentdisposable.py", line 53, in dispose
    old.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\compositedisposable.py", line 69, in dispose
    disp.dispose()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\reactivex\disposable\disposable.py", line 43, in dispose
    self.action()
  File "C:\Users\10632\Downloads\blrec\python\Lib\site-packages\blrec\utils\operators\observe_on.py", line 44, in dispose
    thread.join()
  File "threading.py", line 1109, in join
RuntimeError: cannot join current thread

现象:

之后的某个直播(可能是不同主播)会出现假录制的情况,乍一眼看上去在录制,实际上已经不接收直播流了,文件大小和录制速度均无变化。必须重新启动软件。

Janet-Baker commented 1 year ago

录制的fmp4流上传B站会报转码失败,在本地使用ffmpeg转码后会出现大量报错。

[NULL @ 00000200d89a0d00] Invalid NAL unit size (9232 > 7754).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 7770
[h264 @ 00000200d8a595c0] Invalid NAL unit size (9232 > 7754).
[h264 @ 00000200d8a595c0] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[NULL @ 00000200d89a0d00] Invalid NAL unit size (10363 > 1420).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 1436
[h264 @ 00000200d94cb9c0] Invalid NAL unit size (10363 > 1420).
[h264 @ 00000200d94cb9c0] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[NULL @ 00000200d89a0d00] Invalid NAL unit size (9053 > 646).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 662
[h264 @ 00000200d94cc740] Invalid NAL unit size (9053 > 646).
[h264 @ 00000200d94cc740] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[NULL @ 00000200d89a0d00] Invalid NAL unit size (17789 > 6384).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 6400
[h264 @ 00000200d94cc2c0] Invalid NAL unit size (17789 > 6384).
[h264 @ 00000200d94cc2c0] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[NULL @ 00000200d89a0d00] Invalid NAL unit size (15349 > 15087).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 15103
[h264 @ 00000200d8a5e180] Invalid NAL unit size (15349 > 15087).
[h264 @ 00000200d8a5e180] Error splitting the input into NAL units.
[h264 @ 00000200d8a43bc0] co located POCs unavailable
Error while decoding stream #0:0: Invalid data found when processing input
[NULL @ 00000200d89a0d00] Invalid NAL unit size (14624 > 7554).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 7570
[h264 @ 00000200d8a43bc0] Invalid NAL unit size (14624 > 7554).
[h264 @ 00000200d8a43bc0] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[NULL @ 00000200d89a0d00] Invalid NAL unit size (28283 > 3069).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 3085
[h264 @ 00000200d8a5e180] Invalid NAL unit size (28283 > 3069).
[h264 @ 00000200d8a5e180] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[NULL @ 00000200d89a0d00] Invalid NAL unit size (9733 > 4193).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 4209
[h264 @ 00000200d94cac00] Invalid NAL unit size (9733 > 4193).
[h264 @ 00000200d94cac00] Error splitting the input into NAL units.
[h264 @ 00000200d94cbe40] co located POCs unavailable
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 00000200d94cc2c0] co located POCs unavailable
[h264 @ 00000200d94cb9c0] co located POCs unavailable
[h264 @ 00000200d94cac00] co located POCs unavailable
[h264 @ 00000200d98a0e00] co located POCs unavailable
[NULL @ 00000200d89a0d00] Invalid NAL unit size (15285 > 11107).
[NULL @ 00000200d89a0d00] missing picture in access unit with size 11123
[h264 @ 00000200d98a0e00] Invalid NAL unit size (15285 > 11107).
[h264 @ 00000200d98a0e00] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input