Skip to content

utils: Count rescaled encoders in GetStats output frames - #4

Merged
zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/getstats-rescale-output
Oct 13, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:fix/getstats-rescale-output

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Description

GetStats now counts the frames of encoders that rescale the output. Before, while a recording with Rescale Output ran, it reported outputSkippedFrames / outputTotalFrames = 0 / 0 and never showed encoding lag.

  • Utils::Obs::ObjectHelper::GetStats() (src/utils/Obs_ObjectHelper.cpp) read both values from obs_get_video(), the main video mix. An encoder that rescales the output (Settings > Output > Recording > Rescale Output) encodes from a video mix of its own, which that mix doesn't count.
  • obs-rust's libobs has obs_get_video_frame_counts() (libobs, frontend: Count encoding lag of encoders that rescale the output obs-studio#337). It counts the main mix and the mixes of rescaling encoders on it, each once, and OBS's Stats dock and status bar already use it. GetStats now uses it too. Nothing else changes.

This builds only against obs-rust's libobs (obs_get_video_frame_counts() isn't in upstream OBS).

Motivation and Context

Fixes obs-rust/obs-studio#514, the obs-websocket half of obs-rust/obs-studio#337 (upstream obsproject/obs-studio#11078). #337 listed GetStats as a follow-up.

How Has This Been Tested?

In obs-rust/obs-studio, with this commit as the submodule (the submodule bump follows once this merges), both libobs lanes:

  • Tier 4 suite (test/websocket-tier4/run_tier4.py), new phase "stats with Rescale Output" (records at 640x360 from a 1280x720 canvas for 3 s): GetStats gives 0 / 104 frames; before this commit 0 / 0. The rest of the suite is unchanged (185 of 186; GetVirtualCamStatus fails without a v4l2loopback device, before and after).
  • The current release AppImage (33.0.0-beta6-799-gd711a972c) reports 0 / 0 in the same phase, 3 of 3 runs.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

🤖 Generated with Claude Code

GetStats read outputTotalFrames and outputSkippedFrames from
obs_get_video(), the main video mix. An encoder that rescales the
output on the GPU (Settings > Output > Rescale Output) encodes from a
video mix of its own, so while such an encoder ran, GetStats reported
0 / 0 and never showed encoding lag, even when OBS's Stats dock showed
frames being skipped.

obs-rust's libobs now has obs_get_video_frame_counts(), which counts the
main mix and the mixes of rescaling encoders on it, each once; the
Stats dock and the status bar already use it. Use it here too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zackees
zackees merged commit ee7b938 into obs-rust:master Oct 13, 2026
zackees pushed a commit to rdoupe/obs-studio that referenced this pull request Oct 14, 2026
obs-rust#337 made OBS's Stats dock and status bar count the frames of encoders
that rescale the output (Rescale Output), which encode from a video mix
of their own. obs-websocket's GetStats still read obs_get_video(), the
main mix, so while only a rescaled recording ran it reported
outputSkippedFrames / outputTotalFrames = 0 / 0.
obs-rust/obs-websocket#4 takes both values from
obs_get_video_frame_counts(), like the Stats dock. That fix already
shipped with the submodule pin to 547f5ea; this adds the regression
test.

Add a Tier 4 phase: the suite can now start OBS on a profile written
before launch, and "stats with Rescale Output" records at 640x360 from
a 1280x720 canvas for 3 seconds and checks that GetStats counts the
frames. It retries StartRecord while the server answers 207 (NotReady)
during frontend startup. OBS is now started with --multi, so another
OBS on the same machine does not hold it at the single-instance dialog.
The phase fails with 0 / 0 with the submodule at caf0527, the fork
commit before obs-rust#4 was merged, and passes at 547f5ea.

Refs obs-rust#514.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=2586eb5231297f7e5ac0663ab8afd50d7755feea secs=528 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1792004952,"gate":"rust/all/fmt","host":"linux-x86_64","key":"fb9af536766902129ece46b231d51d356c88cd44b7a4ae4278693b9589973c1d","lane":"lint","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":53,"stamp":"522c5232d38c5379b2dbdf95d6745ae5","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"fb9af536766902129ece46b231d51d356c88cd44b7a4ae4278693b9589973c1d","lane":"lint","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":53,"stamp":"f72e64d0d7ce082ae99190cd946305de","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"f82a96a3ebf8185e9afc6a6936d54c407534dcd196aae1a51d822fd4982f8c3f","lane":"rust-test","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":121,"stamp":"211b88942d2ba50ac8803d0a66ddb031","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"d479cf2a3ac23b07a86c528e60bee7f4","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"a48f50b7437a052e74e2aa246a68bc7a","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"2b3f87af06084f79f56949749d6f7c82","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"c5a41a7056c65e335124d197bda80fd4","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"f85c003f8e3ecc00d28d7870ed9b8e24","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"89a7bf52adb3b008dd2dd6eeb5cfdb92","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"c0c4ea416ea70ee6dcb2acee436be364dea927882183c8c32e588e15bab63775","lane":"tier2-linux","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":244,"stamp":"9c59ada4512d7f5b22fc44fe799716d9","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
zackees pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 14, 2026
…-rust#751)

obs-rust#337 made OBS's Stats dock and status bar count the frames of encoders
that rescale the output (Rescale Output), which encode from a video mix
of their own. obs-websocket's GetStats still read obs_get_video(), the
main mix, so while only a rescaled recording ran it reported
outputSkippedFrames / outputTotalFrames = 0 / 0.
obs-rust/obs-websocket#4 takes both values from
obs_get_video_frame_counts(), like the Stats dock. That fix already
shipped with the submodule pin to 547f5ea; this adds the regression
test.

Add a Tier 4 phase: the suite can now start OBS on a profile written
before launch, and "stats with Rescale Output" records at 640x360 from
a 1280x720 canvas for 3 seconds and checks that GetStats counts the
frames. It retries StartRecord while the server answers 207 (NotReady)
during frontend startup. OBS is now started with --multi, so another
OBS on the same machine does not hold it at the single-instance dialog.
The phase fails with 0 / 0 with the submodule at caf0527, the fork
commit before #4 was merged, and passes at 547f5ea.

Refs obs-rust#514.


Local-Gate: v1 tree=2586eb5231297f7e5ac0663ab8afd50d7755feea secs=528 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1792004952,"gate":"rust/all/fmt","host":"linux-x86_64","key":"fb9af536766902129ece46b231d51d356c88cd44b7a4ae4278693b9589973c1d","lane":"lint","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":53,"stamp":"522c5232d38c5379b2dbdf95d6745ae5","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"fb9af536766902129ece46b231d51d356c88cd44b7a4ae4278693b9589973c1d","lane":"lint","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":53,"stamp":"f72e64d0d7ce082ae99190cd946305de","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"f82a96a3ebf8185e9afc6a6936d54c407534dcd196aae1a51d822fd4982f8c3f","lane":"rust-test","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":121,"stamp":"211b88942d2ba50ac8803d0a66ddb031","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"d479cf2a3ac23b07a86c528e60bee7f4","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"a48f50b7437a052e74e2aa246a68bc7a","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"2b3f87af06084f79f56949749d6f7c82","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"c5a41a7056c65e335124d197bda80fd4","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"f85c003f8e3ecc00d28d7870ed9b8e24","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"525209b94219c953eac4c0a7dc73aa9c42c3767378810ea5160b1b49650d3bfa","lane":"cross","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":109,"stamp":"89a7bf52adb3b008dd2dd6eeb5cfdb92","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}
Ci-Attestation: {"at":1792004952,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"c0c4ea416ea70ee6dcb2acee436be364dea927882183c8c32e588e15bab63775","lane":"tier2-linux","parents":["d9328f4c24bb4ceb49c67e3abb0cd4d74b453f2e"],"secs":244,"stamp":"9c59ada4512d7f5b22fc44fe799716d9","tree":"2586eb5231297f7e5ac0663ab8afd50d7755feea","v":1,"via":"run"}

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: obs-websocket: GetStats reports 0 / 0 output frames while a recording uses Rescale Output (follow-up of #337)

2 participants