GithubHelp home page GithubHelp logo

joe-nano / avisynth_filter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crendking/avisynth_filter

0.0 1.0 0.0 184 KB

A DirectShow filter that loads an AviSynth script and feed the frames to the video player

License: GNU General Public License v2.0

C++ 94.90% C 3.30% Batchfile 1.80%

avisynth_filter's Introduction

AviSynth Filter

A DirectShow filter that loads an AviSynth script and feed the frames to the video player.

This filter exports an "avsfilter_source()" function to the AviSynth script, which serves as a source plugin. This filter feeds the video samples from DirectShow upstream to the script. Then it sends the processed frame data to the downstream.

If you used ffdshow's AviSynth plugin, you may find this filter similar in many ways. On top of that, this filter is actively adding new features. Support most common input formats such as NV12, YUY2 and P010 etc.

Require CPU with SSSE3 instructions.

Install

  • Before anything, install AviSynth+. Make sure AviSynth.dll is either in system directories or at the same directory of this filter.
  • Unpack the archive.
  • Run install.bat to register the filter avisynth_filter.ax.
  • Enable the filter AviSynth Filter in video player.

Uninstall

Run uninstall.bat to unregister the filter and clean up user data.

Interface

The filter exports the following functions to the AviSynth script.

avsfilter_source()

The source function which returns a clip object. Similar to other source functions like AviSource().

This function takes no argument.

avsfilter_disconnect()

This function serves as a heuristic to disconnect the AviSynth Filter from DirectShow filter graph. Put at the end of the script file.

It can be used to avoid unnecessary processing and improve performance if the script does not modify the source. Avoid to use it during live reloading.

A good example is if your script applies modifications based on video metadata (e.g. FPS < 30), without using this function, even if the condition does not hold the filter still needs to copy every frame. At best, it wastes both CPU and memory resource for nothing. At worst, it breaks hardware acceleration chain for certain filters. For instance, when LAV Filters connects directly to madVR in D3D11 mode, the GPU decoded frames are not copied to memory. If any filter goes between them, the frame needs to be copied.

This function takes no argument.

Example script

Add a line of text to videos with less than 20 FPS. Otherwise disconnect the filter.

avsfilter_source()

fps = Round(FrameRate())
if (fps < 20) {
    Subtitle("This video has low FPS")
    Prefetch(4)
} else {
    avsfilter_disconnect()
}

Build

A build script build.bat is included to automate the process. It obtains dependencies and triggers compiling. The project depends on the DirectShow filter base classes from https://github.com/microsoft/Windows-classic-samples. Microsoft has not updated the sample for long time, and the sample solution is still on Visual Studio 2005. One needs to upgrade the solution before building it.

Credit

Many thanks to Milardo from Doom9's Forum (https://forum.doom9.org/member.php?u=159393) for help testing the project.

avisynth_filter's People

Contributors

crendking avatar

Watchers

 avatar

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.