1 #ifndef __VIDEOSINK_FFMPEG_HH__
2 #define __VIDEOSINK_FFMPEG_HH__
4 #include <Base/Image/Image.hh>
7 #ifndef BIAS_HAVE_FFMPEG
13 #define INT64_C(c) (c ## LL)
14 #define UINT64_C(c) (c ## ULL)
20 #include <libavcodec/avcodec.h>
21 #include <libavformat/avformat.h>
22 #include <libavutil/avstring.h>
23 #include <libswscale/swscale.h>
93 void SetSize(
int width,
int height);
147 int Open(std::string filename);
174 int AddFrames(std::vector<std::string> filenames);
221 #endif // __VIDEOSINK_FFMPEG_HH__
EColorModel
These are the most often used color models.
void SetEncoder(enum CodecID codecId)
Set encoder.
void SetSize(int width, int height)
Set frame size of video.
AVFormatContext * pFormatCtx_
Format context for video encoder.
void SetRealtime(bool realtime)
Set realtime mode.
bool override_
Override flag (default: true)
uint64_t bufferSize_
Encoding buffer size.
int maxBFrames_
Max B-frames (default: 0)
void Init_()
Called by constructor to init variables.
Video encoding using FFmpeg library.
void SetFPS(float fps)
Set framerate in frames per second.
int AddFrames(std::vector< std::string > filenames)
Load each Image from a list of files and add them to the video output file.
int Close()
Close the video output file, write remaining frames and clean up.
void SetMaxBFrames(int maxBFrames)
Set maximal number of bidirectional frames.
int AddFrame(const ImageBase &image)
Add an Image to the stream and write it to the video output file.
enum PixelFormat GetPixelFormat_(enum ImageBase::EColorModel colorModel)
Get the pixel format from a given color model.
void SetGopSize(int gopSize)
Set the gop size of the video stream.
uint8_t * pPictBuffer_
Output picture buffer.
enum CodecID codecId_
Codec ID (default: CODEC_ID_MPEG1VIDEO)
int height_
Frame height (default: 288)
std::string errMsg_
The last error message.
void SetDefaults()
Reset all user parameters to default values.
SwsContext * pSwsCtx_
Color conversion context.
AVFrame * pInputPict_
Input picture.
int width_
Frame width (default: 352)
AVFrame * pPict_
Output picture.
~VideoSink_FFmpeg()
Clean up.
AVRational fps_
Framerate (default: 25)
bool realtime_
Realtime flag (default: false)
int gopSize_
Gop size (default: 12)
void SetBitrate(int bitrate)
Set bitrate in bits per second.
int64_t pts_
Presentation timestamp.
int Open(std::string filename)
Open a file for video output and init the codec.
bool IsOpened()
Get status of video output file.
int bitrate_
Bitrate (default: 1200000)
VideoSink_FFmpeg()
Standard constructor.
uint8_t * pBuffer_
Encoding buffer.
std::string GetError()
Get the last error message.
void SetOverride(bool override)
Set if the output file should be overridden if it already exists.
This is the base class for images in BIAS.