gstreamer介紹及使用


一、gstreamer介紹

參考鏈接:https://max.book118.com/html/2019/0302/8137062125002010.shtm

      https://www.cnblogs.com/luckbird/p/GStreamer_Demo.html

     https://www.cnblogs.com/xleng/p/10948838.html

Gstreamer是一個支持Windows,Linux,Android, iOS的跨平台的多媒體框架,應用程序可以通過管道(Pipeline)的方式,將多媒體處理的各個步驟串聯起來,達到預期的效果。每個步驟通過元素(Element)基於GObject對象系統通過插件(plugins)的方式實現,方便了各項功能的擴展。

二、gstreamer安裝

ubuntu下gstreamer安裝命令為:

sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

這個命令主要是安裝gstreamer的各種插件包,這些包中包含了很多插件,如gstreamer1.0-plugins-base是基礎插件包,gstreamer1.0-plugins-good是高質量的采用LGPL授權的插件包。通過gst-inspect-1.0命令看一下qtdemux插件的信息,如下所示:

紅框中顯示qtdemux的的插件屬於gstreamer1.0-plugins-good插件包

 

 

三、gstreamer命令

3.1 gst-inspect-1.0 查看插件信息命令

gst-inspect-1.0 qtdemux 查看qtdemux插件的信息,如下所示:

3.2 gst-launch-1.0 構建管道

播放mp4文件命令:

gst-launch-1.0 filesrc location=1.mp4 ! qtdemux ! decodebin ! videoconvert ! autovideosink

播放mp4流程為:讀入mp4文件->解mp4封裝->解碼->視頻轉換->播放,命令中的filesrc 、qtdemux、 decodebin 、videoconvert 、 autovideosink插件分別對應這四個步驟,構建的管道如下圖所示:

 

 

產生一個指定寬高的視頻

gst-launch-1.0 videotestsrc ! video/x-raw,width=500,height=300 ! autovideosink

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM