Search code examples
videometadatagstreamergstreamer-1.0

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


Using GStreamer (version 1.12.4) I've been creating video from jpegs succesfully using the following statement:

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

As the statement suggests this creates H.264 encoded MPEG-TS files which use the jpeg files at 25 fps.

I currently also have similarly named klv files and would like to mux them into the same output ts file. My best attempt (based on other examples) looks something like this:

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

This leads to quite some syntax errors:

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

I wouldn't mind providing the KLV data in a different format either if that eases the answer. I've also played with adding queue statements as well as multiplexing at different locations, but that results in the same ERROR messages so far.

Any ideas, resources or other suggestions to get me in the right direction for multiplexing KLV?


Solution

  • 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.