Skip to content

AlsoSylv/nvenc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Rust wrapper for the Nvidia NVENC API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages