LoginSignup
10
10

More than 5 years have passed since last update.

Windows 上で GStreamer と戯れる環境を作る

Last updated at Posted at 2015-12-02

はじめに

最近 VisualGDB という素晴らしいものがMSからリリースされたにも関わらず、msys2 を使って GStreamer と戯れる方法を書きます。ゴメンナサイ...

そして、いまだかつて Visual Studio Community Edition? で GStreamer と戯れたことがないので、アドベントカレンダー期間中に戯れることができたらいいな...と思ってます。

とはいっても、多くの人は gst-launch を bash などが動く環境で触れたほうがだよね?ってことで :bow:

msys2 をインストール

pacman を使って gstreamer をインストール

以下、コピペでいけるはず

$ pacman -S \
mingw-w64-x86_64-gstreamer \
mingw-w64-x86_64-gst-libav \
mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good \
mingw-w64-x86_64-gst-plugins-ugly

-Qs オプションを使って dpkg -l みたいなことをして確認

インストールできているかを確認
$ pacman -Qs | grep gst
local/mingw-w64-x86_64-gst-libav 1.6.1-1
local/mingw-w64-x86_64-gst-plugins-bad 1.6.1-2
local/mingw-w64-x86_64-gst-plugins-base 1.6.1-1
local/mingw-w64-x86_64-gst-plugins-good 1.6.1-1
local/mingw-w64-x86_64-gst-plugins-ugly 1.6.1-1
local/mingw-w64-x86_64-gstreamer 1.6.1-1

しかし、この時点ではみんな大好きgst-launchが使えません :(

PATH を通す

PATHに/mingw64/binを追加
$ gst-launch-1.0.exe --help
bash: gst-launch-1.0.exe: command not found

$ echo 'PATH=/mingw64/bin:$PATH' >> .bashrc
$ bash
$ gst-launch-1.0.exe --help
Usage:
  gst-launch-1.0 [OPTION...] PIPELINE-DESCRIPTION

Help Options:
  -h, --help                        Show help options
  --help-all                        Show all help options
  --help-gst                        Show GStreamer Options

Application Options:
  -t, --tags                        Output tags (also known as metadata)
  -c, --toc                         Output TOC (chapters and editions)
  -v, --verbose                     Output status information and property notifications
  -q, --quiet                       Do not print any progress information
  -m, --messages                    Output messages
  -X, --exclude=PROPERTY-NAME       Do not output status information for the specified property if verbose output is enabled (can be used multiple times)
  -f, --no-fault                    Do not install a fault handler
  -e, --eos-on-shutdown             Force EOS on sources before shutting the pipeline down
  --version                         Print version information and exit

イケましたね! :)

おわり

ちなみに、pacman でインストールした gstreamer では、↓これらが使えます。

gst-device-monitor-1.0      gst-launch-1.0
gst-discoverer-1.0          gst-play-1.0
gst-inspect-1.0             gst-typefind-1.0

windows では v4l-utils とかが使えないので、gst-device-monitorが重宝します。

最後にノートPCを使っている私のような人のために Pipeline を1つだけ...

$ gst-launch-1.0 ksvideosrc device-index=0 ! decodebin ! autovideosink

gst-device-monitor を使って、複数カメラが認識されてることを確認したうえで、device-index の値を 1 や 2 にすると、使用するカメラを切り替えることができますのでお試しあれ!

10
10
0

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
10
10