Class BaseInOut<T extends BaseInOut<T>>
- Type Parameters:
T- self
- Direct Known Subclasses:
BaseInput,BaseOutput
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddArgument(String argument) Add custom argument.addArguments(String key, String value) Add custom input/output specific arguments.Build a list of command line arguments that are common for ffmpeg input & output.HelperProcessHelperwhich should be ran in dedicated thread.setCodec(StreamType streamType, String codec) Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams.Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams.setDuration(long durationMillis) When used as an input option, limit the duration of data read from the input file.setDuration(Number duration, TimeUnit timeUnit) When used as an input option, limit the duration of data read from the input file.Force input or output file format.setFrameRate(Number frameRate) Set frame rate.setFrameRate(String streamSpecifier, Number frameRate) Set frame rate.setFrameSize(Number width, Number height) Set frame sizesetFrameSize(String streamSpecifier, Number width, Number height) Set frame sizesetFrameSize(String streamSpecifier, String resolution) Set frame sizesetPixelFormat(String pixelFormat) Set pixel format.setPixelFormat(String streamSpecifier, String pixelFormat) Set pixel format.setPosition(long positionMillis) When used as an input option, seeks in this input file to position.setPosition(Number position, TimeUnit unit) When used as an input option, seeks in this input file to position.setPositionEof(long positionEofMillis) Like thesetPosition(long)(-ss) option but relative to the "end of file".setPositionEof(Number positionEof, TimeUnit unit) Like thesetPosition(Number, TimeUnit)(-ss) option but relative to the "end of file".protected final TthisAsT()toArguments(String key, Map<String, Object> args)
-
Constructor Details
-
BaseInOut
public BaseInOut()
-
-
Method Details
-
setFormat
Force input or output file format. The format is normally auto detected for input files and guessed from the file extension for output files, so this option is not needed in most cases.- Parameters:
format- format- Returns:
- this
-
setDuration
When used as an input option, limit the duration of data read from the input file.When used as an output option, stop writing the output after its duration reaches duration.
- Parameters:
durationMillis- duration in milliseconds- Returns:
- this
-
setDuration
When used as an input option, limit the duration of data read from the input file.When used as an output option, stop writing the output after its duration reaches duration.
- Parameters:
duration- durationtimeUnit- unit of duration- Returns:
- this
- See Also:
-
setPosition
When used as an input option, seeks in this input file to position.Note that in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded.
When doing stream copy or when -noaccurate_seek is used, it will be preserved.
When used as an output option (before an output url), decodes but discards input until the timestamps reach position.
- Parameters:
positionMillis- position in milliseconds.- Returns:
- this
-
setPosition
When used as an input option, seeks in this input file to position.Note that in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded.
When doing stream copy or when -noaccurate_seek is used, it will be preserved.
When used as an output option (before an output url), decodes but discards input until the timestamps reach position.
- Parameters:
position- position.unit- time unit- Returns:
- this
- See Also:
-
setPositionEof
Like thesetPosition(long)(-ss) option but relative to the "end of file". That is negative values are earlier in the file, 0 is at EOF.- Parameters:
positionEofMillis- position in milliseconds, relative to the EOF- Returns:
- this
-
setPositionEof
Like thesetPosition(Number, TimeUnit)(-ss) option but relative to the "end of file". That is negative values are earlier in the file, 0 is at EOF.- Parameters:
positionEof- position, relative to the EOFunit- time unit- Returns:
- this
- See Also:
-
setFrameRate
Set frame rate.As an input option, ignore any timestamps stored in the file and instead generate timestamps assuming constant frame rate fps.
As an output option, duplicate or drop input frames to achieve constant output frame rate fps.
- Parameters:
frameRate- Hz value, fraction or abbreviation- Returns:
- this
-
setFrameRate
Set frame rate.As an input option, ignore any timestamps stored in the file and instead generate timestamps assuming constant frame rate fps.
As an output option, duplicate or drop input frames to achieve constant output frame rate fps.
- Parameters:
streamSpecifier- stream specifierframeRate- Hz value, fraction or abbreviation- Returns:
- this
- See Also:
-
setFrameSize
Set frame sizeAs an input option, this is a shortcut for the video_size private option, recognized by some demuxers for which the frame size is either not stored in the file or is configurable
As an output option, this inserts the scale video filter to the end of the corresponding filtergraph.
- Parameters:
width- frame widthheight- frame height- Returns:
- this
-
setFrameSize
Set frame sizeAs an input option, this is a shortcut for the video_size private option, recognized by some demuxers for which the frame size is either not stored in the file or is configurable
As an output option, this inserts the scale video filter to the end of the corresponding filtergraph.
- Parameters:
streamSpecifier- stream specifierwidth- frame widthheight- frame height- Returns:
- this
- See Also:
-
setFrameSize
Set frame sizeAs an input option, this is a shortcut for the video_size private option, recognized by some demuxers for which the frame size is either not stored in the file or is configurable
As an output option, this inserts the scale video filter to the end of the corresponding filtergraph.
- Parameters:
streamSpecifier- stream specifierresolution- width + "x" + height- Returns:
- this
- See Also:
-
setCodec
Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams.codec is the name of a decoder/encoder or a special value copy (output only) to indicate that the stream is not to be re-encoded.
- Parameters:
streamType- stream typecodec- codec name- Returns:
- this
-
setCodec
Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams.codec is the name of a decoder/encoder or a special value copy (output only) to indicate that the stream is not to be re-encoded.
- Parameters:
streamSpecifier- stream specifiercodec- codec name- Returns:
- this
- See Also:
-
setPixelFormat
Set pixel format.If the selected pixel format can not be selected, ffmpeg will print a warning and select the best pixel format supported by the encoder.
If pix_fmt is prefixed by a +, ffmpeg will exit with an error if the requested pixel format can not be selected, and automatic conversions inside filtergraphs are disabled.
If pix_fmt is a single +, ffmpeg selects the same pixel format as the input (or graph output) and automatic conversions are disabled.
- Parameters:
pixelFormat- pixel format- Returns:
- this
-
setPixelFormat
Set pixel format.If the selected pixel format can not be selected, ffmpeg will print a warning and select the best pixel format supported by the encoder.
If pix_fmt is prefixed by a +, ffmpeg will exit with an error if the requested pixel format can not be selected, and automatic conversions inside filtergraphs are disabled.
If pix_fmt is a single +, ffmpeg selects the same pixel format as the input (or graph output) and automatic conversions are disabled.
- Parameters:
streamSpecifier- stream specifierpixelFormat- pixel format- Returns:
- this
- See Also:
-
addArguments
Add custom input/output specific arguments.Note: if value contains spaces it should not be wrapped with quotes. Also spaces should not be escaped with backslash
- Parameters:
key- key to addvalue- value to add- Returns:
- this
-
addArgument
Add custom argument. Intended for cases, that are not yet supported by jaffree- Parameters:
argument- argument to add- Returns:
- this
-
helperThread
HelperProcessHelperwhich should be ran in dedicated thread. Default implementation always returns null.- Returns:
- ProcessHelper, or null if no helper thread is needed
- See Also:
-
buildArguments
Build a list of command line arguments that are common for ffmpeg input & output.- Returns:
- list of command line arguments
-
getAdditionalArguments
-
thisAsT
-
toArguments
-