0

I am trying to link audio and video queue's using rtspsrc element property name. The pipeline is:

gst-launch-1.0 rtspsrc location="rtsp://" latency=0 name=demux demux. ! queue ! rtpmp4gdepay ! aacparse ! avdec_aac ! audioconvert ! audioresample ! autoaudiosink demux. ! queue ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! videoscale ! video/x-raw,width=176, height=144 ! ximagesink

I could create the value of name element using

g_object_set(source, "name", "demux", NULL);

But I am not able to link audio and video queues hence create. Following is the part of code:

audio = gst_bin_new ("audiobin");
audioQueue = gst_element_factory_make ("queue", "audio-queue");
audioDepay = gst_element_factory_make ("rtpmp4gdepay", "audio-depayer");
audioParse = gst_element_factory_make ("aacparse", "audio-parser");
audioDecode = gst_element_factory_make ("avdec_aac", "audio-decoder");
audioConvert = gst_element_factory_make ("audioconvert", "aconv");
audioResample = gst_element_factory_make ("audioresample", "audio-resample");
audioSink = gst_element_factory_make ("autoaudiosink", "audiosink");

video bin

video  = gst_bin_new ("videobin");
videoQueue = gst_element_factory_make ("queue", "video-queue");
videoDepay= gst_element_factory_make ("rtph264depay", "video-depayer");
videoParser = gst_element_factory_make ("h264parse", "video-parser");
videoDecode = gst_element_factory_make ("omxh264dec", "video-decoder");
videoConvert = gst_element_factory_make("videoconvert", "convert");
videoScale = gst_element_factory_make("videoscale", "video-scale");
videoSink = gst_element_factory_make("ximagesink", "video-sink");
capsFilter = gst_caps_new_simple("video/x-raw",
                    "width", G_TYPE_INT, 176,
                    "height", G_TYPE_INT, 144,
                    NULL);

Linking procedure

 /*Linking filter element to videoScale and videoSink */
    link_ok = gst_element_link_filtered(videoScale,videoSink, capsFilter);
    gst_caps_unref (capsFilter);
    if (!link_ok) {
            g_warning ("Failed to link element1 and element2!");
    }
    /* Linking video elements internally */
    if (!gst_element_link_many(videoQueue, videoDepay, videoParser, videoDecode, videoConvert, NULL))
    {
            g_printerr("Cannot link videoDepay and videoParser \n");
            return 0;
    }
    if (!gst_element_link_many(audioQueue, audioDepay, audioParse, audioDecode, audioConvert, audioResample, audioSink, NULL))
    {
            g_printerr("Cannot link audioDepay and audioParse \n");
            return 0;
    }

Help is highly appreciated

RajviK
  • 41
  • 1
  • 9

1 Answers1

1

videoConvert and videoScale are not linked togheter, you should link them.

I would have created a capfilter element

videoCaps = gst_element_factory_make("capsfilter",NULL);

added the filter:

g_object_set (videoCaps , "caps", capsFilter, NULL);

and instead of calling gst_element_link_filtered I would have added it to gst_element_link_many:

gst_element_link_many(videoQueue, videoDepay, videoParser, videoDecode, videoConvert,videoScale, videoCaps, videoSink, NULL));

ieio
  • 173
  • 9