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

Cannot use hardware accelerated filters #138

Open
Sonic8694 opened this issue Jan 11, 2025 · 6 comments
Open

Cannot use hardware accelerated filters #138

Sonic8694 opened this issue Jan 11, 2025 · 6 comments

Comments

@Sonic8694
Copy link

This is a great FFMPGE GUI,I am using hardware (Nvidia 40 series graphics card) for encoding and decoding, everything is great。But when I tried to use hardware accelerated filters to assist with video processing, an error occurred. The scale_cuda or scale-npp filter should support hardware acceleration, but when I use the command line to call the filter, an error occurs。Here are the commands I used:-c:v av1_nvenc -preset p7 -pix_fmt p010le -vf "scale_npp=w=iw:h=ih:sharpness=2" -cq 38 -c:a aac -b:a 128K
I can't find many solutions online and I'm confused now. I hope it can be resolved

@eibol
Copy link
Owner

eibol commented Jan 12, 2025

What ffmpeg.exe versión are you using?
Maybe you need an updated one, compatible with nvidia drivers.
What is the error?

@Sonic8694
Copy link
Author

Sonic8694 commented Jan 13, 2025

NVIDIA drivers are the latest game version,system version Windows 11 23H2

I am not pro user,Actually, I don't know much about ffmpge ,I use full 7.1 version ffmpge by gyan.dev。I want to use a sharpening filter to sharpen my video, but the CPU processing is too slow and it will drag down GPU encoding。I use -filters to query all the filters supported by the current version of FFMPGE,The only sharpening filter that supports hardware acceleration was found to be 'unshharp_opencl',This is the parameter I am currently trying:

-c:v av1_nvenc -preset p7 -pix_fmt p010le -vf "unsharp_opencl=luma_msize_x=3:luma_msize_y=3:luma_amount=1.02:chroma_amount=1.0" -cq 38 -c:a aac -b:a 128K

Yes, is still reporting errors:
Impossible to convert between the formats supported by the filter 'graph -1 input from stream 0:0' and the filter 'auto_scale_0'
[vf#0:0 @ 0000021de4d3e240] Error reinitializing filters!
[vf#0:0 @ 0000021de4d3e240] Task finished with error code: -40 (Function not implemented)
[vf#0:0 @ 0000021de4d3e240] Terminating thread with return code -40 (Function not implemented)
[af#0:1 @ 0000021de6af3ac0] No filtered frames for output stream, trying to initialize anyway.
[vost#0:0/av1_nvenc @ 0000021de4d3da40] [enc:av1_nvenc @ 0000021de4d3ca40] Could not open encoder before EOF
[vost#0:0/av1_nvenc @ 0000021de4d3da40] Task finished with error code: -22 (Invalid argument)
[vost#0:0/av1_nvenc @ 0000021de4d3da40] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 0000021de472b0c0] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A

@eibol
Copy link
Owner

eibol commented Jan 13, 2025

You may have to select a hardware device to use the hwupload/hwdownload feature:
https://ffmpeg.org/ffmpeg-filters.html#hwupload-1

Then, use the filter like in these examples:
https://ffmpeg.org/ffmpeg-filters.html#unsharp_005fopencl

@Sonic8694
Copy link
Author

Sorry to bother you again.Your reply makes me feel incredibly close to the right answer,Now I adjusted the parameters and confirmed that the system and the ffmpge I'm using support opencl.These are the parameters I'm using now:

-init_hw_device opencl:0 -filter_hw_device OpenCL -vf "format=p010le,hwupload,unsharp_opencl=luma_msize_x=3:luma_msize_y=3:luma_amount=1.02:chroma_amount=1.0" -c:v av1_nvenc -preset p7 -cq 38 -c:a aac -b:a 128K

I specify opencl hardware and use hwupload,but it still gives me an error,But I feel like I'm getting there.This is the ffmpge error message:

[AVHWDeviceContext @ 000001fbd9bc7180] QSV to OpenCL mapping not usable.
[AVHWDeviceContext @ 000001fbd9bc7180] D3D11 to OpenCL mapping not usable.
Invalid filter device OpenCL.
Failed to set value 'OpenCL' for option 'filter_hw_device': Invalid argument
Error parsing global options: Invalid argument

@eibol
Copy link
Owner

eibol commented Jan 14, 2025

I don't know why qsv/d3d problems show up.
Hace you tried command line only, for testing purposes?

@eibol
Copy link
Owner

eibol commented Jan 14, 2025

Could you also try checking "Do not try preset"?

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

2 participants