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
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)