48
40

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gstreamer備忘録

Last updated at Posted at 2017-09-14

個人的備忘録のため随時追記

動作はDebian GNU/Linux (amd64, stretch)で確認

エレメントの情報

gst-inspect-1.0でエレメント一覧が表示されるのでgrepでテキトウに探す。

$ gst-inspect-1.0 | grep 264
videoparsersbad:  h264parse: H.264 parser
uvch264:  uvch264src: UVC H264 Source
uvch264:  uvch264mjpgdemux: UVC H264 MJPG Demuxer
x264:  x264enc: x264enc
typefindfunctions: video/x-h264: h264, x264, 264
libav:  avmux_ipod: libav iPod H.264 MP4 (MPEG-4 Part 14) muxer
libav:  avdec_h264: libav H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 decoder
libav:  avenc_h264_omx: libav OpenMAX IL H.264 video encoder encoder
rtp:  rtph264pay: RTP H264 payloader
rtp:  rtph264depay: RTP H264 depayloader

詳しく見たい場合は

$ gst-inspect-1.0 x264enc
(長いので省略)

指定できるプロパティは、Element Propertiesに記載される

Element Properties:
  name                : The name of the object
                        flags: 読み込み可能, 書き込み可能
                        String. Default: "x264enc0"
  parent              : The parent of the object
                        flags: 読み込み可能, 書き込み可能
                        Object of type "GstObject"
(以下略)

受け取り可能なデータはPad Templates>SINK templateに、吐き出されるデータはPad Templates>SRC templateに記載される

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h264
              framerate: [ 0/1, 2147483647/1 ]
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
          stream-format: { (string)avc, (string)byte-stream }
              alignment: au
                profile: { (string)high-4:4:4, (string)high-4:2:2, (string)high-10, (string)high, (string)main, (string)baseline, (string)constrained-baseline, (string)high-4:4:4-intra, (string)high-4:2:2-intra,
 (string)high-10-intra }

  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw
              framerate: [ 0/1, 2147483647/1 ]
                  width: [ 16, 2147483647 ]
                 height: [ 16, 2147483647 ]
                 format: { (string)Y444, (string)Y42B, (string)I420, (string)YV12, (string)NV12, (string)Y444_10LE, (string)I422_10LE, (string)I420_10LE }



gst-launch-1.0 でいろいろ

一番簡単な例

$ gst-launch-1.0 videotestsrc ! autovideosink

Screenshot from 2017-09-14 13-53-01.png

H264にエンコードしてデコードして表示

$ gst-launch-1.0 -v videotestsrc ! x264enc ! avdec_h264 ! videoconvert ! autovideosink

RTPで動画をストリーミング

送り側

$ gst-launch-1.0 -v videotestsrc ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=5005 sync=false

受け側

$ gst-launch-1.0 -v udpsrc port=5005 ! application/x-rtp,media=video,encoding-name=H264 ! queue ! rtph264depay ! avdec_h264 ! videoconverter ! autovideosink

フレームレートを変える

videorateを使用する

# 30fps
$ gst-launch-1.0 filesrc location=/path/to/movie.mp4 ! decodebin ! videorate ! video/x-raw,framerate=30/1 ! autovideosink
48
40
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
48
40

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?