Pipeline with qtdemus doesn't change state

Hi all,

  • Hardware Platform Jetson AGX Orin
  • JetPack Version 5.0.2-b231
  • GStreamer version 1.16.3

Using gstreamer code examples on element pad signaling, I put together a pipeline that is to take mp4 files.
I used a g_signal_connect to react to when qtdemux adds it’s source pad, but it never gets called, it seems.
Instead, the pipeline failes to elevate it’s state when I ask it to.

Struct for holding all the elements, for pipeline callback reasons:

typedef struct _DynamicPipeData {
	GstElement *pipeline;
	GstElement *source;
	GstElement *demux;
	GstElement *parse;
	GstElement *queue;
	GstElement *nvdec;
	GstElement *nvconv;
	GstElement *vconv;
	GstElement *sink;
} DynamicPipeData;

Main code:

GstStateChangeReturn state_change_return;
gst_init (nullptr, nullptr);

data.source = gst_element_factory_make ("filesrc", "source");
data.demux = gst_element_factory_make ("qtdemux", "demux");
data.parse = gst_element_factory_make ("h264parse", "parse");
data.queue = gst_element_factory_make ("queue", "queue");
data.nvdec = gst_element_factory_make ("nvv4l2decoder", "nvdec");
data.nvconv = gst_element_factory_make ("nvvidconv", "nvconv");
data.vconv = gst_element_factory_make ("videoconvert", "vconv");
data.sink = gst_element_factory_make ("appsink", "sink");
data.pipeline = gst_pipeline_new ("empty-pipeline");

gst_bin_add_many (GST_BIN (data.pipeline), data.source, data.demux, data.parse, data.queue, data.nvdec, data.nvconv, data.vconv, data.sink, NULL);
if (!gst_element_link_many (data.source, data.demux, NULL)) {g_printerr ("Elements could not be linked.\n");}
if (!gst_element_link_many (data.parse, data.queue, data.nvdec, data.nvconv, data.vconv, data.sink, NULL)) {g_printerr ("Elements could not be linked.\n");}

g_object_set (data.source, "location", addressIn, NULL);
g_signal_connect (data.demux, "pad-added", G_CALLBACK (pad_added_handler), &data);

state_change_return = gst_element_set_state (data.pipeline, GST_STATE_NULL);
state_change_return = gst_element_set_state (data.pipeline, GST_STATE_READY);
state_change_return = gst_element_set_state (data.pipeline, GST_STATE_PAUSED);
state_change_return = gst_element_set_state (data.pipeline, GST_STATE_PLAYING);

Since the pad_added_handler doesn’t get called, I haven’t included that function here.
I added plenty of cout’s with the prefix "Local file: " to help keep track of what is going on in the terminal output:

Local file: Start preliminary pipeline build.
Local file: Setting properites of elements.
Local file: Setting properties of source.
Local file: Connect demux to pad-adder signal.
Local file: Start playing pipeline.
Local file: Pipeline state enums are as follows: GST_STATE_VOID_PENDING=0, GST_STATE_NULL=1, GST_STATE_READY=2, GST_STATE_PAUSED=3, GST_STATE_PLAYING=4
Local file: Pipeline state return enums are as follows: GST_STATE_CHANGE_FAILURE=0, GST_STATE_CHANGE_SUCCESS=1, GST_STATE_CHANGE_ASYNC=2, GST_STATE_CHANGE_NO_PREROLL=3
Local file: Current pipeline state: 1 - GST_STATE_NULL
Local file: Setting state to: 1 - GST_STATE_NULL
Local file: Pipeline change return: 1 - GST_STATE_CHANGE_SUCCESS
Local file: Current pipeline state: 1 - GST_STATE_NULL
Local file: Setting state to: 2 - GST_STATE_READY
nvbuf_utils: Could not get EGL display connection
nvbuf_utils: Could not get EGL display connection
Opening in BLOCKING MODE
Local file: Pipeline change return: 1 - GST_STATE_CHANGE_SUCCESS
Local file: Current pipeline state: 1 - GST_STATE_NULL
Local file: Setting state to: 3 - GST_STATE_PAUSED

(executable:33062): GStreamer-WARNING **: 17:23:45.891: Trying to set debug field of error message, but string is not valid UTF-8. Pleasefile a bug.

(executable:33062): GStreamer-WARNING **: 17:23:45.891: Trying to set debug field of error message, but string is not valid UTF-8. Please file a bug.
Local file: Pipeline change return: 0 - GST_STATE_CHANGE_FAILURE
Local file: Current pipeline state: 0 - GST_STATE_VOID_PENDING
Local file: Setting state to: 4 - GST_STATE_PLAYING

(executable:33062): GStreamer-WARNING **: 17:23:46.892: Trying to set debug field of error message, but string is not valid UTF-8. Please file a bug.

(executable:33062): GStreamer-WARNING **: 17:23:46.892: Trying to set debug field of error message, but string is not valid UTF-8. Please file a bug.
Local file: Pipeline change return: 0 - GST_STATE_CHANGE_FAILURE
Local file: Current pipeline state: 0 - GST_STATE_VOID_PENDING
Local file: Start listening to pipeline bus.
Segmentation fault (core dumped)

Any advice would be appreciated.

Hi,
Please try gst_parse_launch() like this sample:
Nvidia-desktop kernel: [407343.357549] (NULL device *): nvhost_channelctl: invalid cmd 0x80685600 - #35 by DaneLLL

It shall work well and no need to add code bout pad_added_handler()
For more gstreamer samples, please also check

/opt/nvidia/deepstream/deepstream-6.2/sources/apps/sample_apps/

Thank you for the suggestion.
I used the referenced post for guidance.

This includes usage of gst_parse_launch() on the pipeline
filesrc location=file.mp4 ! qtdemux ! h264parse ! queue ! nvv4l2decoder ! nvvidconv ! videoconvert ! appsink
And gst_element_set_state() to playing.

qtdemux still doesn’t link to h264parse.

Here is some debug from qtdemux:

WARN qtdemux qtdemux_types.c:239:qtdemux_type_get: unknown QuickTime node type pasp
WARN qtdemux qtdemux_types.c:239:qtdemux_type_get: unknown QuickTime node type XMP_
WARN qtdemux qtdemux.c:3250:qtdemux_parse_trex:<qtdemux0> failed to find fragment defaults for stream 1

And the diagram of the pipeline showing that qtdemux doesn’t connect.
qtdemux_error

@DaneLLL any thoughts on Aron’s response? Looking forward to hearing back from you

Hi,
It seems like the video file is invalid. Are you able to play the file in gst-launch-1.0 command?

1 Like

This pipeline works at the moment

gst-launch-1.0 filesrc location=cc/file.mp4 ! qtdemux ! h264parse ! fakesink

I am left scratching my head, because this problem is not emerging anymore in our own pipeline.

Hi,
Please try software decoder like:

gst-launch-1.0 filesrc location=cc/file.mp4 ! qtdemux ! h264parse ! avdec_h264 ! xvimagesink

I am working in a container, so no access to X display.
But I tried these and both ran without problems.

gst-launch-1.0 filesrc location=cc/file.mp4 ! qtdemux ! h264parse ! avdec_h264 ! fakesink

gst-launch-1.0 filesrc location=cc/file.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! nvvidconv ! nvv4l2h265enc ! h265parse ! mp4mux ! filesink location="./video_out.mp4

There was a period where the storage drive was full.
Could that promote behaviors as if the file is invalid?