[英]Gstreamer application for linking name element of rtspsrc with audio and video queue
我正在尝试使用rtspsrc元素属性名称链接音频和视频队列。 管道是:
gst-launch-1.0 rtspsrc location =“ rtsp://”延迟= 0名称=多路分离器。 ! 排队! rtpmp4gdepay! 刻薄! avdec_aac! 音频转换! audioresample! autoaudiosink多路分配器。 ! 排队! rtph264depay! h264parse! omxh264dec! 视频转换! 视频规模! video / x-raw,width = 176,height = 144! ximagesink
我可以使用创建名称元素的值
g_object_set(source,“ name”,“ demux”,NULL);
但是我无法链接音频和视频队列,因此无法创建。 以下是代码的一部分:
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);
链接程序
/*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;
}
非常感谢您的帮助
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));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.