安装并测试nvenc linux sdk
2019獨角獸企業重金招聘Python工程師標準>>>
????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
額。。。 看了一下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 resourcesFrames Encoded : 74Total Encode Time : 0.80 (sec)Average Time/Frame : 10.75 (ms)Average Frame Rate : 93.04 (fps)OutputFile[0] = HeavyHandIdiot.3sec.gpu0.264Filesize[0] = 832211Average Bitrate[0] (2.47 seconds) 2699062.750 (bps)
轉載于:https://my.oschina.net/zhangxu0512/blog/262184
總結
以上是生活随笔為你收集整理的安装并测试nvenc linux sdk的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java---取得操作系统默认的代理
- 下一篇: Apache POI操作Excel导出J