2021年8月5日 星期四

GStreamer 安裝與使用

Gstreamer 是開放原始碼多媒體開發框架. 先參考 GStreamer 基礎文件, 瞭解模組 (Plugins), 元件 (Element) 與接點 (Pads - source 與 sink).


本文簡單說明 Gstreamer 在 Jetson TK1 R21.2 Ubuntu 14.04 環境下安裝與 gst-* 工具使用.


<< 安裝 GStreamer >>


安裝 GStreamer 1.0 與 0.10 plugins, 函式庫, 工具.

~$ sudo apt-get install gstreamer1.0

~$ sudo apt-get install gstreamer0.10

~$ sudo apt-get install gstreamer-tools


<< 播放音訊檔 >>


使用 gst-play 工具.


~$ gst-play-1.0 http://www.kozco.com/tech/piano2-CoolEdit.mp3


<< 播放影像檔 >> 


使用 gst-launch 工具與 playbin2 元件並 "delay" 輸出 5 秒.


~$ gst-launch playbin2 uri=https://www.collabora.com/assets/images/core/gstreamer-logo.jpg delay=5000000000


使用 gst-launch 工具與 souphttpsrc, jpegdec, ffmpegcolorspace, ffmpegcolorspace, autovideosink 元件播放 JPEG 影像檔.


~$ gst-launch souphttpsrc location=https://www.collabora.com/assets/images/core/gstreamer-logo.jpg ! jpegdec ! ffmpegcolorspace ! imagefreeze ! autovideosink


<< 播放視訊檔 >> 


使用 gst-launch 工具與 playbin2 元件.


~$ gst-launch playbin2 uri=http://cdn.clipcanvas.com/sample/clipcanvas_14348_H264_640x360.mp4


<< 取得視訊檔資訊 >>


使用 gst-discoverer 工具.


~$ gst-discoverer-1.0 http://techslides.com/demos/sample-videos/small.mp4

Analyzing http://techslides.com/demos/sample-videos/small.mp4

Inside NvxLiteH264DecoderLowLatencyInitNvxLiteH264DecoderLowLatencyInit set DPB and MjstreamingNvMMLiteOpen : Block : BlockType = 261

TVMR: NvMMLiteTVMRDecBlockOpen: 4935: NvMMLiteBlockOpen

NvMMLiteBlockCreate : Block : BlockType = 261

TVMR: cbBeginSequence: 571: BeginSequence 560x320, bVPR = 0

TVMR: cbBeginSequence: 813: DecodeBuffers = 3

TVMR: cbBeginSequence: 833: Display Resolution : (560x320)

TVMR: cbBeginSequence: 834: Display Aspect Ratio : (560x320)

TVMR: cbBeginSequence: 996: SurfaceLayout = 3

TVMR: cbBeginSequence: 1026: NumOfSurfaces = 7, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1

Allocating new output: 560x320 (x 9), ThumbnailMode = 0

TVMR: cbDisplayPicture: 2290: Retunred NULL Frame Buffer

TVMR: TVMRFrameDelivery: 3673: Closing TVMR Frame Delivery Thread -------------

TVMR: NvMMDecTVMRDestroyParser: 4151: NvAvpClose

TVMR: NvMMLiteTVMRDecBlockClose: 5090: Done

Done discovering http://techslides.com/demos/sample-videos/small.mp4


Topology:

container: Quicktime

audio: MPEG-4 AAC

video: H.264


Properties:

Duration: 0:00:05.568000000

Seekable: yes

Tags:

datetime: 2010-03-20T21:29:11Z

encoder: HandBrake 0.9.4 2009112300

container format: ISO MP4/M4A

audio codec: MPEG-4 AAC audio

maximum bitrate: 91632

bitrate: 83051

language code: en

video codec: H.264 / AVC

minimum bitrate: 166560

<< 查詢所有已安裝模組與元件 >>


gst-inspect 指令列出所有元件, 利用 grep 找出 MP4 相關元件.


~$ gst-inspect-1.0 | grep MP4

libav: avdec_mp3on4: libav MP3onMP4 decoder

libav: avdec_mp3on4float: libav MP3onMP4 decoder

libav: avmux_ipod: libav iPod H.264 MP4 (MPEG-4 Part 14) muxer

libav: avmux_mp4: libav MP4 (MPEG-4 Part 14) muxer (not recommended, use mp4mux instead)

libav: avmux_psp: libav PSP MP4 (MPEG-4 Part 14) muxer

isomp4: mp4mux: MP4 Muxer


<< 顯示指定模組資訊與內含元件 >>


~$ gst-inspect-1.0 isomp4

Plugin Details:

Name isomp4

Description ISO base media file format support (mp4, 3gpp, qt, mj2)

Filename /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstisomp4.so

Version 1.2.4

License LGPL

Source module gst-plugins-good

Source release date 2014-04-18

Binary package GStreamer Good Plugins (Ubuntu)

Origin URL https://launchpad.net/distros/ubuntu/+source/gst-plugins-good1.0


qtdemux: QuickTime demuxer

rtpxqtdepay: RTP packet depayloader

qtmux: QuickTime Muxer

mp4mux: MP4 Muxer

ismlmux: ISML Muxer

3gppmux: 3GPP Muxer

mj2mux: MJ2 Muxer

qtmoovrecover: QT Moov Recover



* Gstreamer 官網 : http://gstreamer.freedesktop.org/

* Good 元件列表 : http://gstreamer.freedesktop.org/data/doc/gstreamer/1.0/gst-plugins-good-plugins/html

* Bad 元件列表 : http://gstreamer.freedesktop.org/data/doc/gstreamer/1.0/gst-plugins-bad-plugins/html

* Ugly 元件列表 : http://gstreamer.freedesktop.org/data/doc/gstreamer/1.0/gst-plugins-ugly-plugins/html

沒有留言:

張貼留言