obsproject / obs-websocket

Remote-control of OBS Studio through WebSocket
GNU General Public License v2.0
3.79k stars 701 forks source link

Bug: TriggerHotkeyByName `OBSBasic.UnauseRecording` and `OBSBasic.StopRecording` don't work #1188

Closed OnkelTem closed 7 months ago

OnkelTem commented 7 months ago

Operating System Info

Ubuntu 22.04 LTS

Other OS

No response

OBS Studio Version

Other

OBS Studio Version (Other)

30.0.0

obs-websocket Version

5.1.0

OBS Studio Log URL

https://obsproject.com/logs/bTQOeesRGIqvGn95

OBS Studio Crash Log URL

No response

Expected Behavior

TriggerHotkeyByName's OBSBasic.UnpauseRecording and OBSBasic.StopRecording should work

Current Behavior

TriggerHotkeyByName's OBSBasic.UnpauseRecording and OBSBasic.StopRecording don't work

Steps to Reproduce

I call OBS from js using obs-websocket-js.

// This works
await obs.call('TriggerHotkeyByName', { hotkeyName: 'OBSBasic.StartRecording' })
// This works
await obs.call('TriggerHotkeyByName', { hotkeyName: 'OBSBasic.PauseRecording' })
// This does nothing
await obs.call('TriggerHotkeyByName', { hotkeyName: 'OBSBasic.UnpauseRecording' })
// This does nothing
await obs.call('TriggerHotkeyByName', { hotkeyName: 'OBSBasic.StopRecording' })

Anything else we should know?

No response

OnkelTem commented 7 months ago

Downgraded to OBS Studio 29.1.3 - exactly the same behaviour: Start/Pause work, Unpause/Stop - don't.

OnkelTem commented 7 months ago

Here I extracted a part of the logs showing the entire session.

First I issue the connect command:

15:07:19.873: [obs-websocket] [debug] [WebSocketServer::onOpen] Sending Op 0 (Hello) message:
15:07:19.873: {
15:07:19.873:   "d": {
15:07:19.873:     "authentication": {
15:07:19.873:       "challenge": "AatD1LtFlU6yuMHo0CEmE0rXttfdd9MwxCXWQezcn48=",
15:07:19.873:       "salt": "XD13thEodJ47wOvWT16/RPx1QQPaycGuqN3KFJmuqT4="
15:07:19.873:     },
15:07:19.873:     "obsWebSocketVersion": "5.2.3",
15:07:19.873:     "rpcVersion": 1
15:07:19.873:   },
15:07:19.873:   "op": 0
15:07:19.873: }
15:07:19.879: [obs-websocket] [debug] [WebSocketServer::onMessage] Incoming message (decoded):
15:07:19.879: {
15:07:19.879:   "d": {
15:07:19.879:     "authentication": "DfVF5+8NDGevqCWGw4BVE0isKwio3c+RUFNDP2eaPDY=",
15:07:19.879:     "rpcVersion": 1
15:07:19.879:   },
15:07:19.879:   "op": 1
15:07:19.879: }
15:07:19.879: [obs-websocket] [debug] [WebSocketServer::onMessage] Outgoing message:
15:07:19.879: {
15:07:19.879:   "d": {
15:07:19.879:     "negotiatedRpcVersion": 1
15:07:19.879:   },
15:07:19.879:   "op": 2
15:07:19.879: }

Then I send it the GetRecordStatus command:

15:07:21.884: [obs-websocket] [debug] [WebSocketServer::onMessage] Incoming message (decoded):
15:07:21.884: {
15:07:21.884:   "d": {
15:07:21.884:     "requestData": null,
15:07:21.884:     "requestId": "1",
15:07:21.884:     "requestType": "GetRecordStatus"
15:07:21.884:   },
15:07:21.884:   "op": 6
15:07:21.884: }
15:07:21.884: [obs-websocket] [debug] [WebSocketServer::onMessage] Outgoing message:
15:07:21.884: {
15:07:21.884:   "d": {
15:07:21.884:     "requestId": "1",
15:07:21.884:     "requestStatus": {
15:07:21.884:       "code": 100,
15:07:21.884:       "result": true
15:07:21.884:     },
15:07:21.884:     "requestType": "GetRecordStatus",
15:07:21.884:     "responseData": {
15:07:21.884:       "outputActive": false,
15:07:21.884:       "outputBytes": 194132,
15:07:21.884:       "outputDuration": 0,
15:07:21.884:       "outputPaused": false,
15:07:21.884:       "outputTimecode": "00:00:00.000"
15:07:21.884:     }
15:07:21.884:   },
15:07:21.884:   "op": 7
15:07:21.884: }

After a delay of 2 seconds I send it the TriggerHotkeyByName command with the OBSBasic.StartRecording hotkey:

15:07:23.889: [obs-websocket] [debug] [WebSocketServer::onMessage] Incoming message (decoded):
15:07:23.889: {
15:07:23.889:   "d": {
15:07:23.889:     "requestData": {
15:07:23.889:       "hotkeyName": "OBSBasic.StartRecording"
15:07:23.889:     },
15:07:23.889:     "requestId": "2",
15:07:23.889:     "requestType": "TriggerHotkeyByName"
15:07:23.889:   },
15:07:23.889:   "op": 6
15:07:23.889: }

It immediately reacts with:

15:07:23.889: Starting recording due to hotkey
15:07:23.889: [obs-websocket] [WebSocketServer::BroadcastEvent] Outgoing event:
15:07:23.889: {
15:07:23.889:   "d": {
15:07:23.889:     "eventData": {
15:07:23.889:       "outputActive": false,
15:07:23.889:       "outputPath": null,
15:07:23.889:       "outputState": "OBS_WEBSOCKET_OUTPUT_STARTING"
15:07:23.889:     },
15:07:23.889:     "eventIntent": 64,
15:07:23.889:     "eventType": "RecordStateChanged"
15:07:23.889:   },
15:07:23.889:   "op": 5
15:07:23.889: }
15:07:23.890: ---------------------------------
15:07:23.890: [FFmpeg NVENC encoder: 'simple_video_recording'] settings:
15:07:23.890:   encoder:      NVIDIA NVENC HEVC (FFmpeg)
15:07:23.890:   rate_control: CQP
15:07:23.890:   bitrate:      0
15:07:23.890:   cqp:          23
15:07:23.890:   keyint:       250
15:07:23.890:   preset:       p5
15:07:23.890:   tuning:       hq
15:07:23.890:   multipass:    qres
15:07:23.890:   profile:      main
15:07:23.890:   width:        2560
15:07:23.890:   height:       1600
15:07:23.890:   b-frames:     2
15:07:23.890:   psycho-aq:    1
15:07:23.890:   GPU:          0
15:07:23.890: 
15:07:24.029: libfdk_aac encoder created
15:07:24.029: libfdk_aac bitrate: 192, channels: 2
15:07:24.029: [ffmpeg muxer: 'simple_file_output'] Writing file '/projects/podcasts/OBS Plugin/recordings/2023-12-04 15-07-23.mkv'...
15:07:24.029: [obs-websocket] [debug] [WebSocketServer::onMessage] Outgoing message:
15:07:24.029: {
15:07:24.029:   "d": {
15:07:24.029:     "requestId": "2",
15:07:24.029:     "requestStatus": {
15:07:24.029:       "code": 100,
15:07:24.029:       "result": true
15:07:24.029:     },
15:07:24.029:     "requestType": "TriggerHotkeyByName"
15:07:24.029:   },
15:07:24.029:   "op": 7
15:07:24.029: }
15:07:24.039: [obs-websocket] [WebSocketServer::BroadcastEvent] Outgoing event:
15:07:24.039: {
15:07:24.039:   "d": {
15:07:24.039:     "eventData": {
15:07:24.039:       "outputActive": true,
15:07:24.039:       "outputPath": "/projects/podcasts/OBS Plugin/recordings/2023-12-04 15-07-23.mkv",
15:07:24.039:       "outputState": "OBS_WEBSOCKET_OUTPUT_STARTED"
15:07:24.039:     },
15:07:24.039:     "eventIntent": 64,
15:07:24.039:     "eventType": "RecordStateChanged"
15:07:24.039:   },
15:07:24.039:   "op": 5
15:07:24.039: }
15:07:24.044: ==== Recording Start ===============================================

Then after a delay of 5 seconds I send it the TriggerHotkeyByName command with the OBSBasic.StopRecording hotkey:

15:07:29.031: [obs-websocket] [debug] [WebSocketServer::onMessage] Incoming message (decoded):
15:07:29.031: {
15:07:29.031:   "d": {
15:07:29.031:     "requestData": {
15:07:29.031:       "hotkeyName": "OBSBasic.StopRecording"
15:07:29.031:     },
15:07:29.031:     "requestId": "3",
15:07:29.031:     "requestType": "TriggerHotkeyByName"
15:07:29.031:   },
15:07:29.031:   "op": 6
15:07:29.031: }
15:07:29.032: [obs-websocket] [debug] [WebSocketServer::onMessage] Outgoing message:
15:07:29.032: {
15:07:29.032:   "d": {
15:07:29.032:     "requestId": "3",
15:07:29.032:     "requestStatus": {
15:07:29.032:       "code": 100,
15:07:29.032:       "result": true
15:07:29.032:     },
15:07:29.032:     "requestType": "TriggerHotkeyByName"
15:07:29.032:   },
15:07:29.032:   "op": 7
15:07:29.032: }

This is the end of the log, i.e. it doesn't do anything except for reporting about the acceptance of the command.

What is going on here?

tt2468 commented 7 months ago

We will not provide bug support for the hotkey requests, sorry. There are direct methods for pausing and stopping record which are significantly more reliable.