Gstreamer学习流水账

Gstreamer是Linux上的一套多媒体框架,集采集,编码,解码,渲染,滤镜等功能一条龙的媒体解决方案,它的调度能力和扩展能力非常出色,被广泛应用在各种多媒体方案上 ,这里总结一些学习记录和心得,采用编年体,比较自由,到最后肯定会是一篇流水账。

1.查看系统安装了哪些插件

czl@czl-VirtualBox:~/WorkSpace$ gst-inspect-1.0 |grep -i videosink
inter:  intervideosink: Internal video sink
autodetect:  autovideosink: Auto video sink
decklink:  decklinkvideosink: Decklink Video Sink
debugutilsbad:  fpsdisplaysink: Measure and show framerate on videosink
debugutilsbad:  fakevideosink: Fake Video Sink
cluttergst3:  clutterautovideosink: Generic bin

czl@czl-VirtualBox:~/WorkSpace$ gst-inspect-1.0 |grep -i v4l
video4linux2:  v4l2src: Video (video4linux2) Source
video4linux2:  v4l2sink: Video (video4linux2) Sink
video4linux2:  v4l2radio: Radio (video4linux2) Tuner
video4linux2:  v4l2deviceprovider (GstDeviceProviderFactory)
czl@czl-VirtualBox:~/WorkSpace$ 

caozilong@caozilong-Vostro-3268:~/Workspace/camera$ v4l2-ctl --list-devices
Integrated Camera: Integrated C (usb-0000:00:14.0-2):
	/dev/video0
	/dev/video1

caozilong@caozilong-Vostro-3268:~/Workspace/camera$ 

V4L2 plugin注册:

gstv4l2videodec.c启动解码任务:

最终是调用gst-base包中的gst_video_decoder_xxx plugin进行解码的。

V4L2设备打开:


2.videoconvert组件的作用,当不加入videoconvert组件时,以下两个命令会出错:

gst-launch-1.0 filesrc location=./test.mp4  ! decodebin  ! ximagesink
gst-launch-1.0 filesrc location=./test.mp4  ! decodebin  ! xvimagesink
czl@czl-VirtualBox:~/WorkSpace/ffserver$ gst-launch-1.0 filesrc location=./test.mp4  ! decodebin  ! ximagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: Internal data stream error.
Additional debug info:
qtdemux.c(6073): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
czl@czl-VirtualBox:~/WorkSpace/ffserver$ gst-launch-1.0 filesrc location=./test.mp4  ! decodebin  ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0: Internal data stream error.
Additional debug info:
qtdemux.c(6073): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
czl@czl-VirtualBox:~/WorkSpace/ffserver$ 

但是,加入videoconvert后,命令正确执行:

gst-launch-1.0 filesrc location=./test.mp4  ! decodebin ! videoconvert ! ximagesink
gst-launch-1.0 filesrc location=./test.mp4  ! decodebin ! videoconvert ! xvimagesink

3.gst audio sink test

gst-launch-1.0 audiotestsrc ! pulsesink
czl@czl-RedmiBook-14:~$ gst-inspect-1.0 pulseaudio
Plugin Details:
  Name                     pulseaudio
  Description              PulseAudio plugin library
  Filename                 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstpulseaudio.so
  Version                  1.14.5
  License                  LGPL
  Source module            gst-plugins-good
  Source release date      2019-05-29
  Binary package           GStreamer Good Plugins (Ubuntu)
  Origin URL               https://launchpad.net/distros/ubuntu/+source/gst-plugins-good1.0

  pulsedeviceprovider: PulseAudio Device Provider
  pulsesrc: PulseAudio Audio Source
  pulsesink: PulseAudio Audio Sink

  3 features:
  +-- 2 elements
  +-- 1 device providers

czl@czl-RedmiBook-14:~$

结束! 

  • 7
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
GStreamer是一个流媒体处理的框架,用于在嵌入式系统和桌面环境中处理音频和视频数据。学习GStreamer可以帮助我们理解音视频流的处理、数据编码和解码、多媒体的播放和编辑等方面的知识。 要学习GStreamer,我们可以从以下几个方面入手: 1. 学习框架和架构:了解GStreamer的基本术语、组件和概念,例如Pipeline(管道)、Element(元素)、Pad(端口)等等。熟悉框架的架构可以帮助我们理解数据流的处理和转换。 2. 安装和配置:不同平台和操作系统的安装和配置方法可能略有不同。我们需要根据自己的需求选择合适的版本,然后按照相关文档进行安装和配置。 3. 编写和运行代码:GStreamer提供了C语言、Python等多种编程语言的接口和库。我们可以根据自己的熟悉程度选择合适的编程语言,并学习如何使用GStreamer的API来编写音视频处理的代码。可以通过构建和运行一些简单的示例程序来加深理解。 4. 测试和调试:GStreamer提供了一些工具和命令行选项来进行测试和调试。我们可以使用这些工具来验证和评估我们的代码的性能和正确性,以及识别和解决可能出现的问题。 5. 学习案例和文档:在学习的过程中,我们可以参考一些实际的案例和文档来了解GStreamer的使用方法和最佳实践。可以通过在线文档、论坛、博客等渠道找到一些有价值的资源。 总结来说,学习GStreamer需要一定的编程基础和对音视频处理的兴趣。通过深入学习和实践,我们可以逐步掌握GStreamer的核心概念和应用技巧,为开发和调试音视频处理的应用程序提供有力的支持。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

papaofdoudou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值