The encoders only accept input as VAAPI surfaces. If the input is in normal memory, it will need to be uploaded before giving the frames to the encoder - in the ffmpeg utility, the hwupload filter can be used for this. It will upload to a surface with the same layout as the software frame, so it may be necessary to add a format filter immediately before to get the input into the right format (hardware generally wants the nv12 layout, but most software functions use the yuv420p layout). The hwupload filter also requires a device to upload to, which needs to be defined before the filter graph is created.
So, to use the default decoder for some input, then upload frames to VAAPI and encode with H.264 and default settings:
机翻
编码器只接受作为 VAAPI 表面的输入。如果输入在正常内存中,则需要在将帧提供给编码器之前上传它 - 在 ffmpeg 实用程序中,可以使用 hwupload 过滤器。它会上传到与软件框架布局相同的表面,因此可能需要在紧接之前添加格式过滤器才能将输入转换为正确的格式(硬件一般要nv12布局,但大多数软件功能使用yuv420p布局)。 hwupload 过滤器还需要一个设备来上传,这需要在创建过滤器图之前定义。
因此,要对某些输入使用默认解码器,然后将帧上传到 VAAPI 并使用 H.264 和默认设置进行编码