You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用AMD RX580通过FFmpeg硬件编码速度仅1.5x,如何提速?

Answer

Is 1.5x speed normal with AMD RX580 hardware encoding?

Yes, this is expected given your current command. The bottleneck isn't the AMF hardware encoder—it's your entire filter chain (scale, boxblur, overlay, crop), which runs exclusively on the CPU. The GPU encoder sits idle waiting for the CPU to finish processing each frame, so the speed gain over CPU-only encoding is minimal.

Should it be faster?

Absolutely. You can achieve much higher speeds (often 5x or more, depending on the workload) by offloading filtering tasks to the GPU and optimizing encoder settings.

Methods to improve encoding speed:

  1. Offload filtering to the GPU
    The biggest performance gain comes from moving CPU-heavy filters like boxblur and scale to the GPU. For AMD GPUs, use VA-API (Linux) or AMF-specific filters (Windows) to do this.
    Example Linux command with VA-API acceleration:

    ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i 5.mp4 \
    -lavfi "[0:v]scale_vaapi=w=1920:h=1080,boxblur_vaapi=luma_radius=min(h\,w)/8:luma_power=1:chroma_radius=min(cw\,ch)/8:chroma_power=1[bg];[0:v]scale_vaapi=h=1080:w=-1[ov];[bg][ov]overlay_vaapi=(W-w)/2:(H-h)/2" \
    -c:v h264_amf output.mp4
    

    This runs all scaling, blurring, and overlay operations on the GPU, freeing the CPU to handle other tasks and feeding pre-processed frames directly to the AMF encoder.

  2. Use AMF's built-in scaling
    If you can't fully offload filtering, at least let the AMF encoder handle scaling instead of using the CPU-based scale filter. Remove the scale steps from your lavfi chain and specify the output resolution with -s 1920x1080 (for the background) or adjust the overlay's scale to use GPU acceleration where possible.

  3. Optimize AMF encoder presets
    Adjust the encoder preset to prioritize speed over quality. Add -preset ultrafast or -preset fast to your command:

    ffmpeg -i 5.mp4 -c:v h264_amf -preset ultrafast -lavfi "[0:v]scale=1920:1080,boxblur=luma_radius=min(h\,w)/8:luma_power=1:chroma_radius=min(cw\,ch)/8:chroma_power=1[bg];[0:v]scale=-1:1080[ov];[bg][ov]overlay=(W-w)/2:(H-h)/2" output.mp4
    

    Faster presets reduce encoding latency, with only minor quality tradeoffs for most use cases.

  4. Remove unnecessary filters
    Your final crop=w=1920:h=1080 is redundant—your background is already 1920x1080, and the overlay is centered within it. Removing this filter saves a small amount of CPU overhead.

  5. Validate FFmpeg build features
    Ensure your FFmpeg build supports AMF and VA-API:

    • Run ffmpeg -encoders | grep amf to confirm h264_amf is available.
    • Run ffmpeg -filters | grep vaapi to check for GPU-accelerated filters.
      If these are missing, use an official AMD-provided FFmpeg build or compile from source with AMF/VA-API enabled.

内容的提问来源于stack exchange,提问作者Peter Czask

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 16:10:55