mofeng-git / One-KVM

One-KVM,结合玩客云和PiKVM,实现低成本远控方案。
https://one-kvm.mofeng.run
Other
288 stars 28 forks source link

ffmpeg 硬件加速/GPU H.264编码器参数 #28

Closed mofeng-git closed 2 days ago

mofeng-git commented 1 month ago

实现在特定平台(Intel等)的H.264编码硬件加速

任务:

  1. 验证可行性,测试Intel核显平台上ffmpeg h.264加速可行性
  2. 实现demo,编写可运行脚本
  3. 完善优化,脚本自动运行平台加载对应ffmpeg编码器
  4. 集成进入kvmd主程序,引出配置选项
mofeng-git commented 1 month ago

目前没有可以供 ffmpeg 硬件加速测试的平台,此计划暂时搁置。

详细信息:使用 CPU: Intel(R) Core(TM) i5-2410M (4) @ 2.90 GHz GPU: Intel 2nd Generation Core Processor Family] 硬件在 Windows 7/10、Ubuntu、Manjaro 系统中 ffmpeg 都无法使用 Intel 核显 QSV 视频加速功能。

[h264_qsv @ 0x630658a7e1c0] Error creating a MFX session: -9.
[vost#0:0/h264_qsv @ 0x630658ab7000] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[vf#0:0 @ 0x630658b228c0] Error sending frames to consumers: Unknown error occurred
[vf#0:0 @ 0x630658b228c0] Task finished with error code: -1313558101 (Unknown error occurred)
[vf#0:0 @ 0x630658b228c0] Terminating thread with return code -1313558101 (Unknown error occurred)
[vost#0:0/h264_qsv @ 0x630658ab7000] Could not open encoder before EOF
[vost#0:0/h264_qsv @ 0x630658ab7000] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_qsv @ 0x630658ab7000] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 0x630658ab6300] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A    
[aac @ 0x63065902b500] Qavg: 1497.908
Conversion failed!
eritpchy commented 1 week ago

Intel 硬件加速参考: https://github.com/eritpchy/pikvm-container/blob/main/root/usr/share/kvmd/stream.sh https://github.com/eritpchy/pikvm-container/blob/main/script/test_hardware_coder.sh qsv也有测试过, 是可用的, 但在我的机器效率只有VAAPI一半 1080p qsv 4x vaapi 8x左右

同理nvidia, amd支持其实也很简单

另外我的玩客云刷了你的系统老是无条件随机死机(可能硬件问题) 暂时是不会折腾玩客云版硬件加速了

mofeng-git commented 2 days ago

utsreamer 已集成 libx264,性能尚可。暂时不会开发此功能,问题关闭。