我正在尝试使用 rtspsrc 元素属性名称链接音频和视频队列。管道是:
gst-launch-1.0 rtspsrc location="rtsp://" 延迟=0 name=demux demux。!队列 !rtpmp4gdepay !不一样!avdec_aac!音频转换!音频重采样!自动音频接收器解复用器。!队列 !rtph264depay!h264解析!omxh264dec !视频转换!视频缩放!视频/x-raw,宽度=176,高度=144!ximagesink
我可以使用创建名称元素的值
g_object_set(源,“名称”,“解复用”,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;
}
高度赞赏帮助