Class VideoAttributes

  • All Implemented Interfaces:
    java.io.Serializable

    public class VideoAttributes
    extends java.lang.Object
    implements java.io.Serializable
    Attributes controlling the video encoding process.
    See Also:
    Serialized Form
    • Field Detail

      • DIRECT_STREAM_COPY

        public static final java.lang.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:
        Constant Field Values
      • codec

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

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

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

        private java.lang.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 java.lang.Integer quality
        The audio quality value for the encoding process. If null or not specified the ffmpeg default will be used
      • pixelFormat

        private java.lang.String pixelFormat
      • complexFiltergraph

        private FilterGraph complexFiltergraph
      • videoFilters

        private final java.util.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.

      • crf

        private java.lang.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 java.lang.String preset
        This option itemizes a range of choices from ultrafast (best speed) to placebo (best quality). PresetEnum
    • Constructor Detail

      • VideoAttributes

        public VideoAttributes()
    • Method Detail

      • getCodec

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

        public VideoAttributes setCodec​(java.lang.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 java.util.Optional<java.lang.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​(java.lang.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 java.util.Optional<java.lang.Integer> getBitRate()
        Returns the bitrate value for the encoding process.
        Returns:
        The bitrate value for the encoding process.
      • setBitRate

        public VideoAttributes setBitRate​(java.lang.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 java.util.Optional<java.lang.Integer> getFrameRate()
        Returns the frame rate value for the encoding process.
        Returns:
        The frame rate value for the encoding process.
      • setFrameRate

        public VideoAttributes setFrameRate​(java.lang.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 java.util.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 java.util.Optional<FilterGraph> getComplexFiltergraph()
      • addFilter

        public void addFilter​(VideoFilter videoFilter)
      • getVideoFilters

        public java.util.ArrayList<VideoFilter> getVideoFilters()
      • setFaststart

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

        public java.util.Optional<java.lang.Integer> getQuality()
        Returns:
        the quality
      • setQuality

        public VideoAttributes setQuality​(java.lang.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 java.util.Optional<java.lang.String> getPixelFormat()
      • setPixelFormat

        public VideoAttributes setPixelFormat​(java.lang.String pixelFormat)
      • getVsync

        public java.util.Optional<VsyncMethod> getVsync()
      • toString

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

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

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

        public java.util.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​(java.lang.Integer crf)
        Set the quality for constant quality mode.
        Parameters:
        crf - the crf to set
        Returns:
        this instance
      • getCrf

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

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

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