Class Filter

java.lang.Object
ws.schild.jave.filters.Filter
All Implemented Interfaces:
VideoFilter
Direct Known Subclasses:
AssSubtitlesFilter, ColorFilter, ConcatFilter, CropFilter, DrawtextFilter, FadeFilter, MediaConcatFilter, MovieFilter, OverlayFilter, PadFilter, ScaleFilter, SetPtsFilter, TrimFilter, ZoomPanFilter

public class Filter extends Object implements VideoFilter
A filter as described by FFMPEG Documentation.

A filter has an ordered list of input labels, a name, arguments, and an ordered list of output labels. Arguments can be either ordered or named. If both are present, ordered must be emitted first.

Currently filtergraph escaping is not the responsibility of this class. All arguments must be pre-escaped by the time they get to this class.

It is intended that this class is not used directly. Instead, implementers will add a specific implementation of the filter they are implementing. A complete list can be found in FFMPEG Documentation. However, the class is not abstract to not prohibit direct use.

Author:
mressler
  • Constructor Details

    • Filter

      public Filter(String name)
      Create a filter with the specified name with no input/output labels or arguments.
      Parameters:
      name - The name of the filter.
  • Method Details

    • addInputLabel

      public Filter addInputLabel(String... label)
      Add an input label to the list of input labels for this filter
      Parameters:
      label - The name of the input label(s)
      Returns:
      this Filter for builder pattern magic
    • addOrderedArgument

      public Filter addOrderedArgument(String... arg)
      Add an ordered argument to the list of arguments for this filter
      Parameters:
      arg - Any number of ordered arguments
      Returns:
      this Filter for builder pattern magic
    • addNamedArgument

      public Filter addNamedArgument(String name, String value)
      Add a named argument to the set of named arguments for this filter
      Parameters:
      name - The name of the argument
      value - The value for the argument
      Returns:
      this Filter for builder pattern magic
    • addOutputLabel

      public Filter addOutputLabel(String... label)
      Add an output label to the list of output labels for this filter
      Parameters:
      label - The name of the input label
      Returns:
      this Filter for builder pattern magic
    • getExpression

      public String getExpression()
      Description copied from interface: VideoFilter
      The expression to be used in the video filter argument to ffmpeg
      Specified by:
      getExpression in interface VideoFilter
      Returns:
      A string that will be placed in the -vf or -filter_complex option to ffmpeg.
    • setQuoteCharacter

      public void setQuoteCharacter(String quoteCharacter)
      Set quoteCharacter of arguments for this filter, Default is double quote.
      Parameters:
      quoteCharacter - The quoteCharacter of arguments
    • escapingPath

      protected String escapingPath(String filePath)
      escaping special characters for file path. Notes on file url escaping
      Parameters:
      filePath - unescaped file path
      Returns:
      escaped file path