Giter VIP home page Giter VIP logo

anime4kmetal's Introduction

Anime4KMetal

Introduction

This is a port of Anime4K to Metal. It dynamically translates GLSL shaders to Metal shaders and applies them in order during video playback. All shaders and presets from the Anime4K project should work regardless of performance.

Requirements

  • Xcode 13.0+
  • iOS 15.0+
  • macOS 12.0+ (via Mac Catalyst)
  • tvOS 15.0+

Pre-built binaries

Download in Releases.

Screenshots

macOS

iOS

tvOS

Preset demos

All presets are the same as defined the official Anime4K instructions.

Anime4K: Mode A+A (HQ) on 48-core M1 Ultra

Anime4K: Mode A+A (Fast) on iPad mini (6th generation) (A15)

Anime4K: Mode A (Fast) on Apple TV 4K (A10X)

Single shader demos (old version)

Anime4K_Deblur_DoG.glsl on Apple TV 4K (A10X)

Original image

*Note: The above footages are only for demo purpose.

How to use

Only mp4 files with yuv420 pixel format are supported by the OS built-in decoder. Other formats must be converted to the supported format.

Pick shader or preset

Pick the desired shader or preset under Shader selection section. Not all shaders and presets will run well on all devices. If you see obvious dropped frames please use a smaller shader or preset instead. Large shaders and presets will take longer time to convert and compile. In the meantime the app will appear not responsive.

Play from URL

On tvOS no local file can be accessed. You can start a HTTP server (for example nginx) on macOS and play from URL on tvOS.

Click the cell Input URL. Input URL (http://xxx). Then click done and Play. The video should start playing

Play from file

On iOS and macOS you can simply click Select file and pick a local file to play.

Building

  1. Clone this project:
git clone https://github.com/imxieyi/Anime4KMetal.git
cd Anime4KMetal
git submodule update --init
  1. Open Anime4KMetal.xcodeproj.
  2. Select target and build. For macOS please use Anime4KMetal (iOS).

Test shader converter

To test the shader converter simply launch the XCTest suite on a target device.

There are a ton of shader warnings due to unused variables. These messages can be ignored.

Known issues

  • Due to how bilinear sampler works in Metal the output image is not subpixel aligned with the original image.
  • The resulting image is different from mpv, also due to the sampler issue.

License

This project is licensed under Apache 2.0 license.

Credits

  • GLSL shaders are from Anime4K
  • Shader converter referenced code from mpv

anime4kmetal's People

Contributors

imxieyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

anime4kmetal's Issues

Use in MPV

Hello, is it possible to use these shaders in MPV instead of the glsl ones ? I am having performance issues on MPV on Apple Silicon because it simply uses OpenGL and isn't optimised at all for it.

Feature: output to file

Can you please add output to file?
I can't find ways to apply glsl shaders to file and save it on macos

I think default usecase is:

  • download video
  • apply shaders to it on mac
  • stream it to apple tv

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.