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

GStreamer splitmuxsink报"Queued GOP time is negative"错误求助

解决GStreamer splitmuxsink时间戳错误(Queued GOP time is negative)

问题分析

你遇到的Queued GOP time is negative错误,核心是流的时间戳出现回退或同步异常,结合你的流水线配置,还有一个明显的容器格式不匹配问题:用mpegtsmux生成TS流却输出为.mp4文件,这会干扰splitmuxsink的时间戳处理逻辑。

解决方案

1. 修正容器格式匹配

将splitmuxsink的muxer改为mp4mux(对应.mp4输出),或把输出文件后缀改为.ts(保留mpegtsmux)。推荐前者,因为目标是生成MP4片段:

2. 添加时间戳校正与缓冲调整

在流水线中加入缓冲元素,同时调整RTSP源和splitmuxsink的时间戳相关参数,避免时间戳回退。

修改后的完整命令:

$ gst-launch-1.0 rtspsrc location=rtsp://$USER:$PASSWORD@$IP is-live=true protocols=tcp do-timestamp=false \
    ! rtph264depay wait-for-keyframe=true request-keyframe=true sync=false \
    ! h264parse config-interval=-1 \
    ! queue leaky=2 max-size-time=5000000000 \
    ! splitmuxsink name=splitmuxsink max-size-time=10000000000 send-keyframe-requests=true muxer=mp4mux location=segment%05d.mp4 reset-time=true

关键参数说明

  • rtspsrc do-timestamp=false:禁用rtspsrc的时间戳生成,让下游元素基于流本身的时间戳处理,避免直播流的时间戳跳跃。
  • rtph264depay sync=false:解除depay元素与系统时钟的同步,防止时钟偏差导致时间戳异常。
  • queue leaky=2:当下游处理不及时时丢弃旧数据,避免缓冲中积累过期的时间戳帧。
  • splitmuxsink reset-time=true:每个片段开始时重置时间戳起点,确保片段内时间戳连续,避免跨片段的时间戳回退。

额外排查点

  • 检查RTSP源的流是否本身存在时间戳异常:可以用gst-launch-1.0 rtspsrc ... ! rtph264depay ! h264parse ! fakesink -v查看输出的时间戳是否有回退情况。
  • 若仍有问题,尝试在h264parse后添加identity sync=false,强制解除时间戳同步约束。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 03:07:10