Basic Image AlgorithmS Library
2.8.0
|
Class for extracting frames from video files using FFMpeg, analog to class DShowVideo. More...
#include <VideoSource/VideoSource_FFMPEGVideo.hh>
Public Member Functions | |
void | Close () |
Close file and free buffers. More... | |
unsigned int | CountVideoStreams () |
Return number of video streams. More... | |
std::string | ErrMsg () |
Returns last error message. More... | |
unsigned int | GetCurrentDTS () const |
Returns the current decoding timestamp. More... | |
bool | GetFrame (BIAS::ImageBase &img) |
Retreive the next frame from the video. More... | |
unsigned int | GetLength () const |
Returns the length of the video in TimeBase units. More... | |
int | Height () |
Return height of selected video stream. More... | |
bool | Init (int width=0, int height=0, PixelFormat pixFmt=PIX_FMT_RGB24, unsigned int streamIndex=0) |
Select video stream, initialize stuff and set destination size and pixel format. More... | |
bool | Open (const char *file) |
Open file and retreive info. More... | |
void | Seek (int64_t time) |
Seeks to time which is given in TimeBase units. More... | |
AVRational | TimeBase () |
Returns the TimeBase of the video stream. More... | |
VideoSource_FFMPEGVideo () | |
int | Width () |
Return width of selected video stream. More... | |
~VideoSource_FFMPEGVideo () | |
Static Public Member Functions | |
static PixelFormat | Colormodel2PixFmt (ImageBase::EColorModel cm) |
Maps BIAS colormodels to ffmpeg pixelformats. More... | |
Protected Attributes | |
uint8_t * | _buffer |
AVCodec * | _codec |
AVCodecContext * | _codecCtx |
std::string | _errMsg |
AVFormatContext * | _fmtCtx |
AVFrame * | _frame |
AVFrame * | _frameRGB |
unsigned int | _streamIndex |
SwsContext * | _swsCtx |
int | _vidStr |
std::vector< int > | _vidStreams |
Class for extracting frames from video files using FFMpeg, analog to class DShowVideo.
Definition at line 48 of file VideoSource_FFMPEGVideo.hh.
BIAS::VideoSource_FFMPEGVideo::VideoSource_FFMPEGVideo | ( | ) |
Definition at line 30 of file VideoSource_FFMPEGVideo.cpp.
BIAS::VideoSource_FFMPEGVideo::~VideoSource_FFMPEGVideo | ( | ) |
Definition at line 48 of file VideoSource_FFMPEGVideo.cpp.
void BIAS::VideoSource_FFMPEGVideo::Close | ( | ) |
Close file and free buffers.
Definition at line 142 of file VideoSource_FFMPEGVideo.cpp.
|
static |
Maps BIAS colormodels to ffmpeg pixelformats.
Supported so far:
Definition at line 239 of file VideoSource_FFMPEGVideo.cpp.
References BIAS::ImageBase::CM_BGR, BIAS::ImageBase::CM_Grey, and BIAS::ImageBase::CM_RGB.
unsigned int BIAS::VideoSource_FFMPEGVideo::CountVideoStreams | ( | ) |
Return number of video streams.
Definition at line 163 of file VideoSource_FFMPEGVideo.cpp.
string BIAS::VideoSource_FFMPEGVideo::ErrMsg | ( | ) |
Returns last error message.
Definition at line 233 of file VideoSource_FFMPEGVideo.cpp.
unsigned int BIAS::VideoSource_FFMPEGVideo::GetCurrentDTS | ( | ) | const |
Returns the current decoding timestamp.
Definition at line 221 of file VideoSource_FFMPEGVideo.cpp.
bool BIAS::VideoSource_FFMPEGVideo::GetFrame | ( | BIAS::ImageBase & | img | ) |
Retreive the next frame from the video.
Definition at line 186 of file VideoSource_FFMPEGVideo.cpp.
References BIAS::ImageBase::GetImageData().
unsigned int BIAS::VideoSource_FFMPEGVideo::GetLength | ( | ) | const |
Returns the length of the video in TimeBase units.
Definition at line 226 of file VideoSource_FFMPEGVideo.cpp.
int BIAS::VideoSource_FFMPEGVideo::Height | ( | ) |
Return height of selected video stream.
Definition at line 177 of file VideoSource_FFMPEGVideo.cpp.
bool BIAS::VideoSource_FFMPEGVideo::Init | ( | int | width = 0 , |
int | height = 0 , |
||
PixelFormat | pixFmt = PIX_FMT_RGB24 , |
||
unsigned int | streamIndex = 0 |
||
) |
Select video stream, initialize stuff and set destination size and pixel format.
Only call after successfully calling Open(). If width and height both are zero, the video is not resized. If either is zero, the other is calculated to maintain the aspect ratio.
Definition at line 83 of file VideoSource_FFMPEGVideo.cpp.
bool BIAS::VideoSource_FFMPEGVideo::Open | ( | const char * | file | ) |
Open file and retreive info.
Definition at line 52 of file VideoSource_FFMPEGVideo.cpp.
void BIAS::VideoSource_FFMPEGVideo::Seek | ( | int64_t | time | ) |
Seeks to time
which is given in TimeBase units.
Definition at line 211 of file VideoSource_FFMPEGVideo.cpp.
AVRational BIAS::VideoSource_FFMPEGVideo::TimeBase | ( | ) |
Returns the TimeBase of the video stream.
Definition at line 216 of file VideoSource_FFMPEGVideo.cpp.
int BIAS::VideoSource_FFMPEGVideo::Width | ( | ) |
Return width of selected video stream.
Definition at line 169 of file VideoSource_FFMPEGVideo.cpp.
|
protected |
Definition at line 119 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 115 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 113 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 108 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 112 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 117 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 118 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 111 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 114 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 116 of file VideoSource_FFMPEGVideo.hh.
|
protected |
Definition at line 110 of file VideoSource_FFMPEGVideo.hh.