NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.87k stars 13.93k forks source link

obs-studio: ffmpeg with --enable-libsmbclient breaks libusbmuxd #220837

Closed krav closed 5 months ago

krav commented 1 year ago

Describe the bug

Attempting to use an iOS device as a camera crashes OBS.

Both libsmbclient and libusbmuxd export a function socket_send, and the linker picks the wrong one.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install obs-studio with the obs-studio-plugins.droidcam-obs plugin enabled
  2. Add DroidCam OBS as a source
  3. Connect an iPhone to the computer using a USB cable
  4. Open DroidCam OBS settings and select Refresh Device List

OBS will segfault.

Expected behavior

OBS should discover the iPhone and display video input.

Screenshots

$ coredumpctl -r debug
[snip]
                Stack trace of thread 126369:
                #0  0x00001474f6e6af0f socket_send (libsamba-sockets-samba4.so + 0xff0f)
                #1  0x00001474a002ebb3 send_packet (libusbmuxd-2.0.so.6 + 0x3bb3)
                #2  0x00001474a00308d3 usbmuxd_get_device_list (libusbmuxd-2.0.so.6 + 0x58d3)
                #3  0x00001474a004b4d9 _ZN6USBMux8DoReloadEv (droidcam-obs.so + 0x74d9)
                #4  0x00001474a004b1f1 _Z13reload_threadPv (droidcam-obs.so + 0x71f1)
                #5  0x0000147501688e86 start_thread (libc.so.6 + 0x88e86)
                #6  0x000014750170fd30 __clone3 (libc.so.6 + 0x10fd30)
[snip]

Additional context

AFAIK OBS has no use for Samba support. Not sure if ffmpeg withFullDeps should include libsmbclient at all as a default, or if OBS should have more specific feature flags. I imagine there are more affected ffmpeg users.

Notify maintainers

@jb55 @MP2E @v @miangraham @Atemu

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.2.2, NixOS, 23.05 (Stoat), 23.05.20230309.b0e4a1d`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - channels(krav): `"localhost"`
 - nixpkgs: `/nix/store/sbbnabr6xggbq0rl710aqknd9zm34v85-source`
Atemu commented 1 year ago

That's an ..interesting error. OBS shouldn't be using ffmpeg-full though, that's a bug.

You should be able to work around the bug using obs-studio.override { ffmpeg_4 = pkgs.ffmpeg_4; }.

krav commented 1 year ago

Can confirm this works: nix shell --impure --expr 'let pkgs=(import <nixpkgs> {}); in ( pkgs.wrapOBS.override { obs-studio = (pkgs.obs-studio.override { ffmpeg_4 = pkgs.ffmpeg_4; }); } { plugins = [ pkgs.obs-studio-plugins.droidcam-obs ]; })'

raphaelr commented 1 year ago

The ffmpeg-full override was added in https://github.com/NixOS/nixpkgs/commit/8a3191fa1b0bf9fb9c3d59cfb1184adff4312377

Atemu commented 1 year ago

The correct fix is to enable AV1 in ffmpeg.

Atemu commented 5 months ago

SVT-AV1 has been enabled in ffmpeg for a bit now.