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

使用FFmpeg转换视频出现非预期运动模糊的解决咨询

Fixing Motion Blur When Transcoding MPEG-2 to H.264 HLS

Let’s break down why your current command isn’t working and fix it step by step. First, your existing command has conflicting parameters and redundant settings that are likely contributing to the motion blur issue.

Key Issues in Your Current Command

  • Conflicting quality controls: You’re mixing -qp 0 (lossless fixed quantization) and -crf 7 (constrained rate factor)—these override each other, leading to unpredictable encoding behavior that can degrade motion clarity.
  • Unnecessary fixed bitrate locks: -minrate and -b:v restrict x264’s ability to allocate extra bits to fast-moving scenes, which is critical for preserving sharp motion details.
  • Redundant resolution/frame rate: -s 1920x1080 and -r 25 are redundant since your input already uses these settings; forcing them doesn’t help and can introduce unintended processing artifacts.

Solution Command for Blur-Free H.264 HLS

Here’s a refined command that prioritizes motion clarity, preserves original quality, and outputs proper HLS:

ffmpeg \
  -i input.ts \
  -c:v libx264 \
  -preset veryslow \
  -crf 0 \          # Lossless quality (adjust to 1-5 for near-lossless if smaller file size is needed)
  -g 25 \           # 1 keyframe per second (matches input frame rate)
  -x264-params "me=umh:merange=32:subme=10:trellis=2" \
  -c:a aac \
  -b:a 192k \
  -hls_time 2 \
  -hls_list_size 0 \
  -f hls output.m3u8

Parameter Explanations

  • -preset veryslow: Uses x264’s most thorough preset, which enables high-quality motion estimation—this is critical for reducing blur in fast-moving content, as it spends more time analyzing motion vectors.
  • -crf 0: Enables lossless encoding to preserve every detail from your original MPEG-2 source. If you need a smaller file size without visible blur, drop this to -crf 1-5 for near-lossless quality.
  • -x264-params: Fine-tunes motion estimation for maximum sharpness:
    • me=umh: Uses the "uneven multi-hexagon" search algorithm, which is far more accurate than the default for tracking complex motion.
    • merange=32: Expands the search range for motion vectors, ensuring x264 captures even fast, large-scale movement.
    • subme=10 + trellis=2: Optimizes sub-pixel motion compensation and quantization to retain sharp edges and minimize blur.
  • HLS settings: -hls_time 2 splits the video into 2-second segments (standard for HLS), and -hls_list_size 0 keeps all segments in the playlist (ideal for short videos).

Additional Checks

  • If possible, upgrade your FFmpeg version (yours is 4.2.2)—newer versions include improvements to x264’s motion handling that can further reduce blur.
  • Confirm your source video doesn’t have inherent motion blur (you noted the original is sharp, so this shouldn’t be an issue here).

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.09 07:58:12