個人的備忘録のため随時追記
動作は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
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