Expand description
§If you like my work and want to support what I do, support me on Ko-Fi 💜!
§
The following example is for Linux GLX
use nvenc::{session::Session, encoder::Encoder};
fn main() {
// Setup GLX context
let session: Session<NeedsConfig> = Session::open_gl();
let (session, config): (Session<NeedsInit>, NVencPresetConfig)
= session.get_preset_config(
NV_ENC_CODEC_H264_GUID,
NV_ENC_PRESET_P3_GUID,
NVencTuningInfo::LowLatency
);
let init_params = nvenc::session::InitParams {
encode_guid: NV_ENC_H264_GUID,
preset_guid: NV_ENC_PRESET_P3_GUID,
resolution: [1920, 1080],
aspect_ratio: [16, 9],
frame_rate: [30, 1],
tuning_info: NVencTuningInfo::LowLatency,
buffer_format: NVencBufferFormat::ARGB,
encode_config: &mut config.preset_cfg,
enable_ptd: true,
};
let encoder: Encoder = session.init(init_params);
}Modules§
- bitstream
- Contains the type for the safe BitStream buffer wrapper
- encoder
- Wrapper for the NVEncoder after creating an active session
- input_
buffer - Wrapper around an NVenc input buffer
- session
- Type-state wrapper around session initialization
- sys
- Contains the original C Types, functions, enums, and constants
Structs§
- NVENC
Library - Struct containing the library handle, init and get_max_version number functions
Constants§
- NVENC_
DLL - Platform specific DLL name,
libnvidia-encode.so.1on Linux,nvEncodeAPI64.dllon Windows
Functions§
- nvenc_
init - Attempt to init NVENC, returns an error if the library or loading functions cannot be found