NVENC编码器API调用流程

NVIDIA GPUs based on architectures Kepler and beyond, contain a hardware-based H.264/HEVC video encoder (hereafter referred to as NVENC). The NVENC hardware takes YUV/RGB as input and generates an H.264/HEVC compliant video bitstream. NVENC hardware’s encoding capabilities can be accessed using the NVENCODE APIs, available in the NVIDIA Video Codec SDK.

This document provides information on how to program the NVENC using the NVENCODE APIs exposed in the SDK. The NVENCODE APIs expose encoding capabilities on Windows (Windows 7 and above) and Linux. It is expected that the developers should understand H.264/HEVC video codecs and familiarity with Windows and/or Linux development environment. NVENCODE API guarantees backward compatibility (and will make explicit reference whenever backward compatibility is broken). This means that applications compiled with older versions of released API will continue to work on future driver versions released by NVIDIA.

Developers can create a client application that calls NVENCODE API functions exposed by nvEncodeAPI.dll for Windows or libnvidia-encode.so for Linux. These libraries are installed as part of the NVIDIA display driver. The client application can either link to these libraries at run-time using LoadLibrary() on Windows or dlopen() on Linux.
The NVIDIA video encoder API is designed to accept raw video frames (in YUV or RGB format) and output the H.264 or HEVC bitstream. Broadly, the encoding flow consists of the following steps:

  1. Initialize the encoder
  2. Set up the desired encoding parameters
  3. Allocate input/output buffers
  4. Copy frames to input buffers and read bitstream from the output buffers. This can be
    done synchronously (Windows & Linux) or asynchronously (Windows 7 and above
    only).
  5. Clean-up - release all allocated input/output buffers
  6. Close the encoding session

一. 环境配置 [Windows]

  1. NVIDIA Kepler/Maxwell/Pascal/Volta/Turing GPU
  2. Windows: 驱动版本≥ version 418.81
  3. CUDA 10.0 Toolkit
  4. DirectX SDK

二. 流程简介

  1. 初始化编码器
  2. 设置所需编码参数
  3. 分配输入输出buffer
  4. 向input buffer输入编码帧,从output buffer中得到码流(可同步/异步)
  5. 清除释放所分配的输入输出buffer
  6. 关闭编码回话
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值