Repository: streamlink/streamlink (python)

Issue:
plugins.nicolive: Failed to create decryptor: Unable to open URL

### Checklist

- [x] This is a [plugin issue](https://streamlink.github.io/plugins.html) and not [a different kind of issue](https://github.com/streamlink/streamlink/issues/new/choose)
- [x] [I have read the contribution guidelines](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink)
- [x] [I have checked the list of open and recently closed plugin issues](https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+issue%22)
- [x] [I have checked the commit log of the master branch](https://github.com/streamlink/streamlink/commits/master)

### Collaboration

- [x] [I will provide feedback should a pull request be opened with a fix for the plugin](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#pull-request-feedback)

### Streamlink version

8.2.1+8.ge0dbc9a1

### Description

When recording a Niconico Live (nicolive) stream, the recording stops unexpectedly even though the stream is still ongoing.

Switching from the Windows builds version 8.2.1 to the PyPI package (master branch) version 8.2.1+8.ge0dbc9a1 did not resolve the issue.

I also tried specifying a newer version of FFmpeg instead of the bundled one, but the issue still persists.

The recording stops midway even when using a session key or password.
It also stops when running without any account information.

However, I noticed one thing:
When recording while watching the stream in a browser, the recording is more likely to stop if playback freezes or if the page is reloaded (e.g., pressing F5).
Closing the page being viewed, or seeking back about 40 seconds before starting playback, makes the recording significantly more stable.

### Debug/trace log

```text
PS C:\Users\****> streamlinkpipx https://live.nicovideo.jp/watch/lv349584107 --loglevel trace --ffmpeg-ffmpeg D:\CUI_tool\ffmpeg\ffmpeg.exe
[00:39:34.255836][MainThread][session][debug] Loading plugin: nicolive
[00:39:34.547025][MainThread][cli][debug] OS:         Windows 11
[00:39:34.547223][MainThread][cli][debug] Python:     3.14.3
[00:39:34.547540][MainThread][cli][debug] OpenSSL:    OpenSSL 3.0.18 30 Sep 2025
[00:39:34.547657][MainThread][cli][debug] Streamlink: 8.2.1+8.ge0dbc9a1
[00:39:34.547802][MainThread][cli][debug] Dependencies:
[00:39:34.551052][MainThread][cli][debug]  certifi: 2026.2.25
[00:39:34.553349][MainThread][cli][debug]  isodate: 0.7.2
[00:39:34.554750][MainThread][cli][debug]  lxml: 6.0.2
[00:39:34.556414][MainThread][cli][debug]  pycountry: 26.2.16
[00:39:34.557884][MainThread][cli][debug]  pycryptodome: 3.23.0
[00:39:34.559362][MainThread][cli][debug]  PySocks: 1.7.1
[00:39:34.560818][MainThread][cli][debug]  requests: 2.32.5
[00:39:34.562511][MainThread][cli][debug]  trio: 0.33.0
[00:39:34.563965][MainThread][cli][debug]  trio-websocket: 0.12.2
[00:39:34.565880][MainThread][cli][debug]  urllib3: 2.6.3
[00:39:34.567105][MainThread][cli][debug]  websocket-client: 1.9.0
[00:39:34.567277][MainThread][cli][debug] Arguments:
[00:39:34.567365][MainThread][cli][debug]  url=https://live.nicovideo.jp/watch/lv349584107
[00:39:34.567450][MainThread][cli][debug]  --loglevel=trace
[00:39:34.567551][MainThread][cli][debug]  --output=F:\work\streamlink\[{time:%Y-%m-%d}] [{author}] {title} [{id}].ts
[00:39:34.567662][MainThread][cli][debug]  --default-stream=['best']
[00:39:34.567773][MainThread][cli][debug]  --ffmpeg-ffmpeg=D:\CUI_tool\ffmpeg\ffmpeg.exe
[00:39:34.567919][MainThread][cli][info] Found matching plugin nicolive for URL https://live.nicovideo.jp/watch/lv349584107
[00:39:34.568090][MainThread][cache][trace] Loading cache file: C:\Users\****\AppData\Roaming\streamlink\plugin-cache.json
[00:39:34.568590][MainThread][plugins.nicolive][debug] Restored cookies: user_session
[00:39:34.568775][MainThread][plugins.nicolive][info] Logging in via cached user session cookie
[00:39:35.162527][Thread-NicoLiveWsClient-1][plugin.api.websocket][debug] Connecting to: wss://a.live2.nicovideo.jp/wsapi/v2/watch/118285666070?audience_token=17964031_118285666070_1774280376__fe14d04543a0e541fdc3f9d96229a4f5bcb68e76&frontend_id=9
[00:39:35.162637][MainThread][plugins.nicolive][debug] Waiting for permit (for at most 6 seconds)...
[00:39:35.463392][Thread-NicoLiveWsClient-1][websocket][debug] --- request header ---
[00:39:35.463593][Thread-NicoLiveWsClient-1][websocket][debug] GET /wsapi/v2/watch/118285666070?audience_token=17964031_118285666070_1774280376__fe14d04543a0e541fdc3f9d96229a4f5bcb68e76&frontend_id=9 HTTP/1.1
Upgrade: websocket
Host: a.live2.nicovideo.jp
Origin: https://a.live2.nicovideo.jp
Sec-WebSocket-Key: YuPVacOTv5P0l8xuTPoAJA==
Sec-WebSocket-Version: 13
Connection: Upgrade
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36


[00:39:35.463725][Thread-NicoLiveWsClient-1][websocket][debug] -----------------------
[00:39:35.463812][Thread-NicoLiveWsClient-1][websocket][debug] --- response header ---
[00:39:35.489965][Thread-NicoLiveWsClient-1][websocket][debug] HTTP/1.1 101 Switching Protocols
[00:39:35.490187][Thread-NicoLiveWsClient-1][websocket][debug] Connection: upgrade
[00:39:35.490358][Thread-NicoLiveWsClient-1][websocket][debug] Date: Sun, 22 Mar 2026 15:39:36 GMT
[00:39:35.490462][Thread-NicoLiveWsClient-1][websocket][debug] upgrade: websocket
[00:39:35.490589][Thread-NicoLiveWsClient-1][websocket][debug] sec-websocket-accept: ztQm1+2w63h1vFbhyyLP+CA8+E8=
[00:39:35.490687][Thread-NicoLiveWsClient-1][websocket][debug] server: istio-envoy
[00:39:35.490797][Thread-NicoLiveWsClient-1][websocket][debug] X-Cache: Miss from cloudfront
[00:39:35.490941][Thread-NicoLiveWsClient-1][websocket][debug] Via: 1.1 f874b4fe7d91ecfa31e296942e898d14.cloudfront.net (CloudFront)
[00:39:35.491058][Thread-NicoLiveWsClient-1][websocket][debug] X-Amz-Cf-Pop: NRT20-P2
[00:39:35.491214][Thread-NicoLiveWsClient-1][websocket][debug] X-Amz-Cf-Id: YwBybgz5ALza0NJnRiCUdlLdb7yksYmkSWZbNEUHAbZNRfGapW3C_w==
[00:39:35.491299][Thread-NicoLiveWsClient-1][websocket][debug] -----------------------
[00:39:35.491437][Thread-NicoLiveWsClient-1][websocket][info] Websocket connected
[00:39:35.491520][Thread-NicoLiveWsClient-1][plugin.api.websocket][debug] Connected: wss://a.live2.nicovideo.jp/wsapi/v2/watch/118285666070?audience_token=17964031_118285666070_1774280376__fe14d04543a0e541fdc3f9d96229a4f5bcb68e76&frontend_id=9
[00:39:35.491653][Thread-NicoLiveWsClient-1][websocket][debug] ++Sent raw: b"\x81\xfe\x00\xb5\xe6!\x0fF\x9d\x03{?\x96D-|\xc4R{'\x94UX'\x92Bg/\x88F-j\xc4En2\x87\x035=\xc4R{4\x83@bd\xdcZ-7\x93@c/\x92X-|\xc4@m4\xc4\r-6\x94N{)\x85Ncd\xdc\x03g*\x95\x03#d\x8a@{#\x88Bvd\xdc\x03g/\x81I-j\xc4Bg'\x95D_*\x87X-|\x80@c5\x83\\#d\x94N`+\xc4\x1btd\x96S`2\x89B`*\xc4\x1b-1\x83C\\)\x85Jj2\xc4\r-%\x89Lb#\x88Un$\x8aD-|\x92Sz#\x9b\r-4\x83B`(\x88Dl2\xc4\x1bi'\x8aRj;\x9b"
[00:39:35.491740][Thread-NicoLiveWsClient-1][websocket][debug] ++Sent decoded: fin=1 opcode=1 data=b'{"type":"startWatching","data":{"stream":{"quality":"abr","protocol":"hls","latency":"high","chasePlay":false},"room":{"protocol":"webSocket","commentable":true},"reconnect":false}}'
[00:39:35.491981][Thread-NicoLiveWsClient-1][websocket][debug] ++Sent raw: b'\x81\xb0\x90|\xfc\\\xeb^\x88%\xe0\x19\xdef\xb2\x1b\x99(\xd1\x17\x9d/\xf8\x15\x9f~\xbc^\x98=\xe4\x1d\xdef\xeb^\x9f4\xf1\x0f\x99\x0c\xfc\x1d\x85~\xaa\x1a\x9d0\xe3\x19\x81!'
[00:39:35.492095][Thread-NicoLiveWsClient-1][websocket][debug] ++Sent decoded: fin=1 opcode=1 data=b'{"type":"getAkashic","data":{"chasePlay":false}}'
[00:39:35.588109][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81J{"type":"serverTime","data":{"currentMs":"2026-03-23T00:39:36.625+09:00"}}'
[00:39:35.588364][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"serverTime","data":{"currentMs":"2026-03-23T00:39:36.625+09:00"}}'
[00:39:35.588538][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"serverTime","data":{"currentMs":"2026-03-23T00:39:36.625+09:00"}}
[00:39:35.588735][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81-{"type":"seat","data":{"keepIntervalSec":30}}'
[00:39:35.588844][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"seat","data":{"keepIntervalSec":30}}'
[00:39:35.588945][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"seat","data":{"keepIntervalSec":30}}
[00:39:35.589121][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81~\x12\x8d{"type":"stream","data":{"uri":"https://livedelivery.dlive.nicovideo.jp/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a/multivariant/variant.m3u8","syncUri":"https://livedelivery.dlive.nicovideo.jp/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a/multivariant/stream_sync.json","quality":"abr","availableQualities":["abr","6Mbps1080p30fps","super_high","high","normal","low","super_low","audio_high"],"protocol":"hls","cookies":[{"name":"session","value":"3b77d1a71232b97eecb96bb00220365459782dde39b04f4a0000000069c15eb89ffca2d62d208e29","expires":"Mon, 23 Mar 2026 15:39:36 GMT","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9wbGF5bGlzdHMvNjliZmY4M2YxNjkzOTI5MGIzMTg2NTcyLzU5NzgyZGRlMzliMDRmNGEvKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTc3NDI4MDM3Nn19fV19","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Signature","value":"lsl~bKSyLOhGXzwBs59l24L2NJxkyHKsaWBcsUa7qE0hu1xyPTI1uLUZxNMe90VbXq4dF49a3efAQZTwCZcqo1q~dWZBf-cnI~vO7AFhYbsdY~fgkslRF7T6j9F4mZqZhcdZTrzYkOZm-kgBY4UVNnUvxoNIZhe7kh3F~q6tyLsS6ko79K8vBpiJ1qEjuLyJfZxfJyRNCqYBSVT6po3T-NMzSXHR6qGB4Mv~6yx2ke6zl5Q2N5~er4CAEuHN7YvDYxuc49DhpmGglRfm08n1IqTcLXz4cBioDOiec3AOTJlypkiqJEneEQhDbjyue9RVIeKihTZUvBgA-ndKZd5V7A__","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9zZWdtZW50cy82OWJmZjgzZjE2OTM5MjkwYjMxODY1NzIvdmlkZW8vMSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Signature","value":"ICDTkinuI4KcbFmcDZd9QksGy3hfhw9BbxRmp0M4~b1Vc3kI5HeBbT59bctwOgp2YhaWd6v~Pe10hI1TPi6QI503-EUxxq23bTPLDfgkEIp0HQdYpm8svSdkw1I6iB-QiHZA8eurhiaJKtpZDRtSgn4M4-~K1nl5dbvvyiUD3TnqWJAX7MMtk~F4A7DV3ttZerY9lEUViEmKNI1IHL~X-ULRQaoNCmh1MfRBcwIOtU~BqILOM4eSCewD8ZCMEBZy~~T9~-y6qIW46OYo9zo-3GQxSmJthHgOoQgg7eqdoRFcxeTgDUbIk~fpYAg4F~ggI0lXHZuuYLA~OupGe8x4zA__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9zZWdtZW50cy82OWJmZjgzZjE2OTM5MjkwYjMxODY1NzIvYXVkaW8vMSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Signature","value":"p8upfgcm66T5dFafdbV9Hl4Hu4pdiLu267lgPCdhGjjQSz~7WJ3FvIeDovI59m-dB7B-T-kCen6voCb2A0J3rqoJ3Ae5Et8~JDjLaWY6h7PvwmRR8a6Z3leelgU6lSCxWnatshpW6YVU9NSmNzO9JH5LSMGDlSJrONyLSpsAdlN0oUNWwCsToa4tKK78-Og~dvTKJkvEAa2dyffh732YUlq3cXxF-4aA2Dnn8X8HtOar~Zr~ysQF2bPUYAyyciGUTy22~SNYLb1tiFGXnTsCREcSQQ0mV~y1yMTBBZu1JHIpqLdDfnDMjq8yXuW7vmQsG2c2Chvva43CXv~96fViTA__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9rZXlzLzY5YmZmODNmMTY5MzkyOTBiMzE4NjU3Mi81OTc4MmRkZTM5YjA0ZjRhLyoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Signature","value":"GBbYcl7xo-jMQqmIobORHLxcJATnq3c9Ir9e2KNnrlusiFgSFz9fVDzfKcX0UsscimZ6dxb~C6CA3-SeHpiqRTYTR2zlIuj~gbAUbvLczAT7~e~Gx8WTONc4weB5DVmldL0BwoDE1GgcbZwIwbbijMZoep4LjxLKBs8aux8uyxaxqpX5m~rtjh3pVuOZEvCAnFIJOK~ONrGu6T1mEPWQ2oJq~xuYP7CiWwaXXhXqq2AqTUA9wSdyY-d0u3IoT1nV341pnV5Ua1n-OUWoe~ZFZEZsJYQNY2hQBbXvh44jqrReDo1TcnCpLMskbJmjWdgNhvQbA6fa8BsNwjPZQXw00Q__","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true}]}}'
[00:39:35.589297][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"stream","data":{"uri":"https://livedelivery.dlive.nicovideo.jp/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a/multivariant/variant.m3u8","syncUri":"https://livedelivery.dlive.nicovideo.jp/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a/multivariant/stream_sync.json","quality":"abr","availableQualities":["abr","6Mbps1080p30fps","super_high","high","normal","low","super_low","audio_high"],"protocol":"hls","cookies":[{"name":"session","value":"3b77d1a71232b97eecb96bb00220365459782dde39b04f4a0000000069c15eb89ffca2d62d208e29","expires":"Mon, 23 Mar 2026 15:39:36 GMT","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9wbGF5bGlzdHMvNjliZmY4M2YxNjkzOTI5MGIzMTg2NTcyLzU5NzgyZGRlMzliMDRmNGEvKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTc3NDI4MDM3Nn19fV19","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Signature","value":"lsl~bKSyLOhGXzwBs59l24L2NJxkyHKsaWBcsUa7qE0hu1xyPTI1uLUZxNMe90VbXq4dF49a3efAQZTwCZcqo1q~dWZBf-cnI~vO7AFhYbsdY~fgkslRF7T6j9F4mZqZhcdZTrzYkOZm-kgBY4UVNnUvxoNIZhe7kh3F~q6tyLsS6ko79K8vBpiJ1qEjuLyJfZxfJyRNCqYBSVT6po3T-NMzSXHR6qGB4Mv~6yx2ke6zl5Q2N5~er4CAEuHN7YvDYxuc49DhpmGglRfm08n1IqTcLXz4cBioDOiec3AOTJlypkiqJEneEQhDbjyue9RVIeKihTZUvBgA-ndKZd5V7A__","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9zZWdtZW50cy82OWJmZjgzZjE2OTM5MjkwYjMxODY1NzIvdmlkZW8vMSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Signature","value":"ICDTkinuI4KcbFmcDZd9QksGy3hfhw9BbxRmp0M4~b1Vc3kI5HeBbT59bctwOgp2YhaWd6v~Pe10hI1TPi6QI503-EUxxq23bTPLDfgkEIp0HQdYpm8svSdkw1I6iB-QiHZA8eurhiaJKtpZDRtSgn4M4-~K1nl5dbvvyiUD3TnqWJAX7MMtk~F4A7DV3ttZerY9lEUViEmKNI1IHL~X-ULRQaoNCmh1MfRBcwIOtU~BqILOM4eSCewD8ZCMEBZy~~T9~-y6qIW46OYo9zo-3GQxSmJthHgOoQgg7eqdoRFcxeTgDUbIk~fpYAg4F~ggI0lXHZuuYLA~OupGe8x4zA__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9zZWdtZW50cy82OWJmZjgzZjE2OTM5MjkwYjMxODY1NzIvYXVkaW8vMSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Signature","value":"p8upfgcm66T5dFafdbV9Hl4Hu4pdiLu267lgPCdhGjjQSz~7WJ3FvIeDovI59m-dB7B-T-kCen6voCb2A0J3rqoJ3Ae5Et8~JDjLaWY6h7PvwmRR8a6Z3leelgU6lSCxWnatshpW6YVU9NSmNzO9JH5LSMGDlSJrONyLSpsAdlN0oUNWwCsToa4tKK78-Og~dvTKJkvEAa2dyffh732YUlq3cXxF-4aA2Dnn8X8HtOar~Zr~ysQF2bPUYAyyciGUTy22~SNYLb1tiFGXnTsCREcSQQ0mV~y1yMTBBZu1JHIpqLdDfnDMjq8yXuW7vmQsG2c2Chvva43CXv~96fViTA__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9rZXlzLzY5YmZmODNmMTY5MzkyOTBiMzE4NjU3Mi81OTc4MmRkZTM5YjA0ZjRhLyoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Signature","value":"GBbYcl7xo-jMQqmIobORHLxcJATnq3c9Ir9e2KNnrlusiFgSFz9fVDzfKcX0UsscimZ6dxb~C6CA3-SeHpiqRTYTR2zlIuj~gbAUbvLczAT7~e~Gx8WTONc4weB5DVmldL0BwoDE1GgcbZwIwbbijMZoep4LjxLKBs8aux8uyxaxqpX5m~rtjh3pVuOZEvCAnFIJOK~ONrGu6T1mEPWQ2oJq~xuYP7CiWwaXXhXqq2AqTUA9wSdyY-d0u3IoT1nV341pnV5Ua1n-OUWoe~ZFZEZsJYQNY2hQBbXvh44jqrReDo1TcnCpLMskbJmjWdgNhvQbA6fa8BsNwjPZQXw00Q__","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true}]}}'
[00:39:35.589453][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"stream","data":{"uri":"https://livedelivery.dlive.nicovideo.jp/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a/multivariant/variant.m3u8","syncUri":"https://livedelivery.dlive.nicovideo.jp/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a/multivariant/stream_sync.json","quality":"abr","availableQualities":["abr","6Mbps1080p30fps","super_high","high","normal","low","super_low","audio_high"],"protocol":"hls","cookies":[{"name":"session","value":"3b77d1a71232b97eecb96bb00220365459782dde39b04f4a0000000069c15eb89ffca2d62d208e29","expires":"Mon, 23 Mar 2026 15:39:36 GMT","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9wbGF5bGlzdHMvNjliZmY4M2YxNjkzOTI5MGIzMTg2NTcyLzU5NzgyZGRlMzliMDRmNGEvKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTc3NDI4MDM3Nn19fV19","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Signature","value":"lsl~bKSyLOhGXzwBs59l24L2NJxkyHKsaWBcsUa7qE0hu1xyPTI1uLUZxNMe90VbXq4dF49a3efAQZTwCZcqo1q~dWZBf-cnI~vO7AFhYbsdY~fgkslRF7T6j9F4mZqZhcdZTrzYkOZm-kgBY4UVNnUvxoNIZhe7kh3F~q6tyLsS6ko79K8vBpiJ1qEjuLyJfZxfJyRNCqYBSVT6po3T-NMzSXHR6qGB4Mv~6yx2ke6zl5Q2N5~er4CAEuHN7YvDYxuc49DhpmGglRfm08n1IqTcLXz4cBioDOiec3AOTJlypkiqJEneEQhDbjyue9RVIeKihTZUvBgA-ndKZd5V7A__","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/playlists/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9zZWdtZW50cy82OWJmZjgzZjE2OTM5MjkwYjMxODY1NzIvdmlkZW8vMSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Signature","value":"ICDTkinuI4KcbFmcDZd9QksGy3hfhw9BbxRmp0M4~b1Vc3kI5HeBbT59bctwOgp2YhaWd6v~Pe10hI1TPi6QI503-EUxxq23bTPLDfgkEIp0HQdYpm8svSdkw1I6iB-QiHZA8eurhiaJKtpZDRtSgn4M4-~K1nl5dbvvyiUD3TnqWJAX7MMtk~F4A7DV3ttZerY9lEUViEmKNI1IHL~X-ULRQaoNCmh1MfRBcwIOtU~BqILOM4eSCewD8ZCMEBZy~~T9~-y6qIW46OYo9zo-3GQxSmJthHgOoQgg7eqdoRFcxeTgDUbIk~fpYAg4F~ggI0lXHZuuYLA~OupGe8x4zA__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/video","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9zZWdtZW50cy82OWJmZjgzZjE2OTM5MjkwYjMxODY1NzIvYXVkaW8vMSoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Signature","value":"p8upfgcm66T5dFafdbV9Hl4Hu4pdiLu267lgPCdhGjjQSz~7WJ3FvIeDovI59m-dB7B-T-kCen6voCb2A0J3rqoJ3Ae5Et8~JDjLaWY6h7PvwmRR8a6Z3leelgU6lSCxWnatshpW6YVU9NSmNzO9JH5LSMGDlSJrONyLSpsAdlN0oUNWwCsToa4tKK78-Og~dvTKJkvEAa2dyffh732YUlq3cXxF-4aA2Dnn8X8HtOar~Zr~ysQF2bPUYAyyciGUTy22~SNYLb1tiFGXnTsCREcSQQ0mV~y1yMTBBZu1JHIpqLdDfnDMjq8yXuW7vmQsG2c2Chvva43CXv~96fViTA__","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/segments/69bff83f16939290b3186572/audio","secure":true},{"name":"CloudFront-Policy","value":"eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9saXZlZGVsaXZlcnkuZGxpdmUubmljb3ZpZGVvLmpwL2hscy9rZXlzLzY5YmZmODNmMTY5MzkyOTBiMzE4NjU3Mi81OTc4MmRkZTM5YjA0ZjRhLyoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3NzQyODAzNzZ9fX1dfQ__","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Signature","value":"GBbYcl7xo-jMQqmIobORHLxcJATnq3c9Ir9e2KNnrlusiFgSFz9fVDzfKcX0UsscimZ6dxb~C6CA3-SeHpiqRTYTR2zlIuj~gbAUbvLczAT7~e~Gx8WTONc4weB5DVmldL0BwoDE1GgcbZwIwbbijMZoep4LjxLKBs8aux8uyxaxqpX5m~rtjh3pVuOZEvCAnFIJOK~ONrGu6T1mEPWQ2oJq~xuYP7CiWwaXXhXqq2AqTUA9wSdyY-d0u3IoT1nV341pnV5Ua1n-OUWoe~ZFZEZsJYQNY2hQBbXvh44jqrReDo1TcnCpLMskbJmjWdgNhvQbA6fa8BsNwjPZQXw00Q__","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true},{"name":"CloudFront-Key-Pair-Id","value":"K2R26IUCM0JJBQ","domain":"nicovideo.jp","path":"/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a","secure":true}]}}
[00:39:35.619561][MainThread][utils.l10n][debug] Language code: en_US
[00:39:35.920660][MainThread][stream.ffmpegmux][trace] Querying FFmpeg version: ['D:\\CUI_tool\\ffmpeg\\ffmpeg.exe', '-version']
[00:39:37.329776][MainThread][stream.ffmpegmux][debug] ffmpeg version N-123586-g711b1a52bd-20260322 Copyright (c) 2000-2026 the FFmpeg developers
[00:39:37.329991][MainThread][stream.ffmpegmux][debug]  built with gcc 15.2.0 (crosstool-NG 1.28.0.23_185f348)
[00:39:37.330087][MainThread][stream.ffmpegmux][debug]  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libxml2 --enable-libvmaf --enable-fontconfig --enable-libharfbuzz --enable-libfreetype --enable-libfribidi --enable-vulkan --enable-libshaderc --enable-libvorbis --disable-libxcb --disable-xlib --disable-libpulse --enable-opencl --enable-gmp --enable-lzma --enable-liblcevc-dec --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-libplacebo --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-liboapv --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-libvvenc --enable-whisper --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20260322
[00:39:37.330238][MainThread][stream.ffmpegmux][debug]  libavutil      60. 29.100 / 60. 29.100
[00:39:37.330355][MainThread][stream.ffmpegmux][debug]  libavcodec     62. 29.101 / 62. 29.101
[00:39:37.330549][MainThread][stream.ffmpegmux][debug]  libavformat    62. 13.101 / 62. 13.101
[00:39:37.330691][MainThread][stream.ffmpegmux][debug]  libavdevice    62.  4.100 / 62.  4.100
[00:39:37.330809][MainThread][stream.ffmpegmux][debug]  libavfilter    11. 15.101 / 11. 15.101
[00:39:37.330912][MainThread][stream.ffmpegmux][debug]  libswscale      9.  7.100 /  9.  7.100
[00:39:37.331085][MainThread][stream.ffmpegmux][debug]  libswresample   6.  4.100 /  6.  4.100
[00:39:37.331261][MainThread][stream.ffmpegmux][debug]
[00:39:37.331368][MainThread][stream.ffmpegmux][debug]  Exiting with exit code 0
[00:39:37.331484][MainThread][stream.hls][debug] Using external audio tracks for stream 1080p (language=None, name=Main Audio)
[00:39:37.331636][MainThread][stream.hls][debug] Using external audio tracks for stream 720p (language=None, name=Main Audio)
[00:39:37.331775][MainThread][stream.hls][debug] Using external audio tracks for stream 450p (language=None, name=Main Audio)
[00:39:37.331923][MainThread][stream.hls][debug] Using external audio tracks for stream 450p_alt (language=None, name=Main Audio)
[00:39:37.332221][MainThread][stream.hls][debug] Using external audio tracks for stream 288p (language=None, name=Main Audio)
[00:39:37.332417][MainThread][stream.hls][debug] Using external audio tracks for stream 288p_alt (language=None, name=Main Audio)
[00:39:37.332973][MainThread][cli][info] Available streams: 288p_alt (worst), 288p, 450p_alt, 450p, 720p, 1080p (best)
[00:39:37.333139][MainThread][cli][info] Opening stream: 1080p (hls-multi)
[00:39:37.333865][MainThread][cli][info] Writing output to
F:\work\streamlink\[2026-03-23] [株式会社ドワンゴ] 魔都精兵のスレイブ2 11話上映会 [lv349584107].ts
[00:39:37.334004][MainThread][cli][debug] Checking file output
[00:39:37.334162][MainThread][stream.ffmpegmux][debug] Opening hls substream
[00:39:37.334523][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Stream opened, keeping websocket connection alive
[00:39:37.334697][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81~\x00\xf6{"type":"messageServer","data":{"viewUri":"https://mpn.live.nicovideo.jp/api/view/v4/BBz4LDsbxBvq2-ciCyUalyi0l7DBY_7WohbYPEzQHHzmvcri_eLQHGm4oAWRlU9U1a8U39nDtLlhXo4","vposBaseTime":"2026-03-23T00:20:00+09:00","hashedUserId":"a:TQ8T7r34So9_U0H8"}}'
[00:39:37.334834][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"messageServer","data":{"viewUri":"https://mpn.live.nicovideo.jp/api/view/v4/BBz4LDsbxBvq2-ciCyUalyi0l7DBY_7WohbYPEzQHHzmvcri_eLQHGm4oAWRlU9U1a8U39nDtLlhXo4","vposBaseTime":"2026-03-23T00:20:00+09:00","hashedUserId":"a:TQ8T7r34So9_U0H8"}}'
[00:39:37.335039][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"messageServer","data":{"viewUri":"https://mpn.live.nicovideo.jp/api/view/v4/BBz4LDsbxBvq2-ciCyUalyi0l7DBY_7WohbYPEzQHHzmvcri_eLQHGm4oAWRlU9U1a8U39nDtLlhXo4","vposBaseTime":"2026-03-23T00:20:00+09:00","hashedUserId":"a:TQ8T7r34So9_U0H8"}}
[00:39:37.334983][MainThread][stream.ffmpegmux][debug] Opening hls substream
[00:39:37.334918][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:39:37.335247][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81~\x01\xd8{"type":"akashicMessageServer","data":{"viewUri":"https://mpn.live.nicovideo.jp/api/view/v4/BBzNHEOWB4Fj3aS-W58n3NmawPzFXVHCaqU1rqmrMDFvIGc6tm4WTkZz9FYp-EdOQPb1Z4PkXurQyxSGeo0yhB6a41HWiK9h_0W96eOzQw","token":"AQICAHiLR5NHf6Z+TKGGUaE8kt7O93TP0Q97L+MgOrdzJPVm/QFAKSP5FHmMJdAltQSul+cIAAAAiTCBhgYJKoZIhvcNAQcGoHkwdwIBADByBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDFC8kD20vSBuUb3xvwIBEIBFDApOKx7BH1aldBtrwqcHr3RpEdfqybN5ZtTfCZwq4tEEmAcpAXejGLOOVTi7gM6XIRrzeOUJjDXrPv1A4x0bMfdZ7TH+"}}'
[00:39:37.335919][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"akashicMessageServer","data":{"viewUri":"https://mpn.live.nicovideo.jp/api/view/v4/BBzNHEOWB4Fj3aS-W58n3NmawPzFXVHCaqU1rqmrMDFvIGc6tm4WTkZz9FYp-EdOQPb1Z4PkXurQyxSGeo0yhB6a41HWiK9h_0W96eOzQw","token":"AQICAHiLR5NHf6Z+TKGGUaE8kt7O93TP0Q97L+MgOrdzJPVm/QFAKSP5FHmMJdAltQSul+cIAAAAiTCBhgYJKoZIhvcNAQcGoHkwdwIBADByBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDFC8kD20vSBuUb3xvwIBEIBFDApOKx7BH1aldBtrwqcHr3RpEdfqybN5ZtTfCZwq4tEEmAcpAXejGLOOVTi7gM6XIRrzeOUJjDXrPv1A4x0bMfdZ7TH+"}}'
[00:39:37.336500][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"akashicMessageServer","data":{"viewUri":"https://mpn.live.nicovideo.jp/api/view/v4/BBzNHEOWB4Fj3aS-W58n3NmawPzFXVHCaqU1rqmrMDFvIGc6tm4WTkZz9FYp-EdOQPb1Z4PkXurQyxSGeo0yhB6a41HWiK9h_0W96eOzQw","token":"AQICAHiLR5NHf6Z+TKGGUaE8kt7O93TP0Q97L+MgOrdzJPVm/QFAKSP5FHmMJdAltQSul+cIAAAAiTCBhgYJKoZIhvcNAQcGoHkwdwIBADByBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDFC8kD20vSBuUb3xvwIBEIBFDApOKx7BH1aldBtrwqcHr3RpEdfqybN5ZtTfCZwq4tEEmAcpAXejGLOOVTi7gM6XIRrzeOUJjDXrPv1A4x0bMfdZ7TH+"}}
[00:39:37.336668][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81N{"type":"statistics","data":{"viewers":1139,"comments":2019,"adPoints":49500}}'
[00:39:37.335870][MainThread][utils.named_pipe][info] Creating pipe streamlinkpipe-104388-1-5404
[00:39:37.335789][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:39:37.337124][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"statistics","data":{"viewers":1139,"comments":2019,"adPoints":49500}}'
[00:39:37.337687][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"statistics","data":{"viewers":1139,"comments":2019,"adPoints":49500}}
[00:39:37.337437][MainThread][utils.named_pipe][info] Creating pipe streamlinkpipe-104388-2-6047
[00:39:37.339072][MainThread][stream.ffmpegmux][debug] ffmpeg command: ['D:\\CUI_tool\\ffmpeg\\ffmpeg.exe', '-y', '-nostats', '-loglevel', 'info', '-i', '\\\\.\\pipe\\streamlinkpipe-104388-1-5404', '-i', '\\\\.\\pipe\\streamlinkpipe-104388-2-6047', '-c:v', 'copy', '-c:a', 'copy', '-map', '0:v?', '-map', '0:a?', '-map', '1:a', '-copyts', '-f', 'mpegts', 'pipe:1']
[00:39:37.339205][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81.{"type":"akashic","data":{"status":"prepare"}}'
[00:39:37.339737][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"akashic","data":{"status":"prepare"}}'
[00:39:37.339961][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"akashic","data":{"status":"prepare"}}
[00:39:37.340208][Thread-2 (copy_to_pipe)][stream.ffmpegmux][debug] Starting copy to pipe: \\.\pipe\streamlinkpipe-104388-2-6047
[00:39:37.339652][Thread-1 (copy_to_pipe)][stream.ffmpegmux][debug] Starting copy to pipe: \\.\pipe\streamlinkpipe-104388-1-5404
[00:39:37.360184][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:37.360520][HLSStreamWorker-0][stream.hls][debug] First Sequence: 1788; Last Sequence: 1792
[00:39:37.360699][HLSStreamWorker-0][stream.hls][debug] Start offset: 0; Duration: 0.0; Start Sequence: 1790; End Sequence: None
[00:39:37.360842][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1790, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:27.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:37.361696][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1791, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:30.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:37.361941][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1792, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:33.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:37.384585][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1790 to output
[00:39:37.384846][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment initialization 1790 complete
[00:39:37.461591][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1790 to output
[00:39:37.518172][MainThread][cli][debug] Pre-buffering 8192 bytes
[00:39:37.785598][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:37.785918][HLSStreamWorker-audio-0][stream.hls][debug] First Sequence: 1788; Last Sequence: 1792
[00:39:37.786103][HLSStreamWorker-audio-0][stream.hls][debug] Start offset: 0; Duration: 0.0; Start Sequence: 1790; End Sequence: None
[00:39:37.786247][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1790, init=False, discontinuity=False, duration=3.008, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:27.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:37.786996][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1791, init=False, discontinuity=False, duration=3.008, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:30.008000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:37.787224][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1792, init=False, discontinuity=False, duration=2.987, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:33.016000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:37.806345][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1790 to output
[00:39:37.806645][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment initialization 1790 complete
[00:39:37.845291][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1790 to output
[00:39:37.866224][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1790 complete
[00:39:37.877037][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1791 to output
[00:39:37.877894][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1791 complete
[00:39:37.901170][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1790 complete
[00:39:37.901782][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1791 to output
[00:39:37.905022][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1791 complete
[00:39:37.905922][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1792 to output
[00:39:37.909131][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1792 complete
[00:39:37.910396][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1792 to output
[00:39:37.911019][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1792 complete
[00:39:37.944105][MainThread][cli][debug] Writing stream to output
[00:39:40.338426][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:39:40.338649][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:39:40.361206][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:40.361475][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1793, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:36.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:40.364985][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:40.365222][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1793, init=False, discontinuity=False, duration=3.008, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:36.002000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:40.393099][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1793 to output
[00:39:40.393449][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1793 complete
[00:39:40.441988][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1793 to output
[00:39:40.444218][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1793 complete
[00:39:43.343767][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:39:43.343944][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:39:43.366523][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:43.366776][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1794, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:39.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:43.371421][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:43.371620][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1794, init=False, discontinuity=False, duration=3.008, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:39.010000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:43.399996][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1794 to output
[00:39:43.400338][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1794 complete
[00:39:43.437110][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1794 to output
[00:39:43.439511][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1794 complete
[00:39:46.338183][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:39:46.338417][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:39:46.362983][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:46.363199][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1795, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:42.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:46.365543][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:46.365707][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1795, init=False, discontinuity=False, duration=2.987, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:42.018000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:46.421644][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1795 to output
[00:39:46.423982][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1795 complete
[00:39:46.441312][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1795 to output
[00:39:46.441665][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1795 complete
[00:39:48.070174][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81J{"type":"serverTime","data":{"currentMs":"2026-03-23T00:39:49.111+09:00"}}'
[00:39:48.070462][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"serverTime","data":{"currentMs":"2026-03-23T00:39:49.111+09:00"}}'
[00:39:48.070623][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"serverTime","data":{"currentMs":"2026-03-23T00:39:49.111+09:00"}}
[00:39:49.341779][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:39:49.341974][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:39:49.365372][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:49.365586][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1796, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:45.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:49.370193][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:49.370461][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1796, init=False, discontinuity=False, duration=3.008, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:45.005000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:49.400112][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1796 to output
[00:39:49.400452][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1796 complete
[00:39:49.427929][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1796 to output
[00:39:49.430193][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1796 complete
[00:39:52.342873][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:39:52.343082][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:39:52.365432][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:52.365620][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1797, init=False, discontinuity=False, duration=2.987, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:48.013000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:52.370051][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:52.370253][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1797, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:48.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:52.385256][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1797 to output
[00:39:52.385584][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1797 complete
[00:39:52.443959][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1797 to output
[00:39:52.446134][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1797 complete
[00:39:55.344470][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:39:55.344647][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:39:55.370044][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:55.370494][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1798, init=False, discontinuity=False, duration=3.008, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:51.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:55.370911][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:55.371310][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1798, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:51.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:55.425006][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1798 to output
[00:39:55.427225][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1798 complete
[00:39:55.452211][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1798 to output
[00:39:55.452596][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1798 complete
[00:39:58.347674][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:39:58.347844][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:39:58.365983][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:58.366238][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1799, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:54.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:39:58.369011][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:39:58.369270][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1799, init=False, discontinuity=False, duration=3.008, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:54.008000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:39:58.394387][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1799 to output
[00:39:58.394719][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Segment 1799 complete
[00:39:58.415567][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1799 to output
[00:39:58.418100][NicoLiveHLSStreamWriter-0][stream.hls][debug] Segment 1799 complete
[00:40:01.069388][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv raw: b'\x81\x0f{"type":"ping"}'
[00:40:01.069605][Thread-NicoLiveWsClient-1][websocket][debug] ++Rcv decoded: fin=1 opcode=1 data=b'{"type":"ping"}'
[00:40:01.069746][Thread-NicoLiveWsClient-1][plugins.nicolive][debug] Received: {"type":"ping"}
[00:40:01.069957][Thread-NicoLiveWsClient-1][websocket][debug] ++Sent raw: b'\x81\x8f\xe3r\xb0\xca\x98P\xc4\xb3\x93\x17\x92\xf0\xc1\x02\xdf\xa4\x84P\xcd'
[00:40:01.070109][Thread-NicoLiveWsClient-1][websocket][debug] ++Sent decoded: fin=1 opcode=1 data=b'{"type":"pong"}'
[00:40:01.070396][Thread-NicoLiveWsClient-1][websocket][debug] ++Sent raw: b'\x81\x93\xde\xde\xf0\xd4\xa5\xfc\x84\xad\xae\xbb\xd2\xee\xfc\xb5\x95\xb1\xae\x8d\x95\xb5\xaa\xfc\x8d'
[00:40:01.070507][Thread-NicoLiveWsClient-1][websocket][debug] ++Sent decoded: fin=1 opcode=1 data=b'{"type":"keepSeat"}'
[00:40:01.348706][HLSStreamWorker-0][stream.hls][debug] Reloading playlist
[00:40:01.348836][HLSStreamWorker-audio-0][stream.hls][debug] Reloading playlist
[00:40:01.373509][HLSStreamWorker-audio-0][stream.hls][debug] Segments in this playlist are encrypted
[00:40:01.373737][HLSStreamWorker-audio-0][stream.segmented][debug] Queuing HLSSegment(num=1800, init=False, discontinuity=False, duration=2.987, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:57.016000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfa')
[00:40:01.377100][HLSStreamWorker-0][stream.hls][debug] Segments in this playlist are encrypted
[00:40:01.377324][HLSStreamWorker-0][stream.segmented][debug] Queuing HLSSegment(num=1800, init=False, discontinuity=False, duration=3.000, title=None, key=Key(method='AES-128', key_format=None, key_format_versions=None), byterange=None, date=2026-03-22T15:39:57.000000Z, map=Map(key=Key(method='NONE', key_format=None, key_format_versions=None), byterange=None), fileext='cmfv')
[00:40:01.395220][NicoLiveHLSStreamWriter-audio-0][stream.hls][debug] Writing segment 1800 to output
[00:40:01.430820][NicoLiveHLSStreamWriter-0][stream.hls][debug] Writing segment 1800 to output
[00:40:03.578689][NicoLiveHLSStreamWriter-audio-0][stream.hls][error] Failed to create decryptor: Unable to open URL: https://livedelivery.dlive.nicovideo.jp/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a/9d8865de-1573-4b32-990e-8343f208f31e.key (403 Client Error: Forbidden for url: https://livedelivery.dlive.nicovideo.jp/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a/9d8865de-1573-4b32-990e-8343f208f31e.key)
[00:40:03.578949][NicoLiveHLSStreamWriter-audio-0][stream.segmented][debug] Closing writer thread
[00:40:03.579138][NicoLiveHLSStreamWriter-audio-0][stream.segmented][debug] Closing worker thread
[00:40:03.579393][Thread-2 (copy_to_pipe)][stream.ffmpegmux][debug] Pipe copy complete: \\.\pipe\streamlinkpipe-104388-2-6047
[00:40:03.579530][NicoLiveHLSStreamWriter-audio-0][websocket][debug] ++Sent raw: b"\x88\x82$\xfe\xe7\x94'\x16"
[00:40:03.579855][NicoLiveHLSStreamWriter-audio-0][websocket][debug] ++Sent decoded: fin=1 opcode=8 data=b'\x03\xe8'
[00:40:03.589194][Thread-NicoLiveWsClient-1][plugin.api.websocket][debug] Closed: wss://a.live2.nicovideo.jp/wsapi/v2/watch/118285666070?audience_token=17964031_118285666070_1774280376__fe14d04543a0e541fdc3f9d96229a4f5bcb68e76&frontend_id=9
[00:40:03.615872][NicoLiveHLSStreamWriter-0][stream.hls][error] Failed to create decryptor: Unable to open URL: https://livedelivery.dlive.nicovideo.jp/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a/9d8865de-1573-4b32-990e-8343f208f31e.key (403 Client Error: Forbidden for url: https://livedelivery.dlive.nicovideo.jp/hls/keys/69bff83f16939290b3186572/59782dde39b04f4a/9d8865de-1573-4b32-990e-8343f208f31e.key)
[00:40:03.616101][NicoLiveHLSStreamWriter-0][stream.segmented][debug] Closing writer thread
[00:40:03.616299][NicoLiveHLSStreamWriter-0][stream.segmented][debug] Closing worker thread
[00:40:03.616660][Thread-1 (copy_to_pipe)][stream.ffmpegmux][debug] Pipe copy complete: \\.\pipe\streamlinkpipe-104388-1-5404
[00:40:03.622902][MainThread][stream.ffmpegmux][debug] Closing ffmpeg thread
[00:40:03.623751][MainThread][stream.ffmpegmux][debug] Closed all the substreams
[00:40:03.624175][MainThread][cli][info] Stream ended
[00:40:03.624681][MainThread][cli][info] Closing currently open stream...
[download] Written 7.33 MiB to F:…式会社ドワンゴ] 魔都精兵のスレイブ2 11話上映会 [lv349584107].ts (25s @ 180.12 KiB/s)
```


Patch:
diff --git a/src/streamlink/plugin/api/websocket.py b/src/streamlink/plugin/api/websocket.py
index ebf631eb056..f939fe2284a 100644
--- a/src/streamlink/plugin/api/websocket.py
+++ b/src/streamlink/plugin/api/websocket.py
@@ -2,7 +2,7 @@
 
 import json
 import logging
-from threading import RLock, Thread, current_thread
+from threading import Event, RLock, Thread, current_thread
 from typing import TYPE_CHECKING, Any, TypedDict
 from urllib.parse import unquote_plus, urlparse
 
@@ -83,7 +83,8 @@ def __init__(
         if not any(True for h in header if h.startswith("User-Agent: ")):
             header.append(f"User-Agent: {session.http.headers['User-Agent']!s}")
 
-        self._reconnect = False
+        self.reconnect_done = Event()
+        self.is_reconnecting = Event()
         self._reconnect_lock = RLock()
 
         if not sslopt:  # pragma: no cover
@@ -146,9 +147,10 @@ def run(self) -> None:
             self.ws.run_forever(**self._ws_rundata)
             # check if closed via a reconnect() call
             with self._reconnect_lock:
-                if not self._reconnect:
+                if not self.is_reconnecting.is_set():
                     return
-                self._reconnect = False
+                self.reconnect_done.set()
+                self.is_reconnecting.clear()
 
     # ----
 
@@ -164,8 +166,11 @@ def reconnect(
             # ws connection is not active (anymore)
             if not self.ws.keep_running:
                 return
+            if self.is_reconnecting.is_set():
+                return
+            self.is_reconnecting.set()
+            self.reconnect_done.clear()
             log.debug("Reconnecting...")
-            self._reconnect = True
             self.ws.close(**(closeopts or {}))
             self._ws_init(
                 url=self.ws.url if url is None else url,
diff --git a/src/streamlink/plugins/nicolive.py b/src/streamlink/plugins/nicolive.py
index 31e07064bd7..614591b403c 100644
--- a/src/streamlink/plugins/nicolive.py
+++ b/src/streamlink/plugins/nicolive.py
@@ -16,6 +16,9 @@
 from typing import TYPE_CHECKING
 from urllib.parse import urljoin
 
+from requests.exceptions import HTTPError
+
+from streamlink.exceptions import StreamError
 from streamlink.logger import getLogger
 from streamlink.plugin import Plugin, pluginargument, pluginmatcher
 from streamlink.plugin.api import useragents, validate
@@ -56,6 +59,10 @@ def __init__(self, *args, **kwargs):
         self.opened = Event()
         self.ready = Event()
 
+    def reconnect(self, *args, **kwargs):
+        self.ready.clear()
+        return super().reconnect(*args, **kwargs)
+
     def on_open(self, wsapp):
         super().on_open(wsapp)
         self.send_playerversion()
@@ -84,6 +91,7 @@ def on_message_stream(self, data):
 
         # cookies may be required by some HLS multivariant playlists
         if cookies := data.get("cookies", []):
+            log.info("Applying HTTP session cookies from websocket data")
             for cookie in self._SCHEMA_COOKIES.validate(cookies):
                 self.session.http.cookies.set(**cookie)
 
@@ -136,6 +144,32 @@ class NicoLiveHLSStreamWriter(HLSStreamWriter):
     reader: NicoLiveHLSStreamReader
     stream: NicoLiveHLSStream
 
+    def create_decryptor(self, *args, **kwargs):
+        try:
+            return super().create_decryptor(*args, **kwargs)
+        except StreamError as err:
+            # TODO: fix HTTPSession.request()
+            if (
+                not (orig_err := getattr(err, "err", None))
+                or not isinstance(orig_err, HTTPError)
+                or orig_err.response.status_code != 403
+            ):
+                raise
+
+            if not self.stream.wsclient.is_reconnecting.is_set():
+                log.warning("HLSSegment decryption key retrieval failed. Attempting to reconnect to websocket...")
+                self.stream.wsclient.reconnect()
+            if (
+                not self.stream.wsclient.reconnect_done.wait(self.stream.wsclient.STREAM_OPENED_TIMEOUT)
+                or not self.stream.wsclient.ready.wait(self.stream.wsclient.STREAM_OPENED_TIMEOUT)
+            ):  # fmt: skip
+                raise
+
+            # drop cached key
+            self.key_uri = None
+
+            return super().create_decryptor(*args, **kwargs)
+
     def should_filter_segment(self, segment: HLSSegment) -> bool:
         if "/blank/" in segment.uri:
             return True


Test patch:
diff --git a/tests/test_api_websocket.py b/tests/test_api_websocket.py
index 67480751135..067668af630 100644
--- a/tests/test_api_websocket.py
+++ b/tests/test_api_websocket.py
@@ -1,5 +1,6 @@
 from __future__ import annotations
 
+from threading import Thread
 from typing import TYPE_CHECKING
 from unittest.mock import ANY, Mock, call, patch
 
@@ -231,17 +232,32 @@ def mock_run_forever(**data):
         client.start()
         assert client.ws.close.call_count == 0
         assert websocketapp.call_count == 1, "Creates initial connection"
-        assert not client._reconnect, "Has not set the _reconnect state"
+        assert not client.is_reconnecting.is_set(), "Has not set the is_reconnecting state"
         assert handshake.wait_ready(1), "Enters run_forever loop on client thread"
+        assert not client.reconnect_done.is_set(), "Reconnect is not done yet"
 
         client.reconnect()
         assert client.ws.close.call_count == 1
         assert websocketapp.call_count == 2, "Creates new connection"
-        assert client._reconnect, "Has set the _reconnect state"
+        assert client.is_reconnecting.is_set(), "Has set the is_reconnecting state"
+        assert not client.reconnect_done.is_set(), "Has not finished reconnecting"
+
+        threads = [Thread(target=client.reconnect, daemon=True) for _ in range(2)]
+        for thread in threads:
+            thread.start()
+        for thread in threads:
+            thread.join(1)
+            assert not thread.is_alive()
+
+        assert client.ws.close.call_count == 1, "Can't reconnect unless connection was reestablished"
+        assert websocketapp.call_count == 2, "Doesn't reconnect more than once"
+        assert client.is_reconnecting.is_set(), "Has set the is_reconnecting state"
+        assert not client.reconnect_done.is_set(), "Has not finished reconnecting"
 
         assert handshake.step(1)
         assert handshake.wait_ready(1), "Enters run_forever loop on client thread again"
-        assert not client._reconnect, "Has reset the _reconnect state"
+        assert not client.is_reconnecting.is_set(), "Has cleared the is_reconnecting state"
+        assert client.reconnect_done.is_set(), "Has finished reconnecting"
 
         assert handshake.step(1)
         assert not handshake.wait_ready(0), "Doesn't enter run_forever loop on client thread again"