FFmpeg-backed RGBA video writer. More...
#include <MXWrite/mxwrite.hpp>
Public Member Functions | |
| void | close () |
| Close the writer and flush pending packets. | |
| bool | get_block_when_full () const |
| Check whether the encoder queue blocks instead of dropping frames. | |
| double | get_duration () const |
| Return the encoded duration in seconds. | |
| int64_t | get_frame_count () const |
| Return the number of frames submitted to the writer. | |
| bool | is_hardware_encode () const |
| True when the active encoder backend is hardware (NVENC). | |
| bool | is_open () const |
| Check whether the writer is currently open. | |
| bool | open (const std::string &filename, int width, int height, float fps, const char *crf) |
| Open an output file using the legacy CRF string interface. | |
| bool | open (const std::string &filename, int width, int height, float fps, const EncodeOptions &opts) |
| Open an output file using explicit encoder options. | |
| bool | open_ts (const std::string &filename, int width, int height, float fps, const char *crf) |
| Open a timestamp-based output stream using the legacy CRF string interface. | |
| bool | open_ts (const std::string &filename, int width, int height, float fps, const EncodeOptions &opts) |
| Open a timestamp-based output stream using explicit encoder options. | |
| void | set_block_when_full (bool value) |
| If true, producer threads block when the encoder queue is full instead of dropping frames. Intended for headless/batch transcoding where every input frame must reach the output. Default: false (drop). | |
| void | write (void *rgba_buffer) |
| Queue a host RGBA frame for immediate-mode encoding. | |
| bool | write_cuda_rgba (void *cuda_rgba_buffer, int src_stride, bool bottom_up=false) |
| Queue a CUDA RGBA frame for encoding. | |
| void | write_hdr_rgba16 (void *rgba16_buffer) |
| Write a 16-bit RGBA frame that is already PQ- or HLG-encoded in BT.2020 primaries (8 bytes/pixel: R16,G16,B16,A16, little-endian unsigned normalised). | |
| void | write_ts (void *rgba_buffer) |
| Queue a host RGBA frame using capture timestamps. | |
| Writer ()=default | |
| Construct a closed writer. | |
| ~Writer () | |
| Close the writer on destruction if it is still open. | |
FFmpeg-backed RGBA video writer.
The writer accepts host RGBA buffers, optional CUDA device buffers, and 16-bit HDR RGBA buffers. It can encode either frame-by-frame or from timestamped frames, depending on the open mode.
Definition at line 102 of file mxwrite.hpp.
|
default |
Construct a closed writer.
|
inline |
Close the writer on destruction if it is still open.
Definition at line 197 of file mxwrite.hpp.
| void Writer::close | ( | ) |
Close the writer and flush pending packets.
Definition at line 1465 of file mxwrite.cpp.
|
inline |
Check whether the encoder queue blocks instead of dropping frames.
Definition at line 191 of file mxwrite.hpp.
| double Writer::get_duration | ( | ) | const |
Return the encoded duration in seconds.
Definition at line 1521 of file mxwrite.cpp.
|
inline |
Return the number of frames submitted to the writer.
Definition at line 193 of file mxwrite.hpp.
|
inline |
True when the active encoder backend is hardware (NVENC).
Definition at line 185 of file mxwrite.hpp.
|
inline |
Check whether the writer is currently open.
Definition at line 183 of file mxwrite.hpp.
| bool Writer::open | ( | const std::string & | filename, |
| int | width, | ||
| int | height, | ||
| float | fps, | ||
| const char * | crf ) |
Open an output file using the legacy CRF string interface.
| filename | Output file path. |
| width | Output width in pixels. |
| height | Output height in pixels. |
| fps | Output frame rate. |
| crf | Constant Rate Factor as a string. |
Definition at line 473 of file mxwrite.cpp.
| bool Writer::open | ( | const std::string & | filename, |
| int | width, | ||
| int | height, | ||
| float | fps, | ||
| const EncodeOptions & | opts ) |
Open an output file using explicit encoder options.
| filename | Output file path. |
| width | Output width in pixels. |
| height | Output height in pixels. |
| fps | Output frame rate. |
| opts | Encoder configuration. |
Definition at line 486 of file mxwrite.cpp.
| bool Writer::open_ts | ( | const std::string & | filename, |
| int | width, | ||
| int | height, | ||
| float | fps, | ||
| const char * | crf ) |
Open a timestamp-based output stream using the legacy CRF string interface.
| filename | Output file path. |
| width | Output width in pixels. |
| height | Output height in pixels. |
| fps | Nominal input frame rate. |
| crf | Constant Rate Factor as a string. |
Definition at line 491 of file mxwrite.cpp.
| bool Writer::open_ts | ( | const std::string & | filename, |
| int | width, | ||
| int | height, | ||
| float | fps, | ||
| const EncodeOptions & | opts ) |
Open a timestamp-based output stream using explicit encoder options.
| filename | Output file path. |
| width | Output width in pixels. |
| height | Output height in pixels. |
| fps | Nominal input frame rate. |
| opts | Encoder configuration. |
Definition at line 503 of file mxwrite.cpp.
|
inline |
If true, producer threads block when the encoder queue is full instead of dropping frames. Intended for headless/batch transcoding where every input frame must reach the output. Default: false (drop).
Definition at line 189 of file mxwrite.hpp.
| void Writer::write | ( | void * | rgba_buffer | ) |
Queue a host RGBA frame for immediate-mode encoding.
| rgba_buffer | Pointer to tightly packed RGBA8 pixels. |
Definition at line 1002 of file mxwrite.cpp.
| bool Writer::write_cuda_rgba | ( | void * | cuda_rgba_buffer, |
| int | src_stride, | ||
| bool | bottom_up = false ) |
Queue a CUDA RGBA frame for encoding.
| cuda_rgba_buffer | CUDA device pointer. |
| src_stride | Source row pitch in bytes. |
| bottom_up | Whether the source is stored bottom-up. |
Definition at line 1185 of file mxwrite.cpp.
| void Writer::write_hdr_rgba16 | ( | void * | rgba16_buffer | ) |
Write a 16-bit RGBA frame that is already PQ- or HLG-encoded in BT.2020 primaries (8 bytes/pixel: R16,G16,B16,A16, little-endian unsigned normalised).
The data is expected to originate from the HDR GPU encode pass: it is BT.2020 primaries with a non-linear PQ (or HLG) transfer already applied, so this path skips colour-space conversion and only performs (a) the BT.2020 non-constant-luminance RGB'->YCbCr' matrix, and (b) 16-bit -> 10-bit limited-range scaling, producing AV_PIX_FMT_YUV420P10LE for libx265 Main10. Requires the writer to have been opened with EncodeOptions::HdrInfo::enabled.
| rgba16_buffer | Pointer to tightly packed RGBA16 pixels. |
Definition at line 1100 of file mxwrite.cpp.
| void Writer::write_ts | ( | void * | rgba_buffer | ) |
Queue a host RGBA frame using capture timestamps.
| rgba_buffer | Pointer to tightly packed RGBA8 pixels. |
Definition at line 1311 of file mxwrite.cpp.