使用 GStreamer 将 KLV 从文件转换为 MPEG-TS

Muxing KLV from file(s) into MPEG-TS using GStreamer

使用 GStreamer(版本 1.12.4)我一直在使用以下语句成功地从 jpegs 创建视频:

gst-launch-1.0 multifilesrc location=image-%06d.jpg \
! image/jpeg,framerate=25/1 \
! decodebin \
! videoscale \
! video/x-raw \
! x264enc bitrate=10000 \
! mpegtsmux \
! filesink location=test-H264-10Mbps.ts

如声明所示,这会创建 H.264 编码的 MPEG-TS 文件,该文件使用 25 fps 的 jpeg 文件。

我目前也有类似命名的 klv 文件,并想将它们混合到同一个输出 ts 文件中。我的最佳尝试(基于其他示例)看起来像这样:

gst-launch-1.0 multifilesrc location=data-%06d.klv \
  ! meta/x-klv \
  ! mpegtsmux name=mux \
! multifilesrc location=image-%06d.jpg \
  ! image/jpeg,framerate=25/1 \
  ! decodebin \
  ! videoscale \
  ! video/x-raw \
  ! x264enc bitrate=10000 \
! mux. \
  ! filesink location=test-H264-KLV-10Mbps.ts

这会导致相当多的语法错误:

0:00:00.081526898 20796 000000000529E360 WARN                 default grammar.y:1137:priv_gst_parse_yyerror: Error during parsing: syntax error, unexpected LINK
0:00:00.087062261 20796 000000000529E360 ERROR           GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error
0:00:00.091393840 20796 000000000529E360 ERROR           GST_PIPELINE grammar.y:1061:priv_gst_parse_yyparse: syntax error
0:00:00.099172303 20796 000000000529E360 ERROR           GST_PIPELINE grammar.y:740:gst_parse_perform_link: could not link mux to multifilesrc1
WARNING: erroneous pipeline: syntax error

我不介意以不同的格式提供 KLV 数据,如果这样可以简化答案的话。我还玩过添加队列语句以及在不同位置进行多路复用,但到目前为止,这会导致相同的错误消息。

有什么想法、资源或其他建议可以让我在多路复用 KLV 方面走上正确的方向吗?

there isn’t any readily available gstreamer plugin which you can use to mux the file, you will have to write your own application, refer link for similar example.