gstreamer官网

https://gstreamer.freedesktop.org/

应用手册

https://gstreamer.freedesktop.org/documentation/index.html

一、getreamer安装(ubuntu)

gstreamer0.10和gstreamer1.0两个版本容易混淆

sudo add-apt-repository ppa:mc3man/trusty-media

sudo apt-get update

sudo apt-get install build-essential dpkg-dev flex bison autotools-dev automake liborc-dev autopoint libtool gtk-doc-tools libgstreamer1.0-dev

sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev
gstreamer0.10-tools gstreamer0.10-plugins-base
libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good
gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad
gstreamer0.10-ffmpeg

sudo apt-get install libgstreamer0.10-dev gstreamer-tools gstreamer0.10-tools gstreamer0.10-doc

sudo apt-get install gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse

若有需要还可以再安装如下gst插件:
gstreamer0.10-tools
gstreamer0.10-x
gstreamer0.10-plugins-base
gstreamer0.10-plugins-good
gstreamer0.10-plugins-ugly
gstreamer0.10-plugins-bad
gstreamer0.10-ffmpeg
gstreamer0.10-alsa
gstreamer0.10-schroedinger
gstreamer0.10-pulseaudio

有可能需要安装的软件:
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install zlib1g
mad解码插件
apt-get install libmad0-dev
apt-get install gstreamer0.10-plugins-ugly

安装音频库

sudo apt-get install gstreamer1.0-alsa

安装ffmpeg多媒体库

gst-ffmpeg
--enable-liba52       enable GPLed liba52 support [default=no]
--enable-liba52bin    open liba52.so.0 at runtime [default=no]
--enable-libamr-nb    enable libamr-nb floating point audio codec
--enable-libamr-wb    enable libamr-wb floating point audio codec
--enable-libfaac      enable FAAC support via libfaac [default=no]
--enable-libfaad      enable FAAD support via libfaad [default=no]
--enable-libfaadbin   open libfaad.so.0 at runtime [default=no]
--enable-libgsm       enable GSM support via libgsm [default=no]
--enable-libmp3lame   enable MP3 encoding via libmp3lame
--enable-libvorbis    enable Vorbis encoding via libvorbis,
                     native implementation exists [default=no]
--enable-libx264      enable H.264 encoding via x264 [default=no]
--enable-libxvid      enable Xvid encoding via xvidcore,
                      native MPEG-4/Xvid encoder exists [default=no]

插件太多了,几百上千个

List of Elements and Plugins

https://gstreamer.freedesktop.org/documentation/plugins.html

一劳永逸

sudo apt-get install gstreamer-plugins-*

sudo apt-get install gstreamer-*

二、 千里之行,始于"hello,world"

Tutorials

Basic tutorials

Basic tutorial 1: Hello world!

Basic tutorial 2: GStreamer concepts

Basic tutorial 3: Dynamic pipelines

Basic tutorial 4: Time management

Basic tutorial 5: GUI toolkit integration

Basic tutorial 6: Media formats and Pad Capabilities

Basic tutorial 7: Multithreading and Pad Availability

Basic tutorial 8: Short-cutting the pipeline

Basic tutorial 9: Media information gathering

Basic tutorial 10: GStreamer tools

Basic tutorial 11: Debugging tools

Basic tutorial 12: Streaming

Basic tutorial 13: Playback speed

Basic tutorial 14: Handy elements

Basic tutorial 16: Platform-specific elements

除了这16个入门samples,后面的pipelines Command line tools 和 Plugin 插件开发也是多媒体类应用极好的教材

官网才是最应该多关注的地方


https://gstreamer.freedesktop.org/documentation/tutorials/basic/hello-world.html

wiki手册也非常全面,几乎所有应用方向都说明

http://wiki.oz9aec.net/index.php?title=Gstreamer_cheat_sheet

IBM社区gstreamer教程

https://www.ibm.com/developerworks/cn/linux/l-gstreamer/

三、 gstreamer 进阶...

1、播放视频文件

以MP4格式为例,其它格式可以 通过gst-inspect-1.0 |  grep  查找对应的demux,decode,sink等插件,当然也可以使用auto开头的插件,或者playbin会自动选择播放,只是没有自己指定那么灵活,方便调试和验证一些功能。

1)硬解(vaapi)播放MP4文件:

gst-launch-1.0 filesrc location=FilePath/test.mp4 ! qtdemux ! vaapidecode ! vaapisink

2) 软解,只要将解码器vaapidecode换成avdec_h264,播放器vaapisink换成 ximagesink即可

2、播放RTSP视频流

1) 硬解。

gst-launch-1.0 rtspsrc location=rtsp://username:passwd@ipaddr:port  latency=0 ! rtph264depay  !  capsfilter caps="video/x-h264"  ! h264parse  ! vaapidecode  !  vaapipostproc  width=800 height=600  !  vaapisink sync=false

2)软解。

gst-launch-1.0 rtspsrc location=rtsp://username:passwd@ipaddr:port  latency=0 ! rtph264depay ! capsfilter caps="video/x-h264" ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=800,height=600 ! ximagesink

3、 播放Udp视频流

Udp播放需要根据发送端数据源封装格式来决定采用哪些Gstreamer插件,如果进行了RTP封装,则需要先用rtph264depay进行解包,如果包含自定义帧头的情况,应该编程对帧头进行处理,不然会显示异常,比如部分花屏现象,以下是对裸流进行播放。

1)硬解

gst-launch-1.0 udpsrc port=2101 ! h264parse ! vaapidecode ! vaapisink

2)软解

gst-launch-1.0  udpsrc port=2101 ! h264parse ! avdec_h264 !  autovideosink

参考https://blog.csdn.net/manjiao4651538/article/details/80227966

4、gstreamer rtsp推流/拉流

1)gstreamer rtsp拉流播放

https://blog.csdn.net/yang_quan_yang/article/details/78846134

2)gstereamer rtsp推流

https://blog.csdn.net/zhuwei622/article/details/80348916

3) On the Raspberry:

 $ gst-launch-1.0 rtspsrc location=rtsp://192.168.2.112:8080/stream.sdp ! rtph264depay ! h264parse ! omxh264dec ! autovideosink

5、rtpbin Network/RTP

send

Encode and payload H263 video captured from a v4l2src. Encode and payload AMR audio generated from audiotestsrc. The video is sent to session 0 in rtpbin and the audio is sent to session 1. Video packets are sent on UDP port 5000 and audio packets on port 5002. The video RTCP packets for session 0 are sent on port 5001 and the audio RTCP packets for session 0 are sent on port 5003. RTCP packets for session 0 are received on port 5005 and RTCP for session 1 is received on port 5007. Since RTCP packets from the sender should be sent as soon as possible and do not participate in preroll, sync=false and async=false is configured on udpsink

gst-launch-1.0 rtpbin name=rtpbin \
v4l2src ! videoconvert ! ffenc_h263 ! rtph263ppay ! rtpbin.send_rtp_sink_0 \
rtpbin.send_rtp_src_0 ! udpsink port= \
rtpbin.send_rtcp_src_0 ! udpsink port= sync=false async=false \
udpsrc port= ! rtpbin.recv_rtcp_sink_0 \
audiotestsrc ! amrnbenc ! rtpamrpay ! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink port= \
rtpbin.send_rtcp_src_1 ! udpsink port= sync=false async=false \
udpsrc port= ! rtpbin.recv_rtcp_sink_1

recv

Receive H263 on port 5000, send it through rtpbin in session 0, depayload, decode and display the video. Receive AMR on port 5002, send it through rtpbin in session 1, depayload, decode and play the audio. Receive server RTCP packets for session 0 on port 5001 and RTCP packets for session 1 on port 5003. These packets will be used for session management and synchronisation. Send RTCP reports for session 0 on port 5005 and RTCP reports for session 1 on port 5007.

gst-launch-1.0 -v rtpbin name=rtpbin                                          \
udpsrc caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H263-1998" \
port= ! rtpbin.recv_rtp_sink_0 \
rtpbin. ! rtph263pdepay ! ffdec_h263 ! xvimagesink \
udpsrc port= ! rtpbin.recv_rtcp_sink_0 \
rtpbin.send_rtcp_src_0 ! udpsink port= sync=false async=false \
udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)AMR,encoding-params=(string)1,octet-align=(string)1" \
port= ! rtpbin.recv_rtp_sink_1 \
rtpbin. ! rtpamrdepay ! amrnbdec ! alsasink \
udpsrc port= ! rtpbin.recv_rtcp_sink_1 \
rtpbin.send_rtcp_src_1 ! udpsink port= sync=false async=false

参考:

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtpbin.html

GStreamer RTP Streaming

https://community.nxp.com/docs/DOC-94646

6、录音

录音:

gst-launch -e pulsesrc ! audioconvert ! lamemp3enc target= bitrate= cbr=true ! filesink location=audio.mp3

gst-launch -e pulsesrc device="alsa_input.pci-0000_02_02.0.analog-stereo" ! audioconvert ! \
lamemp3enc target= bitrate= cbr=true ! filesink location=audio.mp3

播放录音:

gst-launch-1.0 filesrc location=audio.mp3 ! decodebin ! audioconvert ! audioresample ! autoaudiosink

还是上面的wiki

http://wiki.oz9aec.net/index.php?title=Gstreamer_cheat_sheet

7、录视频

命令:gst-launch-1.0 -e rtspsrc location=rtsp://admin:admin@192.168.1.2 ! rtph264depay ! "video/x-h264, stream-format=byte-stream" ! filesink location=test.264

说明:主要是用gst-lanuch工具连接相关插件将rtsp video stream 保存为.264文件,然后可以利用相关播放器(如:kmpplayer)进行播放,亦可以供live555MediaServer生成rtsp stream;("video/x-h264, stream-format=byte-stream"这个caps一定要连接才行)
原文:https://blog.csdn.net/u010005508/article/details/52710302

8、视频收发(监控,预览)

send:

gst-launch v4l2src ! video/x-raw-yuv,width=128,height=96,format='(fourcc)'UYVY ! ffmpegcolorspace ! ffenc_h263 ! video/x-h263 ! rtph263ppay pt=96 ! udpsink host=127.0.0.1 port=5000 sync=false

recv:
gst-launch  udpsrc  port=5000 ! application/x-rtp, clock-rate=90000,payload=96 ! rtph263pdepay queue-delay=0 ! ffdec_h263 ! xvimagesink

以Freescale平台为例,实时码流收发命令行如下:

Server侧(发送方):

gst-launch -v videotestsrc ! video/x-raw-yuv,width=640,height=480 ! vpuenc codec=avc ! rtph264pay pt=96 ! udpsink host=127.0.0.1 port=1234

Client侧(接收方):

gst-launch -vvv udpsrc port=1234 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! rtph264depay ! vpudec ! mfw_isink

9、音频收发(语音对讲)

模拟声音数据

1)send.sh

gst-launch-1.0 rtpbin name=rtpbin \
audiotestsrc ! amrnbenc ! rtpamrpay ! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink port= \
rtpbin.send_rtcp_src_1 ! udpsink port= sync=false async=false \
udpsrc port= ! rtpbin.recv_rtcp_sink_1

2)recv.sh

gst-launch-1.0 -v rtpbin name=rtpbin                                          \
udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)AMR,encoding-params=(string)1,octet-align=(string)1" \
port= ! rtpbin.recv_rtp_sink_1 \
rtpbin. ! rtpamrdepay ! amrnbdec ! alsasink \
udpsrc port= ! rtpbin.recv_rtcp_sink_1 \
rtpbin.send_rtcp_src_1 ! udpsink port= sync=false async=false

真实声卡

1) send.sh

gst-launch-1.0 rtpbin name=rtpbin \
pulsesrc ! amrnbenc ! rtpamrpay ! rtpbin.send_rtp_sink_1 \
rtpbin.send_rtp_src_1 ! udpsink port= \
rtpbin.send_rtcp_src_1 ! udpsink port= sync=false async=false \
udpsrc port= ! rtpbin.recv_rtcp_sink_1

2) recv.sh

gst-launch-1.0 -v rtpbin name=rtpbin                                          \
udpsrc caps="application/x-rtp,media=(string)audio,clock-rate=(int)8000,encoding-name=(string)AMR,encoding-params=(string)1,octet-align=(string)1" \
port= ! rtpbin.recv_rtp_sink_1 \
rtpbin. ! rtpamrdepay ! amrnbdec ! alsasink \
udpsrc port= ! rtpbin.recv_rtcp_sink_1 \
rtpbin.send_rtcp_src_1 ! udpsink port= sync=false async=false

模拟声音和实际声卡只有发送端采集程序不同,模拟采集是audiotestsrc,实际声卡采集是pulsesrc

中国移动和对讲amr实时语音解码播放

gst-launch-1.0 udpsrc port= caps="application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)AMR, payload=(int)106" ! rtpamrdepay ! decodebin name=decoder ! queue ! audioconvert ! autoaudiosink

tcpdump -i eth0 -w dump.pcap

gstreamer中通过UDP(RTP)远程播放MP3

send.sh

gst-launch-1.0 -v filesrc location = Hopy_Always.mp3 ! decodebin ! audioconvert ! rtpL16pay ! udpsink host=127.0.0.1 port=6000

recv.sh

gst-launch-1.0 udpsrc port=6000 caps='application/x-rtp, media=(string)audio, clock-rate=(int)44100, channels=(int)2' ! rtpjitterbuffer latency=400 ! rtpL16depay ! pulsesink

Gstreamer 测试udpsink udpsrc播放mp3文件

https://blog.csdn.net/zhujinghao_09/article/details/8513962

10、gstreamer 播放mp3源码(播放器) ,入门开发极好的samples

https://blog.csdn.net/fireroll/article/details/49126827

https://www.cnblogs.com/274914765qq/p/5090299.html

11、Gstreamer的音视频同步

https://blog.csdn.net/maeom/article/details/7729840

12、播放音频

gst-launch-1.0 playbin uri=file:///home/dong/Hopy_Always.mp3
gst-launch-1.0 filesrc location=Hopy_Always.mp3 ! decodebin ! audioconvert ! audioresample ! autoaudiosink

13、Gstreamer视频传输测试gst-launch

https://blog.csdn.net/meng_tianshi/article/details/80142005

14、How to listen to the pulseaudio RTP Stream and play

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Network/RTP/

15、Gstreamer cheat sheet —— Picture in Picture / Video Wall / Text Overlay / Time Overlay ... ... ..

http://wiki.oz9aec.net/index.php?title=Gstreamer_cheat_sheet

16、用树莓派做 RTMP 流直播服务器,可推送至斗鱼直播

http://shumeipai.nxez.com/2017/11/01/build-rtmp-stream-live-server-with-raspberry-pi.html

17、gstreamer学习笔记:通过gst-launch工具抓取播放的音频数据并通过upd传输

gst-launch数据转换(pcm,aac,ts), rtp收发

https://blog.csdn.net/u010312436/article/details/53335579

18、gstreamer实现摄像头的远程采集,udp传输,本地显示和保存为AVI文件 发送端

send

https://blog.csdn.net/zhujinghao_09/article/details/8528802

recv

https://blog.csdn.net/zhujinghao_09/article/details/8528879

19、QtGStreamer dvr

https://blog.csdn.net/lg1259156776/article/details/53413877

https://blog.csdn.net/xueyeguiren8/article/details/54581536

20、基于Gstreamer的实时视频流的分发

https://blog.csdn.net/sdjhs/article/details/51444934

21、gstreamer学习笔记:将音视频合成MPEG2-TS流并打包通过rtp传输

https://blog.csdn.net/u010312436/article/details/53668083

22、gstreamer之RTSP Server一个进程提供多路不同视频

https://blog.csdn.net/quantum7/article/details/82999132

23、GStreamer资料整理(包括摄像头采集,视频保存,远程监控,流媒体RTP传输)

https://blog.csdn.net/wzwxiaozheng/article/details/6099397

24、使用GStreamer作v4l2摄像头采集和输出到YUV文件及屏幕的相关测试

https://blog.csdn.net/shallon_luo/article/details/5400708

25、Gstreamer中添加x265编解码器

https://blog.csdn.net/songwater/article/details/34855883

26、Gstreamer One Liners

https://metalab.at/wiki/Gstreamer_One_Liners

ARM平台基于嵌入式Linux Gstreamer 使用

https://www.eefocus.com/toradex/blog/16-05/379143_e4fcb.html

常见gstreamer pipeline 命令—— TI 3730 dvsdk

https://blog.csdn.net/songwater/article/details/34800017

gstreamer中的好东西,appsink和appsrc

https://blog.csdn.net/jack0106/article/details/5909935

基于DM3730平台的gstreamer音视频传输调试

https://blog.csdn.net/goalietech/article/details/24887955

gstreamer appsrc appsink应用

gstreamer向appsrc发送帧画面的代码

https://blog.csdn.net/quantum7/article/details/82226608

gstreamer向appsrc发送编码数据的代码

https://blog.csdn.net/quantum7/article/details/82250524

gstreamer学习笔记:分享几个appsink和appsrc的example

https://blog.csdn.net/u010312436/article/details/53610599

Here are two basic send/receive  h264 video stream pipelines:

gst-launch-0.10 v4l2src ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv,width=640,height=480 ! vpuenc ! h264parse ! rtph264pay ! udpsink host=localhost port=5555

gst-launch-0.10 udpsrc port=5555 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! ffdec_h264 ! videoconvert ! ximagesink

gstreamer使用进阶

https://blog.csdn.net/jack0106/article/details/5592557

# 整理了这么多,梳理一下指令,组织一下模块代码,应付常规的多媒体应用绰绰有余了!

gstreamer应用笔记的更多相关文章

  1. openwrt gstreamer实例学习笔记(七. gstreamer 缓冲区(Buffers)和事件(Events))

    1)概述 管道的数据流由一组缓冲区和事件组成,缓冲区包括实际的管道数据,事件包括控制信息,如寻找信息和流的终止信号.所有这些数据流在运行的时候自动的流过管道. 2) 缓冲区(Buffers) 缓冲区包 ...

  2. openwrt gstreamer实例学习笔记(六. gstreamer Pads及其功能)

    一:概述 如我们在Elements一章中看到的那样,Pads是element对外的接口.数据流从一个element的source pad到另一个element的sink pad.pads的功能(cap ...

  3. openwrt gstreamer实例学习笔记(五. gstreamer BUS)

    1)概述 BUS(总线) 是一个简单的系统,它采用自己的线程机制将一个管道线程的消息分发到一个应用程序当中.总线的优势是:当使用GStreamer的时候,应用程序不需要线程识别,即便GStreamer ...

  4. openwrt gstreamer实例学习笔记(四. gstreamer Bins)

    1)概述 Bins是一种容器element.你可以往Bins中添加element.由于Bins本身也是一种element,所以你可以像普通element一样 操作Bins.因此,先前关element的 ...

  5. openwrt gstreamer实例学习笔记(三.深入了解gstreamer 的 Element)

    在前面的部分,我们简要介绍过 GstElementFactory 可以用来创建一个element的实例,但是GstElementFactory不仅仅只能做这件事,GstElementFactory作为 ...

  6. openwrt gstreamer实例学习笔记(二.gstreamer 的 Element)

    对程序员来说,GStreamer 中最重要的一个概念就是 GstElement 对象.该对象是构建一个媒体管道的基本块.所有上层(high-level)部件都源自GstElement对象.任何一个解码 ...

  7. openwrt gstreamer实例学习笔记(一.初始化gstreamer)

    GStreamer 是一个非常强大而且通用的流媒体应用程序框架. GStreamer所具备的很多优点来源于其框架的模块化: GStreamer能够无缝的合并新的插件. 但是, 由于追求模块化和高效率, ...

  8. Gstreamer学习

    Gstreamer学习笔记----Gstreamer架构设计思想 http://blog.csdn.net/tx3344/article/details/7497434 Gstreamer到底是个啥? ...

  9. 【miscellaneous】 GStreamer应用开发手册学习笔记之基础概念介绍

    第3章. 基础概念介绍 本章将介绍GStreamer的基本概念. 理解这些概念对于你后续的学习非常重要,因为后续深入的讲解我们都假定你已经完全理解了这些概念. 3.1. 元件(Elements) 元件 ...

随机推荐

  1. string 线程安全

    线程安全:class Program { public delegate void MyDelegate(string aa); static void Main(string[] args) { M ...

  2. SVN常用命令与分支操作

    1.基本操作 1.0 创建版本库: Svnadmin create /data/repos 2.0 修改配置文件 Auth文件   [groups]   admin=shguo   [/]   @ad ...

  3. 连接oracle服务器超慢--原因分析

    连接oracle服务器超慢:有如下原因可能会影响. 网络不好:oracle服务器跟本地网络不好. oracle服务器内存不足:导致反应超慢 监听日志listener.log太大:导致响应超慢. 所以对 ...

  4. Qt监控后台服务运行状态

    mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QMa ...

  5. 通过Nagios监控weblogic服务

    1.前言      前段时间搭建了一套Nagios监控服务,心血来潮想自己写一个脚本,拓展Nagios插件来监控公司的weblogic服务. 环境:weblogic10.3.3.0 . CentOS6 ...

  6. php学习九:存取器&魔术方法

    当声明属性的时候用到了private,那么的话只能本类中才能访问此属性,其他地方无法使用,这个时候需要给外界提供一些方法来使外界访问 方法一:存取器: 可以提供一个public的方法来使外界对类里面的 ...

  7. iOS设计模式之类族(class cluster)

    类族模式在UIKit(user interface framework)使用的范围已经远远超过我们的想象,比如,UIButton,NSArray,NSString,NSNumber等, 例如NSNum ...

  8. poj_3987 Trie图

    题目大意 有N个病毒,病毒由A-Z字母构成,N个病毒各不相同.给出一段程序P,由A-Z字母构成,若病毒在在程序P或者P的逆转字符串P'中存在,则该程序P被该病毒感染.求出程序P被多少种病毒感染. 题目 ...

  9. MQTT的学习研究(二)moquette-mqtt 的使用之mqtt broker的启动

    在MQTT 官网 (http://mqtt.org/software)中有众多MQTT的实现方式.具体参看官网,Moquette是基于Apache Mina 的模型的一个Java MQTT broke ...

  10. Servlet 工程 web.xml 中的 servlet 和 servlet-mapping 标签 《转载》

    摘录某个工程的 web.xml 文件片段: 访问顺序为1—>2—>3—>4,其中2和3的值必须相同. url-pattern 标签中的值是要在浏览器地址栏中输入的 url,可以自己命 ...