Repository navigation
Description
Upstream OBS bug, reported by lindenkron in obsproject/obs-studio#4245 (Windows 10, OBS 26.1.1, still there on 28.1.2), reproduced there by farhanjiwani and flaeri. Create a group, change its Bounding Box Type, then drag a source into it: the source and the group get broken transforms, and the transform dialog shows 90001 in every field. The issue was closed as stale in 2024 without a fix. It still happens on current master and on OBS 32.2.2. The code has not changed upstream or in this fork.
Location
libobs/obs-scene.clines 450-490,calculate_bounds_data(): the scale that fits a source into its bounding box is the box size divided by the source size (lines 477, 482, 485, 488 and 489). An empty group has size 0x0, so its scale is infinite.- Same file,
apply_group_transform()(line 3434) andget_ungrouped_transform()(line 3339): an item moved into a group is mapped through the group's draw transform (its inverse,matrix4_invat line 3452). With an infinite scale the item's position becomes NaN and its scale 0. The group's size is then computed from the NaN item (resize_scene_base(), line 3479).
The transform dialog clamps NaN to its spin boxes' maximum, which is the 90001 in the report.
Class
Wrong transform (NaN) from a division by zero. The source disappears from the canvas and the group cannot be repaired from the transform dialog.
How it is reached
- Add a group to a scene (empty).
- Edit Transform on the group: set Bounding Box Type to anything but "No bounds" or "Only constrain maximum size" (Stretch, Scale to inner bounds, outer bounds, to width, to height).
- Drag a source into the group in the Sources dock (
obs_scene_reorder_items2), or add it withobs_sceneitem_group_add_itemfrom a script.
The source's position becomes NaN and nothing is drawn. The same happens when the source has no size yet (0x0) and is added to an empty bounded group: it stays broken after it gets a size.
Reproduced with a libobs test (real scene, private Xvfb, canvas read back): with each of the five bounds types and both ways of adding, the item's position is NaN, the group's content is 0x0 and nothing is drawn.
Upstream work
None. No upstream PR. obsproject/obs-studio#8400 (de-served) describes confusing group layout with centred alignment; maintainers answered that its steps work as designed, and it does not involve an empty group, so it is not covered here.
Proposed fix and failing test
Fix (libobs):
- The scale half of
calculate_bounds_data()moves into a small helper,obs_bounds_fit_scale()inlibobs/obs-scene-bounds.[ch]. - Each fit divides only by a size that is not zero. A source with no size on an axis (an empty group, a source that has not loaded, a scale of 0) keeps its scale on that axis, so the empty group's transform stays finite and invertible. Every result that was finite before is unchanged.
Once the first source is in the group, the group resizes and the bounding box fits it as usual.
RED tests:
test_scene_bounds_fit(cmocka, all platforms, no display): the helper with 0x0, 0xN, Nx0 sources and a 0 scale, plus controls for sized sources. 4 of 5 cases fail today.test_group_empty_bounds(cmocka, Linux, needs core video, skips without a display): real scene, empty group with each bounds type, a source added withobs_sceneitem_group_add_itemand withobs_scene_reorder_items2; transforms of the item and the group must be finite, the item must be where the bounding box puts it, and the canvas is read back. Also a 0x0 source that grows later, and controls with a group that already holds a source and with a group without bounds. 12 of 18 cases fail today.
Side finding, not fixed here: obs_sceneitem_group_add_item() (line 3766) calls remove_group_transform() on an item that is not in the group yet, so an item added from a script to a group without a bounding box moves by the group's offset. Different cause; worth its own issue.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
rdoupe commentedon Oct 12, 2026
Claiming: this issue.
test_group_empty_bounds(12 of 18 failing) adds a source to an empty group with each bounding box type, throughobs_sceneitem_group_add_itemand the Sources dock's reorder path, and checks finite transforms and the rendered canvas;test_scene_bounds_fit(4 of 5 failing, no display) checks the bounds fit on its own.PR today.
test/cmocka: Add failing test for sources added to an empty bounded g…
libobs: Keep the transform of an empty bounded group finite
libobs: Keep the transform of an empty bounded group finite (#388)
rdoupe commentedon Oct 12, 2026
@lindenkron you reported this in obsproject/obs-studio#4245, so a heads-up: it's fixed here in obs-rust by #388, merged today with a regression test.
Cause: an empty group is 0x0, and when it has a bounding box, libobs fit it to the box by dividing the box's size by the group's size, which is a divide by zero. The group's scale became infinite, and every item moved into it was run through the inverse of that transform, so its position became NaN, which the Edit Transform dialog shows as 90001. farhanjiwani reproduced it and flaeri confirmed it in your thread. Now the bounds fit never divides by a zero size: on an axis with nothing to fit, the item keeps its scale, and every result that was already finite is computed exactly as before. The test adds a source to an empty group with each bounding box type, both the way scripts do and the way dragging in the Sources dock does: before, the item ended up NaN and off the canvas; now it lands in the group's box and renders there.
Not covered: the Sources dock wasn't dragged by hand; the test drives the same libobs calls.
Workaround on stock OBS: put a source in the group before giving the group a bounding box, or remove the bounding box while the group is empty.
obs-rust is an AI-assisted fork of OBS; on Arch it's
obs-studio-rust-gitin the AUR.If you try it, a short reply here on whether adding to an empty bounded group works for you would really help.