Skip to content

Instantly share code, notes, and snippets.

@danielrosehill
Created April 29, 2026 15:07
Show Gist options
  • Select an option

  • Save danielrosehill/f2e6861dd6e4deba3eb173ce2847d860 to your computer and use it in GitHub Desktop.

Select an option

Save danielrosehill/f2e6861dd6e4deba3eb173ce2847d860 to your computer and use it in GitHub Desktop.
Fix: OBS Studio "Couldn't initialize muxer" on Ubuntu 24.04+ / 25.10 (AppArmor userns)

OBS Studio: "Couldn't initialize muxer" on Ubuntu 24.04+ / 25.10

If OBS Studio refuses to record on a recent Ubuntu (24.04, 24.10, 25.04, 25.10) with this dialog:

An encoder error occurred while recording: Couldn't initialize muxer

…and the OBS log (~/.config/obs-studio/logs/) shows:

[ffmpeg muxer: 'simple_file_output'] os_process_pipe_write for info structure failed
[ffmpeg muxer: 'simple_file_output'] ffmpeg-mux: Couldn't initialize muxer

…this is almost certainly AppArmor blocking unprivileged user namespaces, not a codec/container/path problem.

Root cause

Ubuntu 24.04+ ships with:

kernel.apparmor_restrict_unprivileged_userns = 1

OBS spawns obs-ffmpeg-mux as a helper child process and pipes muxer configuration to it over stdin. The userns restriction breaks that IPC, so the muxer never initializes — even though the helper binary itself works fine when invoked directly.

You can confirm by temporarily disabling the restriction:

sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

If recording starts working, this is your problem.

Permanent fix (recommended)

Re-enable the global restriction and grant OBS its own AppArmor profile that allows userns:

sudo tee /etc/apparmor.d/obs >/dev/null <<'EOF'
abi <abi/4.0>,
include <tunables/global>

profile obs /usr/bin/obs flags=(unconfined) {
  userns,
  include if exists <local/obs>
}
EOF

sudo systemctl reload apparmor
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=1

OBS now has the exception it needs while the rest of the system stays protected. Recording survives reboot.

Notes

  • If your OBS binary lives somewhere other than /usr/bin/obs (e.g. Flatpak), adjust the profile path. Flatpak OBS has different sandboxing — different fix.
  • The flags=(unconfined) attaches a profile without confining OBS further; we just need the userns line to be allowed.
  • This is unrelated to the more common "MP4 + weird codec" muxer errors. If your log doesn't contain os_process_pipe_write, you have a different problem.

This gist was generated by Claude Code. Please verify any information before relying on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment