Skip to content

Start recording once the source has video - #198

Open
samaistudio wants to merge 1 commit into
exeldro:masterfrom
samaistudio:fix/start-recording-when-picture-arrives
Open

samaistudio wants to merge 1 commit into
exeldro:masterfrom
samaistudio:fix/start-recording-when-picture-arrives

Conversation

@samaistudio

Copy link
Copy Markdown

Problem

If recording starts (record mode "Recording", "Streaming", etc.) while the parent source has no size yet, no file is ever written for that session.

In source_record_filter_update, start_file_output is only called when filter->video_output already exists. That only happens once the tick has seen a non-zero source size. filter->record is set to true anyway, so when the source gets video a moment later, every later update sees record == filter->record and never starts the output.

Easy ways to hit it on macOS:

  • a Continuity Camera (iPhone) or capture device that connects or warms up after OBS starts,
  • a window capture whose window was closed and reopened,
  • pressing Start Recording right after launching OBS.

Fix

In the tick, if recording is wanted, the video output now exists and no file output was created, reset filter->record and queue the normal update, so the recording starts through the usual path (encoders included). A flag keeps it from being queued more than once.

Testing

macOS (Apple Silicon), OBS 33.0.1, built against the 33.0.1 headers:

  • Filter on a window capture with no window. Start Recording, then point the capture at a window: the file now starts when the video appears (before: no file).
  • Filter on a camera that delivers frames normally: unchanged, the file starts with the recording.
  • Two filtered sources in the same scene: both files are written.

When the record (or record-when-streaming) mode kicks in while the parent
source has no size yet, there is no video output, so start_file_output is
skipped. filter->record is still set to true, so later updates see no change
and the file output is never created. Nothing is recorded for the whole
session.

This happens easily on macOS: a Continuity Camera that connects after OBS
starts, a capture card that is still waking up, or a window capture whose
window was closed and reopened.

In the tick, once the video output exists and recording is wanted but no
file output was created, reset the flag and queue the normal update, so the
recording starts through the usual path (encoders included).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant