public class FFmpegFrameGrabber extends FrameGrabber
Modifier and Type | Class and Description |
---|---|
static class |
FFmpegFrameGrabber.Exception |
FrameGrabber.Array, FrameGrabber.ImageMode, FrameGrabber.PropertyEditor, FrameGrabber.SampleMode
aspectRatio, audioBitrate, audioChannels, audioCodec, audioCodecName, audioDisposition, audioMetadata, audioOptions, audioSideData, audioStream, bpp, charset, deinterlace, format, frameNumber, frameRate, gamma, imageHeight, imageMode, imageScalingFlags, imageWidth, list, maxDelay, metadata, numBuffers, options, pixelFormat, sampleFormat, sampleMode, sampleRate, SENSOR_PATTERN_BGGR, SENSOR_PATTERN_GBRG, SENSOR_PATTERN_GRBG, SENSOR_PATTERN_RGGB, sensorPattern, startTime, timeout, timestamp, triggerMode, videoBitrate, videoCodec, videoCodecName, videoDisposition, videoMetadata, videoOptions, videoSideData, videoStream
Constructor and Description |
---|
FFmpegFrameGrabber(File file) |
FFmpegFrameGrabber(InputStream inputStream)
Calls
FFmpegFrameGrabber(inputStream, Integer.MAX_VALUE - 8)
so that the whole input stream is seekable. |
FFmpegFrameGrabber(InputStream inputStream,
int maximumSize)
Set maximumSize to 0 to disable seek and minimize startup time.
|
FFmpegFrameGrabber(String filename) |
FFmpegFrameGrabber(URL url) |
Modifier and Type | Method and Description |
---|---|
static FFmpegFrameGrabber |
createDefault(File deviceFile) |
static FFmpegFrameGrabber |
createDefault(int deviceNumber) |
static FFmpegFrameGrabber |
createDefault(String devicePath) |
protected void |
finalize() |
double |
getAspectRatio() |
int |
getAudioBitrate() |
int |
getAudioChannels() |
int |
getAudioCodec() |
String |
getAudioCodecName() |
double |
getAudioFrameRate()
Estimation of audio frames per second.
|
Map<String,String> |
getAudioMetadata() |
String |
getAudioMetadata(String key) |
Map<String,Buffer> |
getAudioSideData() |
Buffer |
getAudioSideData(String key) |
static String[] |
getDeviceDescriptions() |
double |
getDisplayRotation()
Returns the rotation in degrees from the side data of the video stream, or 0 if unknown.
|
String |
getFormat() |
AVFormatContext |
getFormatContext() |
double |
getFrameRate()
Returns
getVideoFrameRate() |
double |
getGamma() |
int |
getImageHeight() |
int |
getImageWidth() |
int |
getLengthInAudioFrames() |
int |
getLengthInFrames()
Returns
getLengthInVideoFrames() |
long |
getLengthInTime() |
int |
getLengthInVideoFrames()
Returns
(int) Math.round(getLengthInTime() * getFrameRate() / 1000000L) , which is an approximation in general. |
Map<String,String> |
getMetadata() |
String |
getMetadata(String key) |
int |
getPixelFormat() |
int |
getSampleFormat() |
int |
getSampleRate() |
int |
getVideoBitrate() |
int |
getVideoCodec() |
String |
getVideoCodecName() |
double |
getVideoFrameRate() |
Map<String,String> |
getVideoMetadata() |
String |
getVideoMetadata(String key) |
Map<String,Buffer> |
getVideoSideData() |
Buffer |
getVideoSideData(String key) |
Frame |
grab()
Each call to grab stores the new image in the memory address for the previously returned frame.
|
Frame |
grabFrame(boolean doAudio,
boolean doVideo,
boolean doProcessing,
boolean keyFrames) |
Frame |
grabFrame(boolean doAudio,
boolean doVideo,
boolean doProcessing,
boolean keyFrames,
boolean doData) |
Frame |
grabImage() |
Frame |
grabKeyFrame() |
AVPacket |
grabPacket() |
Frame |
grabSamples() |
boolean |
hasAudio()
Is there an audio stream?
|
boolean |
hasVideo()
Is there a video stream?
|
boolean |
isCloseInputStream() |
void |
release() |
void |
releaseUnsafe() |
void |
setAudioFrameNumber(int frameNumber)
if there is audio stream tries to seek to audio frame with corresponding timestamp
ignoring otherwise
|
void |
setAudioTimestamp(long timestamp)
setTimestamp with resulting audio frame type if there is an audio stream.
|
void |
setCloseInputStream(boolean closeInputStream) |
void |
setFrameNumber(int frameNumber)
default override of super.setFrameNumber implies setting
of a frame close to a video frame having that number
|
void |
setTimestamp(long timestamp)
setTimestamp without checking frame content (using old code used in JavaCV versions prior to 1.4.1)
|
void |
setTimestamp(long timestamp,
boolean checkFrame)
setTimestamp with possibility to select between old quick seek code or new code
doing check of frame content.
|
void |
setVideoFrameNumber(int frameNumber)
if there is video stream tries to seek to video frame with corresponding timestamp
otherwise sets super.frameNumber only because frameRate==0 if there is no video stream
|
void |
setVideoTimestamp(long timestamp)
setTimestamp with resulting video frame type if there is a video stream.
|
void |
start()
Calls
start(true) . |
void |
start(boolean findStreamInfo)
Set findStreamInfo to false to minimize startup time, at the expense of robustness.
|
void |
startUnsafe() |
void |
startUnsafe(boolean findStreamInfo) |
void |
stop() |
void |
trigger() |
static void |
tryLoad() |
close, create, create, create, create, createArray, delayedGrab, flush, get, getAudioDisposition, getAudioOption, getAudioOptions, getAudioStream, getBitsPerPixel, getCharset, getDefault, getDelayedFrame, getDelayedTime, getFrameNumber, getImageMode, getImageScalingFlags, getMaxDelay, getNumBuffers, getOption, getOptions, getSampleMode, getSensorPattern, getTimeout, getTimestamp, getVideoDisposition, getVideoOption, getVideoOptions, getVideoStream, grabAtFrameRate, grabFrame, init, isDeinterlace, isTriggerMode, resetStartTime, restart, setAspectRatio, setAudioBitrate, setAudioChannels, setAudioCodec, setAudioCodecName, setAudioDisposition, setAudioMetadata, setAudioMetadata, setAudioOption, setAudioOptions, setAudioSideData, setAudioSideData, setAudioStream, setBitsPerPixel, setCharset, setDeinterlace, setFormat, setFrameRate, setGamma, setImageHeight, setImageMode, setImageScalingFlags, setImageWidth, setMaxDelay, setMetadata, setMetadata, setNumBuffers, setOption, setOptions, setPixelFormat, setSampleFormat, setSampleMode, setSampleRate, setSensorPattern, setTimeout, setTriggerMode, setVideoBitrate, setVideoCodec, setVideoCodecName, setVideoDisposition, setVideoMetadata, setVideoMetadata, setVideoOption, setVideoOptions, setVideoSideData, setVideoSideData, setVideoStream, waitForTimestamp
public FFmpegFrameGrabber(URL url)
public FFmpegFrameGrabber(File file)
public FFmpegFrameGrabber(String filename)
public FFmpegFrameGrabber(InputStream inputStream)
FFmpegFrameGrabber(inputStream, Integer.MAX_VALUE - 8)
so that the whole input stream is seekable.public FFmpegFrameGrabber(InputStream inputStream, int maximumSize)
public static String[] getDeviceDescriptions() throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public static FFmpegFrameGrabber createDefault(File deviceFile) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public static FFmpegFrameGrabber createDefault(String devicePath) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public static FFmpegFrameGrabber createDefault(int deviceNumber) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public static void tryLoad() throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public void release() throws FFmpegFrameGrabber.Exception
release
in class FrameGrabber
FFmpegFrameGrabber.Exception
public void releaseUnsafe() throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
protected void finalize() throws Throwable
public boolean isCloseInputStream()
public void setCloseInputStream(boolean closeInputStream)
public boolean hasVideo()
video_st!=null;
public boolean hasAudio()
audio_st!=null;
public double getGamma()
getGamma
in class FrameGrabber
public String getFormat()
getFormat
in class FrameGrabber
public int getImageWidth()
getImageWidth
in class FrameGrabber
public int getImageHeight()
getImageHeight
in class FrameGrabber
public int getAudioChannels()
getAudioChannels
in class FrameGrabber
public int getPixelFormat()
getPixelFormat
in class FrameGrabber
public int getVideoCodec()
getVideoCodec
in class FrameGrabber
public String getVideoCodecName()
getVideoCodecName
in class FrameGrabber
public int getVideoBitrate()
getVideoBitrate
in class FrameGrabber
public double getAspectRatio()
getAspectRatio
in class FrameGrabber
public double getFrameRate()
getVideoFrameRate()
getFrameRate
in class FrameGrabber
public double getAudioFrameRate()
public double getVideoFrameRate()
public int getAudioCodec()
getAudioCodec
in class FrameGrabber
public String getAudioCodecName()
getAudioCodecName
in class FrameGrabber
public int getAudioBitrate()
getAudioBitrate
in class FrameGrabber
public int getSampleFormat()
getSampleFormat
in class FrameGrabber
public int getSampleRate()
getSampleRate
in class FrameGrabber
public Map<String,String> getMetadata()
getMetadata
in class FrameGrabber
public Map<String,String> getVideoMetadata()
getVideoMetadata
in class FrameGrabber
public Map<String,String> getAudioMetadata()
getAudioMetadata
in class FrameGrabber
public String getMetadata(String key)
getMetadata
in class FrameGrabber
public String getVideoMetadata(String key)
getVideoMetadata
in class FrameGrabber
public String getAudioMetadata(String key)
getAudioMetadata
in class FrameGrabber
public Map<String,Buffer> getVideoSideData()
getVideoSideData
in class FrameGrabber
public Buffer getVideoSideData(String key)
getVideoSideData
in class FrameGrabber
public double getDisplayRotation()
public Map<String,Buffer> getAudioSideData()
getAudioSideData
in class FrameGrabber
public Buffer getAudioSideData(String key)
getAudioSideData
in class FrameGrabber
public void setFrameNumber(int frameNumber) throws FFmpegFrameGrabber.Exception
setFrameNumber
in class FrameGrabber
FFmpegFrameGrabber.Exception
public void setVideoFrameNumber(int frameNumber) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public void setAudioFrameNumber(int frameNumber) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public void setTimestamp(long timestamp) throws FFmpegFrameGrabber.Exception
setTimestamp
in class FrameGrabber
FFmpegFrameGrabber.Exception
public void setTimestamp(long timestamp, boolean checkFrame) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public void setVideoTimestamp(long timestamp) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public void setAudioTimestamp(long timestamp) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public int getLengthInFrames()
getLengthInVideoFrames()
getLengthInFrames
in class FrameGrabber
public long getLengthInTime()
getLengthInTime
in class FrameGrabber
public int getLengthInVideoFrames()
(int) Math.round(getLengthInTime() * getFrameRate() / 1000000L)
, which is an approximation in general.public int getLengthInAudioFrames()
public AVFormatContext getFormatContext()
public void start() throws FFmpegFrameGrabber.Exception
start(true)
.start
in class FrameGrabber
FFmpegFrameGrabber.Exception
public void start(boolean findStreamInfo) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public void startUnsafe() throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public void startUnsafe(boolean findStreamInfo) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public void stop() throws FFmpegFrameGrabber.Exception
stop
in class FrameGrabber
FFmpegFrameGrabber.Exception
public void trigger() throws FFmpegFrameGrabber.Exception
trigger
in class FrameGrabber
FFmpegFrameGrabber.Exception
public Frame grab() throws FFmpegFrameGrabber.Exception
FrameGrabber
grabber.grab() == grabber.grab()
Frame.clone()
the
returned frame as the next call to grab will overwrite your existing image's memory.
grab
in class FrameGrabber
FFmpegFrameGrabber.Exception
public Frame grabImage() throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public Frame grabSamples() throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public Frame grabKeyFrame() throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public Frame grabFrame(boolean doAudio, boolean doVideo, boolean doProcessing, boolean keyFrames) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public Frame grabFrame(boolean doAudio, boolean doVideo, boolean doProcessing, boolean keyFrames, boolean doData) throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
public AVPacket grabPacket() throws FFmpegFrameGrabber.Exception
FFmpegFrameGrabber.Exception
Copyright © 2023. All rights reserved.