Easy3D 2.5.3
video_encoder.h
1/********************************************************************
2 * Copyright (C) 2015 Liangliang Nan <liangliang.nan@gmail.com>
3 * https://3d.bk.tudelft.nl/liangliang/
4 *
5 * This file is part of Easy3D. If it is useful in your research/work,
6 * I would be grateful if you show your appreciation by citing it:
7 * ------------------------------------------------------------------
8 * Liangliang Nan.
9 * Easy3D: a lightweight, easy-to-use, and efficient C++ library
10 * for processing and rendering 3D data.
11 * Journal of Open Source Software, 6(64), 3255, 2021.
12 * ------------------------------------------------------------------
13 *
14 * Easy3D is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License Version 3
16 * as published by the Free Software Foundation.
17 *
18 * Easy3D is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ********************************************************************/
26
27#ifndef EASY3D_VIDEO_ENCODER_H
28#define EASY3D_VIDEO_ENCODER_H
29
30#include <string>
31
32
33namespace internal {
34 class VideoEncoderImpl;
35}
36
37
38namespace easy3d {
39
58 {
59 public:
64
67 PIX_FMT_RGB_888,
71 };
72
77 bool start(const std::string& file_name, int framerate, int bitrate);
78
90 bool encode(const unsigned char* data, int width, int height, PixelFormat pixel_format);
91
96 bool end();
97
99 static bool is_size_acceptable(int width, int height) { return (width % 8) == 0 && (height % 8) == 0; }
100
101 private:
102 internal::VideoEncoderImpl* encoder_;
103 };
104
105}
106
107#endif // EASY3D_VIDEO_ENCODER_H
A class that encodes video frames (e.g., images) into a video file.
Definition: video_encoder.h:58
bool encode(const unsigned char *data, int width, int height, PixelFormat pixel_format)
Definition: video_encoder.cpp:450
PixelFormat
The supported pixel format/storage of the video frames.
Definition: video_encoder.h:66
@ PIX_FMT_BGR_888
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: video_encoder.h:68
@ PIX_FMT_RGBA_8888
packed BGR 8:8:8, 24bpp, BGRBGR...
Definition: video_encoder.h:69
@ PIX_FMT_BGRA_8888
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: video_encoder.h:70
bool start(const std::string &file_name, int framerate, int bitrate)
Definition: video_encoder.cpp:441
~VideoEncoder()
Destructor.
Definition: video_encoder.cpp:433
static bool is_size_acceptable(int width, int height)
Returns whether the image size (width, height) is acceptable.
Definition: video_encoder.h:99
bool end()
Definition: video_encoder.cpp:492
VideoEncoder()
Constructor.
Definition: video_encoder.cpp:418
Definition: collider.cpp:182