Tutorial: Getting gst-rtsp-server to compile and running on Windows 10
Hi, I was trying to compile and run the examples from gst-rtsp-server on Windows 10. I took me quite some time, and I want to share some infos, which I want to share.
Installation steps:
gstreamer-1.0-mingw-x86_64-1.16.0.msi
and
gstreamer-1.0-devel-mingw-x86_64-1.16.0.msi
Choose the "Complete" installation and make sure it installed into C:\gstreamer (This directory seems hard-coded in the compilation step later) My first problem was, that I tried with to build with MSYS, but this is too old. So I switched to MSYS2. Install the
msys2-x86_64-20190524.exe
Make sure to let the installer start MSYS2 automatically at the end of the installation. Update your installation:
pacman -Syu
close Msys2 window and start it again
pacman -Su
Install the required packages. I don't now the exact packages installed, but here is a snapshot of
$ pacman -Qe:
asciidoc autoconf autoconf2.13 autogen automake-wrapper automake1.10 automake1.11 automake1.12
automake1.13 automake1.14 automake1.15 automake1.16 automake1.6 automake1.7 automake1.8 automake1.9 bash
bash-completion bison bsdcpio bsdtar bzip2 cmake coreutils curl dash diffstat diffutils
dos2unix dtc file filesystem findutils flex gawk gcc gcc-libs gdb getent gettext-devel
glib2-devel gperf grep groff gzip help2man inetutils info intltool lemon less
libargp libtool libunrar libunrar-devel lndir make man-db
mingw-w64-i686-gcc
mingw-w64-i686-gstreamer
mingw-w64-i686-libffi mingw-w64-x86_64-gcc mingw-w64-x86_64-gst-libav mingw-w64-x86_64-gst-python mingw-w64-x86_64-gst-rtsp-server
mingw-w64-x86_64-libffi mingw-w64-x86_64-ninja
mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-gobject mingw-w64-x86_64-python3-pip mingw-w64-x86_64-python3-wheel
mintty msys2-keyring msys2-launcher-git
msys2-runtime nano ncurses pacman pacman-mirrors pactoys-git patch patchutils pax-git perl
pkg-config pkgfile quilt rcs rebase scons sed swig texinfo texinfo-tex tftp-hpa time
ttyrec tzcode unrar util-linux which xmlto zip git
We need the mingw-w64-x86_64-python3 packages, because the meson build system claims there is a problem with the built-in python3 from MSYS2. You can call the python from mingw-w64-x86_64-python3 by executing "python3" and "pip3" instead of "python" and "pip".
Close the MSYS2 window.
edit the file C:\msys64\etc\fstab and add at the end:
C:/Users /home ntfs binary,noacl,auto 1 1
On the start menu, open the "MSYS2 MING 64-bit" shortcut, not the "MSYS MSYS2"! When startet, it will also say
user@myMachine MINGW64 ~
$
not:
user@myMachine MSYS ~
$
Install the build system.
pip3 install --user meson
unfortunatly, this will place the meson.exe in a rather strange place, that is not currently on your path. So add it: create a text file (the name doesn't matter, as all files in this directory are loaded) in
C:\msys64\etc\profile.d\
We choose to name it myUserPath.sh and put the following line into it, but be sure to replace xxxUserxxx with your local windows 10 user directory.
PATH="/C/Users/xxxUserxxx/.local/bin:${PATH}"
Clone the version of gst-rtsp-server for which you also have gstreamer installed, that is 1.16. I first tried with the development version of 1.17, but the build script would not find my gstreamer installation.
https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/tree/1.16
to a directory, for example ~/gst-rtsp-server
type the following to start the build
cd ~/gst-rtsp-server
$ meson builddir
$ cd builddir
$ ninja
$ ninja test
$ cd builddir/examples
if there are some errors in these step, you need to try around and google a little bit. I did some fuzzy things here, like "alias pkgconfig=pkg-config.EXE", but I don't know if these are necessary if you start the correct way. At some point I also copied the whole C:\gstreamer\1.0\ dir into the various C:\msys64\user and C:\msys64\mingw64 directory trees, because the build system would not find gstreamer-1.0. But again, I don't know if this is necessary if done correctly. I also found these pages helpful:
https://github.com/valtron/llvm-stuff/wiki/Set-up-Windows-dev-environment-with-MSYS2
[http://users.freebasic-portal.de/stw/files/prog/fb/doc/MinGW Setup.pdf](http://users.freebasic-portal.de/stw/files/prog/fb/doc/MinGW Setup.pdf)
Now you sould have succeeded in setting up the build-environment, building the gst-rtsp-server 1.16.0 examples using meson build system.
To get rid of the error message:
** (test-mp4.exe:15920): WARNING **: failed to create element 'rtpbin', check your installation
you must suplly the the plugin path as command line argument
--gst-plugin-path=C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
so the full command line for running from cmd.exe shell is:
test-mp4.exe C:\\Users\\xxxUserxxx\\Videos\\myVideo.mp4 --gst-debug-level=3 --gst-plugin-path=C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0