steam-for-linux icon indicating copy to clipboard operation
steam-for-linux copied to clipboard

Exporting a clip in h265 on a 2080 results in a generic "Failed to export 2"

Open Lifeismana opened this issue 1 year ago • 16 comments

Your system information

  • Steam client version (build number or date): 1734743608
  • Distribution (e.g. Ubuntu): Arch Linux
  • Opted into Steam client beta?: Yes
  • Have you checked for system updates?: Yes
  • Steam Logs: steam-logs.tar.gz
  • GPU: Nvidia 2080 565.77

Please describe your issue in as much detail as possible:

Trying to export a clip in h265 results in a generic "Failed to export 2" error Switching to h264 solves that error (recording is reported as being in h265) 2080 should support h265 hardware encoding but it could still be a driver error (not sure if i have a way to look into that)

I would expect it to not fail (maybe try to fallback to a software encoder?) or to at least to not show such a generic error (maybe recommend to try another codec)

Steps for reproducing this issue:

  1. Make a clip out of a recording (recording seems to be in h265, (enabled in settings))
  2. Export the clip with the "Original" setting

Lifeismana avatar Dec 26 '24 21:12 Lifeismana

Hello @Lifeismana,

Please set LIBVA_MESSAGING_LEVEL=2 before running steam (LIBVA_MESSAGING_LEVEL=2 steam from the CLI), then run Help -> Steam Runtime Diagnostics and upload the result.

It is likely you have no working 32 bit vaapi, or it's not actually pointing to your NVidia card, but I'd like to make sure.

TTimo avatar Jan 02 '25 22:01 TTimo

Is there even libVA encoding support on nvidia gpus? since nvidia doesn't provide any support you (I) have to resolve to use nvidia-vaapi-driver which doesn't have encoding support (https://github.com/elFarto/nvidia-vaapi-driver/issues/116)

vainfo
Trying display: wayland
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_12         : VAEntrypointVLD

Steam Runtime Diagnostics: https://gist.github.com/Lifeismana/ec8ac4dbf493a2518b0d856b462c1d1c

Lifeismana avatar Jan 02 '25 22:01 Lifeismana

Oh, right. LIBVA_MESSAGING_LEVEL defined in /etc/libva.conf overrides the env variable, so it didn't actually verbose .. please edit/comment out /etc/libva.conf instead..

In any case you'd need to look at 32 bit vainfo, which you probably don't have atm (the steam client is 32 bit).

The Steam Runtime diagnostic reports:

        "x11/vaapi" : {
          "messages" : [
            "vaInitialize (va_display, &major_version, &minor_version) failed: unknown libva error (-1)"
          ],
          "renderer" : null,
          "version" : null,
          "issues" : [
            "cannot-draw"
          ],
          "exit-status" : 1
        },

Showing you don't have 32 bit vaapi.

And yes I think you are correct, in order for this to work you may need a 32 bit build of https://github.com/elFarto/nvidia-vaapi-driver/

TTimo avatar Jan 02 '25 23:01 TTimo

In the end, this made me realize that nvidia-vaapi-driver was of no use for me since it isn't even used by steam for "accelerated rendering in web views" so i ended up uninstalling it since it cause games to lags when there's some decoding happening in firefox. (thanks nvidia :D) (Fwiw i was unable to compîle a 32bit build on arch, meson was complaining about deps missing (cmake & ffnvcodec) (it was building fine in 64bits))

Hopefully in the future nvidia will implement va-api or web browsers will be able to use vulkan video to hw accelerate dec/enc

This also made me realize that ffmpeg was only used for the record (which explains why i can record in h265) but not for clips, i assume it's easier to do everything in chromium once the stream record is loaded than to somehow export a buffer to ffmpeg

Lifeismana avatar Jan 06 '25 17:01 Lifeismana

Hello y'all. I previously was able to export video without tinkering. Latest on the 9th of January 2025. I've just run into this problem. I do not have an nvidia card.

Here's the steam runtime diagnostics with the LIBAV_MESSAGING_LEVEL of two: https://gist.github.com/xrogaan/6a26ea1153fdcda57908823a56608658

OP's workaroud to use H264 instead of H265 worked.

xrogaan avatar Jan 31 '25 13:01 xrogaan

Workaround for who want to export HEVC clip without re-encode to H.264 a.k.a. how to remux clip to normal mp4 without using Steam's UI:

  • Install VLC
  • Try to export clip on Steam and fail
  • Find a path to MPEG-DASH manifest by grep "Processing file" ~/.steam/steam/logs/streaming_log.txt | tail -n 1
  • /usr/bin/cvlc --play-and-exit /path/to/session.mpd --sout="#std{access=file,mux=mp4,dst=clip_$(LANG=C date +%Y%m%d_%H%M%S).mp4}"
    • ⚠ WARNING: VLC will silently overwrite destination path without asking to you. this is why I'm using date command to generate filename
  • After remux to mp4, you probably want to re-remux by FFmpeg, for example changing tag to hvc1 (for macOS users) by -tag:v hvc1.

Note:

  • FFmpeg (n7.1) will not work (only reads first segment if MPEG-DASH manifest doesn't contains SegmentTimeline)
  • yt-dlp (2025.01.26) will not work (they doens't handle MPEG-DASH manifest correctly if its on local filesystem)

rinsuki avatar Feb 09 '25 17:02 rinsuki

Can we get NVENC support or at least libx264 fallback? What about making the Original quality level be a pure raw remux instead of a re-encode? That way at least we can get videos out of the Steam client easily.

@TTimo The nvidia-vaapi-driver will not work because AFAICT it is only meant for decoding via NVDEC. The Github page says "Hardware decoding only, encoding is not supported."

urbenlegend avatar Apr 03 '25 18:04 urbenlegend

Tried to run the H.265 (NVENC) to export, but fails to export.

Failed with unknown libva error, despite being installed and reports version 1.22.0

"x11/vaapi" : {
          "messages" : [
            "libva info: VA-API version 1.22.0",
            "libva error: vaGetDriverNames() failed with unknown libva error",
            "vaInitialize (va_display, &major_version, &minor_version) failed: unknown libva error (-1)"
          ],
          "renderer" : null,
          "version" : null,
          "issues" : [
            "cannot-draw"
          ],
          "exit-status" : 1
        }

The exporting error that shows;

Starting export of clip clip_1659040_20250406_074449
Exporting/previewing from MPD files /home/xxxxxx/.local/share/Steam/userdata/50887403/gamerecordings/clips/clip_1659040_20250406_074449/video/fg_1659040_20250406_074422/session.mpd
[export] Starting for file: /home/xxxxxx/Videos/clip_1,743,932,590,460.mp4
[export] Failed to make initial encoder
Export failed with error code Failure

it fails to initialize encoder, I do have the libvaapi NVIDIA drivers installed, when I do try to run vainfo I also get same error as shown in Steam's error logs.

$ vainfo                                                                                           
Trying display: wayland
Trying display: x11
libva info: VA-API version 1.22.0
libva error: vaGetDriverNames() failed with unknown libva error
vaInitialize failed with error code -1 (unknown libva error),exit

Operating System: Manjaro Linux KDE Plasma Version: 6.3.2 KDE Frameworks Version: 6.11.0 Qt Version: 6.8.2 Kernel Version: 6.12.17-1-MANJARO (64-bit) Graphics Platform: X11 Processors: 8 × Intel® Core™ i7-7700K CPU @ 4.20GHz Memory: 31.3 GiB of RAM Graphics Processor: NVIDIA GeForce RTX 3070

alkaris2 avatar Apr 06 '25 10:04 alkaris2

fwiw i'm not seeing that error anymore when exporting a clip (save or copy to clipboard), i assume it's correctly falling back to software encoding when hardware encode isn't supported (2080 for me) although they might have broke the windows fallback when fixing that, i've seen a windows user complain about getting that "Failed to export 2" error when exporting a clip while it was working fine before for him

Lifeismana avatar Jun 20 '25 09:06 Lifeismana

Hey there, just noticed the "Need Retest" tag. I still can't export to h265 on my system.

[2025-07-16 05:40:35] Starting export of clip clip_1091500_20250212_080844
[2025-07-16 05:40:35] Exporting/previewing from MPD files /mnt/Games/media/gamesrecordings/clips/clip_1091500_20250212_080844/video/fg_1091500_20250212_072836/session.mpd
[2025-07-16 05:40:35] [export] Starting for file: /home/user/Vidéos/Steam/Cyberpunk 2077 - 2025-02-12 09-08-43 (1).mp4
[2025-07-16 05:40:35] libav: Cannot load libcuda.so.1
[2025-07-16 05:40:35] 
[2025-07-16 05:40:35] libav: Cannot load libcuda.so.1
[2025-07-16 05:40:35] libav: Could not dynamically load CUDA
[2025-07-16 05:40:35] 
[2025-07-16 05:40:35] libav: Could not dynamically load CUDA
[2025-07-16 05:40:35] [export] Failed to make initial encoder
[2025-07-16 05:40:35] Export failed with error code Failure
Steam Beta Branch:  Stable Client
Steam Version:  1751405894
Steam Client Build Date:  Sat, Jun 28 03:07 UTC -08:00
Steam Web Build Date:  Tue, Jul 1 23:19 UTC -08:00
Steam API Version:  SteamClient022

xrogaan avatar Jul 16 '25 03:07 xrogaan

Tested and itś not working.

[export] Starting for file: /home/someone/Videos/gamevideo.mp4
libav: Cannot load libcuda.so.1

libav: Cannot load libcuda.so.1
libav: Could not dynamically load CUDA

libav: Could not dynamically load CUDA
[export] Failed to make initial encoder
Export failed with error code Failure

Itś wierd, because i´ve got an AMD Radeon 9070XT Gpu. And it is installed proberly

vainfo --display drm --device /dev/dri/renderD128
Trying display: drm
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 25.2.0-cachyos1.1 for AMD Radeon RX 9070 XT (radeonsi, gfx1201, LLVM 20.1.8, DRM 3.64, 6.16.0-5-cachyos)
vainfo: Supported profile and entrypoints
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileHEVCMain10             :	VAEntrypointEncSlice
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileVP9Profile0            :	VAEntrypointVLD
      VAProfileVP9Profile2            :	VAEntrypointVLD
      VAProfileAV1Profile0            :	VAEntrypointVLD
      VAProfileAV1Profile0            :	VAEntrypointEncSlice
      VAProfileNone                   :	VAEntrypointVideoProc

H.264 works fine.

Toxican avatar Aug 11 '25 17:08 Toxican

🤔 maybe they broke amd support when fixing this @xrogaan @Toxican can you try installing cuda even though you're not using an nvidia gpu, it obviously seems to be failing on that being missing (afaik nvidia's drivers aren't required to install cuda) Could work as a temporary fix until valve fixes it (either libav is miss-configured to not fail on cuda missing by valve, or it's an issue with ffmpeg/libav itself)

Lifeismana avatar Aug 11 '25 18:08 Lifeismana

I decided to give this a try despite having an AMD GPU as well, and installing the cuda package for Arch Linux did not fix it. I have not yet found a fix. What did was nvidia-utils and lib32-nvidia-utils. I discovered this package by running pacman -F libcuda.so.1 to see which package(s) provided this library.

After installing the two Nvidia util packages, the error message changed (restarting Steam was not required):

[export] Starting for file: /tmp/steam/61B1385AAB5126E3.mp4
ERROR: unsafe call to setenv count:1 var:'PATH'
ERROR: unsafe call to setenv count:1 var:'PATH'
ERROR: unsafe call to setenv count:1 var:'PATH'
ERROR: unsafe call to setenv count:1 var:'PATH'
libav: cu->cuInit(0) failed
libav: cu->cuInit(0) failed
libav:  -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
libav:  -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
libav: 

libav:
[export] Failed to make initial encoder
Export failed with error code Failure

I have not yet found a fix.

EDIT: To clarify for any onlookers, I am not expecting to use CUDA here. I am perfectly aware I have and happy to have a GPU that does not support CUDA. This is specifically in response to my curiosity to the query above mine to try installing CUDA to fix the issue, regardless of GPU vendor, to see I presume if this step is just looking for CUDA due to a misconfiguration of libav, with the theory that once it got past this step it could correctly use i.e. vaapi to do the encoding. This reply is specifically to clarify that sadly this did not work. I realised after posting my reply that it seemed naive and unclear.

sonic2kk avatar Sep 10 '25 19:09 sonic2kk

If this wasn't stated before I'll just say that exporting from Steam on Windows using H.265 with the exact same hardware (AMD gpu, etc) works just fine. This only fails on Linux. I've since made a VLC script as stated earlier to export manually

Message ID: @.***>

dandalous avatar Sep 10 '25 22:09 dandalous

Same problem for me. 5090 on Windows 10

gdragon-git avatar Nov 22 '25 04:11 gdragon-git

open session.mpd in VLC convert/stream menu and RE-save

catara avatar Nov 30 '25 14:11 catara