nvenc 0.1.0

Wrapper for the nvidia NVENC API
Documentation
  • Coverage
  • 16.01%
    146 out of 912 items documented1 out of 214 items with examples
  • Size
  • Source code size: 92.54 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 22.09 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 34s Average build duration of successful builds.
  • all releases: 34s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • AlsoSylv/nvenc
    3 1 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AlsoSylv

If you like my work and want to support what I do, support me on Ko-Fi 💜!

Ko-Fi

Crates.io MSRV Crates.io License GitHub Repo stars

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);
}