The error "Failed to open NVENC codec: Generic error in an external library" in OBS on Ubuntu typically happens due to issues with the NVIDIA drivers or NVENC support on the system. Here's a step-by-step guide to fix it:
### 1. **Update NVIDIA Drivers**
Make sure you have the latest NVIDIA drivers installed on your system, as older drivers may not support NVENC properly.
1. Open a terminal and check the available NVIDIA drivers:
```bash
ubuntu-drivers devices
```
2. Install the recommended driver:
```bash
sudo apt install nvidia-driver-<recommended-version>
```
3. Reboot the system:
```bash
sudo reboot
```
### 2. **Install NVIDIA Codec SDK (NVENC Support)**
Ensure that the necessary packages for NVENC encoding are installed.
1. Add the NVIDIA PPA:
```bash
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
```
2. Install NVENC support:
```bash
sudo apt install libnvidia-encode1
```
### 3. **Check for FFmpeg with NVENC Support**
OBS relies on FFmpeg for encoding, so you need to ensure FFmpeg is compiled with NVENC support.
1. Install FFmpeg with NVENC support:
```bash
sudo apt install ffmpeg
```
### 4. **Disable Other Recording Software**
Ensure no other software is using NVENC, like NVIDIA ShadowPlay or Windows Game DVR. If you are dual-booting or using any other screen recording software, make sure they are disabled.
### 5. **Reconfigure OBS Settings**
Try resetting your OBS output settings:
1. Open OBS.
2. Go to **Settings > Output > Encoder**.
3. Select "Software (x264)" temporarily to check if software encoding works.
4. Switch back to NVENC to test after making sure all drivers are updated.
### 6. **Restart OBS**
After completing all the steps, restart OBS and check if NVENC works.
Let me know if these steps resolve the issue!