Class FFprobe
FFprobe provides an ability to execute ffprobe process.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddArgument(String argument) Adds custom argument to ffprobe arguments list.addArguments(String key, String value) Adds custom arguments to ffprobe arguments list.static FFprobeatPath()CreatesFFprobe.static FFprobeCreatesFFprobe.Constructs ffprobe command line.protected StdReader<FFprobeResult> CreatesStdReaderwhich is used to read ffprobe stderr.protected StdReader<FFprobeResult> createStdOutReader(FormatParser formatParser) CreatesStdReaderwhich is used to read ffprobe stdout.execute()Starts synchronous ffprobe execution.Starts asynchronous ffprobe execution.setAnalyzeDuration(Long analyzeDurationMicros) Specify how many microseconds are analyzed to probe the input (from 0 to I64_MAX).setAnalyzeDuration(Number analyzeDurationInTimeUnit, TimeUnit timeUnit) Specify how long to analyze to probe the input (from 0 to I64_MAX) (default 0).setCountFrames(boolean countFrames) Count the number of frames per stream and report it in the corresponding stream section.setCountPackets(boolean countPackets) Count the number of packets per stream and report it in the corresponding stream section.Force input file format.setFormatParser(FormatParser formatParser) Sets ffprobe output format parser (and corresponding output format).setFpsProbeSize(Long fpsProbeSize) Number of frames used to probe fps (from -1 to 2.14748e+009) (default -1).Sets input to analyze with ffprobe.setInput(InputStream inputStream) Sets input to analyze with ffprobe.setInput(InputStream inputStream, int bufferSize) Sets input to analyze with ffprobe.Sets input to analyze with ffprobe.setInput(SeekableByteChannel inputChannel) Sets input to analyze with ffprobe.setInput(SeekableByteChannel inputChannel, int bufferSize) Sets input to analyze with ffprobe.Sets input to analyze with ffprobe.setLogLevel(LogLevel logLevel) Sets ffprobe logging level.setProbeSize(Long probeSize) Set probing size (from 32 to I64_MAX) (default 5e+006).setReadIntervals(String intervals) Read only the specified intervals.setSelectStreams(StreamType streamType) Select only the streams of the specified type.setSelectStreams(String streamSpecifier) Select only the streams specified by stream_specifier.setShowChapters(boolean showChapters) Show information about chapters stored in the format.setShowData(boolean showData) Show payload data, as a hexadecimal and ASCII dump.setShowDataHash(String algorithm) Show a hash of payload data, for packets with -show_packets and for codec extradata with -show_streams.setShowEntries(String showEntries) Set list of entries to show.setShowFormat(boolean showFormat) Show information about the container format of the input multimedia stream.setShowFrames(boolean showFrames) Show information about each frame and subtitle contained in the input multimedia stream.setShowLog(LogLevel showLog) Show logging information from the decoder about each frame according to the value set in loglevel, (see -loglevel).setShowPackets(boolean showPackets) Show information about each packet contained in the input multimedia stream.setShowPrivateData(boolean showPrivateData) Show private data, that is data depending on the format of the particular shown element.setShowPrograms(boolean showPrograms) Show information about programs and their streams contained in the input multimedia stream.setShowStreams(boolean showStreams) Show information about each media stream contained in the input multimedia stream.
-
Constructor Details
-
FFprobe
CreatesFFprobe.- Parameters:
executable- path to ffprobe binary
-
-
Method Details
-
addArgument
Adds custom argument to ffprobe arguments list.Note: if value contains spaces it should not be wrapped with quotes. Also spaces should not be escaped with backslash
- Parameters:
argument- argument- Returns:
- this
-
addArguments
Adds custom arguments to ffprobe arguments list.Note: if value contains spaces it should not be wrapped with quotes. Also spaces should not be escaped with backslash
- Parameters:
key- key argumentvalue- value argument- Returns:
- this
-
setSelectStreams
Select only the streams specified by stream_specifier.This option affects only the options related to streams (e.g. show_streams, show_packets, etc.).
- Parameters:
streamSpecifier- stream specifier- Returns:
- this
- See Also:
-
setSelectStreams
Select only the streams of the specified type.- Parameters:
streamType- stream type- Returns:
- this
-
setShowData
Show payload data, as a hexadecimal and ASCII dump.Coupled with -show_packets, it will dump the packets’ data.
Coupled with -show_streams, it will dump the codec extradata.
- Parameters:
showData- true to show data- Returns:
- this
-
setShowPrivateData
Show private data, that is data depending on the format of the particular shown element. This option is enabled by default, but you may need to disable it for specific uses.- Parameters:
showPrivateData- true to show private data- Returns:
- this
-
setShowDataHash
Show a hash of payload data, for packets with -show_packets and for codec extradata with -show_streams.- Parameters:
algorithm- algorithm to calculate hash- Returns:
- this
-
setShowFormat
Show information about the container format of the input multimedia stream.- Parameters:
showFormat- true to show format- Returns:
- this
-
setShowEntries
Set list of entries to show.Entries are specified according to the following syntax. section_entries contains a list of section entries separated by :. Each section entry is composed by a section name (or unique name), optionally followed by a list of entries local to that section, separated by ,.
Note that the order of specification of the local section entries is not honored in the output, and the usual display order will be retained.
The formal syntax is given by:
LOCAL_SECTION_ENTRIES ::= SECTION_ENTRY_NAME[,LOCAL_SECTION_ENTRIES]
SECTION_ENTRY ::= SECTION_NAME[=[LOCAL_SECTION_ENTRIES]]
SECTION_ENTRIES ::= SECTION_ENTRY[:SECTION_ENTRIES]
Note: this option overwrites any "show..." set before, so this method should not be used together with any of
setShowFormat(boolean),setShowFrames(boolean),setShowPackets(boolean),setShowStreams(boolean),setShowChapters(boolean)orsetShowPrograms(boolean)- Parameters:
showEntries- list entries syntax- Returns:
- this
-
setShowPackets
Show information about each packet contained in the input multimedia stream.Requires -show_streams
- Parameters:
showPackets- true to show packets- Returns:
- this
- See Also:
-
setShowFrames
Show information about each frame and subtitle contained in the input multimedia stream.- Parameters:
showFrames- true to show frames- Returns:
- this
-
setShowLog
Show logging information from the decoder about each frame according to the value set in loglevel, (see -loglevel).This option requires -show_frames.
- Parameters:
showLog- decoder log level- Returns:
- this
- See Also:
-
setShowStreams
Show information about each media stream contained in the input multimedia stream.- Parameters:
showStreams- true to show streams- Returns:
- this
-
setShowPrograms
Show information about programs and their streams contained in the input multimedia stream.- Parameters:
showPrograms- true to show programs- Returns:
- this
-
setShowChapters
Show information about chapters stored in the format.- Parameters:
showChapters- true to show chapters- Returns:
- this
-
setCountFrames
Count the number of frames per stream and report it in the corresponding stream section.Requires -show_streams
- Parameters:
countFrames- true to count frames- Returns:
- this
- See Also:
-
setCountPackets
Count the number of packets per stream and report it in the corresponding stream section.Requires -show_streams
- Parameters:
countPackets- true to count packets- Returns:
- this
-
setReadIntervals
Read only the specified intervals. read_intervals must be a sequence of interval specifications separated by ",".ffprobe will seek to the interval starting point, and will continue reading from that.
The formal syntax is given by:
INTERVAL ::= [START|+START_OFFSET][%[END|+END_OFFSET|+#NUMBER_OF_FRAMES]]
INTERVALS ::= INTERVAL[,INTERVALS]
- Parameters:
intervals- interval specification- Returns:
- this
-
setProbeSize
Set probing size (from 32 to I64_MAX) (default 5e+006).- Parameters:
probeSize- prpobe size in bytes- Returns:
- this
-
setAnalyzeDuration
Specify how many microseconds are analyzed to probe the input (from 0 to I64_MAX). (default 0).- Parameters:
analyzeDurationMicros- analyze duration micros- Returns:
- this
-
setAnalyzeDuration
Specify how long to analyze to probe the input (from 0 to I64_MAX) (default 0).- Parameters:
analyzeDurationInTimeUnit- durationtimeUnit- time unit- Returns:
- this
-
setFpsProbeSize
Number of frames used to probe fps (from -1 to 2.14748e+009) (default -1).- Parameters:
fpsProbeSize- frames- Returns:
- this
-
setFormat
Force input file format. The format is normally auto detected for input files, so this option is not needed in most cases.- Parameters:
format- format- Returns:
- this
-
setInput
Sets input to analyze with ffprobe.- Parameters:
inputPath- path to media file- Returns:
- this
-
setInput
Sets input to analyze with ffprobe.- Parameters:
inputUriOrPath- URI or path to media file- Returns:
- this
-
setInput
Sets input to analyze with ffprobe.- Parameters:
inputStream- input stream to analyze- Returns:
- this
-
setInput
Sets input to analyze with ffprobe.- Parameters:
inputStream- input stream to analyzebufferSize- buffer size to copy bytes from input stream- Returns:
- this
-
setInput
Sets input to analyze with ffprobe.- Parameters:
inputChannel- byte channel to analyze- Returns:
- this
-
setInput
Sets input to analyze with ffprobe.- Parameters:
inputChannel- byte channel to analyzebufferSize- buffer size to copy bytes from input stream- Returns:
- this
-
setInput
Sets input to analyze with ffprobe.- Parameters:
input- input to analyze- Returns:
- this
-
setFormatParser
Sets ffprobe output format parser (and corresponding output format).JsonFormatParseris used by default. It's possible to provide custom implementation.- Parameters:
formatParser- format parser- Returns:
- this
-
setLogLevel
Sets ffprobe logging level.Note: for message to appear in SLF4J logging it's required to configure appropriate log level for SLF4J.
- Parameters:
logLevel- log level- Returns:
- this
-
executeAsync
Starts asynchronous ffprobe execution.- Returns:
- ffprobe result future
-
execute
Starts synchronous ffprobe execution.Current thread is blocked until ffprobe is finished.
- Returns:
- ffprobe result
-
buildArguments
Constructs ffprobe command line.- Returns:
- arguments list
-
createStdOutReader
CreatesStdReaderwhich is used to read ffprobe stdout.Note: default implementation uses
FormatParserto parse output.- Parameters:
formatParser- format parser to use- Returns:
- this
-
createStdErrReader
CreatesStdReaderwhich is used to read ffprobe stderr.Note: default implementation simply logs everything with SLF4J.
- Returns:
- this
-
atPath
CreatesFFprobe.Note: directory with ffprobe binaries must be in PATH environment variable.
- Returns:
- FFprobe
-
atPath
CreatesFFprobe.- Parameters:
pathToDir- path to ffprobe directory- Returns:
- FFprobe
-