Class VideoAttributes
- java.lang.Object
-
- ws.schild.jave.encode.VideoAttributes
-
- All Implemented Interfaces:
java.io.Serializable
public class VideoAttributes extends java.lang.Object implements java.io.SerializableAttributes controlling the video encoding process.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.IntegerbitRateThe bitrate value for the encoding process.private java.lang.StringcodecThe codec name for the encoding process.private FilterGraphcomplexFiltergraphprivate java.lang.IntegercrfSet the quality for constant quality mode.static java.lang.StringDIRECT_STREAM_COPYThis value can be set in the codec field to perform a direct stream copy, without re-encoding of the audio stream.private booleanfaststartEncode the video with faststart mode, default OFFprivate java.lang.IntegerframeRateThe frame rate value for the encoding process.private java.lang.StringpixelFormatprivate java.lang.StringpresetThis option itemizes a range of choices from ultrafast (best speed) to placebo (best quality).private java.lang.IntegerqualityThe audio quality value for the encoding process.private static longserialVersionUIDprivate VideoSizesizeThe video size for the encoding process.private java.lang.StringtagThe the forced tag/fourcc value for the video stream.private TuneEnumtuneprivate java.util.ArrayList<VideoFilter>videoFiltersprivate VsyncMethodvsyncprivate X264_PROFILEx264Profile
-
Constructor Summary
Constructors Constructor Description VideoAttributes()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFilter(VideoFilter videoFilter)java.util.Optional<java.lang.Integer>getBitRate()Returns the bitrate value for the encoding process.java.util.Optional<java.lang.String>getCodec()Returns the codec name for the encoding process.java.util.Optional<FilterGraph>getComplexFiltergraph()java.util.Optional<java.lang.Integer>getCrf()Get the quality for constant quality mode.java.util.Optional<java.lang.Integer>getFrameRate()Returns the frame rate value for the encoding process.java.util.Optional<java.lang.String>getPixelFormat()java.util.Optional<java.lang.String>getPreset()Get the preset.java.util.Optional<java.lang.Integer>getQuality()java.util.Optional<VideoSize>getSize()Returns the video size for the encoding process.java.util.Optional<java.lang.String>getTag()Returns the the forced tag/fourcc value for the video stream.java.util.Optional<TuneEnum>getTune()java.util.ArrayList<VideoFilter>getVideoFilters()java.util.Optional<VsyncMethod>getVsync()java.util.Optional<X264_PROFILE>getX264Profile()booleanisFaststart()VideoAttributessetBitRate(java.lang.Integer bitRate)Sets the bitrate value for the encoding process.VideoAttributessetCodec(java.lang.String codec)Sets the codec name for the encoding process.VideoAttributessetComplexFiltergraph(FilterGraph complexFiltergraph)VideoAttributessetCrf(java.lang.Integer crf)Set the quality for constant quality mode.VideoAttributessetFaststart(boolean faststart)VideoAttributessetFrameRate(java.lang.Integer frameRate)Sets the frame rate value for the encoding process.VideoAttributessetPixelFormat(java.lang.String pixelFormat)VideoAttributessetPreset(java.lang.String preset)set the quality fromPresetEnumVideoAttributessetQuality(java.lang.Integer quality)The video quality value for the encoding process.VideoAttributessetSize(VideoSize size)Sets the video size for the encoding process.VideoAttributessetTag(java.lang.String tag)Sets the forced tag/fourcc value for the video stream.VideoAttributessetTune(TuneEnum tune)VideoAttributessetVsync(VsyncMethod vsync)VideoAttributessetX264Profile(X264_PROFILE x264Profile)java.lang.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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
-
vsync
private VsyncMethod vsync
-
complexFiltergraph
private FilterGraph complexFiltergraph
-
videoFilters
private final java.util.ArrayList<VideoFilter> videoFilters
-
faststart
private boolean faststart
Encode the video with faststart mode, default OFFThe 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 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
-
-
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()
-
setComplexFiltergraph
public VideoAttributes setComplexFiltergraph(FilterGraph complexFiltergraph)
-
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()
-
setVsync
public VideoAttributes setVsync(VsyncMethod vsync)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.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 fromPresetEnum- Parameters:
preset-- Returns:
- this instance
-
getPreset
public java.util.Optional<java.lang.String> getPreset()
Get the preset.- Returns:
- the preset
-
-