AvWriter is a video writer.
More...
#include <AvWriter.hpp>
|
void | initialize (std::size_t output_video_width, std::size_t output_video_height, std::size_t output_video_nbframes, int bit_rate, AVRational time_base, bool dimension_optimize=0, CodecID codec_id=CODEC_ID_NONE) |
| initialized the writing process. Has to be called before the first write() call of a given video. More...
|
|
void | release () |
| release the writing process. Has to be called when an video has been fully written. More...
|
|
int | write (const container_type &data) |
| write function. This function write the data within the output file after the previous one. When last is set to true, the output file is closed. More...
|
|
|
| AvWriter () |
|
| input_pxfmt_ (PIX_FMT_GRAY8) |
|
| output_pxfmt_ (PIX_FMT_RGB24) |
|
| row_stride (0) |
|
| finished (0) |
|
| total_nb_slice (0) |
|
| initialized (false) |
|
| AvWriter (std::string output_filename, std::size_t output_video_width, std::size_t output_video_height, std::size_t output_video_nbframes, int bit_rate, AVRational time_base, bool dimension_optimize=0, CodecID codec_id=CODEC_ID_NONE) |
|
virtual | ~AvWriter () |
|
|
const std::string & | get_output_filename () const |
| return the output file name. More...
|
|
void | set_output_filename (const std::string &output_filename) |
| set the output file name. More...
|
|
template<class ContainerVideo, typename T, std::size_t Nb_components>
class slip::AvWriter< ContainerVideo, T, Nb_components >
AvWriter is a video writer.
- Version
- Fluex 1.0
- Date
- 2013/04/29
- Author
- Denis Arrivault <denis.arrivault_AT_inria.fr>
- Parameters
-
ContainerVideo | is the type of the containers that will be written in the avi file. It has to be a 3D container. The [][] operator and the slices(), the rows() and the cols() methods should have been defined. |
T | the type of the container data. |
Nb_components | the number of video components (3 for a color video or 1 for a gray scale video). |
- Note
- The input container format should be RGB24 or GRAY8 according to the Nb_component value.
-
only the video streams are registered, no sound can be added.
- Examples:
- av_file_io.cpp, and fits_file_io.cpp.
Definition at line 55 of file AvWriter.hpp.
template<class ContainerVideo, typename T, std::size_t Nb_components>
template<class ContainerVideo, typename T, std::size_t Nb_components>
template<class ContainerVideo, typename T, std::size_t Nb_components>
template<class ContainerVideo, typename T, std::size_t Nb_components>
template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::AvWriter |
( |
std::string |
output_filename, |
|
|
std::size_t |
output_video_width, |
|
|
std::size_t |
output_video_height, |
|
|
std::size_t |
output_video_nbframes, |
|
|
int |
bit_rate, |
|
|
AVRational |
time_base, |
|
|
bool |
dimension_optimize = 0 , |
|
|
CodecID |
codec_id = CODEC_ID_NONE |
|
) |
| |
|
inline |
Constructor with parameters.
- Parameters
-
output_filename | is the name of the output file where the data of the container will be saved |
output_video_width | the total video width |
output_video_height | the total video height |
output_video_nbframes | the total video number of video frames |
bit_rate | = average bit rate of the video frame. |
time_base | time base of the video stream = 1/frame_rate. AVRationnal is a structure used for writing a rational number. AvRational r{1,5} = 1/5. |
codec_id | is the id of the codec according to the CodecID enum defined in avcodec.h. By default it is guessed from the output filename extension if possible. |
dimension_optimize | true if output frame dimensions should be modified so that they will result in a memory buffer that is acceptable for the codec (frames will be rescaled). Be careful, some codec can operate with any kind of dimension. For exemple, every codec that are using Y'UV pixel format require dimensions that are at least divisible by 2 (mpgX codecs). Default is false. |
Definition at line 92 of file AvWriter.hpp.
template<class ContainerVideo, typename T, std::size_t Nb_components>
template<class ContainerVideo, typename T, std::size_t Nb_components>
return the output file name.
template<class ContainerVideo , typename T , std::size_t Nb_components>
void slip::AvWriter< ContainerVideo, T, Nb_components >::initialize |
( |
std::size_t |
output_video_width, |
|
|
std::size_t |
output_video_height, |
|
|
std::size_t |
output_video_nbframes, |
|
|
int |
bit_rate, |
|
|
AVRational |
time_base, |
|
|
bool |
dimension_optimize = 0 , |
|
|
CodecID |
codec_id = CODEC_ID_NONE |
|
) |
| |
|
inline |
initialized the writing process. Has to be called before the first write() call of a given video.
- Parameters
-
bit_rate | = average bit rate of the video frame. |
output_video_width | the total video width |
output_video_height | the total video height |
output_video_nbframes | the total video number of video frames |
duration | video stream duration |
time_base | time base of the video stream = 1/frame_rate |
codec_id | is the id of the codec according to the CodecID enum defined in avcodec.h. By default it is guessed from the output filename extension if possible. |
dimension_optimize | true if output frame dimensions should be modified so that they will result in a memory buffer that is acceptable for the codec (frames will be rescaled). Be careful, some codec can operate with any kind of dimension. For exemple, every codec that are using Y'UV pixel format require dimensions that are at least divisible by 2 (mpgX codecs). Default is false. |
Definition at line 200 of file AvWriter.hpp.
template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::initialized |
( |
false |
| ) |
|
|
inline |
template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::input_pxfmt_ |
( |
PIX_FMT_GRAY8 |
| ) |
|
template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::output_pxfmt_ |
( |
PIX_FMT_RGB24 |
| ) |
|
template<class ContainerVideo , typename T , std::size_t Nb_components>
release the writing process. Has to be called when an video has been fully written.
Definition at line 574 of file AvWriter.hpp.
template<class ContainerVideo, typename T, std::size_t Nb_components>
void slip::ContainerWriter< ContainerVideo , T >::set_output_filename |
( |
const std::string & |
output_filename | ) |
|
|
inherited |
set the output file name.
template<class ContainerVideo, typename T, std::size_t Nb_components>
slip::AvWriter< ContainerVideo, T, Nb_components >::total_nb_slice |
( |
0 |
| ) |
|
template<class ContainerVideo , typename T , std::size_t Nb_components>
write function. This function write the data within the output file after the previous one. When last is set to true, the output file is closed.
- Parameters
-
data | is the video container to save. Warning, the container should be a 3d container with [][] operator, slices() rows() and cols() methods defined. |
- Returns
- false if the file has been completely filled.
- Note
- Whatever the type of the data in the container, a static_cast is done for getting unsigned char. Be sure that the dynamic of the data is conform with this cast.
-
The input container format should be RGB24 or GRAY8 according to the Nb_component value.
Implements slip::ContainerWriter< ContainerVideo, T >.
Definition at line 527 of file AvWriter.hpp.
The documentation for this class was generated from the following file: