Ubuntu搭建Gstreamer开发环境
-
文档
git://anongit.freedesktop.org/gstreamer/gst-docs -
apollo
https://github.com/ApolloAuto/apollo.git
下载新立得
sudo apt install synaptic
libgstreamer1.0-0
libgstreamer1.0-dev
libgstreamer1.0-0-dbg
在新立得里选中应用即可
libgstreamer1.0-dev
libgstreamer1.0-0-dbg
在新立得里选中应用即可
或执行命令:(测试会报错)
sudo apt-get install libgstreamer1.0-0 libgstreamer1.0-dev libgstreamer1.0-0-dbg
设置环境变量:
export GST_INCLUDE_DIRS=/usr/include/gstreamer-1.0
echo $GST_PLUGIN_PATH
export GST_PLUGIN_PATH=/usr/local/lib:/usr/lib/x86_64-linux-gnu/gstreamer-1.0
vscode编译配置:
ctrl+shift+P
打开Command Palette,选择C/C++ 编辑配置 (C/Cpp: Edit configurations)...
生成c_cpp_properties.json:c_cpp_properties.json
"includePath": [
"${workspaceFolder}/**",
"/usr/include/glib-2.0",
"/usr/lib/x86_64-linux-gnu/glib-2.0/include",
"/usr/include/gstreamer-1.0"
],
终端-配置任务(或者ctrl+shift+p - 运行任务 - 添加任务),选择GCC调试
tasks.json
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-I",
"/usr/include/glib-2.0",
"-I",
"/usr/lib/x86_64-linux-gnu/glib-2.0/include",
"-I",
"/usr/include/gstreamer-1.0",
"-L", "/usr/lib/x86_64-linux-gnu",
"-l", "gstreamer-1.0"
],
#include <gst/gst.h> #include <stdio.h> int main (int argc,char *argv[]) { const gchar *nano_str; guint major, minor, micro, nano; gst_init (&argc, &argv); gst_version (&major, &minor, µ, &nano); if (nano == 1) nano_str = "(CVS)"; else if (nano == 2) nano_str = "(Prerelease)"; else nano_str = ""; printf ("This program is linked against GStreamer %d.%d.%d %s\n", major, minor, micro, nano_str); return 0; }
gst-launch-1.0 v4l2src ! xvimagesink
gst-launch-1.0 v4l2src ! video/x-raw-yuv,width=320,height=240,framerate=20/1 ! xvimagesink
gst-launch-1.0 videotestsrc ! ximagesink
gst-launch-1.0 v4l2src ! video/x-raw-yuv,format=YUY2,width=640,height=480,framerate=15/1 ! videorate ! videoscale ! xvimagesink
gst-launch-1.0 -v filesrc location="/t3" blocksize=57344 ! video/x-raw-rgb,bpp=32,depth=32,width=128,height=112,framerate=25/1,endianness=4321
sudo apt-get install guvcview
guvcview -d /dev/video