Class VideoAttributes

java.lang.Object
ws.schild.jave.encode.VideoAttributes
All Implemented Interfaces:
Serializable

public class VideoAttributes extends Object implements Serializable
Attributes controlling the video encoding process.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • DIRECT_STREAM_COPY

      public static final String DIRECT_STREAM_COPY
      This value can be set in the codec field to perform a direct stream copy, without re-encoding of the audio stream.
      See Also:
    • codec

      private String codec
      The codec name for the encoding process. If null or not specified the encoder will perform a direct stream copy.
    • tag

      private String tag
      The the forced tag/fourcc value for the video stream.
    • bitRate

      private Integer bitRate
      The bitrate value for the encoding process. If null or not specified a default value will be picked.
    • frameRate

      private Integer frameRate
      The frame rate value for the encoding process. If null or not specified a default value will be picked.
    • size

      private VideoSize size
      The video size for the encoding process. If null or not specified the source video size will not be modified.
    • quality

      private Integer quality
      The audio quality value for the encoding process. If null or not specified the ffmpeg default will be used
    • pixelFormat

      private String pixelFormat
    • vsync

      private VsyncMethod vsync
    • complexFiltergraph

      private FilterGraph complexFiltergraph
    • videoFilters

      private final ArrayList<VideoFilter> videoFilters
    • faststart

      private boolean faststart
      Encode the video with faststart mode, default OFF

      The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4 file has all the metadata about all packets stored in one location (written at the end of the file, it can be moved to the start for better playback by adding faststart to the movflags, or using the qt-faststart tool). A fragmented file consists of a number of fragments, where packets and metadata about these packets are stored together. Writing a fragmented file has the advantage that the file is decodable even if the writing is interrupted (while a normal MOV/MP4 is undecodable if it is not properly finished), and it requires less memory when writing very long files (since writing normal MOV/MP4 files stores info about every single packet in memory until the file is closed). The downside is that it is less compatible with other applications.

    • tune

      private TuneEnum tune
    • x264Profile

      private X264_PROFILE x264Profile
    • crf

      private Integer crf
      Set the quality for constant quality mode. The lower the value, the better the quality and the larger the file size. Reference Range:[0, 51]
    • preset

      private String preset
      This option itemizes a range of choices from ultrafast (best speed) to placebo (best quality). PresetEnum
  • Constructor Details

    • VideoAttributes

      public VideoAttributes()
  • Method Details

    • getCodec

      public Optional<String> getCodec()
      Returns the codec name for the encoding process.
      Returns:
      The codec name for the encoding process.
    • setCodec

      public VideoAttributes setCodec(String codec)
      Sets the codec name for the encoding process. If null or not specified the encoder will perform a direct stream copy.

      Be sure the supplied codec name is in the list returned by Encoder.getVideoEncoders().

      A special value can be picked from DIRECT_STREAM_COPY.

      Parameters:
      codec - The codec name for the encoding process.
      Returns:
      this instance
    • getTag

      public Optional<String> getTag()
      Returns the the forced tag/fourcc value for the video stream.
      Returns:
      The the forced tag/fourcc value for the video stream.
    • setTag

      public VideoAttributes setTag(String tag)
      Sets the forced tag/fourcc value for the video stream.
      Parameters:
      tag - The the forced tag/fourcc value for the video stream.
      Returns:
      this instance
    • getBitRate

      public Optional<Integer> getBitRate()
      Returns the bitrate value for the encoding process.
      Returns:
      The bitrate value for the encoding process.
    • setBitRate

      public VideoAttributes setBitRate(Integer bitRate)
      Sets the bitrate value for the encoding process. If null or not specified a default value will be picked.
      Parameters:
      bitRate - The bitrate value for the encoding process.
      Returns:
      this instance
    • getFrameRate

      public Optional<Integer> getFrameRate()
      Returns the frame rate value for the encoding process.
      Returns:
      The frame rate value for the encoding process.
    • setFrameRate

      public VideoAttributes setFrameRate(Integer frameRate)
      Sets the frame rate value for the encoding process. If null or not specified a default value will be picked.
      Parameters:
      frameRate - The frame rate value for the encoding process.
      Returns:
      this instance
    • getSize

      public Optional<VideoSize> getSize()
      Returns the video size for the encoding process.
      Returns:
      The video size for the encoding process.
    • setSize

      public VideoAttributes setSize(VideoSize size)
      Sets the video size for the encoding process. If null or not specified the source video size will not be modified.
      Parameters:
      size - The video size for the encoding process.
      Returns:
      this instance
    • isFaststart

      public boolean isFaststart()
      Returns:
      the faststart
    • getComplexFiltergraph

      public Optional<FilterGraph> getComplexFiltergraph()
    • setComplexFiltergraph

      public VideoAttributes setComplexFiltergraph(FilterGraph complexFiltergraph)
    • addFilter

      public void addFilter(VideoFilter videoFilter)
    • getVideoFilters

      public ArrayList<VideoFilter> getVideoFilters()
    • setFaststart

      public VideoAttributes setFaststart(boolean faststart)
      Parameters:
      faststart - the faststart to set
      Returns:
      this instance
    • getQuality

      public Optional<Integer> getQuality()
      Returns:
      the quality
    • setQuality

      public VideoAttributes setQuality(Integer quality)
      The video quality value for the encoding process. If null or not specified the ffmpeg default will be used
      Parameters:
      quality - the quality to set
      Returns:
      this instance
    • getPixelFormat

      public Optional<String> getPixelFormat()
    • setPixelFormat

      public VideoAttributes setPixelFormat(String pixelFormat)
    • getVsync

      public Optional<VsyncMethod> getVsync()
    • setVsync

      public VideoAttributes setVsync(VsyncMethod vsync)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTune

      public Optional<TuneEnum> getTune()
      Returns:
      the Tune value
    • setTune

      public VideoAttributes setTune(TuneEnum tune)
      Parameters:
      tune - the TuneEnum to set
      Returns:
      this instance
    • getX264Profile

      public Optional<X264_PROFILE> getX264Profile()
      Returns:
      the x264Profile
    • setX264Profile

      public VideoAttributes setX264Profile(X264_PROFILE x264Profile)
      Parameters:
      x264Profile - the x264Profile to set
      Returns:
      this instance
    • setCrf

      public VideoAttributes setCrf(Integer crf)
      Set the quality for constant quality mode.
      Parameters:
      crf - the crf to set
      Returns:
      this instance
    • getCrf

      public Optional<Integer> getCrf()
      Get the quality for constant quality mode.
      Returns:
      the crf
    • setPreset

      public VideoAttributes setPreset(String preset)
      set the quality from PresetEnum
      Parameters:
      preset -
      Returns:
      this instance
    • getPreset

      public Optional<String> getPreset()
      Get the preset.
      Returns:
      the preset