Skip to content

linux-pipewire: Use list-based format selector for video capture#11741

Merged
RytoEX merged 3 commits into
obsproject:masterfrom
tytan652:improve_pw_camera_ux
Aug 22, 2025
Merged

linux-pipewire: Use list-based format selector for video capture#11741
RytoEX merged 3 commits into
obsproject:masterfrom
tytan652:improve_pw_camera_ux

Conversation

@tytan652
Copy link
Copy Markdown
Collaborator

@tytan652 tytan652 commented Jan 18, 2025

Description

Change the video capture source UX to choose between formats provided as is by PipeWire and avoid providing non-functional combination.

Also it avoid the user to check every format to find the right resolution.

Negotiation is now made with the user selected format (the choice was ignored before).

Also fixes a typo in the name of a structure.

Note

Formatting of the strings case can be discussed, and FPS values (mainly multiple choices per format) could be added.

Before:

Screenshot From 2025-01-18 13-55-52

After first commit:
Screenshot From 2025-01-18 13-57-11

After second and third commit:
Screenshot From 2025-04-02 08-03-20

Motivation and Context

Inspired by #10895 and the fact the actual code was not respecting the user chosen format and potentially showing non-available resolution for some formats.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@tytan652 tytan652 added kind/bug Categorizes issue or PR as related to a bug. kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. Seeking Testers Build artifacts on CI platform/linux Categorizes issue or PR as affecting Linux specifically labels Jan 18, 2025
@tytan652 tytan652 force-pushed the improve_pw_camera_ux branch from 1fdcb9b to 65891c4 Compare January 18, 2025 13:22
@tytan652 tytan652 added the area/ui-ux Anything to do with changes or additions to UI/UX elements. label Jan 18, 2025
@Warchamp7
Copy link
Copy Markdown
Member

We had a lot of discussion about the string formatting for #10895 so I'd like to copy that as closely as possible for this.

@tytan652 tytan652 force-pushed the improve_pw_camera_ux branch from 65891c4 to 9ae7734 Compare January 28, 2025 06:30
@tytan652
Copy link
Copy Markdown
Collaborator Author

@Warchamp7

Screenshot From 2025-01-28 07-30-25

Comment thread plugins/linux-pipewire/camera-portal.c
@RytoEX
Copy link
Copy Markdown
Member

RytoEX commented Feb 14, 2025

@Warchamp7 does this now copy #10895 as closely as possible to be acceptable?

@RytoEX RytoEX requested a review from Warchamp7 February 14, 2025 19:40
@Warchamp7
Copy link
Copy Markdown
Member

@tytan652 tytan652 force-pushed the improve_pw_camera_ux branch from f7f7068 to a47e245 Compare April 2, 2025 06:08
@tytan652
Copy link
Copy Markdown
Collaborator Author

tytan652 commented Apr 2, 2025

@Warchamp7 requested changes are done.

Screenshot From 2025-04-02 08-03-20

Comment thread plugins/linux-pipewire/camera-portal.c Outdated
Comment thread plugins/linux-pipewire/camera-portal.c
@PatTheMav PatTheMav moved this from Ready to In review in OBS Studio 32.0 PR Considerations Aug 7, 2025
@PatTheMav PatTheMav moved this from In review to In progress in OBS Studio 32.0 PR Considerations Aug 8, 2025
@stephematician
Copy link
Copy Markdown
Contributor

Not that this is intended to be addressed with this PR (or perhaps a sensible default would be to assume 'N/A' FPS) - but 'ranged' FPS is not supported. E.g. start a loopback device and feed it some frames:

sudo modprobe v4l2loopback video_nr=10 max_buffers=4
gst-launch-1.0 videotestsrc horizontal_speed=4 ! \
    'video/x-raw,format=YUY2,width=640,height=480,framerate=30/1' ! \
    v4l2sink device=/dev/video10

This can be viewed using V4L2 input, but doesn't work with pipewire (camera) capture.

Also; I see errors in my log related to reading the format: test-v4l2loopback-pw.log - and the dropdown for format and FPS are empty.

@tytan652
Copy link
Copy Markdown
Collaborator Author

tytan652 commented Aug 20, 2025

but 'ranged' FPS is not supported

It is already explicitly marked/logged unsupported on master.

@stephematician
Copy link
Copy Markdown
Contributor

but 'ranged' FPS is not supported

It is already explicitly marked/logged unsupported on master.

ACK - and given that these devices work with plain V4L2 input; there's probably nothing that needs to be done here.

Confirming that if we use gstreamer's pipewiresink instead (not v4l2loopback) i.e.

gst-launch-1.0 videotestsrc ! 'video/x-raw,format=YUY2,width=640,height=480,framerate=30/1' ! \
    identity drop-allocation=1 ! \
    pipewiresink mode='render' \
    stream-properties='props,node.name=virtual_input.gst.test-source,media.class=Video/Source,media.role=Camera'

We get exactly what we expect in OBS; one format + FPS available:

image

@tytan652 tytan652 force-pushed the improve_pw_camera_ux branch from 6dc08ff to 70171b0 Compare August 22, 2025 04:32
@RytoEX RytoEX merged commit 2fe0385 into obsproject:master Aug 22, 2025
15 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in OBS Studio 32.0 PR Considerations Aug 22, 2025
@tytan652 tytan652 deleted the improve_pw_camera_ux branch August 22, 2025 18:34
pobrn added a commit to pobrn/obs-studio that referenced this pull request Aug 28, 2025
The refactor in obsproject#11741 made it so that if an offered format of a node
does not have a frame rate, then that is ignored. Instead of ignoring
those formats, just skip those parts from the format description.
pobrn added a commit to pobrn/obs-studio that referenced this pull request Sep 30, 2025
The refactor in obsproject#11741 made it so that if an offered format of a node
does not have a frame rate, then that is ignored. Instead of ignoring
those formats, just skip those parts from the format description.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ui-ux Anything to do with changes or additions to UI/UX elements. kind/bug Categorizes issue or PR as related to a bug. kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. platform/linux Categorizes issue or PR as affecting Linux specifically Seeking Testers Build artifacts on CI

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

7 participants