Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using new ffmpeg HEVC D3D12 encoder support.. (on both NV and AMD GPUs) #311

Open
oscarbg opened this issue Mar 29, 2024 · 10 comments

Comments

@oscarbg
Copy link

oscarbg commented Mar 29, 2024

Hi,
built FFMPEG on Windows and simple testing fails on NV 3070 GPU..
I verify:

Enabled encoders:
d3d12va_encode

and ffmpeg -encoders:

V....D hevc_d3d12va D3D12VA hevc encoder (codec hevc)

running:

ffmpeg.exe -hwaccel d3d12va -hwaccel_output_format d3d12 -i c:\av1\input.mp4 -c:v hevc_d3d12va -acodec aac output.mp4

[hevc_d3d12va @ 00000237B7B29640] Encode failed 16
[hevc_d3d12va @ 00000237B7B29640] Output failed: -22.
[vost#0:0/hevc_d3d12va @ 00000237B7EC1980] Error submitting video frame to the encoder
[vost#0:0/hevc_d3d12va @ 00000237B7EC1980] Error encoding a frame: Invalid argument
[vost#0:0/hevc_d3d12va @ 00000237B7EC1980] Task finished with error code: -22 (Invalid argument)
[vost#0:0/hevc_d3d12va @ 00000237B7EC1980] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 00000237B5D29A80] video:59KiB audio:478KiB subtitle:0KiB other streams:0KiB global headers:0Ki

more log:

Metadata:
   major_brand     : mp42
   minor_version   : 0
   compatible_brands: isommp42
   encoder         : Lavf61.2.100
 Stream #0:0(und): Video: hevc (Main) (hev1 / 0x31766568), d3d12(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 12800 tbn (default)
     Metadata:
       creation_time   : 2023-04-12T01:03:23.000000Z
       handler_name    : ISO Media file produced by Google Inc. Created on: 04/11/2023.
       vendor_id       : [0][0][0][0]
       encoder         : Lavc61.4.100 hevc_d3d12va
 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
     Metadata:
       creation_time   : 2023-04-12T01:03:23.000000Z
       handler_name    : ISO Media file produced by Google Inc. Created on: 04/11/2023.
       vendor_id       : [0][0][0][0]
       encoder         : Lavc61.4.100 aac
[hevc_d3d12va @ 00000237B7B29640] Encode failed 16
[hevc_d3d12va @ 00000237B7B29640] Output failed: -22.
[vost#0:0/hevc_d3d12va @ 00000237B7EC1980] Error submitting video frame to the encoder
[vost#0:0/hevc_d3d12va @ 00000237B7EC1980] Error encoding a frame: Invalid argument
[vost#0:0/hevc_d3d12va @ 00000237B7EC1980] Task finished with error code: -22 (Invalid argument)
[vost#0:0/hevc_d3d12va @ 00000237B7EC1980] Terminating thread with return code -22 (Invalid argument)
@oscarbg
Copy link
Author

oscarbg commented Apr 4, 2024

@tong1wu can share if #313 is expected to fix, the errors I see in this issue?

@tong1wu
Copy link
Contributor

tong1wu commented Apr 7, 2024

@tong1wu can share if #313 is expected to fix, the errors I see in this issue?

It should be fixing this issue.

@oscarbg
Copy link
Author

oscarbg commented Apr 9, 2024

seems no..
recompiled today and still getting:

[hevc_d3d12va @ 00000177F916EB40] Encode failed 16
[hevc_d3d12va @ 00000177F916EB40] Output failed: -22.
[vost#0:0/hevc_d3d12va @ 00000177F916E5C0] Error submitting video frame to the encoder
[vost#0:0/hevc_d3d12va @ 00000177F916E5C0] Error encoding a frame: Invalid argument
[vost#0:0/hevc_d3d12va @ 00000177F916E5C0] Task finished with error code: -22 (Invalid argument)
[vost#0:0/hevc_d3d12va @ 00000177F916E5C0] Terminating thread with return code -22 (Invalid argument)

@oscarbg
Copy link
Author

oscarbg commented Apr 11, 2024

more info in case it helps..
using Nvida latest driver from 552.04
built with visual studio with flags (tried both a shared and a static build):
./configure --enable-vaapi --enable-d3d12va --target-os=win64 --arch=x86_64 --toolchain=msvc
./configure --enable-vaapi --enable-d3d12va --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-shared
both builds failed equally..

note I also tested on AMD RDNA2 GPU with latest drivers and even fail earlier (more error output shown)
can share if wanted.
but I think is better fix issues on Nvidia GPUs and later fix remaining bugs of D3D12 encoder AMD GPUs..

EDIT: question I also debugged with Visual Studio the exe file and seems is initializing the encoder/decoder correctly and even creating some correctly encoded frames before it fails en around 10-20fps.. maybe because of threading /sync issues and how to force a single threaded run (I also ran with "-threads 1" but also fails)..

@xuguangxin
Copy link
Contributor

xuguangxin commented Apr 11, 2024

more info in case it helps.. using Nvida latest driver from 552.04 built with visual studio with flags (tried both a shared and a static build): ./configure --enable-vaapi --enable-d3d12va --target-os=win64 --arch=x86_64 --toolchain=msvc ./configure --enable-vaapi --enable-d3d12va --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-shared both builds failed equally..

note I also tested on AMD RDNA2 GPU with latest drivers and even fail earlier (more error output shown) can share if wanted. but I think is better fix issues on Nvidia GPUs and later fix remaining bugs of D3D12 encoder AMD GPUs..

EDIT: question I also debugger with Visual Studio the exe file and seems is initializing the encoder/decoder correctly and even creating some correctly encoded frames before it fails en around 10-20fps.. maybe because of threading /sync issues and how to force a single threaded run (I also ran with "-threads 1" but also fails)..

@oscarbg , seems it's NV or AMD issue. Could you ask NV or AMD's help on this? thank you

@oscarbg
Copy link
Author

oscarbg commented Apr 11, 2024

@xuguangxin yes will try.. but don't know how to contact D3D12 teams at NV and AMD.. maybe you have better contacts to inform..
also would be nice and would help if this repo offered Windows binaries i.e. if a prebuilt ffmpeg.exe Windows binary with all cartwheel patches (like D3D12VA encode) was downloadable from this site perhaps added to quarterly releases for example added to:
https://github.com/intel/cartwheel-ffmpeg/releases/tag/2024q1
this way I can point directly at how to run to reproduce ..
afraid asking IVHs of patching FFMPEG and building first ffmpeg windows before they can debug their drivers..
they may answer to wait for patches to be merged into ffmpeg main first..
what do you think?
thanks..

@oscarbg
Copy link
Author

oscarbg commented Apr 12, 2024

commented to AMD here: https://twitter.com/oscarbg81/status/1778613900021272835

@oscarbg
Copy link
Author

oscarbg commented Apr 12, 2024

commented to NV here: https://twitter.com/oscarbg81/status/1778615032248422738
will close once I confirm it's NV and/or AMD issue..

@oscarbg oscarbg changed the title Error using HEVC D3D12 encoder.. Error using HEVC D3D12 encoder.. (on both NV and AMD GPUs) Apr 16, 2024
@oscarbg oscarbg changed the title Error using HEVC D3D12 encoder.. (on both NV and AMD GPUs) Error using new HEVC D3D12 encoder.. (on both NV and AMD GPUs) Apr 16, 2024
@oscarbg
Copy link
Author

oscarbg commented Apr 16, 2024

Asked to nvidia vulkan video devs:
nvpro-samples/vk_video_samples#76

@oscarbg
Copy link
Author

oscarbg commented Apr 16, 2024

Commented to amd amf guys?
GPUOpen-LibrariesAndSDKs/AMF#474

@oscarbg oscarbg changed the title Error using new HEVC D3D12 encoder.. (on both NV and AMD GPUs) Error using new ffmpeg HEVC D3D12 encoder support.. (on both NV and AMD GPUs) Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants