Class BaseOutput<T extends BaseOutput<T>>

java.lang.Object
com.github.kokorin.jaffree.ffmpeg.BaseInOut<T>
com.github.kokorin.jaffree.ffmpeg.BaseOutput<T>
Type Parameters:
T - self
All Implemented Interfaces:
Output
Direct Known Subclasses:
NullOutput, TcpOutput, UrlOutput

public abstract class BaseOutput<T extends BaseOutput<T>> extends BaseInOut<T> implements Output
Base class which handles all arguments for ffmpeg output.
  • Constructor Details

    • BaseOutput

      public BaseOutput(String output)
      Parameters:
      output - output path to file or URI
  • Method Details

    • setOutputPosition

      public T setOutputPosition(long positionMillis)
      Stop writing the output at outputPosition.

      outputPosition (-to) and duration (-t) are mutually exclusive and duration has priority.

      Parameters:
      positionMillis - outputPosition in milliseconds
      Returns:
      this
      See Also:
    • setOutputPosition

      public T setOutputPosition(Number position, TimeUnit unit)
      Stop writing the output at outputPosition.

      outputPosition (-to) and duration (-t) are mutually exclusive and duration has priority.

      Parameters:
      position - outputPosition
      unit - unit
      Returns:
      this
      See Also:
    • setSizeLimit

      public T setSizeLimit(long sizeLimitBytes)
      Set the file size limit, expressed in bytes. No further chunk of bytes is written after the limit is exceeded.

      The size of the output file is slightly more than the requested file size.

      Parameters:
      sizeLimitBytes - size limit in bytes
      Returns:
      this
    • copyAllCodecs

      public T copyAllCodecs()
      Sets special "copy" codec for all streams.
      Returns:
      this
    • copyCodec

      public T copyCodec(String streamSpecifier)
      Sets special "copy" codec for specified streams.
      Parameters:
      streamSpecifier - stream specifier
      Returns:
      this
      See Also:
    • copyCodec

      public T copyCodec(StreamType streamType)
      Sets special "copy" codec for specified streams.
      Parameters:
      streamType - stream type
      Returns:
      this
    • disableStream

      public T disableStream(StreamType streamType)
      Disable stream of the specified type.
      Parameters:
      streamType - stream type
      Returns:
      this
    • setFrameCount

      public T setFrameCount(StreamType streamType, Long frameCount)
      Stop writing to the stream after specified number of frames.
      Parameters:
      streamType - stream type
      frameCount - frame count
      Returns:
      this
    • addMap

      public T addMap(int inputFileIndex)
      Maps all streams from the input file.

      Each input stream is identified by the input file index input_file_id. Index starts at 0.

      Parameters:
      inputFileIndex - index of input file
      Returns:
      this
    • addMap

      public T addMap(int inputFileIndex, StreamType streamType)
      Designate one or more input streams as a source for the output file.

      Each input stream is identified by the input file index input_file_id and the input stream index input_stream_id within the input file. Both indices start at 0.

      Parameters:
      inputFileIndex - index of input file
      streamType - stream type
      Returns:
      this
    • addMap

      public T addMap(int inputFileIndex, String streamSpecifier)
      Designate one or more input streams as a source for the output file.

      Each input stream is identified by the input file index input_file_id and the input stream index input_stream_id within the input file. Both indices start at 0.

      Parameters:
      inputFileIndex - index of input file
      streamSpecifier - specifier for stream(s) in input file
      Returns:
      this
      See Also:
    • addMap

      public T addMap(String linkLabel)
      An alternative [linklabel] form will map outputs from complex filter graphs (see the -filter_complex option) to the output file.

      linklabel must correspond to a defined output link label in the graph.

      Parameters:
      linkLabel - label in complex filter
      Returns:
      this
    • addProgram

      public T addProgram(int number, String title, int... streams)
      Creates a program with the specified title, program_num and adds the specified stream(s) to it.
      Parameters:
      number - program number
      title - program title
      streams - stream to add to a program
      Returns:
      this
    • addProgram

      public T addProgram(int number, String title, String... streams)
      Creates a program with the specified title, program_num and adds the specified stream(s) to it.
      Parameters:
      number - program number
      title - program title
      streams - stream to add to a program
      Returns:
      this
    • buildArguments

      public final List<String> buildArguments()
      Build a list of command line arguments that are common for ffmpeg input & output.
      Specified by:
      buildArguments in interface Output
      Overrides:
      buildArguments in class BaseInOut<T extends BaseOutput<T>>
      Returns:
      list of command line arguments