FiniteSingularity / obs-composite-blur

A comprehensive blur plugin for OBS that provides several different blur algorithms, and proper compositing.
GNU General Public License v2.0
319 stars 27 forks source link

[BUG] - Adding filter through OBS WebSocket makes the Display Capture black/invisible until the filters menu is opened [ Any other source as well ] #104

Open ftk789 opened 1 week ago

ftk789 commented 1 week ago

Describe the bug When adding a filter through the OBS WebSocket, It makes the source black/invisible until the filter menu is open, This happen with all sources, With normal sources being invisible, And with captures being black.

To Reproduce Steps to reproduce the behavior:

  1. Download OBS WebSocket
  2. Use any WebSocket Library ( I used NodeJS:
    
    const { default: OBSWebSocket } = require('obs-websocket-js');
    const obs = new OBSWebSocket();

// Configuration const obsHost = 'localhost'; // OBS WebSocket host const obsPort = 4444; // OBS WebSocket port const obsPassword = 'PASSWORD'; // OBS WebSocket password

async function applyEffectToSources() { try { // Connect to OBS WebSocket await obs.connect(ws://${obsHost}:${obsPort}, obsPassword); console.log('Connected to OBS WebSocket');

// Get the current scene
const { currentProgramSceneName } = await obs.call('GetCurrentProgramScene');
console.log(`Current scene: ${currentProgramSceneName}`);

obs.on('SourceFilterSettingsChanged', data => {
  console.log(data);
});

// Get all sources in the current scene
const { sceneItems } = await obs.call('GetSceneItemList', { sceneName: currentProgramSceneName });

// Apply the "Composite Blur" effect to each source
for (const item of sceneItems) {
  console.log(`Applying Composite Blur to source: ${item.sourceName}`);
  const { filters } = await obs.call('GetSourceFilterList', { sourceName: item.sourceName });
  const filterExists = filters.some(filter => filter.filterName === 'Composite Blur');

  if (!filterExists) {
    await obs.call('CreateSourceFilter', {
      sourceName: item.sourceName,
      filterName: 'Composite Blur',
      filterKind: 'obs_composite_blur',
    });
    console.log(`Filter 'Composite Blur' applied to source: ${item.sourceName}`);

  } else {
    console.log(`Filter 'Composite Blur' already exists on source: ${item.sourceName}`);
  }
}

// Disconnect from OBS WebSocket
//await obs.disconnect();
console.log('Disconnected from OBS WebSocket');

} catch (error) { console.error('Failed to apply effect:', error); } }

applyEffectToSources();


 )
3. And upon executing the NodeJS script, It just applies the effect but sources go invisible and captures goes black Until the filters menu have been brought up.

**Expected behavior**
To apply the effect without making the sources invisible / black

**Screenshots**
![image](https://github.com/FiniteSingularity/obs-composite-blur/assets/57598907/eeb3fd64-1fec-43a0-b339-40d18cc7d91f)

**Environment**
 - OS/Version: Windows 10
 - OBS Version: 30.0.2
 - Composite Blur Plugin Version: 1.1.0
 - Blur Algorithm/Type: Any

**GPU**
 - GPU make/model : NVIDIA GeForce GTX 1660 SUPER
 - GPU VRAM: 14 Gbps GDDR6 VRAM

**Additional context**
Thank you for an amazing plugin.
FiniteSingularity commented 1 week ago

Thank you for the bug report. I'll look into this soon, and try to get a fix out.