Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obs-studio: 28.0.3 (additional to 27.x) #194578

Merged
merged 1 commit into from Nov 11, 2022
Merged

obs-studio: 28.0.3 (additional to 27.x) #194578

merged 1 commit into from Nov 11, 2022

Conversation

SebTM
Copy link
Contributor

@SebTM SebTM commented Oct 5, 2022

Description of changes

Depends on #194572 #194518 (✅ merged)

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@SebTM SebTM changed the title obs-studio: 27.2.4 -> 28.0.3 DRAFT: obs-studio: 27.2.4 -> 28.0.3 Oct 5, 2022
@SebTM
Copy link
Contributor Author

SebTM commented Oct 5, 2022

Attempted path: share/obs/obs-studio/locale/en-US.ini
Attempted path: /nix/store/kdpiplmmvdgw3yync5wwhp8akkynghnf-obs-studio-28.0.3/share/obs/obs-studio/locale/en-US.ini
Attempted path: share/obs/obs-studio/locale.ini
Attempted path: /nix/store/kdpiplmmvdgw3yync5wwhp8akkynghnf-obs-studio-28.0.3/share/obs/obs-studio/locale.ini
Attempted path: share/obs/obs-studio/themes/Yami.qss
Attempted path: /nix/store/kdpiplmmvdgw3yync5wwhp8akkynghnf-obs-studio-28.0.3/share/obs/obs-studio/themes/Yami.qss
info: Using EGL/X11
info: CPU Name: AMD Ryzen 7 PRO 4750U with Radeon Graphics
info: CPU Speed: 1700.000MHz
info: Physical Cores: 8, Logical Cores: 16
info: Physical Memory: 31329MB Total, 13964MB Free
info: Kernel Version: Linux 5.15.71
info: Distribution: NixOS "22.11"
info: Session Type: x11
info: Window System: X11.0, Vendor: The X.Org Foundation, Version: 1.20.14
info: Qt Version: 5.15.5 (runtime), 5.15.5 (compiled)
info: Portable mode: false
Attempted path: share/obs/obs-studio/themes/Dark/no_sources.svg
Attempted path: /nix/store/kdpiplmmvdgw3yync5wwhp8akkynghnf-obs-studio-28.0.3/share/obs/obs-studio/themes/Dark/no_sources.svg
QMetaObject::connectSlotsByName: No matching signal for on_tbar_position_valueChanged(int)
QMetaObject::connectSlotsByName: No matching signal for on_actionShowTransitionProperties_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionHideTransitionProperties_triggered()
info: OBS 28.0.3 (linux)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
	samples per sec: 48000
	speakers:        2
	max buffering:   960 milliseconds
	buffering type:  dynamically increasing
info: ---------------------------------
info: Initializing OpenGL...
info: Loading up OpenGL on adapter AMD AMD RENOIR (LLVM 14.0.6, DRM 3.42, 5.15.71)
info: OpenGL loaded successfully, version 4.6 (Core Profile) Mesa 22.1.7, shading language 4.60
info: ---------------------------------
info: video settings reset:
	base resolution:   640x480
	output resolution: 640x480
	downscale filter:  Bicubic
	fps:               30/1
	format:            NV12
	YUV mode:          Rec. 709/Partial
info: NV12 texture support not available
info: P010 texture support not available
info: Audio monitoring device:
	name: Default
	id: default
info: ---------------------------------
info: ---------------------------------
info:   Loaded Modules:
info: ---------------------------------
info: ==== Startup complete ===============================================
**error: Encoder ID 'obs_x264' not found
error: Failed to get properties for encoder '' (ffmpeg_aac)
error: Could not enumerate any AAC encoder bitrates
error: Failed to create aac streaming encoder (simple output)**
info: Freeing OBS context data
warning: 1 views remain at shutdown
info: == Profiler Results =============================
info: run_program_init: 1022.73 ms
info:  ┣OBSApp::AppInit: 3.835 ms
info:  ┃ ┗OBSApp::InitLocale: 0.908 ms
info:  ┗OBSApp::OBSInit: 211.068 ms
info:    ┣obs_startup: 62.216 ms
info:    ┗OBSBasic::OBSInit: 115.947 ms
info:      ┣OBSBasic::InitBasicConfig: 0.134 ms
info:      ┣OBSBasic::ResetAudio: 0.337 ms
info:      ┣OBSBasic::ResetVideo: 114.975 ms
info:      ┣OBSBasic::InitOBSCallbacks: 0.012 ms
info:      ┣OBSBasic::InitHotkeys: 0.041 ms
info:      ┣obs_load_all_modules2: 0.024 ms
info:      ┗OBSBasic::ResetOutputs: 0.132 ms
info: obs_hotkey_thread(25 ms): min=0.348 ms, median=0.943 ms, max=25.107 ms, 99th percentile=25.107 ms, 96.2963% below 25 ms
info: audio_thread(Audio): min=0.017 ms, median=0.025 ms, max=0.04 ms, 99th percentile=0.04 ms
info: obs_graphics_thread(33.3333 ms): min=0.312 ms, median=0.413 ms, max=2.573 ms, 99th percentile=2.573 ms, 100% below 33.333 ms
info:  ┣tick_sources: min=0.001 ms, median=0.002 ms, max=0.003 ms, 99th percentile=0.003 ms
info:  ┣output_frame: min=0.251 ms, median=0.333 ms, max=2.521 ms, 99th percentile=2.521 ms
info:  ┃ ┗gs_context(video->graphics): min=0.246 ms, median=0.329 ms, max=2.518 ms, 99th percentile=2.518 ms
info:  ┃   ┣render_video: min=0.024 ms, median=0.039 ms, max=0.697 ms, 99th percentile=0.697 ms
info:  ┃   ┃ ┗render_main_texture: min=0.017 ms, median=0.029 ms, max=0.687 ms, 99th percentile=0.687 ms
info:  ┃   ┗gs_flush: min=0.006 ms, median=0.01 ms, max=0.018 ms, 99th percentile=0.018 ms
info:  ┗render_displays: min=0.015 ms, median=0.026 ms, max=0.063 ms, 99th percentile=0.063 ms
info: =================================================
info: == Profiler Time Between Calls ==================
info: obs_hotkey_thread(25 ms): min=25.434 ms, median=26.249 ms, max=49.981 ms, 7.69231% within ±2% of 25 ms (0% lower, 92.3077% higher)
info: obs_graphics_thread(33.3333 ms): min=32.577 ms, median=33.343 ms, max=33.926 ms, 95.2381% within ±2% of 33.333 ms (4.7619% lower, 0% higher)
info: =================================================
info: Number of memory leaks: 304

Builds now successfully but does not start with this error: Failed to create aac streaming encoder (simple output)

@SebTM SebTM requested review from ymatsiuk, blitz and pasqui23 and removed request for blitz October 5, 2022 17:49
@SebTM SebTM changed the title DRAFT: obs-studio: 27.2.4 -> 28.0.3 obs-studio: 27.2.4 -> 28.0.3 Oct 5, 2022
@BenediktSeidl
Copy link

I think the problem is, that the plugin folder is cleared. At least i got it somehow working with the following hackish diff (which breaks the nixos plugin system for obs, it's only for demonstration!)

index 5303991f1fb..6db7c5239e7 100644
--- a/pkgs/applications/video/obs-studio/wrapper.nix
+++ b/pkgs/applications/video/obs-studio/wrapper.nix
@@ -22,16 +22,16 @@ symlinkJoin {
       wrapCommandLine = [
           "wrapProgram"
           "$out/bin/obs"
-          ''--set OBS_PLUGINS_PATH "${pluginsJoined}/lib/obs-plugins"''
-          ''--set OBS_PLUGINS_DATA_PATH "${pluginsJoined}/share/obs/obs-plugins"''
+          ''--set OBS_PLUGINS_PATH "${obs-studio}/lib/obs-plugins"''
+          ''--set OBS_PLUGINS_DATA_PATH "${obs-studio}/share/obs/obs-plugins"''
         ] ++ pluginArguments;
     in ''
     ${concatStringsSep " " wrapCommandLine}
 
     # Remove unused obs-plugins dir to not cause confusion
-    rm -r $out/share/obs/obs-plugins
+    # rm -r $out/share/obs/obs-plugins
     # Leave some breadcrumbs
-    echo 'Plugins are at ${pluginsJoined}/share/obs/obs-plugins' > $out/share/obs/obs-plugins-README
+    # echo 'Plugins are at ${pluginsJoined}/share/obs/obs-plugins' > $out/share/obs/obs-plugins-README
   '';
 
   inherit (obs-studio) meta;

Please also note that with obs version 28, there is no need for the external websocket plugin. i did not manage to build version 5.0.2 of it, but it's also not needed, because it is now included in obs (see https://github.com/obsproject/obs-studio/releases/tag/28.0.0):

Added obs-websocket 5.0 as a first-party plugin [tt2468]

So i think obs-studio-plugins.obs-websocket should to be removed with/after the update to version 28 of obs.

Sadly my nixos skills are not good enough to really help, but i hope this information saves you some time.

@SebTM
Copy link
Contributor Author

SebTM commented Oct 5, 2022

Thanks for your research and pointing this out! It seems, that we can not continue to drop the shipped plugins like before (?), maybe we can do something like splitting the plugin-files from the obs-build to include them in the combined-plugins output. But for now I have no idea how to archive this.

For the websocket-plugin: I also ran into this but forget to add it here as I dropped the plugins at some point for now until OBS28 runs (somehow).

@raphaelr
Copy link
Contributor

raphaelr commented Oct 6, 2022

obs doesn't pick up its built-in plugins, setting OBS_PLUGINS_PATH to ./result/lib/obs-plugins (same with OBS_PLUGINS_DATA_PATH and share) makes startup succeed. Trying to figure out how to properly fix that.

Also we should consider building it with Qt 6, which may cause plugin incompatibilities however.

Edit v2: Found it:

  1. obs-nix.c (referring to unix, not us) sets the default plugin path to OBS_INSTALL_PREFIX "/" OBS_PLUGIN_DESTINATION.
  2. OBS_INSTALL_PREFIX is $out (so an absolute store path)
  3. OBS_PLUGINS_DATA_PATH is ${OBS_LIBRARY_DESTINATION}/obs-plugins
  4. OBS_LIBRARY_DESTINATION is CMAKE_INSTALL_LIBDIR
  5. CMAKE_INSTALL_LIBDIR is $out/lib, so again an absolute store path
  6. Therefore, the builtin plugin path is "/nix/store/bla/" + "/" + "/nix/store/bla/lib", which is wrong

The issue is that obs assumes that CMAKE_INSTALL_LIBDIR is a relative directory (usually, just lib). Compare with Alpine Linux.

Thinking of a solution

@SebTM
Copy link
Contributor Author

SebTM commented Oct 6, 2022

Also we should consider building it with Qt 6, which may cause plugin incompatibilities however.

Checked the used dependencies, we missing qtx11extras for Qt6. As I didn't found libsForQt6 I would have imported qt6 and use qt6.qtbase and qt6.qtsvg? Or do we have to move the obs-studio package to qt6-packages.nix?

@raphaelr Thanks for looking into and helping out 🥇

@BenediktSeidl
Copy link

i also wanted to share my latest success: i got obs working with an external plugin: BenediktSeidl@b4c7471 but the non wrapped version of obs will exit with an error, you described above. also obs-backgroundremoval can only be compiled from master.

@raphaelr
Copy link
Contributor

raphaelr commented Oct 6, 2022

we missing qtx11extras for Qt6

It's fine, doesn't exist/not needed in Qt6

For Qt6, in all-packages.nix you need to replace libsForQt5.callPackage with qt6Packages.callPackage, and in obs-studio/default.nix remove the mkDerivation import and use the usual stdenv.mkDerivation instead, and add wrapQtAppsHook to nativeBuildInputs

@SebTM
Copy link
Contributor Author

SebTM commented Oct 6, 2022

Updated PR to build with qt6, added temporary fix (#194578 (comment)) to be able to run output for testing

@miangraham
Copy link
Contributor

miangraham commented Oct 7, 2022

Re: obs-plugins, Raphael has the problem right. obs-nix.c expects a relative OBS_PLUGIN_DESTINATION at runtime, but we need it to be absolute at build time.

I'd consider something like this: https://github.com/miangraham/nixpkgs/commit/286080568c51f5f3d3e3a06a1c8322bf15c98cd5

Leave OBS_PLUGIN_DESTINATION unchanged on the build side, but give the runtime side what it expects by pulling the prefix out of the string passed from cmake into obsconfig.h's #define. Slightly bigger change than one-line patching obs-nix.c, but future-proofs against other C code additions with similar expectations.

New variable used just for this at build time, as seen from cmake:

-- OBS_PLUGIN_DESTINATION_RELATIVE="lib/obs-plugins"

I've built but not runtime tested the above because my wayland system dumps core from Qt before reaching the affected areas, which will be another bug to fix at some point. Should be testable from X.

@SebTM
Copy link
Contributor Author

SebTM commented Oct 9, 2022

Updated PR to add -DENABLE_JACK=ON, tested/built locally successful. When it's ready I will remove the picked commit for the required new packages.

@miangraham
Copy link
Contributor

Updated PR to add -DENABLE_JACK=ON

Tested on 31b147d:

info: ---------------------------------
info:   Loaded Modules:
...
info:     linux-jack.so
...
info: ---------------------------------

info: ------------------------------------------------
info: Loaded scenes:
info: - scene 'Main':
info:     - source: 'obs music in' (jack_output_capture)
info:         - monitoring: monitor and output
info:     - source: 'obs mic in' (jack_output_capture)
info:         - monitoring: monitor and output
...
info: ------------------------------------------------

It works! 🎉

Qt is still sad:

info: Qt Version: 5.15.5 (runtime), 5.15.5 (compiled)

Current PR is missing at least the qt6Packages.callPackage change from a previously working commit.

@SebTM
Copy link
Contributor Author

SebTM commented Oct 11, 2022

Updated PR to build against Qt6 again (sorry amneded before so rebase removed the changes), removed cherry-picked dependencies as merged now. Retested it with "looking-glass-obs" and works for me :)

@raphaelr
Copy link
Contributor

Can I do it within this PR (in an additional commit) as the plugin will be removed with the upgrade to OBS28 or should it be another depending PR (like librist and libajantv2)

Do it in this PR; if you do it in a new PR master becomes broken (no obs-websocket but also no OBS 28).

@blitz
Copy link
Contributor

blitz commented Oct 12, 2022

Great to see a new OBS coming in. 👍 Can you rebase this PR? Otherwise, the build runs into:

❯ nix-build -A pkgs.obs-studio
error: Function called without required argument "librist" at /home/julian/src/own/nixpkgs/pkgs/applications/video/obs-studio/default.nix:40, did you mean "librest", "libXtst" or "libast"?

@blitz
Copy link
Contributor

blitz commented Oct 12, 2022

I've tested it with some light recording workloads and it looks good. Fiddling with a V4L2 source made by Gnome Session crash, but that doesn't seem like it should be OBS's fault.

The Gnome Shell crash is this one and it's supposedly fixed in GNOME 43: https://gitlab.gnome.org/GNOME/mutter/-/issues/2433 (I'm running 42.4)

@SebTM
Copy link
Contributor Author

SebTM commented Oct 12, 2022

Can I do it within this PR (in an additional commit) as the plugin will be removed with the upgrade to OBS28 or should it be another depending PR (like librist and libajantv2)

Do it in this PR; if you do it in a new PR master becomes broken (no obs-websocket but also no OBS 28).

Done in separate commit within this PR

Great to see a new OBS coming in. +1 Can you rebase this PR? Otherwise, the build runs into:

Rebased on current master

@raphaelr
Copy link
Contributor

raphaelr commented Oct 12, 2022

obs-studio looks good; plugin status (nix build .#obs-studio-plugins.name):

https://obsproject.com/kb/obs-studio-28-plugin-compatibility

This is just an overview of the current status, not neccessarily a "this MUST be fixed" list.

@miangraham
Copy link
Contributor

miangraham commented Oct 15, 2022

obs-ndi non-compat tracking issue: obs-ndi/obs-ndi#745

Upstream is broken against v28 until they finalize a fix.

Bleeding edge packagers like Alpine-edge, Arch, and RPMFusion seem to have rolled forward without it. It's also got users in practice--see activity on the issue above for an idea.

Assuming we don't plan to wait for it, flag as broken until they have a new release and consider user impact as a factor in merge timing relative to 22.11.

@Atemu
Copy link
Member

Atemu commented Oct 16, 2022

Since many plugins aren't ported yet and the changes to the derivation seem fairly minimal, could we keep around both versions?

@SebTM
Copy link
Contributor Author

SebTM commented Oct 17, 2022

Since many plugins aren't ported yet and the changes to the derivation seem fairly minimal, could we keep around both versions?

Sounds like a good idea, will try to have a look at it but mighty take some days (maybe the weekend).

@SebTM
Copy link
Contributor Author

SebTM commented Oct 20, 2022

Since many plugins aren't ported yet and the changes to the derivation seem fairly minimal, could we keep around both versions?

I've had quiet a look today but as there are fundamental changes like stdenv.mkDerivation vs mkDerivation my solution would be two separate derivations even with some duplicate code as we intend to drop 27 in the near future? Otherwise I would need some help/ideas on a more generic approach/example

@Atemu
Copy link
Member

Atemu commented Oct 21, 2022

I'm not an expert in this but it seems mkDerivation as a direct parameter is a remnant of an older style of packaging QT apps. Just use stdenv.mkDerivation and add wrapQtAppsHook to nativeBuildInputs for both versions.

As for version selection, I'd use a pattern similar to Emacs. A generic.nix with a function that takes version and hash and returns the existing package function. Then add versioned files that simply call generic.nix with a certain version. (You could do the same in a single file, that's preference.)

In the derivation we can then check against the version for optional dependencies etc. using finalAttrs.version (or rec but it kinda sucks).

@SebTM
Copy link
Contributor Author

SebTM commented Oct 22, 2022

Thanks @Atemu again for your help - I'm not quite sure if it's fully the solution you proposed but there were some issues with importing additional packages in 27/28.nix and appending to buildInputs so I came across this solution in a library and got it adapted and working. Both versions 27.x and 28.x are building and possible to launch without errors.

One thing I'm unsure about, how to handle/proceed with the plugins as there are sometimes different build/things for LibObs etc. needed.

@SebTM SebTM changed the title obs-studio: 27.2.4 -> 28.0.3 obs-studio: 28.0.3 (additional to 27.x) Oct 22, 2022
Copy link
Member

@fpletz fpletz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we will have both versions available in nixpkgs, let's merge this.

@fpletz fpletz merged commit d28a094 into NixOS:master Nov 11, 2022
@SebTM SebTM deleted the update/obs2803 branch November 11, 2022 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants