obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.69k stars 8.02k forks source link

QSV: Hardware device returned unexpected errors (MFX_ERR_DEVICE_FAILED) #9825

Closed BrentonPoke closed 1 year ago

BrentonPoke commented 1 year ago

Operating System Info

Other

Other OS

Fedora 39

OBS Studio Version

30.0.0-rc2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/IpzYJgIHHo3vrxHa

OBS Studio Crash Log URL

No response

Expected Behavior

A matroska file should be created and start recording video

Current Behavior

I get the following in an error modal:

Starting the output failed. Please check the log for details.

Note: If you are using the NVENC or AMD encoders, make sure your video drivers are up to date.

Steps to Reproduce

  1. Have a video source captured by OBS
  2. Go to settings and use Standard for recording type, selecting QuickSync AV1 for video enocder
  3. Save
  4. Press "Start Recording"

Anything else we should know?

I noticed the following in the log:

02:18:09.470: [qsv encoder: 'advanced_video_recording'] debug info:
02:18:09.481:   surf:           SysMem
02:18:09.491: [qsv encoder: 'msdk_impl'] Hardware device returned unexpected errors (MFX_ERR_DEVICE_FAILED)
02:18:09.491: [qsv encoder: 'advanced_video_recording'] qsv failed to load

This seems to affect other QSV encoding options, as I can't use any of them. My Mesa drivers are up to date and the rest of my display and video capability seems perfectly fine.

kkartaltepe commented 1 year ago

MFX_ERR_DEVICE_FAILED means your vaapi drivers failed to load, make sure your system is up to date, you dont have multiple intel vaapi drivers, and you have rebooted.

After that try adding --verbose flags when starting obs and re-uploading the log.

BrentonPoke commented 1 year ago

New log file Everything is up to date and I checked that the latest intel-media-driver was installed.

I did notice that FFMPEG VAAPI H264 works so long as I don't use Fedora's hot-corner feature (the OS may crash afterward).

These were my installed packages, i'm going to try uninstalling and reinstalling from the same repo:

Installed Packages
intel-dmabuf-dkms.x86_64       0.5949.220707.2.4.18.0.372.13.1-4.el8_6
                                                        @intel-graphics-rhel-8.5
intel-fw-gpu.x86_64            2022.27.1-156.el8        @intel-graphics-rhel-8.5
intel-gmmlib.x86_64            22.3.12-1.fc39           @fedora                 
intel-gmmlib-devel.x86_64      22.3.12-1.fc39           @fedora                 
intel-gpu-firmware.noarch      20231030-1.fc39          @updates                
intel-gsc.x86_64               0.8.4-35.el8             @intel-graphics-rhel-8.5
intel-gsc-devel.x86_64         0.8.4-35.el8             @intel-graphics-rhel-8.5
intel-i915-dkms.x86_64         0.5949.220707.2.4.18.0.372.13.1-4.el8_6
                                                        @intel-graphics-rhel-8.5
intel-igc-core.x86_64          1.0.11485-i419.el8       @intel-graphics-rhel-8.5
intel-igc-opencl.x86_64        1.0.11485-i419.el8       @intel-graphics-rhel-8.5
intel-level-zero-gpu.x86_64    1.3.23726.1-i419.el8     @intel-graphics-rhel-8.5
intel-media-driver.x86_64      23.3.5-1.fc39            @rpmfusion-nonfree      
intel-mediasdk.x86_64          23.2.2-2.fc39            @fedora                 
intel-platform-cse-dkms.x86_64 2022.28-4                @intel-graphics-rhel-8.5
kkartaltepe commented 1 year ago

I did notice that FFMPEG VAAPI H264 works so long as I don't use Fedora's hot-corner feature (the OS may crash afterward).

Unfortunately this isnt very useful, obs and intel's vpl libraries probe the driver a lot while ffmpeg vaapi only probes the driver once. So bugs in intel's vaapi driver during loading wont happen when using vaapi directly instead of intel's vpl/qsv libraries.

Everything is up to date and I checked that the latest intel-media-driver was installed.

It looks like you are mixing intel/rhel and fedora repositories. Doing this is probably causing your problem.

BrentonPoke commented 1 year ago

Everything is up to date and I checked that the latest intel-media-driver was installed.

It looks like you are mixing intel/rhel and fedora repositories. Doing this is probably causing your problem.

I already rectified that and the rhel libraries are no-longer installed. The problem persists and nothing seems to have changed.

This is the current list of packages:

Installed Packages
intel-gmmlib.x86_64                         22.3.12-1.fc39                        @fedora
intel-gmmlib-devel.x86_64                   22.3.12-1.fc39                        @fedora
intel-gpu-firmware.noarch                   20231030-1.fc39                       @updates
intel-igc.x86_64                            1.0.15313.1-1.fc39                    @updates
intel-igc-libs.x86_64                       1.0.15313.1-1.fc39                    @updates
intel-level-zero.x86_64                     23.35.27191.9-1.fc39                  @updates
intel-media-driver.x86_64                   23.3.5-1.fc39                         @rpmfusion-nonfree
intel-mediasdk.x86_64                       23.2.2-2.fc39                         @fedora
intel-mediasdk-devel.x86_64                 23.2.2-2.fc39                         @fedora
intel-opencl-clang.x86_64                   15.0.0-8.fc39                         @updates
A1RM4X commented 1 year ago

Salut!

I have the exact same issue here on Arch Linux with the latest obs studio compiled from git and an Intel A380.

I can provide more info if required. Thanks.

kkartaltepe commented 1 year ago

Unfortunately anyone who can replicate is likely going to need to debug the intel drivers and file the bug against them or provide some insight into how we can workaround it in obs. I've never replicated this issue and so far most people who reported it later reported it was fixed by using up to date system packages (as recently as a few days ago, so I don't think this is broken for all people).

Or figure out why it replicates on your machine and provide me a means to replicate it.

BrentonPoke commented 1 year ago

What packages did they need and where was that discussion? Mine are up to date and this is not working.

luyu-wu commented 1 year ago

Also experiencing the same problem!

Arch Linux Iris Xe (1135G7)

BrentonPoke commented 1 year ago

@A1RM4X @luyu-wu What intel packages do you have installed? Can you do list installed "intel*" with pacman?

BrentonPoke commented 1 year ago

I think I found the main issue. Walk with me:

There is a package called oneVPL-intel-gpu that requires a sort of "parent" package, oneVPL. The problem is that if I try to install it... image

...and I now direct your attention to the conflict:

Error: Transaction test error:
  file /usr/lib64/libvpl.so.2 from install of oneVPL-2023.3.1-1.fc39.x86_64 conflicts with file from package libvpl2-2022.1.5.0-i419.el8.x86_64

It seems that libvpl2 is actually required by OBS and numerous other things, but I wondered if removing it and installing oneVPL anyway would work. It turns out it did - sorta. I can now produce an AV1 encoded file in a 2-pc setup with OBS streaming from windows to nginx in a container alongside OBS both on linux.

Now here's the new problem - stability. The system crashes all the time when trying to do this, and i'm not convinced it's the chips. The system is a 6800K with an A770 and 48GB of system RAM, so i'm pretty sure this isn't a chip issue. I think it's a wayland issue, but I have no proof because I'm not sure how to debug the crashes since it's not OBS crashing, but the entire system due to OBS. One thing I noticed is that it's less likely when the preview isn't running. Another thing I noticed is simply playing back the resulting file can crash the system. I don't get why, and Totem has never acted like this before. But it does happen pretty consistently.

ghost commented 1 year ago

Have the same issue on stable 30.0 when trying to record with QuickSync H.264 Fedora Linux 39, UHD 620

kkartaltepe commented 1 year ago

As always, saying "me too" is functionally useless. If you feel like posting that please include a log from obs that includes the error at minimum or you may have a completely different issue and be wasting your time waiting for a possible fix for this issue.

There is a package called oneVPL-intel-gpu that requires a sort of "parent" package, oneVPL. The problem is that if I try to install it...

as originally pointed out you are mixing repostiories that shouldnt be mixed. If you cannot remove all non-fedora repositories on the system I think we can just close the issue as your system is unsupportable in this state.

BrentonPoke commented 1 year ago

The repository has already been disabled, but that doesn't remove packages. Linux is inherently unstable, so it's not "my system" it's literally the nature of the stack. Regardless of repositories, obs is still reliably crashing the machine on qsv while simple ffmpeg h264 never did. And it does no good to close this when people who are still having similar issues will just reopen it.

luyu-wu commented 1 year ago

@A1RM4X @luyu-wu What intel packages do you have installed? Can you do list installed "intel*" with pacman?

Sorry for the delayed response! image There shouldn't be anything conflicted here.

Edit: as @BretonPoke mentioned, I think it's better to leave this thread open until we can find a solution for people in the future who stumble upon this! I haven't done anything weird with my system, OBS QSV just didn't work ootb.

BrentonPoke commented 1 year ago

You might also need the oneVPL gpu package. I'm not sure if Arch packages oneVPL as a dependency or combined as one package, but can you try that and see what happens?

jthomaschewski commented 1 year ago

You might also need the oneVPL gpu package. I'm not sure if Arch packages oneVPL as a dependency or combined as one package, but can you try that and see what happens?

Thanks, installing the package onevpl-intel-gpu solved this issue for me on Arch.

Intel i7-1260P. Vaapi decoding/encoding worked fine in other applications but OBS.

Not working in official flatpak release though. Probably this needs to be distributed with the flatpak pkg.

Flatpak log when starting recording with QSV H264 (I assume this qualifies for a dedicated issue though) ``` info: ------------------------------------------------ info: >>> gpu tex not active, fall back to old qsv encoder info: [qsv encoder: 'advanced_video_stream'] settings: codec: H.264 rate_control: CBR info: target_bitrate: 2500 info: Lookahead Depth:60 info: target_usage: TU4 profile: high keyint: 2 latency: normal b-frames: 3 enhancements: on fps_num: 60 fps_den: 1 width: 1280 height: 720 info: [qsv encoder: 'advanced_video_stream'] debug info: error: Failed to initialize MFX Specified object not found. /run/build/obs/plugins/obs-qsv11/common_utils_linux.cpp 140 Specified object not found. /run/build/obs/plugins/obs-qsv11/QSV_Encoder_Internal.cpp 156 warning: [qsv encoder: 'msdk_impl'] Specified object/item/sync point not found. (MFX_ERR_NOT_FOUND) warning: [qsv encoder: 'advanced_video_stream'] qsv failed to load info: major: 1 minor: 0 info: interval: 4 GopPictSize: 120 g_pts2dtsShift: 0 ```
kkartaltepe commented 1 year ago

Closing this as people are mixing different issues and as expected most people just are unable to figure out the mess of packages to get intel's runtime working. I recommend you create a page on the wiki about what packages are required for your various distributions as we dont want to track this in our issue tracker.

For system stability issues you should file a bug against intel, especially if it happens playing back files without obs running. If you find a change to obs that improves your experience this please send a patch.

BrentonPoke commented 1 year ago

Closing this as people are mixing different issues and as expected most people just are unable to figure out the mess of packages to get intel's runtime working. I recommend you create a page on the wiki about what packages are required for your various distributions as we dont want to track this in our issue tracker.

For system stability issues you should file a bug against intel, especially if it happens playing back files without obs running. If you find a change to obs that improves your experience this please send a patch.

You could've been helpful by adding the oneVPL package as a conditional dependency for obs, since there is no indication it would even be necessary for this and you currently pull something else in its place.

kkartaltepe commented 1 year ago

You could've been helpful by adding the oneVPL package as a confidential dependency for obs, since there is no indication it would even be necessary for this and you currently pull something else in its place.

We do not maintain fedora packages, so you should provide appropriate packager with your feedback if you feel it was packaged poorly.

k1gen commented 1 year ago

hey, I have a similar error, MFX_ERR_NOT_FOUND (https://paste.c-net.org/CopyingBowing) on Arch, with UHD620. I have these packages installed:

$ pacman -Q | rg "intel|onevpl"
intel-compute-runtime 23.30.26918.9-1
intel-gmmlib 22.3.12-1
intel-gpu-tools 1.27-2
intel-graphics-compiler 1:1.0.14828.8-1
intel-media-driver 23.3.5-1
intel-ucode 20230808-1
lib32-vulkan-intel 1:23.2.1-2
onevpl 2023.3.1-1
onevpl-intel-gpu 23.3.4-1
vulkan-intel 1:23.2.1-2
ghost commented 1 year ago

We do not maintain fedora packages, so you should provide appropriate packager with your feedback if you feel it was packaged poorly.

Just tried the rpm OBS package from fedora repo and it works fine As @jthomaschewski has already said the problem is in the flatpak build

A1RM4X commented 1 year ago

Sorry for the late answer guys.

Just reinstalled a fresh Arch to troubleshoot. I confirm the error disappeared, might have too many drivers installed on my previous OS installation.

For information:

Hardware - Intel Arc a380 Distro: Arch Packages installed: pacman -Qq | grep intel intel-gmmlib intel-media-driver onevpl-intel-gpu

Thanks for the AWESOME work, we can finally play with our Arc intel GPU within OBS.

kkartaltepe commented 1 year ago

hey, I have a similar error, MFX_ERR_NOT_FOUND (https://paste.c-net.org/CopyingBowing) on Arch, with UHD620. I have these packages installed:

No this is a very different error, and conflating these two is precisely why I would prefer users not continue to append their varied QSV issues into this issue.

We prefer not to use our issues for support on what drivers to install for every package and Id prefer not to lock this issues for becoming a QSV support dumping ground. As recommended if you want a place to collaborate on documenting the proper way to install QSV for your preferred distribution you can use our forum or our wiki or anywhere else you prefer to collate information about how to properly install drivers.

k1gen commented 1 year ago

hey, I have a similar error, MFX_ERR_NOT_FOUND (https://paste.c-net.org/CopyingBowing) on Arch, with UHD620. I have these packages installed:

No this is a very different error, and conflating these two is precisely why I would prefer users not continue to append their varied QSV issues into this issue.

We prefer not to use our issues for support on what drivers to install for every package and Id prefer not to lock this issues for becoming a QSV support dumping ground. As recommended if you want a place to collaborate on documenting the proper way to install QSV for your preferred distribution you can use our forum or our wiki or anywhere else you prefer to collate information about how to properly install drivers.

could you please help me instead of complaining that I "dump my errors here"? I am here because I couldn't find any information on installing drivers for QSV on Arch, for Skylake cards.

BrentonPoke commented 1 year ago

hey, I have a similar error, MFX_ERR_NOT_FOUND (https://paste.c-net.org/CopyingBowing) on Arch, with UHD620. I have these packages installed:

No this is a very different error, and conflating these two is precisely why I would prefer users not continue to append their varied QSV issues into this issue.

We prefer not to use our issues for support on what drivers to install for every package and Id prefer not to lock this issues for becoming a QSV support dumping ground. As recommended if you want a place to collaborate on documenting the proper way to install QSV for your preferred distribution you can use our forum or our wiki or anywhere else you prefer to collate information about how to properly install drivers.

The reason they're not going to the forums is because nobody else does. Most of those threads have zero replies and it's a bit cynical to expect people to use a useless forum most people don't know about for any issue. You can't have everything you want. Fact of the matter is, there's still an issue with OBS crashing linux every time you press the record button, when the system is fine otherwise. Your refusal to even look into why OBS crashes systems so much is part of the problem, and makes it seem you're being defensive about your PR.

kkartaltepe commented 1 year ago

could you please help me instead of complaining that I "dump my errors here"? I am here because I couldn't find any information on installing drivers for QSV on Arch, for Skylake cards.

This is precisely what we hope to avoid in our issues, so if thats the discussion thats going to happen here we will need to lock this to ensure people know that they should be going to https://obsproject.com/help instead.

The reason they're not going to the forums is because nobody else does. Most of those threads have zero replies and it's a bit cynical to expect people to use a useless forum most people don't know about for any issue. You can't have everything you want. Fact of the matter is, there's still an issue with OBS crashing linux every time you press the record button, when the system is fine otherwise. Your refusal to even look into why OBS crashes systems so much is part of the problem, and makes it seem you're being defensive about your PR.

If you still think obs is fault and want this reopened you would need some exceptional evidence. To quote your earlier comment "I'm not sure how to debug the crashes since it's not OBS crashing", this strongly suggests there is a bug in something outside of obs (or more likely your early sabotage of your system is still in effect). If you cannot investigate further then it seems everything is done for this bug and we await someone to reply with a fix or more information to make it worth opening.

BrentonPoke commented 1 year ago

The reason they're not going to the forums is because nobody else does. Most of those threads have zero replies and it's a bit cynical to expect people to use a useless forum most people don't know about for any issue. You can't have everything you want. Fact of the matter is, there's still an issue with OBS crashing linux every time you press the record button, when the system is fine otherwise. Your refusal to even look into why OBS crashes systems so much is part of the problem, and makes it seem you're being defensive about your PR.

If you still think obs is fault and want this reopened you would need some exceptional evidence. To quote your earlier comment "I'm not sure how to debug the crashes since it's not OBS crashing", this strongly suggests there is a bug in something outside of obs (or more likely your early sabotage of your system is still in effect). If you cannot investigate further then it seems everything is done for this bug and we await someone to reply with a fix or more information to make it worth opening.

You deliberately cut off a key part of that sentence, which was that the system was crashing because of obs. There is no graceful failure by obs that allows me to see the log file afterwards, but a catastrophic one that can be reproduced by just using the software. But you haven't helped find any way to get telemetry about what happens when obs crashes the entire system if the log can't be counted on. The system is not "sabotaged", and blaming everyone else will not make obs better. If you're too proud to be a part of the solution, get us someone who can so you don't become part of the problem.

Fenrirthviti commented 1 year ago

As a reminder, please remain respectful and don't resort to personal attacks, which is against our CoC

As it stands, all evidence points towards broken/incompatible packages on the system which we cannot reproduce, and without reliable steps to reproduce the issue, there is unfortunately not much for us to investigate. If you would like this issue to be reopened/reconsidered, we would need full steps to reproduce the broken state from a clean Fedora install.

Thanks for understanding.

leodip commented 1 year ago

@k1gen Have you found a solution to this problem? I'm having the same here. https://github.com/obsproject/obs-studio/issues/9930

k1gen commented 1 year ago

@k1gen Have you found a solution to this problem? I'm having the same here. #9930

no, haven't found anything, switched back to vaapi. also, the forum is dead, so if you want to get help - I think the only place left to ask is discord

Motaphe commented 5 months ago

You might also need the oneVPL gpu package. I'm not sure if Arch packages oneVPL as a dependency or combined as one package, but can you try that and see what happens?

Thanks, installing the package onevpl-intel-gpu solved this issue for me on Arch.