Giter Club home page Giter Club logo

Comments (4)

AN3223 avatar AN3223 commented on June 25, 2024

I have an example of using ffmpeg's libplacebo filter here, relevant snippet:

ffmpeg -y -init_hw_device vulkan -i images/anime/mountain_adventurer.webp -vf 'crop=128:128:y=128,format=yuv420p,gblur=0.625,hwupload,libplacebo=w=128:h=128:custom_shader_path=$?,hwdownload,format=yuv420p,scale=256:256:flags=neighbor' $@

($? and $@ are replaced by the shader path and the output filename respectively.)

So you need to specify a vulkan device with -init_hw_device, you need to do hwupload first, you need to do hwdownload after libplacebo, and you may need to specify an appropriate format before and/or after. Also you put libplacebo=custom_shader_path= twice in your command.

Is it using the upscaling algorithm in libplacebo first, before applying anime4k? How can I achieve my original goal that only use anime4k to upscale?

If your output resolution (libplacebo's w and h parameters) is 2x the input resolution and you apply a shader that does a 2x upscale, then the shader should be doing all of the upscaling.

from anime4k.

Arc-2023 avatar Arc-2023 commented on June 25, 2024

I have an example of using ffmpeg's libplacebo filter here, relevant snippet:

ffmpeg -y -init_hw_device vulkan -i images/anime/mountain_adventurer.webp -vf 'crop=128:128:y=128,format=yuv420p,gblur=0.625,hwupload,libplacebo=w=128:h=128:custom_shader_path=$?,hwdownload,format=yuv420p,scale=256:256:flags=neighbor' $@

($? and $@ are replaced by the shader path and the output filename respectively.)

So you need to specify a vulkan device with -init_hw_device, you need to do hwupload first, you need to do hwdownload after libplacebo, and you may need to specify an appropriate format before and/or after. Also you put libplacebo=custom_shader_path= twice in your command.

Is it using the upscaling algorithm in libplacebo first, before applying anime4k? How can I achieve my original goal that only use anime4k to upscale?

If your output resolution (libplacebo's w and h parameters) is 2x the input resolution and you apply a shader that does a 2x upscale, then the shader should be doing all of the upscaling.

thanks a lot for your answering!

if i don't use -init_hw_device vulkan , 'hwpoload' and 'hwdownload' these three options for transcoding, I noticed some GPU usage. Does this mean shaders are being used for processing?

from anime4k.

AN3223 avatar AN3223 commented on June 25, 2024

Seeing GPU usage is a good sign but you should compare the output to the input to ensure that the shaders are working, you should also see that the output resolution is 2x the input resolution.

from anime4k.

Arc-2023 avatar Arc-2023 commented on June 25, 2024

Thank you for the reply, but I am still not clear about the specific functions of hwupload and hwdownload. The information I could find only provides simple descriptions of their roles. If I don't add these options, why would the GPU still be occupied? Does this mean adding or not adding these parameters does not affect shader invocation? Or does ffmpeg automatically upload streams to VRAM for processing when handling video and audio streams? If so, what is the significance of manually specifying upload and download?

Also, I noticed that if I directly remove hwdownload, there are still no issues. Does this mean hwdownload is unnecessary?

from anime4k.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.