GStreamer-sharp无法创建管道 [英] GStreamer-sharp failed to create pipeline
问题描述
我尝试在WPF应用程序中使用Gstreamer显示RTSP流.
I try to display RTSP stream using Gstreamer in my WPF application.
所以我到目前为止:
- 将GStreamer安装到Lo文件夹F:/gstreamer
- 创建了新的WPF应用程序
- 添加了glib-sharp和gstreamer-sharp作为依赖项.
以下我用来初始化库的代码:
The code below I use to init the library:
Gst.Application.Init(); // (1)
mainLoop = new GLib.MainLoop();
mainGLibThread = new System.Threading.Thread(mainLoop.Run);
mainGLibThread.Start();
Element uriDecodeBin = ElementFactory.Make("playbin", "uriDecodeBin0"); // (2)
无法加载DLL'libgstreamer-1.0-0.dll':找不到指定的模块.
Unable to load DLL 'libgstreamer-1.0-0.dll': The specified module could not be found.
在行(1)上
.如果我将所有gstreamer dll复制到bin/Debug文件夹中,则该异常消失了,但第(2)行中的ElementFactory.Make
总是返回null
,而没有任何异常.如果我尝试做类似
on line (1). If I copy all the gstreamer dlls into bin/Debug folder the exception gone but ElementFactory.Make
in line (2) always returns null
without any exception. If I try to do something like
Parse.Launch(@"videotestsrc ! videoconvert ! autovideosink")
要测试库功能,我会收到错误消息:
to test the library functionality I get error:
没有元素"videotestsrc"
no element "videotestsrc"
但是如果我从命令行运行它:
but if I run it from command line:
gst-launch-1.0 videotestsrc!视频转换!自动视频接收器
gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
可以正常工作.
所以我的问题-如何使GStreamer锐化工作?
So my question - how to get GStreamer-sharp work?
推荐答案
将路径更改为GStream并在开始之前添加此代码
Change path to GStream and add this code before start
string path = @"G:\gstreamer\1.0\x86\"; // path to your gstream
string pluginpath = @"G:\gstreamer\1.0\x86\lib\gstreamer-1.0\"; // path to your gstream
string registry = System.IO.Path.Combine(path, "registry.bin");
Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + path);
Environment.SetEnvironmentVariable("GST_PLUGIN_PATH", pluginpath + ";" + Environment.GetEnvironmentVariable("GST_PLUGIN_PATH"));
Environment.SetEnvironmentVariable("GST_PLUGIN_SYSTEM_PATH_1_0", pluginpath + ";" + Environment.GetEnvironmentVariable("GST_PLUGIN_SYSTEM_PATH_1_0"));
Environment.SetEnvironmentVariable("GST_PLUGIN_SYSTEM_PATH", pluginpath + ";" + Environment.GetEnvironmentVariable("GST_PLUGIN_SYSTEM_PATH"));
Environment.SetEnvironmentVariable("GST_DEBUG", "*:4");
Environment.SetEnvironmentVariable("GST_DEBUG_FILE", System.IO.Path.Combine(path, "gstreamer.log"));
Environment.SetEnvironmentVariable("GST_REGISTRY", registry);
这篇关于GStreamer-sharp无法创建管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!