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

使用FFmpeg进行X11屏幕录制时出现Past duration过大等错误的求助

Fixing Your FFmpeg Screen Recording Issues

Let's break down what's going wrong and get you a working screen recording command tailored to your 1920x1080 display.

First, Fix the Syntax Error in Your Original Command

Your initial command has a critical typo: the -s (resolution) parameter uses a space between 1920 and 1080—FFmpeg interprets this as two separate invalid arguments. It should be 1920x1080 without spaces.

Address the "Not Enough Frames to Estimate Rate" Warning

This happens because FFmpeg needs more data to properly detect the stream's rate. Add these two parameters to give it enough buffer:

  • probesize 100M: Increases the amount of data FFmpeg reads to probe the stream
  • analyzeduration 100M: Gives FFmpeg more time to analyze the stream before starting encoding

Fix "Past Duration Too Large" Warnings & Slow Recording Speed (0.382x)

These issues stem from slow encoding performance. By default, FFmpeg might use a slow encoder preset that can't keep up with your 30fps capture. Switch to the ultrafast preset for libx264 (the most efficient H.264 encoder) to boost speed, and set a reasonable CRF (Constant Rate Factor) for balanced quality and file size.

The Final Working Command

ffmpeg -f x11grab -framerate 30 -probesize 100M -analyzeduration 100M -s 1920x1080 -i :0 -c:v libx264 -preset ultrafast -crf 23 -threads 0 /tmp/capture.mp4

Let's walk through the key parameters:

  • -framerate 30: Locks in your desired capture frame rate
  • -c:v libx264: Uses the widely supported H.264 video encoder
  • -preset ultrafast: Prioritizes encoding speed over file size (you can tweak this to fast or medium later if you want smaller files and don't mind slower recording)
  • -crf 23: Balances quality and file size (lower values = better quality, higher = smaller files; 23 is a reliable default)
  • -threads 0: Lets FFmpeg use all available CPU cores for faster processing

Optional: Add Audio Capture

If you want to include system audio, add the ALSA input (use arecord -l to list your audio devices if default doesn't work):

ffmpeg -f x11grab -framerate 30 -probesize 100M -analyzeduration 100M -s 1920x1080 -i :0 -f alsa -ac 2 -i default -c:v libx264 -preset ultrafast -crf 23 -c:a aac -b:a 192k -threads 0 /tmp/capture_with_audio.mp4

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 07:58:30