[英]Gstreamer application for linking name element of rtspsrc with audio and video queue
I am trying to link audio and video queue's using rtspsrc element property name. 我正在尝试使用rtspsrc元素属性名称链接音频和视频队列。 The pipeline is:
管道是:
gst-launch-1.0 rtspsrc location="rtsp://" latency=0 name=demux demux.
gst-launch-1.0 rtspsrc location =“ rtsp://”延迟= 0名称=多路分离器。 !
! queue !
排队! rtpmp4gdepay !
rtpmp4gdepay! aacparse !
刻薄! avdec_aac !
avdec_aac! audioconvert !
音频转换! audioresample !
audioresample! autoaudiosink demux.
autoaudiosink多路分配器。 !
! queue !
排队! rtph264depay !
rtph264depay! h264parse !
h264parse! omxh264dec !
omxh264dec! videoconvert !
视频转换! videoscale !
视频规模! video/x-raw,width=176, height=144 !
video / x-raw,width = 176,height = 144! ximagesink
ximagesink
I could create the value of name element using 我可以使用创建名称元素的值
g_object_set(source, "name", "demux", NULL);
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 非常感谢您的帮助
videoConvert and videoScale are not linked togheter, you should link them. videoConvert和videoScale未链接到gheter,您应该将它们链接。
I would have created a capfilter element 我会创建一个capfilter元素
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_filtered,我将其添加到gst_element_link_many中:
gst_element_link_many(videoQueue, videoDepay, videoParser, videoDecode, videoConvert,videoScale, videoCaps, videoSink, NULL));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.