安装gstreamer开发环境
ubuntu中安装gstreamer开发环境:
* 安装gstreamer基本库,工具,以及插件
sudo apt-get install libgstreamer0.-dev gstreamer-tools gstreamer0.-tools gstreamer0.-doc
sudo apt-get install gstreamer0.-plugins-base gstreamer0.-plugins-good gstreamer0.-plugins-ugly gstreamer0.-plugins-bad gstreamer0.-plugins-bad-multiverse
* 安装ffmpeg支持
sudo apt-get install gstreamer0.-ffmpeg
* 测试
gst-launch autovideosrc ! ffmpegcolorspace ! autovideosink
或
gst-launch v4l2src ! ffmpegcolorspace ! autovideosink
* 录制摄像头视频
以上内容转自 http://foyo99.zhuidaniu.com/blogs/724
1,设置环境变量
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/lib
2,安装mad插件
下载libmad-0.15.1b.tar.gz
http://sourceforge.net/project/showfiles.php?group_id=12349
./configure --prefix=/usr/local/
make
make install
下载libid3tag-0.15.1b.tar.gz
http://sourceforge.net/project/showfiles.php?group_id=12349
./configure --prefix=/usr/local/
make
make install
下载gst-plugins-ugly-0.10.9.tar.bz2 2008.8.26
http://gstreamer.freedesktop.org/src/
./configure
make
make install
这样,在/usr/local/lib/gstreamer-0.10目录下就出现了
libgstmad.a libgstmad.la libgstmad.so
mad插件也就安装成功了!
检测mad插件是否安装上的命令
gst-inspect mad
会显示已安装的mad插件的详细信息
3,用gst-launch测试播放mp3
gst-launch filesrc location="beyond.mp3" ! mad ! audioconvert ! alsasink
可以听到音乐了。
4,用mp3_dec.c文件测试
----------------
#include <gst/gst.h>
int
main(int argc,char *argv[])
{
GstElement *pipeline,*filesrc,*decoder,*convert,*audiosink;
gst_init(&argc,&argv);
if(argc != 2){
g_print("usage: %s <mp3 filename>\n",argv[0]);
exit(-1);
}
pipeline=gst_pipeline_new("pipeline");
if(!pipeline)
{
g_print("Maybe pipeline cann't be created!\n");
exit(-1);
}
filesrc=gst_element_factory_make("filesrc","disk_source");
if(!filesrc)
{
g_print("Maybe filesrc cann't be created!\n");
exit(-1);
}
g_object_set(G_OBJECT(filesrc),"location",argv[1],NULL);
decoder=gst_element_factory_make("mad","decoder-audio");
if(!decoder)
{
g_print("Maybe decoder cann't be created!\n");
exit(-1);
}
convert = gst_element_factory_make("audioconvert", "a-convert");
if(! convert)
{
g_print("Maybe convert cann't be created!\n");
exit(-1);
}
audiosink=gst_element_factory_make("osssink","play_audio");
if(! audiosink)
{
g_print("Maybe audiosink cann't be created!\n");
exit(-1);
}
gst_bin_add_many(GST_BIN(pipeline),filesrc,decoder,convert,audiosink,NULL);
gst_element_link_many(filesrc,decoder,convert,audiosink,NULL);
gst_element_set_state(pipeline,GST_STATE_PLAYING);
while(gst_bin_iterate_recurse(GST_BIN(pipeline)));
gst_element_set_state(pipeline,GST_STATE_NULL);
gst_object_unref(GST_OBJECT(pipeline));
exit(0);
}
----------------
编译命令
gcc -Wall $(pkg-config --cflags --libs gstreamer-0.10)mp3_dec.c -o mp3_dec
生成可执行文件
mp3_dec
播放mp3
./mp3_dec beyond.mp3
就可以听到音乐了!
note:
Element为null,说明没安装mad插件,可以通过
安装gstreamer开发环境的更多相关文章
- 【转】一步一步教你在Ubuntu12.04搭建gstreamer开发环境
原文网址:http://blog.csdn.net/xsl1990/article/details/8333062 闲得蛋疼 无聊寂寞冷 随便写写弄弄 看到网上蛮多搭建gstreamer开 ...
- Linux安装LAMP开发环境及配置文件管理
Linux主要分为两大系发行版,分别是RedHat和Debian,lamp环境的安装和配置也会有所不同,所以分别以CentOS 7.1和Ubuntu 14.04做为主机(L) Linux下安装软件,最 ...
- win使用MSYS2安装Qt开发环境
原文链接 MSYS2 下载地址: pacman的具体用法 有pacman的具体使用方法.我们首先对系统升级 我们首先对系统升级 pacman -Syu 就会检测整个系统可以升级的组件,并自动下载安装, ...
- Appium移动自动化测试(二)--安装Android开发环境
继续Appium环境的搭建. 第二节 安装Android开发环境 如果你的环境是MAC那么可以直接跳过这一节.就像我们在用Selenium进行web自动化测试的时候一样,我们需要一个浏览器来执行测试 ...
- Appium移动自动化测试(二)--安装Android开发环境(转)
Appium移动自动化测试(二)--安装Android开发环境 2015-06-04 17:30 by 虫师, 35299 阅读, 23 评论, 收藏, 编辑 继续Appium环境的搭建. 第二节 ...
- 如何用docker安装laravel开发环境
如何用docker安装laravel开发环境 看laravel框架的官方文档安装部分时,发现需要安装特别多软件,估计还有许多复杂的配置,官方推荐使用Laravel Homestead虚拟机进行安装,但 ...
- [树莓派(raspberry pi)] 02、PI3安装openCV开发环境做图像识别(详细版)
前言 上一篇我们讲了在linux环境下给树莓派安装系统及入门各种资料 ,今天我们更进一步,尝试在PI3上安装openCV开发环境. 博主在做的过程中主要参考一个国外小哥的文章(见最后链接1),不过其教 ...
- 一键安装Android开发环境
一键安装Android开发环境 1 下载tadp-3.0r4-linux-x64.run 进入下面的地址下载: https://developer.nvidia.com/gameworksdownlo ...
- 阿里云学生服务器搭建网站-Ubuntu16.04安装php开发环境
阿里云学生服务器搭建网站(2)-Ubuntu16.04安装php开发环境 优秀博文:https://www.linuxidc.com/Linux/2016-10/136327.htm https:/ ...
随机推荐
- openGl 基础
最近由于手机项目中需要用到OpenGL ES的知识,所以这段时间正在研究OpenGL的相关知识.因为OpenGL ES是OpenGL的剪裁版本,所以我直接从OpenGL入手,然后再去看OpenGL E ...
- Openshift中Configmap的使用
先基于外部镜像构建一个deployment ericdeMacBook-Pro:nginx ericnie$ oc --allow-missing-images --name=nginx-demo - ...
- ylbtech-LanguageSamples-Nullable(可以为 null 的类型)
ylbtech-Microsoft-CSharpSamples:ylbtech-LanguageSamples-Nullable(可以为 null 的类型) 1.A,示例(Sample) 返回顶部 “ ...
- delphi 自定义内存管理
1.主要通过GetMemoryManager来hook原来的内存管理. 2.通过SetMemoryManager来设置你自己的新的内存管理,可以用一个内存池来优化和管理程序的内存调用情况. proce ...
- libev客户端
#include <ev.h> #include <stdio.h> #include <netinet/in.h> #include <stdlib.h&g ...
- 流畅的python第九章符合Python风格的对象学习记录
对象表示形式 每门面向对象的语言至少都有一种获取对象的字符串表示形式的标准方式.Python提供了两种方式 repr()便于开发者理解的方式返回对象的字符串表示形式 str()便于用户理解的方式返回对 ...
- vue项目如何实现剪切板功能--vue-clipboard2
一.vue项目利用vue-clipboard2实现剪切板的功能 1.安装vue-clipboard2插件:cnpm install --save vue-clipboard2 2.main.js添加 ...
- android带有文字的图片按钮的两种实现方式
android带有文字的图片按钮的两种实现方式 1). TextView对Button用相对布局,这要要求按钮的背景图片要留下空白位置给文字.这种方式开发比较简单,适合做一些风格一致的Button. ...
- Discuz常见小问题2-如何在新建的页面上只显示一部分板块
切换到论坛-版块管理,记住要只显示的板块的gid(比如我的是36) 为某个主导航设置一个单独的php页面(名字自己取) 如果这个页面内容跟首页forum.php完全一样,只是第三行增加了一句话 ...
- 网页制作,网站制作中put和get的区别
Http定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,POST,PUT,DELETE.URL全称是资源描述符,我们可以这样认为:一个URL地址,它用于描述一个网络上的资源,而HTTP ...