Can't play a video through Gtk.Video and MediaFile on windows

Hello, I’m trying to build a Gtk4 based app using gtkmm-4.0 through MSYS2. I was trying to display an animated icon using gif files but found gtk4 doesn’t support gif images so I thought of converting the gif file to webm and displaying it as a video. I tried using gtk4.Video to play it but it doesn’t work. The video widget shows up but it doesn’t let me play the video. Here is a pic.

I also get this warning

GStreamer-Play-WARNING **: 21:55:21.600: GstPlay: scaletempo element not available. Audio pitch will not be preserved during trick modes

This is how I set up the video

Glib::RefPtr< Gtk::MediaFile > mf = Gtk::MediaFile::create_for_filename("./xyz.mp4");
Gtk::Video vid(mf);

I thought I was missing the gstreamer library perhaps so I also included the gstreamer library through cmake and installed the binaries from the website for windows but it still doesn’t work. Here is a screencap of my cmakeLists.txt

Hello @gallickgunner! Will take a look

What’s the output of:

  • gst-inspect-1.0 -a
  • pacman -Q | grep gst

Thanks. The first command throws a bunch of info which is very long to post here. Here is the link to text file containing the output.

The output of the second command is this.


I also tried installing gst-plugins-bad but didn’t work so I uninstalled it. Hence you don’t see it in the above picture

I think the problem is the gtkmm-4.0 package on msys2 site lists gtk4 as the dependency instead of gtk4-media-gstreamer


Gtk4 unlike gtk4-media-gstreamer includes the gst-plugin-bad-libs as its “build” dependency instead of the normal dependency.


Perhaps this is causing the issue? Found a relevant issue on MSYS github regarding splitting of the gtk4 core and the media backend.

If that’s the case what’s the workaround? How do I tell gtkmm to use gtk4-media-gstreamer instead of plain gtk4 ?

It’s a runtime library, so you only have to install it with pacman, no need to recompile :slight_smile:

Also try running gtk4-widget-factory (t’s part of the gtk4 package). It should display a video as in File:Gtk4-widget-factory demos.png - Wikipedia

It doesn’t show the video in the example as well. I tried installing gtk4-media-gstreamer but it says there is a conflict with the files installed by the simple gtk4 and installation aborts.

EDIT:- So I just checked the msys2 site and these are the only 2 files that get installed and I already had them somehow. I tried deleting them and installing the gtk4-media-gstreamer package and it got installed successfully but the video still isn’t playing.

EDIT2: In order to better isolate the issue I uninstalled everything and installed gtk4 only. The video doesn’t play as expected since gstreamer is missing. I installed gtk4-media-gstreamer but the video still doesn’t play even though the gstreamer dlls are now present in the right directory.

Issue solved. It seems I needed to add gst-plugins-good as well. Link to github issue on msys2 repo


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.