安装并测试nvenc linux sdk

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

1. 硬件配置

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

显卡: NVIDIA Tesla K10

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

系统: centos6.2 64


2. 下载

在官网上根据自己设备下载驱动: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

3. 驱动安装

参考: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)




你可能感兴趣的:(安装并测试nvenc linux sdk)