NvTranscoder.exe 的程序编译出来的是 裸流
需要 h264 封包 到 mp4
可以使用 ffmpeg 命令
ffmpeg.exe -i "111.mp4" -c:v copy -f mp4 "test111.mp4"
也可以使用代码去封包
ffmpeg.exe 工具
在解码出 数据后 如果需要对数据进行处理
需要使用 cuda driver API
不过可以通过和 CUDA runtime API 一起混用
Interoperability between Runtime and Driver APIs
An application can mix runtime API code with driver API code.
If a context is created and made current via the driver API, subsequent runtime calls will pick up this context instead of creating a new one.
If the runtime is initialized (implicitly as mentioned in CUDA C Runtime),cuCtxGetCurrent() can be used to retrieve the context created during initialization.
This context can be used by subsequent driver API calls.
Device memory can be allocated and freed using either API. CUdeviceptr can be cast to regular pointers and vice-versa:
CUdeviceptr devPtr;
float* d_data;
// Allocation using driver API
cuMemAlloc(&devPtr, size);
d_data = (float*)devPtr;
// Allocation using runtime API
cudaMalloc(&d_data, size);
devPtr = (CUdeviceptr)d_data;
In particular, this means that applications written using the driver API can invoke libraries written using the runtime API (such as cuFFT, cuBLAS, ...).
All functions from the device and version management sections of the reference manual can be used interchangeably.
在线文档地址
http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#module
离线 pdf 文档
compress H264 with for multiple video streams
使用多路流时进行编码时 会在 nvEncOpenEncodeSessionEx 函数处 报 NV_ENC_ERR_OUT_OF_MEMORY
必须使用两路同时编码
注意在调用cuda时 容易出现找不到ctx的错误
需要加一句cuCtxPushCurrent(ctx);