Package ws.schild.jave.encode
Class EncodingAttributes
java.lang.Object
ws.schild.jave.encode.EncodingAttributes
- All Implemented Interfaces:
Serializable
Attributes controlling the encoding process.
- Author:
- Carlo Pelliccia
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the attributes for the encoding of the audio stream in the target multimedia file.Number of threads to use for decoding (if supported by codec) -1 means use default of ffmpegReturns the duration (seconds) of the re-encoded stream.Number of threads to use for encoding (if supported by codec) No value (Optional.empty()) means use default of ffmpegReturns any additional user supplied context.Returns the format name for the incoming multimedia file.booleangetLoop()Returns if the input is to be considered for looping.Returns the start offset time (seconds).Returns the format name for the encoded target multimedia file.getSafe()Returns whether or not the encoder will consider file paths "safe".Returns the attributes for the encoding of the video stream in the target multimedia file.booleansetAudioAttributes(AudioAttributes audioAttributes) Sets the attributes for the encoding of the audio stream in the target multimedia file.setDecodingThreads(int decodingThreads) Number of threads to use for decoding (if supported by codec) -1 means use default of ffmpegsetDuration(Float duration) Sets the duration (seconds) of the re-encoded stream.setEncodingThreads(Integer encodingThreads) Number of threads to use for encoding (if supported by codec) null means use default of ffmpegsetExtraContext(Map<String, String> context) Adds all key/value pairs from context to the extraContext private variable.Meant to be used in conjunction withEncoder.addOptionAtIndex(EncodingArgument, Integer).Add context here and retrieve the context via an EncodingArgument.setFilterThreads(int filterThreads) ffmpeg uses multiple cores for filteringsetInputFormat(String inputFormat) Sets the format name for the source multimedia file.setLoop(boolean loop) Sets if the inputs will be looped or not.setMapMetaData(boolean mapMetaData) Copy over meta data from original file to new output if possibleSets the start offset time (seconds).setOutputFormat(String format) Sets the format name for the encoded target multimedia file.Are the file paths considered "safe": A file path is considered safe if it does not contain a protocol specification and is relative and all components only contain characters from the portable character set (letters, digits, period, underscore and hyphen) and have no period at the beginning of a component.setVideoAttributes(VideoAttributes videoAttributes) Sets the attributes for the encoding of the video stream in the target multimedia file.toString()voidvalidate()
-
Constructor Details
-
EncodingAttributes
public EncodingAttributes()
-
-
Method Details
-
getExtraContext
Returns any additional user supplied context. Meant to be used in conjunction withEncoder.addOptionAtIndex(EncodingArgument, Integer)- Returns:
- extra context
-
setExtraContext
Adds all key/value pairs from context to the extraContext private variable.Meant to be used in conjunction withEncoder.addOptionAtIndex(EncodingArgument, Integer).Add context here and retrieve the context via an EncodingArgument.- Parameters:
context- extra context- Returns:
- the EncodingAttributes
-
getInputFormat
Returns the format name for the incoming multimedia file.- Returns:
- The format name for the incoming multimedia file.
-
setInputFormat
Sets the format name for the source multimedia file.- Parameters:
inputFormat- the format name for the incoming multimedia file.- Returns:
- this instance
-
getOutputFormat
Returns the format name for the encoded target multimedia file.- Returns:
- The format name for the encoded target multimedia file.
-
setOutputFormat
Sets the format name for the encoded target multimedia file. Be sure this format is supported (seeEncoder.getSupportedEncodingFormats().- Parameters:
format- The format name for the encoded target multimedia file.- Returns:
- this instance
-
getOffset
Returns the start offset time (seconds).- Returns:
- The start offset time (seconds).
-
setOffset
Sets the start offset time (seconds). If null or not specified no start offset will be applied.- Parameters:
offset- The start offset time (seconds).- Returns:
- this instance
-
getDuration
Returns the duration (seconds) of the re-encoded stream.- Returns:
- The duration (seconds) of the re-encoded stream.
-
setDuration
Sets the duration (seconds) of the re-encoded stream. If null or not specified the source stream, starting from the offset, will be completely re-encoded in the target stream.- Parameters:
duration- The duration (seconds) of the re-encoded stream.- Returns:
- this instance
-
getLoop
public boolean getLoop()Returns if the input is to be considered for looping.- Returns:
- if the input will be looped.
-
setLoop
Sets if the inputs will be looped or not.- Parameters:
loop- if the input should be looped.- Returns:
- this instance
-
getSafe
Returns whether or not the encoder will consider file paths "safe".- Returns:
- Whether or not the encoder will consider file paths "safe".
- See Also:
-
setSafe
Are the file paths considered "safe": A file path is considered safe if it does not contain a protocol specification and is relative and all components only contain characters from the portable character set (letters, digits, period, underscore and hyphen) and have no period at the beginning of a component.- Parameters:
safe- 0 for not safe; 1 for safe; is equivalent to 1 if the format was automatically probed and 0 otherwise. 1 is the default- Returns:
- The EncodingAttributes
- See Also:
-
getAudioAttributes
Returns the attributes for the encoding of the audio stream in the target multimedia file.- Returns:
- The attributes for the encoding of the audio stream in the target multimedia file.
-
setAudioAttributes
Sets the attributes for the encoding of the audio stream in the target multimedia file. If null of not specified no audio stream will be encoded. It cannot be null if also the video field is null.- Parameters:
audioAttributes- The attributes for the encoding of the audio stream in the target multimedia file.- Returns:
- this instance
-
getVideoAttributes
Returns the attributes for the encoding of the video stream in the target multimedia file.- Returns:
- The attributes for the encoding of the video stream in the target multimedia file.
-
setVideoAttributes
Sets the attributes for the encoding of the video stream in the target multimedia file. If null of not specified no video stream will be encoded. It cannot be null if also the audio field is null.- Parameters:
videoAttributes- The attributes for the encoding of the video stream in the target multimedia file.- Returns:
- this instance
-
toString
-
isMapMetaData
public boolean isMapMetaData()- Returns:
- the mapMetaData
-
setMapMetaData
Copy over meta data from original file to new output if possible- Parameters:
mapMetaData- the mapMetaData to set- Returns:
- this instance
-
getFilterThreads
- Returns:
- Maximum number of cores/cpus to use for filtering -1 means use default of ffmpeg
-
setFilterThreads
ffmpeg uses multiple cores for filtering- Parameters:
filterThreads- Maximum number of cores/cpus to use -1 means use default of ffmpeg- Returns:
- this instance
-
getDecodingThreads
Number of threads to use for decoding (if supported by codec) -1 means use default of ffmpeg- Returns:
- the decodingThreads
-
setDecodingThreads
Number of threads to use for decoding (if supported by codec) -1 means use default of ffmpeg- Parameters:
decodingThreads- the decodingThreads to set- Returns:
- this instance
-
getEncodingThreads
Number of threads to use for encoding (if supported by codec) No value (Optional.empty()) means use default of ffmpeg- Returns:
- the encodingThreads
-
setEncodingThreads
Number of threads to use for encoding (if supported by codec) null means use default of ffmpeg- Parameters:
encodingThreads- the encodingThreads to set- Returns:
- this instance
-
validate
public void validate()
-