1

我目前正在尝试将 FFMPEG 与硬件/GPU 编码和 H264 编解码器一起使用。

我所做的是,我将原始数据直接导入 ffmpeg 以将它们输出到 udp 流。这些是我的设置:

var ffmpegArgs = [
    '-c:v', 'rawvideo',// input container
    '-f', 'rawvideo',
    '-pix_fmt', 'rgba', // input pixel format
    '-s', '600x600', //input size
    '-video_size', '600x600',
    '-i', 'pipe:0', // input source
    '-f', 'mpegts', // output container format
    '-s', '600x600',
    '-video_size', '600x600',
    '-c:v', 'libx264', // output video codec
    '-b:v', '1m', // output bitrate
    'udp://239.255.123.46:1234' // output destination
];

总的来说它是有效的,但质量和延迟真的很糟糕。帧大约落后 5 秒,然后有很多错误,因此至少需要 10 或 15 秒才能看到孔帧(视频是画布上的“实时流”)。

但是我认为 GPU 编码在这里可能会有所帮助,但我没有得到这个工作。我正在尝试使用VAAPI,但无论我尝试使用来自 ffmpeg 的哪个命令(在此处描述),它都无法正常工作....

我正在尝试在 Ubuntu 16.04上的英特尔 NUC(这个)上运行它。

有什么提示可以让我运行吗?

4

1 回答 1

2

The encoder you're using, libx264, does not implement hardware-accelerated encoding. Only (some) OpenCL-accelerated look-ahead function(s) are available, and performance gains from that are at best, marginal, especially on high-end systems. To expose look-ahead accelerated look-ahead in that library, ensure that an OpenCL ICD and OpenCL headers are present on the system and that the option --disable-opencl is omitted at x264's configuration phase. Likewise, for FFmpeg, ensure that --enable-opencl is enabled at the configuration phase.

Take a look at similar answers provided on queries regarding hardware-accelerated encoding with FFmpeg.

  1. With NVENC.

  2. With QuickSync (which requires the Intel Media SDK to be installed when configuring and building FFmpeg).

  3. With VAAPI.

And the FFmpeg wiki on hardware acceleration.

于 2019-05-08T22:02:05.993 回答