Gstreamer应用程序,用于链接rtspsrc的name元素与音频和视频队列

时间:2017-01-23 12:32:45

标签: c rtsp-client gstreamer-1.0

我正在尝试使用rtspsrc元素属性名链接音频和视频队列。管道是:

  

gst-launch-1.0 rtspsrc location =“rtsp://”latency = 0 name = demux demux。 !排队! rtpmp4gdepay! aacparse! avdec_aac! audioconvert!听觉样本! autoaudiosink demux。 !排队! rtph264depay! h264parse! omxh264dec!视频转换!视频! video / x-raw,width = 176,height = 144! ximagesink

我可以使用

创建name元素的值
  

g_object_set(source,“name”,“demux”,NULL);

但我无法链接音频和视频队列因此创建。以下是代码的一部分:

content-type: undefined

视频箱

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  = 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);

非常感谢帮助

1 个答案:

答案 0 :(得分:1)

videoConvert和videoScale没有链接到gheter,你应该链接它们。

我会创建一个capfilter元素

videoCaps = gst_element_factory_make("capsfilter",NULL);

添加了过滤器:

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

而不是调用gst_element_link_filtered我会将它添加到gst_element_link_many:

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