安装并测试nvenc linux sdk

    nvidia在cuda以后推出一种官方生成更好视频处理技术nvenc。 网上相关资料不多, 也不知道这个东西到底怎么样,本身测试一下吧。 linux

1. 硬件配置 shell

CPU:   Intel(R) Core(TM)2 Quad CPU    Q8400  @ 2.66GHz centos

显卡: NVIDIA Tesla K10 bash

(注:这个显卡还比较挑主板,本身攒的比较给力的机器主板不识别,用了台比较老旧的服务器。。。) 服务器

系统: centos6.2 64 app


2. 下载 ide

在官网上根据本身设备下载驱动:http://www.nvidia.com/Download/index.aspx?lang=en-us 测试

我是直接下载了SDK,里面有驱动。 http://developer.download.nvidia.com/compute/nvenc/v3.0/nvenc_3.0_linux_sdk.tgz ui

3. 驱动安装 this

参考:centos6.2下装NVIDIA显卡安装

4. 测试

运行SDK提供的Sample例程,出现了小问题:

[root@localhost nvEncodeApp]# ./nvEncoder 
./nvEncoder: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./nvEncoder)



额,动态库问题。

有两种方法解决:

a. 增长动态库

参见:/lib64/libc.so.6: version `GLIBC_2.14' not found问题

b. 从新编译例程


SDK提供了一个名为"1080p_heavyhand_3sec.sh"的脚本其内容很简单

./nvEncoder -configFile=HeavyHand_1080p.txt -outfile=HeavyHandIdiot.3sec.264



不怎么顺利啊,运行这个脚本出现错误:
[root@localhost nvEncodeApp]# ./1080p_heavyhand_3sec.sh 
>> GetNumberEncoders() has detected 2 CUDA capable GPU device(s) <<
  [ GPU #0 - < Tesla K10.G1.8GB > has Compute SM 3.0, NVENC Available ]
  [ GPU #1 - < Tesla K10.G1.8GB > has Compute SM 3.0, NVENC Available ]

>> InitCUDA() has detected 2 CUDA capable GPU device(s)<<
  [ GPU #0 - < Tesla K10.G1.8GB > has Compute SM 3.0, Available NVENC ]
  [ GPU #1 - < Tesla K10.G1.8GB > has Compute SM 3.0, Available NVENC ]

>> Select GPU #0 - < Tesla K10.G1.8GB > supports SM 3.0 and NVENC
./1080p_heavyhand_3sec.sh: line 2: 30523 Bus error               (core dumped) ./nvEncoder -configFile=HeavyHand_1080p.txt -outfile=HeavyHandIdiot.3sec.264


额。。。 看了一下README.txt:

You will need to install NVIDIA CUDA toolkit (CUDA 5.0 Production) for Linux to build and run
this sample application.


Once the CUDA toolkit is installed, update environment variable PATH to
correctly point to a location where CUDA binaries are installed.
    e.g. export PATH=$PATH:/usr/local/cuda/bin


The application no longer requires a GUID to initialize the NVENC encoder, the
driver performs the validation.  NVENC is officially supported on GPU hardware
based on Quadro, Tesla, GeForce GRID, or VGX.  NVENC on GeForce is not officially
supported.


In order to build and run the application on linux, ensure the CUDA library
path is included in the environment variable LD_LIBRARY_PATH. e.g.


For 32-bit system:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
For 64-bit system:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

有点着急,哥只装了驱动。。。,好吧安装CUDA toolkit 。能够参考安装NVIDIA CUDA toolkit


再次尝试运行,仍是不行。。。跟上面的结果差很少。


提示信息太少,不能判断啥缘由啊。索性从新编译。

运行make,很正常得编译不经过。。。 提示信息:“/opt/glibc-2.14/lib/libpthread.so.0: undefined reference to `memcpy@GLIBC_2.14'”

手动修改makefile,增长了glibc2.14的指定,而后编译经过了。


====== 豪华分割线 ======

测试运行,

[root@localhost nvEncodeApp]# /bin/bash 1080p_heavyhand_3sec.sh 
/opt/glibc-2.14/lib:/usr/local/cuda/lib64

>> GetNumberEncoders() has detected 2 CUDA capable GPU device(s) <<
  [ GPU #0 - < Tesla K10.G1.8GB > has Compute SM 3.0, NVENC Available ]
  [ GPU #1 - < Tesla K10.G1.8GB > has Compute SM 3.0, NVENC Available ]

>> InitCUDA() has detected 2 CUDA capable GPU device(s)<<
  [ GPU #0 - < Tesla K10.G1.8GB > has Compute SM 3.0, Available NVENC ]
  [ GPU #1 - < Tesla K10.G1.8GB > has Compute SM 3.0, Available NVENC ]

>> Select GPU #0 - < Tesla K10.G1.8GB > supports SM 3.0 and NVENC
 > CNvEncoder::AllocateIOBuffers() = Size (1920x1080 @ 16 frames)
 > System Memory with 16 buffers.



> NVENC Encoder[0] configuration parameters for configuration #0
> GPU Device ID             = 0
> Frames                    = 0 frames 
> ConfigFile                = HeavyHand_1080p.txt 
> Frame at which 0th configuration will happen = 0 
> maxWidth,maxHeight        = [1920,1080]
> Width,Height              = [1920,1080]
> Video Output Codec        = 4 - H.264 Codec
> Average Bitrate           = 2000000 (bps/sec)
> Peak Bitrate              = 2000000 (bps/sec)
> Rate Control Mode         = 1 - VBR (Variable Bitrate)
> Frame Rate (Num/Denom)    = (30/1) 30.0000 fps
> GOP Length                = 30
> Set Initial RC      QP    = 1
> Initial RC QP (I,P,B)     = I(28), P(28), B(34)
> Number of B Frames        = 0
> Display Aspect Ratio X    = 1920
> Display Aspect Ratio Y    = 1080
> Video codec profile       = 100
> Video codec Level         = 0
> FieldEncoding             = 0
> Number slices per Frame   = 0
> Encoder Preset            = 1 - Low Latancy Default Preset
> NVENC API Interface       = 2 - CUDA
Input Filesize: 230227968 bytes
[ Source Input File ] = "../YUV/1080p/HeavyHandIdiot.3sec.yuv"
[ # of Input Frames ] = 74

 ** Start Encode <../YUV/1080p/HeavyHandIdiot.3sec.yuv>, Frames [0,74] ** 

Loading Frames [0,73] into system memory queue (74 frames)
Encoding Frames [0,73]
0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 

>> Last Encoded Frame completed <<

encodeID[0], Frames [0,73] Encode Time = 795.37 (ms)
CNvEncoder::ReleaseEncoderResources() m_RefCount == 0, releasing resources
  Frames Encoded     :     74
  Total Encode Time  :   0.80 (sec)
  Average Time/Frame :  10.75 (ms)
  Average Frame Rate :  93.04 (fps)
  OutputFile[0] = HeavyHandIdiot.3sec.gpu0.264
  Filesize[0] = 832211
  Average Bitrate[0] (2.47 seconds) 2699062.750 (bps)
相关文章
相关标签/搜索