Pipeline hangs when processing klv data

Haraka Matt matt.haraka24 at gmail.com
Thu May 12 02:36:20 UTC 2022

Hi all,

I have been testing using FFmpeg with a MPG file that has KLV and output as
a UDP stream. Using that UDP stream, to create a GStreamer pipeline to
demux using tsdemux to h264 and KLV elementary streams, process it, and
then mux the streams back into mpegts. I have also created a simple plugin
to print the klv buffer out to see if the pipeline works correctly. The
pipeline will throw an error at the start but continue to run for a
minute or so, print out part of the klv data and then it hangs. The
pipeline will not hang and works properly if the tsdemux ignores the entire
KLV stream or KLV data does not mux the klv streams back into mpegts. I
tried to demux one of the streams (ignore/drop the other) and it works but
when merging into one command and it doesn't. Also tried to comment away
the code that cause the error but it does not solve the hanging issue and
not all the klv data was printed out(this is impt). Any idea how to debug
and fix these issues? I tested it using the latest GStreamer version 1.20.1

The only error msg as shown below:
[image: image.png]

This is the command that I have used to create an UDP stream from a file:
FFmpeg -re -i E:\sample1.mpg -map 0 -c copy -f mpegts udp://

This is the pipeline command that was used in the test: gst-launch-1.0
udpsrc port=1551 ! tsdemux name=demux demux. ! queue !
video/x-h264,stream-format=byte-stream ! h264parse ! avdec_h264 !
avenc_mpeg4 ! mpegtsmux name=mux mux. ! udpsink host= port=5089
demux. ! queue ! meta/x-klv ! my_filter ! mux.

My pipeline looks sth like this:
[image: pipeline_flow.PNG]
Here's the link to the sample file that was used in this test:

I took the sample from here:
wget http://samples.ffmpeg.org/MPEG2/mpegts-klv/Day%20Flight.mpg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220512/eb3d8243/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 3957 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220512/eb3d8243/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pipeline_flow.PNG
Type: image/png
Size: 13442 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220512/eb3d8243/attachment-0003.png>

More information about the gstreamer-devel mailing list