VisionDepth3D icon indicating copy to clipboard operation
VisionDepth3D copied to clipboard

Accelated hardware encoding not working for generator. (-hwaccel cuda?)

Open 3DVRFan opened this issue 1 year ago • 7 comments

Hardware CPU - AMD 7950X3D GPU - RTX 5090

I linked FFmpeg and tested the link in terminal gave back the version number of FFmpeg.

In the 3D generator tab.

Processing options Ticked FFmpeg.

Encoding settings. 16:9 / AV1 Nvenc / mp4v

(Not sure if the command is inserting -hwaccel cuda. But GPU is getting 0 use and CPU is around 70%. Am wanting to encode with GPU for speed like the "depth estimation" does. Also does the same when i untick FFmpeg.)

other interesting issues.

Selecting AV1( SVT-CPU, Faster). And others.

"undefined constant ( in 'slow'" "unable to parse option slow" "Error setting Slow preset"

(side note am new to this what model balances CPU/GPU to mid usage and is good for movies? DPT-beit-large seems to use reasonable resources. Someone told me DepthCrafter is best for video but i get an error "failed to load DepthCrafter custom")

3DVRFan avatar Oct 02 '25 05:10 3DVRFan

Hello, Thanks for your interest in VisionDepth3D, I am curious if you are using the release version or the dev version from GitHub? it could be that installing from .exe doesn't have the GPU .dll files needed or if FFMPEG isnt installed into PATH on your system or something else is underlying in the code, 3D gen wont run 100 percent off GPU being that it has to share resources between CPU and GPU this is what I get when running my renders, let me know if these track for you? and yea depth crafter is an amazing model and was getting implemented but I couldn't get the depth pipeline to run with mine never gave proper output so I decided to scrap that, the next update I have implemented Depth Anything V2 Giant Diffusion Model and will be available for use in the next update release, also MKV is recommended for AV1 since MP4 support is still inconsistent across players and editors.

Image Image Image

VisionDepth avatar Oct 04 '25 01:10 VisionDepth

Sorry my post was messy let me try again with more info am not good at this.

(Click "Environment Variables." Under "System variables," select Path and click "Edit." Click "New" and add the path to the bin folder (e.g., C:\FFmpeg\bin ). Click "OK" on all dialogs to apply the changes.)

Did this then went into terminal to check it worked with "ffmpeg -version". ✓

  • "Depth estimation" tab works great uses my cuda cores get a depth map after. ✓

  • "3D Video generator" tab will not use my GPU when using Full-SBS AV1 NVENC to generate final video. ❌

I use ffmpeg normally and understand it balances AV1 under NVENC between GPU and CPU. This is why i noticed the problem as VisionDepth3D is not doing this 0% GPU usage full CPU usage at 6FPS 👎 .

As for installing i went to/VisionDepth/VisionDepth3D/releases Aug 28 installer.

Download the Installer Installer.exe (GUI installer for latest releases). Then "Follow the INNO installer prompts to install the full program."

I did tell it to install into my C:\Program Files\VisionDepth3D. NOT the local area it wanted by default.

"could be that installing from .exe doesn't have the GPU .dll"

Not sure how to check "GPU .DLL" i do have the new RTX 5090.... Digging around i did look at the code. (I'm not a coder...sorry for my ignorance)

"    if use_ffmpeg:
        ffmpeg_cmd = [
            "ffmpeg", "-y",
            "-f", "rawvideo",
            "-vcodec", "rawvideo",
            "-pix_fmt", "bgr24",
            "-s", f"{out_width}x{out_height}",
            "-r", str(fps),
            "-i", "-",
            "-an",
            "-c:v", selected_ffmpeg_codec,
            "-preset", "slow",
            "-pix_fmt", "yuv420p"
        ]"

"selected_ffmpeg_codec = "libx264""

I can't see where it's inserting codec map? It's defaulting to libx264 in my opinion. But you posted a photo of it working for you???? And as i said that "-preset slow" is making errors.


FFMPEG_CODEC_MAP = {
    # Software (CPU) Encoders
    "H.264 / AVC (libx264 - CPU)": "libx264",
    "H.265 / HEVC (libx265 - CPU)": "libx265",
    "AV1 (libaom - CPU)": "libaom-av1",
    "AV1 (SVT - CPU, faster)": "libsvtav1",
    "MPEG-4 (mp4v - CPU)": "mp4v",
    "XviD (AVI - CPU)": "XVID",
    "DivX (AVI - CPU)": "DIVX",

    # NVIDIA NVENC
    "H.264 / AVC (NVENC - NVIDIA GPU)": "h264_nvenc",
    "H.265 / HEVC (NVENC - NVIDIA GPU)": "hevc_nvenc",
    "AV1 (NVENC - NVIDIA RTX 40+ GPU)": "av1_nvenc",

    # AMD AMF
    "H.264 / AVC (AMF - AMD GPU)": "h264_amf",
    "H.265 / HEVC (AMF - AMD GPU)": "hevc_amf",
    "AV1 (AMF - AMD RDNA3+)": "av1_amf",

    # Intel QSV
    "H.264 / AVC (QSV - Intel GPU)": "h264_qsv",
    "H.265 / HEVC (QSV - Intel GPU)": "hevc_qsv",
    "VP9 (QSV - Intel GPU)": "vp9_qsv",
    "AV1 (QSV - Intel ARC / Gen11+)": "av1_qsv",
}

3DVRFan avatar Oct 04 '25 02:10 3DVRFan

Noticed this Error in the VisionDepth3D CMD windows. When pressing "generate 3D video".

C:\Program Files\VisionDepth3D\_internal\core\render_3d.py:138: UserWarning: expandable_segments not supported on this platform (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\pytorch\c10/cuda/CUDAAllocatorConfig.h:35.) return frame_tensor.to(torch_device)

Also it clearly see FFmpeg in VisionDepth3D CMD window.

ffmpeg version 8.0-full_build-www.gyan.dev Copyright (c) 2000-2025

3DVRFan avatar Oct 04 '25 03:10 3DVRFan

Sorry for the multiple posts am learning as i go...

So i changed to save MKV and AV1 kicked in. And GPU kicked in BUT Only using 5% of GPU and still stuck at 6FPS? No difference in speed to CPU.

From my little understanding adding "-hwaccel cuda" to the FFmpeg command when am encoding a video from 1 format to another helps in latch onto GPU and speed it up.

My normal FFmpeg for AV1 is around 200FPS and 35% GPU usage along with CPU.

3DVRFan avatar Oct 04 '25 03:10 3DVRFan

I will work on this for the next update thank you for bringing it up, im thinking that there are some .dll files that are missing that the 5090 needs to run at its fullest that i dont think I put in the folder during packaging since I don't have a 5090 for testing at the moment hopefully can get this sorted for you

VisionDepth avatar Oct 05 '25 01:10 VisionDepth

To let you know in the code i remove "slow" preset and put in "10" this solved the other error when trying to run AV1-SVT CPU.

3DVRFan avatar Oct 05 '25 03:10 3DVRFan

v3.6 - hopefully this update fixes the issues for you, I added a diagnostic button in the help drop down to see if the program is picking up gpu if any issue arise let me know by opening another issue

VisionDepth avatar Oct 06 '25 15:10 VisionDepth