0

I need to demux the video frames and KLV data from an MPEG-TS stream in sync, frame-by-frame. The following command to demux the KLV data and outputs a text file with the KLV data.

gst-launch-1.0 filesrc location="some_file.ts" ! tsdemux name=demux \
demux. ! queue ! meta/x-klv ! filesink location="some_file-KLV.txt"

The following command to demux the video and outputs a video file.

gst-launch-1.0 filesrc location="some_file.ts" ! tsdemux name=demux \
demux. ! queue ! decodebin ! videorate ! videoscale ! x264enc ! mp4mux ! filesink location="some_file-video.mp4" 

On combining the above two:

gst-launch-1.0 filesrc location="some_file.ts" ! tsdemux name=demux \
demux. ! queue ! decodebin ! videorate ! videoscale ! x264enc ! mp4mux ! filesink location="some_file-video.mp4" 
demux. ! queue ! meta/x-klv ! filesink location="some_file.txt"

The command doesn't work. It just gets stuck after the following message on the terminal;

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

and, the size text and video files is 0 bytes.

An example .ts file can be found at(this file hasn't been uploaded and created by me, it is part of data for some code on github(https://gist.github.com/All4Gis/509fbe06ce53a0885744d16595811e6f)): https://drive.google.com/drive/folders/1AIbCGTqjk8NgA4R818pGSvU1UCcm-lib?usp=sharing

Thank you for helping! Cheers. :)

Edit:

I realised that there can be some confusion. The files in the link above were just used to create the .ts file.

The .ts file I am using, is available directly in either of the links below:

https://drive.google.com/drive/folders/1t-u8rnEE2MftWQkS1q3UB-J3ogXBr3p9?usp=sharing

https://easyupload.io/xufeny

9friday
  • 1
  • 1
  • 3

1 Answers1

0

It seems if we use Gstreamer's multiqueue element, instead of queue, the files are being created.

I tried the following based on a suggestion from a commenter on another website I had posted the question on:

gst-launch-1.0 filesrc location="MISB.ts" ! tsdemux name=demux \
demux. ! multiqueue name=mq ! decodebin ! videorate ! videoscale ! x264enc tune=zerolatency ! mp4mux ! filesink location="some_file-video.mp4" \
demux. ! mq. mq. ! meta/x-klv ! filesink location="some_file-KLV.txt"

But, the KLV data and frames are still not in sync. I need the KLV data corresponding to each frame.

Thanks & Regards.

9friday
  • 1
  • 1
  • 3
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 10 '22 at 22:21