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

Gstreamer解码H.264失败:求支持色彩校正2:4:5:4的驱动方案

解码H.264文件时GStreamer流水线协商失败问题

问题现象

使用GStreamer解码H.264文件时,流水线运行失败,报错为Internal data stream error,具体原因是streaming stopped, reason not-negotiated (-4)。

报错日志

...................
0:00:01.968415100  2374   0x3fa0000b70 DEBUG           v4l2videodec gstv4l2videodec.c:1156:gst_v4l2_vidRedistribute latency...
eo_dec_sink_getcaps:<v4l2h264dec0> Returning sink caps video/x-h264, width=(int)[ 48, 4096 ], height=(int)[ 16, 2304 ], framerate=(fraction)[ 0/1, 2147483647/1 ], stream-format=(string)byte-stream, alignment=(string)au, level=(string){ 1, 1b, 1.1, 1.2, 1.3, 2, 2.1, 2.2, 3, 3.1, 3.2, 4, 4.1, 4.2, 5, 5.1 }, profile=(string){ baseline, constrained-baseline, main, high }, colorimetry=(string){ bt709, bt601, smpte240m, 1:3:5:1, 2:4:5:2, 2:4:5:3, 1:4:7:1, 2:4:7:1, 2:4:12:8, bt2020, 2:0:0:0 }, parsed=(boolean)true
0:00:01.969251400  2374   0x3fa0000b70 DEBUG              h264parse gsth264parse.c:1897:ensure_caps_profile:<h264parse0> Setting compatible profile high to the caps
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)0/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, colorimetry=(string)2:4:5:4, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)high, level=(string)1.3
0:00:01.970644300  2374   0x3fa0000b70 DEBUG           v4l2videodec gstv4l2videodec.c:1156:gst_v4l2_video_dec_sink_getcaps:<v4l2h264dec0> Returning sink caps EMPTY
0:00:01.971063200  2374   0x3fa0000b70 LOG                h264parse gsth264parse.c:2657:gst_h264_parse_get_timestamp:<h264parse0> Upstream ts 0:00:00.000000000
0:00:01.971347300  2374   0x3fa0000b70 DEBUG              h264parse gsth264parse.c:2674:gst_h264_parse_get_timestamp:<h264parse0> unable to compute timestamp: timing info not present
0:00:01.971434900  2374   0x3fa0000b70 DEBUG              h264parse gsth264parse.c:2575:gst_h264_parse_get_duration:<h264parse0> unable to compute duration: timing info not present
0:00:01.972205200  2374   0x3fa0000b70 DEBUG           v4l2videodec gstv4l2videodec.c:1156:gst_v4l2_video_dec_sink_getcaps:<v4l2h264dec0> Returning sink caps EMPTY
0:00:01.972825600  2374   0x3fa0000b70 DEBUG              h264parse gsth264parse.c:3268:gst_h264_parse_pre_push_frame:<h264parse0> Inserting AUD into the stream.
0:00:01.972947300  2374   0x3fa0000b70 DEBUG              h264parse gsth264parse.c:225:gst_h264_parse_reset_frame:<h264parse0> reset frame
0:00:01.973267700  2374   0x3fa0000b70 DEBUG           v4l2videodec gstv4l2videodec.c:1156:gst_v4l2_video_dec_sink_getcaps:<v4l2h264dec0> Returning sink caps EMPTY
0:00:01.973586100  2374   0x3fa0000b70 DEBUG           v4l2videodec gstv4l2videodec.c:1156:gst_v4l2_video_dec_sink_getcaps:<v4l2h264dec0> Returning sink caps EMPTY
ERROR: from element /GstPipeline:pipeline0/GstH264Parse:h264parse0: Internal data stream error.
Additional debug info:
../gstreamer-1.22.12/libs/gst/base/gstbaseparse.c(3699): gst_base_parse_loop (): /GstPipeline:pipeline0/GstH264Parse:h264parse0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
0:00:01.974780200  2374   0x3fa0000b70 DEBUG           v4l2videodec gstv4l2videodec.c:1156:gst_v4l2_vidSetting pipeline to NULL ...
eo_dec_sink_getcaps:<v4l2h264dec0> Returning sink caps EMPTY

执行的GStreamer命令

export GST_DEBUG=h264parse:7,v4l2videodec:7
gst-launch-1.0 -vvv --no-fault filesrc location=./test-25fps.h264 num-buffers=10 ! h264parse ! v4l2h264dec ! video/x-raw,format=I420 ! filesink location=./out.yuv

问题分析

从日志可以看到,h264parse输出的caps包含colorimetry=(string)2:4:5:4,但v4l2h264dec返回的sink caps为空,说明V4L2 H.264解码驱动不支持该色彩校正参数。该参数对应的具体色彩属性为:

colorimetry.range     = GST_VIDEO_COLOR_RANGE_16_235;
colorimetry.matrix    = GST_VIDEO_COLOR_MATRIX_BT601;
colorimetry.transfer  = GST_VIDEO_TRANSFER_BT709;
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_SMPTE170M;

疑问

不清楚在驱动中需要修复或实现什么逻辑来支持2:4:5:4色彩校正参数,也未找到类似处理H.264级别、配置文件那样的参数管理接口。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 00:24:52