or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

error-handling.mdevent-client.mdevent-subscriptions.mdindex.mdrequest-client.md

request-client.mddocs/

0

# Request Client

1

2

The ReqClient provides a synchronous interface for sending commands to OBS Studio via WebSocket. All methods correspond to OBS WebSocket v5.0 API calls with snake_case naming and return structured response objects.

3

4

## Core Connection

5

6

### Client Management

7

8

```python { .api }

9

class ReqClient:

10

def __init__(self, host='localhost', port=4455, password='', timeout=None):

11

"""

12

Initialize request client.

13

14

Parameters:

15

- host (str): OBS WebSocket host address

16

- port (int): OBS WebSocket port number

17

- password (str): OBS WebSocket password

18

- timeout (float, optional): Connection timeout in seconds

19

"""

20

21

def __enter__(self):

22

"""Context manager entry."""

23

24

def __exit__(self, exc_type, exc_value, exc_traceback):

25

"""Context manager exit with automatic disconnect."""

26

27

def disconnect(self):

28

"""Close WebSocket connection."""

29

30

def send(self, param, data=None, raw=False):

31

"""

32

Send raw request to OBS.

33

34

Parameters:

35

- param (str): Request type name

36

- data (dict, optional): Request data payload

37

- raw (bool): Return raw JSON instead of dataclass object

38

39

Returns:

40

Response dataclass object or raw dict if raw=True

41

"""

42

```

43

44

## System Operations

45

46

### Version and Statistics

47

48

```python { .api }

49

def get_version(self):

50

"""

51

Get OBS and WebSocket version information.

52

53

Returns:

54

Object with obs_version, obs_web_socket_version, rpc_version, available_requests, supported_image_formats

55

"""

56

57

def get_stats(self):

58

"""

59

Get OBS performance statistics.

60

61

Returns:

62

Object with cpu_usage, memory_usage, free_disk_space, average_frame_time, render_total_frames, etc.

63

"""

64

65

def broadcast_custom_event(self, eventData):

66

"""

67

Broadcast custom event to all WebSocket clients.

68

69

Parameters:

70

- eventData (object): Data payload to emit

71

"""

72

73

def call_vendor_request(self, vendor_name, request_type, request_data=None):

74

"""

75

Call vendor-specific request.

76

77

Parameters:

78

- vendor_name (str): Name of the vendor

79

- request_type (str): Request type to call

80

- request_data (dict, optional): Request data

81

82

Returns:

83

Vendor-specific response data

84

"""

85

86

def sleep(self, sleep_millis=None, sleep_frames=None):

87

"""

88

Sleep for a time duration or number of frames (only available in request batches).

89

90

Parameters:

91

- sleep_millis (int, optional): Sleep time in milliseconds

92

- sleep_frames (int, optional): Sleep time in frames

93

"""

94

95

def get_persistent_data(self, realm, slot_name):

96

"""

97

Get value from persistent data realm.

98

99

Parameters:

100

- realm (str): Data realm (OBS_WEBSOCKET_DATA_REALM_*)

101

- slot_name (str): Name of the slot

102

103

Returns:

104

Object with slot_value

105

"""

106

107

def set_persistent_data(self, realm, slot_name, slot_value):

108

"""

109

Set value in persistent data realm.

110

111

Parameters:

112

- realm (str): Data realm (OBS_WEBSOCKET_DATA_REALM_*)

113

- slot_name (str): Name of the slot

114

- slot_value: Value to store in slot

115

"""

116

```

117

118

## Scene Management

119

120

### Scene Operations

121

122

```python { .api }

123

def get_scene_list(self):

124

"""

125

Get list of all scenes.

126

127

Returns:

128

Object with current_program_scene_name, current_preview_scene_name, scenes

129

"""

130

131

def get_current_program_scene(self):

132

"""

133

Get current program scene.

134

135

Returns:

136

Object with current_program_scene_name

137

"""

138

139

def set_current_program_scene(self, name):

140

"""

141

Set current program scene.

142

143

Parameters:

144

- name (str): Scene name to switch to

145

"""

146

147

def get_current_preview_scene(self):

148

"""

149

Get current preview scene.

150

151

Returns:

152

Object with current_preview_scene_name

153

"""

154

155

def set_current_preview_scene(self, name):

156

"""

157

Set current preview scene.

158

159

Parameters:

160

- name (str): Scene name to set as preview

161

"""

162

163

def create_scene(self, name):

164

"""

165

Create new scene.

166

167

Parameters:

168

- name (str): Name for new scene

169

"""

170

171

def remove_scene(self, name):

172

"""

173

Remove scene from OBS.

174

175

Parameters:

176

- name (str): Name of scene to remove

177

"""

178

179

def set_scene_name(self, old_name, new_name):

180

"""

181

Rename scene.

182

183

Parameters:

184

- old_name (str): Current scene name

185

- new_name (str): New scene name

186

"""

187

```

188

189

### Groups

190

191

```python { .api }

192

def get_group_list(self):

193

"""

194

Get list of all groups (groups are special scenes).

195

196

Returns:

197

Object with groups list

198

"""

199

```

200

201

## Input Management

202

203

### Input Discovery and Creation

204

205

```python { .api }

206

def get_input_list(self, kind=None):

207

"""

208

Get list of all inputs.

209

210

Parameters:

211

- kind (str, optional): Filter by input kind

212

213

Returns:

214

Object with inputs list

215

"""

216

217

def get_input_kind_list(self, unversioned):

218

"""

219

Get list of available input kinds.

220

221

Parameters:

222

- unversioned (bool): Return unversioned kind names

223

224

Returns:

225

Object with input_kinds list

226

"""

227

228

def get_special_inputs(self):

229

"""

230

Get special input names (Desktop Audio, Mic/Aux, etc.).

231

232

Returns:

233

Object with desktop1, desktop2, mic1, mic2, etc.

234

"""

235

236

def create_input(self, sceneName, inputName, inputKind, inputSettings, sceneItemEnabled):

237

"""

238

Create new input and add to scene.

239

240

Parameters:

241

- sceneName (str): Scene to add input to

242

- inputName (str): Name for new input

243

- inputKind (str): Input type/kind

244

- inputSettings (object): Input configuration

245

- sceneItemEnabled (bool): Enable scene item

246

247

Returns:

248

Object with scene_item_id

249

"""

250

251

def remove_input(self, name):

252

"""

253

Remove input.

254

255

Parameters:

256

- name (str): Input name to remove

257

"""

258

259

def set_input_name(self, old_name, new_name):

260

"""

261

Rename input.

262

263

Parameters:

264

- old_name (str): Current input name

265

- new_name (str): New input name

266

"""

267

```

268

269

### Input Settings

270

271

```python { .api }

272

def get_input_default_settings(self, kind):

273

"""

274

Get default settings for input kind.

275

276

Parameters:

277

- kind (str): Input kind name

278

279

Returns:

280

Object with default_input_settings

281

"""

282

283

def get_input_settings(self, name):

284

"""

285

Get input settings.

286

287

Parameters:

288

- name (str): Input name

289

290

Returns:

291

Object with input_settings, input_kind

292

"""

293

294

def set_input_settings(self, name, settings, overlay):

295

"""

296

Set input settings.

297

298

Parameters:

299

- name (str): Input name

300

- settings (dict): Settings to apply

301

- overlay (bool): Overlay on existing settings or replace

302

"""

303

```

304

305

### Audio Controls

306

307

```python { .api }

308

def get_input_mute(self, name):

309

"""

310

Get input mute state.

311

312

Parameters:

313

- name (str): Input name

314

315

Returns:

316

Object with input_muted

317

"""

318

319

def set_input_mute(self, name, muted):

320

"""

321

Set input mute state.

322

323

Parameters:

324

- name (str): Input name

325

- muted (bool): Mute state

326

"""

327

328

def toggle_input_mute(self, name):

329

"""

330

Toggle input mute state.

331

332

Parameters:

333

- name (str): Input name

334

335

Returns:

336

Object with input_muted (new state)

337

"""

338

339

def get_input_volume(self, name):

340

"""

341

Get input volume.

342

343

Parameters:

344

- name (str): Input name

345

346

Returns:

347

Object with input_volume_mul, input_volume_db

348

"""

349

350

def set_input_volume(self, name, vol_mul=None, vol_db=None):

351

"""

352

Set input volume.

353

354

Parameters:

355

- name (str): Input name

356

- vol_mul (float, optional): Volume multiplier (0-20)

357

- vol_db (float, optional): Volume in dB (-100 to 26)

358

"""

359

360

def get_input_audio_balance(self, name):

361

"""

362

Get audio balance.

363

364

Parameters:

365

- name (str): Input name

366

367

Returns:

368

Object with input_audio_balance

369

"""

370

371

def set_input_audio_balance(self, name, balance):

372

"""

373

Set audio balance.

374

375

Parameters:

376

- name (str): Input name

377

- balance (float): Balance value (0.0-1.0)

378

"""

379

380

def get_input_audio_sync_offset(self, name):

381

"""

382

Get audio sync offset.

383

384

Parameters:

385

- name (str): Input name

386

387

Returns:

388

Object with input_audio_sync_offset

389

"""

390

391

def set_input_audio_sync_offset(self, name, offset):

392

"""

393

Set audio sync offset.

394

395

Parameters:

396

- name (str): Input name

397

- offset (int): Offset in milliseconds (-950 to 20000)

398

"""

399

400

def get_input_audio_monitor_type(self, name):

401

"""

402

Get audio monitor type.

403

404

Parameters:

405

- name (str): Input name

406

407

Returns:

408

Object with monitor_type

409

"""

410

411

def set_input_audio_monitor_type(self, name, mon_type):

412

"""

413

Set audio monitor type.

414

415

Parameters:

416

- name (str): Input name

417

- mon_type (int): Monitor type (OBS_MONITORING_TYPE_*)

418

"""

419

420

def get_input_audio_tracks(self, name):

421

"""

422

Get audio track enable states.

423

424

Parameters:

425

- name (str): Input name

426

427

Returns:

428

Object with input_audio_tracks dict

429

"""

430

431

def set_input_audio_tracks(self, name, track):

432

"""

433

Set audio track enable states.

434

435

Parameters:

436

- name (str): Input name

437

- track (dict): Track enable states

438

"""

439

440

def get_input_properties_list_property_items(self, input_name, property_name):

441

"""

442

Get items of a list property from input's properties.

443

444

Parameters:

445

- input_name (str): Input name

446

- property_name (str): Property name

447

448

Returns:

449

Object with property_items list

450

"""

451

452

def press_input_properties_button(self, input_name, property_name):

453

"""

454

Press a button in input properties.

455

456

Parameters:

457

- input_name (str): Input name

458

- property_name (str): Button property name

459

"""

460

```

461

462

## Scene Items

463

464

### Scene Item Management

465

466

```python { .api }

467

def get_scene_item_list(self, name):

468

"""

469

Get scene items in scene.

470

471

Parameters:

472

- name (str): Scene name

473

474

Returns:

475

Object with scene_items list

476

"""

477

478

def get_scene_item_id(self, scene_name, source_name, offset=None):

479

"""

480

Get scene item ID by source name.

481

482

Parameters:

483

- scene_name (str): Scene name

484

- source_name (str): Source name to find

485

- offset (int, optional): Search offset

486

487

Returns:

488

Object with scene_item_id

489

"""

490

491

def create_scene_item(self, scene_name, source_name, enabled=None):

492

"""

493

Add existing source to scene.

494

495

Parameters:

496

- scene_name (str): Scene name

497

- source_name (str): Source name to add

498

- enabled (bool, optional): Enable state

499

500

Returns:

501

Object with scene_item_id

502

"""

503

504

def remove_scene_item(self, scene_name, item_id):

505

"""

506

Remove scene item.

507

508

Parameters:

509

- scene_name (str): Scene name

510

- item_id (int): Scene item ID

511

"""

512

513

def duplicate_scene_item(self, scene_name, item_id, dest_scene_name=None):

514

"""

515

Duplicate scene item.

516

517

Parameters:

518

- scene_name (str): Source scene name

519

- item_id (int): Scene item ID

520

- dest_scene_name (str, optional): Destination scene

521

522

Returns:

523

Object with scene_item_id

524

"""

525

```

526

527

### Scene Item Properties

528

529

```python { .api }

530

def get_scene_item_enabled(self, scene_name, item_id):

531

"""

532

Get scene item enabled state.

533

534

Parameters:

535

- scene_name (str): Scene name

536

- item_id (int): Scene item ID

537

538

Returns:

539

Object with scene_item_enabled

540

"""

541

542

def set_scene_item_enabled(self, scene_name, item_id, enabled):

543

"""

544

Set scene item enabled state.

545

546

Parameters:

547

- scene_name (str): Scene name

548

- item_id (int): Scene item ID

549

- enabled (bool): Enable state

550

"""

551

552

def get_scene_item_locked(self, scene_name, item_id):

553

"""

554

Get scene item locked state.

555

556

Parameters:

557

- scene_name (str): Scene name

558

- item_id (int): Scene item ID

559

560

Returns:

561

Object with scene_item_locked

562

"""

563

564

def set_scene_item_locked(self, scene_name, item_id, locked):

565

"""

566

Set scene item locked state.

567

568

Parameters:

569

- scene_name (str): Scene name

570

- item_id (int): Scene item ID

571

- locked (bool): Lock state

572

"""

573

574

def get_scene_item_transform(self, scene_name, item_id):

575

"""

576

Get scene item transform and crop info.

577

578

Parameters:

579

- scene_name (str): Scene name

580

- item_id (int): Scene item ID

581

582

Returns:

583

Object with scene_item_transform containing position, rotation, scale, crop, etc.

584

"""

585

586

def set_scene_item_transform(self, scene_name, item_id, transform):

587

"""

588

Set scene item transform.

589

590

Parameters:

591

- scene_name (str): Scene name

592

- item_id (int): Scene item ID

593

- transform (dict): Transform settings

594

"""

595

596

def get_group_scene_item_list(self, group_name):

597

"""

598

Get scene items in a group.

599

600

Parameters:

601

- group_name (str): Group name

602

603

Returns:

604

Object with scene_items list

605

"""

606

607

def get_scene_item_source(self, scene_name, item_id):

608

"""

609

Get source associated with a scene item.

610

611

Parameters:

612

- scene_name (str): Scene name

613

- item_id (int): Scene item ID

614

615

Returns:

616

Object with source_name and source_type

617

"""

618

619

def get_scene_item_index(self, scene_name, item_id):

620

"""

621

Get index position of a scene item.

622

623

Parameters:

624

- scene_name (str): Scene name

625

- item_id (int): Scene item ID

626

627

Returns:

628

Object with scene_item_index

629

"""

630

631

def set_scene_item_index(self, scene_name, item_id, index):

632

"""

633

Set index position of a scene item.

634

635

Parameters:

636

- scene_name (str): Scene name

637

- item_id (int): Scene item ID

638

- index (int): New index position

639

"""

640

641

def get_scene_item_blend_mode(self, scene_name, item_id):

642

"""

643

Get blend mode of a scene item.

644

645

Parameters:

646

- scene_name (str): Scene name

647

- item_id (int): Scene item ID

648

649

Returns:

650

Object with scene_item_blend_mode

651

"""

652

653

def set_scene_item_blend_mode(self, scene_name, item_id, blend_mode):

654

"""

655

Set blend mode of a scene item.

656

657

Parameters:

658

- scene_name (str): Scene name

659

- item_id (int): Scene item ID

660

- blend_mode (str): Blend mode (Normal, Additive, Subtract, Screen, Multiply, etc.)

661

"""

662

```

663

664

## Streaming and Recording

665

666

### Streaming Controls

667

668

```python { .api }

669

def get_stream_status(self):

670

"""

671

Get stream output status.

672

673

Returns:

674

Object with output_active, output_reconnecting, output_timecode, output_duration, etc.

675

"""

676

677

def toggle_stream(self):

678

"""

679

Toggle streaming state.

680

681

Returns:

682

Object with output_active

683

"""

684

685

def start_stream(self):

686

"""Start streaming."""

687

688

def stop_stream(self):

689

"""Stop streaming."""

690

691

def send_stream_caption(self, caption):

692

"""

693

Send CEA-608 caption text.

694

695

Parameters:

696

- caption (str): Caption text

697

"""

698

```

699

700

### Recording Controls

701

702

```python { .api }

703

def get_record_status(self):

704

"""

705

Get recording output status.

706

707

Returns:

708

Object with output_active, output_paused, output_timecode, output_duration, etc.

709

"""

710

711

def toggle_record(self):

712

"""

713

Toggle recording state.

714

715

Returns:

716

Object with output_active

717

"""

718

719

def start_record(self):

720

"""Start recording."""

721

722

def stop_record(self):

723

"""

724

Stop recording.

725

726

Returns:

727

Object with output_path

728

"""

729

730

def pause_record(self):

731

"""Pause recording."""

732

733

def resume_record(self):

734

"""Resume recording."""

735

736

def toggle_record_pause(self):

737

"""Toggle recording pause state."""

738

739

def split_record_file(self):

740

"""Split current recording into new file."""

741

742

def create_record_chapter(self, chapter_name=None):

743

"""

744

Add chapter marker to recording.

745

746

Parameters:

747

- chapter_name (str, optional): Chapter name

748

"""

749

750

def get_record_directory(self):

751

"""

752

Get recording output directory.

753

754

Returns:

755

Object with record_directory

756

"""

757

758

def set_record_directory(self, recordDirectory):

759

"""

760

Set recording output directory.

761

762

Parameters:

763

- recordDirectory (str): Output directory path

764

"""

765

```

766

767

## Virtual Camera and Replay Buffer

768

769

### Virtual Camera

770

771

```python { .api }

772

def get_virtual_cam_status(self):

773

"""

774

Get virtual camera status.

775

776

Returns:

777

Object with output_active

778

"""

779

780

def start_virtual_cam(self):

781

"""Start virtual camera."""

782

783

def stop_virtual_cam(self):

784

"""Stop virtual camera."""

785

786

def toggle_virtual_cam(self):

787

"""

788

Toggle virtual camera.

789

790

Returns:

791

Object with output_active

792

"""

793

```

794

795

### Replay Buffer

796

797

```python { .api }

798

def get_replay_buffer_status(self):

799

"""

800

Get replay buffer status.

801

802

Returns:

803

Object with output_active

804

"""

805

806

def start_replay_buffer(self):

807

"""Start replay buffer."""

808

809

def stop_replay_buffer(self):

810

"""Stop replay buffer."""

811

812

def toggle_replay_buffer(self):

813

"""

814

Toggle replay buffer.

815

816

Returns:

817

Object with output_active

818

"""

819

820

def save_replay_buffer(self):

821

"""Save replay buffer to file."""

822

823

def get_last_replay_buffer_replay(self):

824

"""

825

Get last replay buffer save path.

826

827

Returns:

828

Object with saved_replay_path

829

"""

830

```

831

832

## Configuration Management

833

834

### Scene Collections

835

836

```python { .api }

837

def get_scene_collection_list(self):

838

"""

839

Get array of all scene collections.

840

841

Returns:

842

Object with scene_collections list

843

"""

844

845

def set_current_scene_collection(self, name):

846

"""

847

Switch to a scene collection.

848

849

Parameters:

850

- name (str): Name of scene collection to switch to

851

"""

852

853

def create_scene_collection(self, name):

854

"""

855

Create new scene collection and switch to it.

856

Note: This blocks until collection has finished changing.

857

858

Parameters:

859

- name (str): Name for new scene collection

860

"""

861

```

862

863

### Profiles

864

865

```python { .api }

866

def get_profile_list(self):

867

"""

868

Get list of all profiles.

869

870

Returns:

871

Object with profiles list

872

"""

873

874

def set_current_profile(self, name):

875

"""

876

Switch to a profile.

877

878

Parameters:

879

- name (str): Name of profile to switch to

880

"""

881

882

def create_profile(self, name):

883

"""

884

Create new profile and switch to it.

885

886

Parameters:

887

- name (str): Name for new profile

888

"""

889

890

def remove_profile(self, name):

891

"""

892

Remove a profile. If current profile is chosen, switches to different profile first.

893

894

Parameters:

895

- name (str): Name of profile to remove

896

"""

897

898

def get_profile_parameter(self, category, name):

899

"""

900

Get parameter from current profile's configuration.

901

902

Parameters:

903

- category (str): Parameter category

904

- name (str): Parameter name

905

906

Returns:

907

Object with parameter_value and default_parameter_value

908

"""

909

910

def set_profile_parameter(self, category, name, value):

911

"""

912

Set parameter value in current profile's configuration.

913

914

Parameters:

915

- category (str): Parameter category

916

- name (str): Parameter name

917

- value (str): Parameter value (use None to delete)

918

"""

919

```

920

921

### Video and Stream Settings

922

923

```python { .api }

924

def get_video_settings(self):

925

"""

926

Get current video settings.

927

928

Returns:

929

Object with fps_numerator, fps_denominator, base_width, base_height, output_width, output_height

930

"""

931

932

def set_video_settings(self, fps_numerator=None, fps_denominator=None, base_width=None, base_height=None, output_width=None, output_height=None):

933

"""

934

Set video settings.

935

936

Parameters:

937

- fps_numerator (int, optional): Numerator of FPS fraction

938

- fps_denominator (int, optional): Denominator of FPS fraction

939

- base_width (int, optional): Base canvas width

940

- base_height (int, optional): Base canvas height

941

- output_width (int, optional): Output width

942

- output_height (int, optional): Output height

943

"""

944

945

def get_stream_service_settings(self):

946

"""

947

Get current stream service settings.

948

949

Returns:

950

Object with stream_service_type and stream_service_settings

951

"""

952

953

def set_stream_service_settings(self, ss_type, ss_settings):

954

"""

955

Set stream service settings.

956

957

Parameters:

958

- ss_type (str): Stream service type

959

- ss_settings (dict): Stream service settings

960

"""

961

```

962

963

### Scene Transitions

964

965

```python { .api }

966

def get_transition_kind_list(self):

967

"""

968

Get array of all available transition kinds.

969

970

Returns:

971

Object with transition_kinds list

972

"""

973

974

def get_scene_transition_list(self):

975

"""

976

Get array of all scene transitions in OBS.

977

978

Returns:

979

Object with scene_transitions list

980

"""

981

982

def get_current_scene_transition(self):

983

"""

984

Get current scene transition information.

985

986

Returns:

987

Object with transition_name, transition_kind, transition_duration, transition_fixed, transition_configurable, transition_settings

988

"""

989

990

def set_current_scene_transition(self, name):

991

"""

992

Set current scene transition.

993

Note: While transition namespace is generally unique, uniqueness is not guaranteed.

994

995

Parameters:

996

- name (str): Name of transition to make active

997

"""

998

999

def set_current_scene_transition_duration(self, duration):

1000

"""

1001

Set duration of current scene transition, if not fixed.

1002

1003

Parameters:

1004

- duration (int): Duration in milliseconds (50-20000)

1005

"""

1006

1007

def set_current_scene_transition_settings(self, settings, overlay=None):

1008

"""

1009

Set settings of current scene transition.

1010

1011

Parameters:

1012

- settings (dict): Settings object to apply (can be empty dict)

1013

- overlay (bool, optional): Whether to overlay over current settings or replace them

1014

"""

1015

1016

def get_current_scene_transition_cursor(self):

1017

"""

1018

Get cursor position of current scene transition.

1019

Note: Returns 1.0 when transition is inactive.

1020

1021

Returns:

1022

Object with transition_cursor (0.0-1.0)

1023

"""

1024

1025

def trigger_studio_mode_transition(self):

1026

"""

1027

Trigger current scene transition (same as Transition button in studio mode).

1028

Note: Studio mode must be active or throws StudioModeNotActive error.

1029

"""

1030

1031

def set_t_bar_position(self, pos, release=None):

1032

"""

1033

Set position of TBar.

1034

Warning: This will be deprecated in future obs-websocket version.

1035

1036

Parameters:

1037

- pos (float): New position (0.0-1.0)

1038

- release (bool, optional): Whether to release TBar (only set False if sending another position update)

1039

"""

1040

```

1041

1042

### Studio Mode

1043

1044

```python { .api }

1045

def get_studio_mode_enabled(self):

1046

"""

1047

Get whether studio mode is enabled.

1048

1049

Returns:

1050

Object with studio_mode_enabled

1051

"""

1052

1053

def set_studio_mode_enabled(self, enabled):

1054

"""

1055

Enable or disable studio mode.

1056

1057

Parameters:

1058

- enabled (bool): Enable studio mode

1059

"""

1060

```

1061

1062

### General Output Management

1063

1064

```python { .api }

1065

def get_output_list(self):

1066

"""

1067

Get list of available outputs.

1068

1069

Returns:

1070

Object with outputs list

1071

"""

1072

1073

def get_output_status(self, name):

1074

"""

1075

Get status of an output.

1076

1077

Parameters:

1078

- name (str): Output name

1079

1080

Returns:

1081

Object with output_active and other status information

1082

"""

1083

1084

def toggle_output(self, name):

1085

"""

1086

Toggle status of an output.

1087

1088

Parameters:

1089

- name (str): Output name

1090

1091

Returns:

1092

Object with output_active (new state)

1093

"""

1094

1095

def start_output(self, name):

1096

"""

1097

Start an output.

1098

1099

Parameters:

1100

- name (str): Output name

1101

"""

1102

1103

def stop_output(self, name):

1104

"""

1105

Stop an output.

1106

1107

Parameters:

1108

- name (str): Output name

1109

"""

1110

1111

def get_output_settings(self, name):

1112

"""

1113

Get settings of an output.

1114

1115

Parameters:

1116

- name (str): Output name

1117

1118

Returns:

1119

Object with output_settings

1120

"""

1121

1122

def set_output_settings(self, name, settings):

1123

"""

1124

Set settings of an output.

1125

1126

Parameters:

1127

- name (str): Output name

1128

- settings (dict): Output settings

1129

"""

1130

```

1131

1132

### Source Operations

1133

1134

```python { .api }

1135

def get_source_active(self, name):

1136

"""

1137

Get active and show state of a source.

1138

1139

Parameters:

1140

- name (str): Source name

1141

1142

Returns:

1143

Object with video_active and video_showing

1144

"""

1145

1146

def get_source_screenshot(self, name, img_format, width=None, height=None, quality=None):

1147

"""

1148

Get Base64-encoded screenshot of a source.

1149

1150

Parameters:

1151

- name (str): Source name

1152

- img_format (str): Image format (jpg, png, bmp, tga, etc.)

1153

- width (int, optional): Screenshot width

1154

- height (int, optional): Screenshot height

1155

- quality (int, optional): Quality for jpg format (0-100)

1156

1157

Returns:

1158

Object with image_data (Base64 string)

1159

"""

1160

1161

def save_source_screenshot(self, name, img_format, file_path, width=None, height=None, quality=None):

1162

"""

1163

Save screenshot of a source to file.

1164

1165

Parameters:

1166

- name (str): Source name

1167

- img_format (str): Image format (jpg, png, bmp, tga, etc.)

1168

- file_path (str): Path to save screenshot

1169

- width (int, optional): Screenshot width

1170

- height (int, optional): Screenshot height

1171

- quality (int, optional): Quality for jpg format (0-100)

1172

"""

1173

```

1174

1175

### Media Input Controls

1176

1177

```python { .api }

1178

def get_media_input_status(self, name):

1179

"""

1180

Get status of a media input.

1181

1182

Parameters:

1183

- name (str): Media input name

1184

1185

Returns:

1186

Object with media_state, media_duration, media_cursor

1187

"""

1188

1189

def set_media_input_cursor(self, name, cursor):

1190

"""

1191

Set cursor position of a media input.

1192

1193

Parameters:

1194

- name (str): Media input name

1195

- cursor (int): Cursor position in milliseconds

1196

"""

1197

1198

def offset_media_input_cursor(self, name, offset):

1199

"""

1200

Offset cursor position of a media input.

1201

1202

Parameters:

1203

- name (str): Media input name

1204

- offset (int): Offset in milliseconds (can be negative)

1205

"""

1206

1207

def trigger_media_input_action(self, name, action):

1208

"""

1209

Trigger action on a media input.

1210

1211

Parameters:

1212

- name (str): Media input name

1213

- action (str): Action to trigger (Play, Pause, Stop, Restart, Next, Previous)

1214

"""

1215

```

1216

1217

## Advanced Features

1218

1219

### Hotkeys

1220

1221

```python { .api }

1222

def get_hot_key_list(self):

1223

"""

1224

Get available hotkeys.

1225

1226

Returns:

1227

Object with hotkeys list

1228

"""

1229

1230

get_hotkey_list = get_hot_key_list # Alias

1231

1232

def trigger_hot_key_by_name(self, hotkeyName, contextName=None):

1233

"""

1234

Trigger hotkey by name.

1235

1236

Parameters:

1237

- hotkeyName (str): Hotkey name

1238

- contextName (str, optional): Context name

1239

"""

1240

1241

trigger_hotkey_by_name = trigger_hot_key_by_name # Alias

1242

1243

def trigger_hot_key_by_key_sequence(self, keyId, pressShift=None, pressCtrl=None, pressAlt=None, pressCmd=None):

1244

"""

1245

Trigger hotkey by key sequence.

1246

1247

Parameters:

1248

- keyId (str): OBS key ID

1249

- pressShift (bool, optional): Press Shift modifier

1250

- pressCtrl (bool, optional): Press Ctrl modifier

1251

- pressAlt (bool, optional): Press Alt modifier

1252

- pressCmd (bool, optional): Press Cmd modifier (Mac)

1253

"""

1254

1255

trigger_hotkey_by_key_sequence = trigger_hot_key_by_key_sequence # Alias

1256

1257

get_hotkey_list = get_hot_key_list # Alias

1258

trigger_hotkey_by_name = trigger_hot_key_by_name # Alias

1259

```

1260

1261

### Filters

1262

1263

```python { .api }

1264

def get_source_filter_list(self, name):

1265

"""

1266

Get source filters.

1267

1268

Parameters:

1269

- name (str): Source name

1270

1271

Returns:

1272

Object with filters list

1273

"""

1274

1275

def create_source_filter(self, source_name, filter_name, filter_kind, filter_settings=None):

1276

"""

1277

Create source filter.

1278

1279

Parameters:

1280

- source_name (str): Source name

1281

- filter_name (str): Filter name

1282

- filter_kind (str): Filter type

1283

- filter_settings (dict, optional): Filter settings

1284

"""

1285

1286

def remove_source_filter(self, source_name, filter_name):

1287

"""

1288

Remove source filter.

1289

1290

Parameters:

1291

- source_name (str): Source name

1292

- filter_name (str): Filter name

1293

"""

1294

1295

def set_source_filter_enabled(self, source_name, filter_name, enabled):

1296

"""

1297

Enable/disable source filter.

1298

1299

Parameters:

1300

- source_name (str): Source name

1301

- filter_name (str): Filter name

1302

- enabled (bool): Enable state

1303

"""

1304

1305

def get_source_filter_kind_list(self):

1306

"""

1307

Get array of all available source filter kinds.

1308

1309

Returns:

1310

Object with source_filter_kinds list

1311

"""

1312

1313

def get_source_filter_default_settings(self, filter_kind):

1314

"""

1315

Get default settings for a filter kind.

1316

1317

Parameters:

1318

- filter_kind (str): Filter kind name

1319

1320

Returns:

1321

Object with default_filter_settings

1322

"""

1323

1324

def get_source_filter(self, source_name, filter_name):

1325

"""

1326

Get information for a specific source filter.

1327

1328

Parameters:

1329

- source_name (str): Source name

1330

- filter_name (str): Filter name

1331

1332

Returns:

1333

Object with filter_enabled, filter_index, filter_kind, filter_settings

1334

"""

1335

1336

def set_source_filter_name(self, source_name, old_filter_name, new_filter_name):

1337

"""

1338

Set name of a source filter (rename).

1339

1340

Parameters:

1341

- source_name (str): Source name

1342

- old_filter_name (str): Current filter name

1343

- new_filter_name (str): New filter name

1344

"""

1345

1346

def set_source_filter_index(self, source_name, filter_name, index):

1347

"""

1348

Set index position of a filter on a source.

1349

1350

Parameters:

1351

- source_name (str): Source name

1352

- filter_name (str): Filter name

1353

- index (int): New filter index

1354

"""

1355

1356

def set_source_filter_settings(self, source_name, filter_name, settings, overlay=None):

1357

"""

1358

Set settings of a source filter.

1359

1360

Parameters:

1361

- source_name (str): Source name

1362

- filter_name (str): Filter name

1363

- settings (dict): Filter settings

1364

- overlay (bool, optional): Overlay on existing settings or replace

1365

"""

1366

```

1367

1368

### UI and Dialog Operations

1369

1370

```python { .api }

1371

def open_input_properties_dialog(self, input_name):

1372

"""

1373

Open properties dialog of an input.

1374

1375

Parameters:

1376

- input_name (str): Input name

1377

"""

1378

1379

def open_input_filters_dialog(self, input_name):

1380

"""

1381

Open filters dialog of an input.

1382

1383

Parameters:

1384

- input_name (str): Input name

1385

"""

1386

1387

def open_input_interact_dialog(self, input_name):

1388

"""

1389

Open interact dialog of an input.

1390

1391

Parameters:

1392

- input_name (str): Input name

1393

"""

1394

```

1395

1396

### Monitor and Projector Operations

1397

1398

```python { .api }

1399

def get_monitor_list(self):

1400

"""

1401

Get list of connected monitors.

1402

1403

Returns:

1404

Object with monitors list

1405

"""

1406

1407

def open_video_mix_projector(self, video_mix_type, monitor_index=None, projector_geometry=None):

1408

"""

1409

Open projector for specific output video mix.

1410

1411

Parameters:

1412

- video_mix_type (str): Video mix type (OBS_WEBSOCKET_VIDEO_MIX_TYPE_*)

1413

- monitor_index (int, optional): Monitor index (-1 for windowed)

1414

- projector_geometry (str, optional): Projector geometry in format "x,y,width,height"

1415

"""

1416

1417

def open_source_projector(self, source_name, monitor_index=None, projector_geometry=None):

1418

"""

1419

Open projector for a source.

1420

1421

Parameters:

1422

- source_name (str): Source name

1423

- monitor_index (int, optional): Monitor index (-1 for windowed)

1424

- projector_geometry (str, optional): Projector geometry in format "x,y,width,height"

1425

"""

1426

```

1427

1428

## Usage Examples

1429

1430

### Complete Scene Management

1431

1432

```python

1433

import obsws_python as obs

1434

1435

with obs.ReqClient() as client:

1436

# Get current scene information

1437

current = client.get_current_program_scene()

1438

print(f"Current scene: {current.current_program_scene_name}")

1439

1440

# Create and switch to new scene

1441

client.create_scene("My New Scene")

1442

client.set_current_program_scene("My New Scene")

1443

1444

# Add existing source to scene

1445

result = client.create_scene_item("My New Scene", "Mic/Aux", enabled=True)

1446

scene_item_id = result.scene_item_id

1447

1448

# Configure scene item

1449

client.set_scene_item_locked("My New Scene", scene_item_id, False)

1450

1451

# Get scene item transform

1452

transform = client.get_scene_item_transform("My New Scene", scene_item_id)

1453

print(f"Item position: {transform.scene_item_transform}")

1454

```

1455

1456

### Audio Input Control

1457

1458

```python

1459

import obsws_python as obs

1460

1461

with obs.ReqClient() as client:

1462

# Check current mute state

1463

mute_state = client.get_input_mute("Mic/Aux")

1464

print(f"Mic muted: {mute_state.input_muted}")

1465

1466

# Toggle mute and get new state

1467

new_state = client.toggle_input_mute("Mic/Aux")

1468

print(f"Mic now muted: {new_state.input_muted}")

1469

1470

# Set volume to 50%

1471

client.set_input_volume("Mic/Aux", vol_mul=0.5)

1472

1473

# Get current volume

1474

volume = client.get_input_volume("Mic/Aux")

1475

print(f"Volume: {volume.input_volume_mul} ({volume.input_volume_db}dB)")

1476

```