GStreamer video window not opening (macOS) - c

I am trying to run the first tutorial on GStreamer and running into some issues.
When I compile the code found here and run it, no compilation errors or warnings occur and the stream is found, but only the audio plays. When I run the executable with the GST_DEBUG environment variable set to 3, then I get the following debug output:
0:00:00.312559000 5230 0x7f8326031ad0 FIXME videodecoder gstvideodecoder.c:928:GstFlowReturn gst_video_decoder_drain_out(GstVideoDecoder *, gboolean):<vp8dec0> Sub-class should implement drain()
0:00:00.355530000 5230 0x7f8325139ed0 FIXME videodecoder gstvideodecoder.c:928:GstFlowReturn gst_video_decoder_drain_out(GstVideoDecoder *, gboolean):<vp8dec0> Sub-class should implement drain()
0:00:00.355659000 5230 0x7f8325139ed0 FIXME videodecoder gstvideodecoder.c:928:GstFlowReturn gst_video_decoder_drain_out(GstVideoDecoder *, gboolean):<vp8dec0> Sub-class should implement drain()
So it seems like there is some error either in my install of the videodecoder or the videodecoder itself, I can't say for certain.
When I try running the same media directly from the gstreamer CLI using the command
./gst-launch-1.0 -v playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm
I get a small OpenGL window that plays both the video and audio without any hiccups.
When I tried to install GStreamer and its plugins from brew, I ran into issues with certain plugins missing (namely certain decoders and demuxeres like vorbisdec). When I run the gst-launch tool from the brew install, I get warnings regarding the missing vorbis decoder. In this case, video plays without incident but audio does not.
Could this be an issue with the GStreamer framework pointing to the wrong plugins or directories? How can I diagnose this and/or fix it? Any help is greatly appreciated!

You might be running into https://gitlab.freedesktop.org/gstreamer/gst-docs/-/issues/10: on macOS you need to have a GLib main-loop running in order to display an OpenGL window. So in the tutorial you'll need to add something along the lines of this to make it work:
// Construct main-loop
GMainLoop *main_loop;
main_loop = g_main_loop_new(NULL, FALSE);
(...)
// Run main-loop
g_main_loop_run(main_loop);
(...)
// Clean-up
g_main_loop_unref(main_loop);
See tutorial 12 for an example.
As for the plugins not working with the Homebrew installation, you'll need to specify the location of the plugins manually. Depending on where Homebrew installed them and which ones you installed, it might look something like this:
export GST_PLUGIN_SYSTEM_PATH="/usr/local/opt/gst-plugins-good/lib/gstreamer-1.0/:/usr/local/opt/gst-plugins-bad/lib/gstreamer-1.0/:/usr/local/opt/gst-plugins-base/lib/gstreamer-1.0/:/usr/local/opt/gstreamer/lib/"

Related

Alsa tools not found on buildroot

I am trying to set a buildroot install to build an mp3 player and the issue I am encountering right now is that aplay that I have enabled in menuconfig is not available on my card flashed.
I am using buildroot-2020.02.8.
When looking for them in my BR folder I can find :
./build/alsa-utils-1.2.1/aplay
./build/alsa-utils-1.2.1/aplay/aplay
but nothing appears in the target. In my defconfig I have :
BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_ALSACONF=y
BR2_PACKAGE_ALSA_UTILS_ACONNECT=y
BR2_PACKAGE_ALSA_UTILS_ALSALOOP=y
BR2_PACKAGE_ALSA_UTILS_ALSAUCM=y
BR2_PACKAGE_ALSA_UTILS_ALSATPLG=y
BR2_PACKAGE_ALSA_UTILS_AMIDI=y
BR2_PACKAGE_ALSA_UTILS_AMIXER=y
BR2_PACKAGE_ALSA_UTILS_APLAY=y
BR2_PACKAGE_ALSA_UTILS_APLAYMIDI=y
BR2_PACKAGE_ALSA_UTILS_ARECORDMIDI=y
BR2_PACKAGE_ALSA_UTILS_ASEQDUMP=y
BR2_PACKAGE_ALSA_UTILS_ASEQNET=y
BR2_PACKAGE_ALSA_UTILS_BAT=y
BR2_PACKAGE_ALSA_UTILS_IECSET=y
BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST=y
But in the target folder I can't find any mention of these tools. And when the card is flashed, trying to run any of these as root return "not found".
Any advice on what I sould do to try to get them?
edit: added the buildroot version used.
Thanks to this thread I have found a solution. It seems that is was because I had first tried to install only alsamixer (which was working), then later other alsa tools. The first configuration was kept in memory and not changed.
I have been able to fix the issue by running :
make alsa-utils-dirclean

Gstreamer tutorial gives distorted/warped video

I am running Ubuntu (18.04.01 LTS) on a virtual machine (VMware Fusion 11.0.0) and I want to go through the first basic GStreamer tutorial. This example should play a short video from the internet using the playbin element. However, when I compile and run the code, the resulting video is distorted/warped. When I download the file and play it directly from the desktop, everything looks fine. Same problem with other video files.
I have successfully followed the instructions how to install GStreamer (gstreamer-1.0, version 1.14.1) on Ubuntu and all the required additional plugins:
sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools
The same problem occurs when I play the video using gst-launch-1.0 directly in the terminal:
gst-launch-1.0 playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm
Anybody has an idea what's going on here?
Thanks in advance.
As Florian pointed out in the comments: Use another renderer instead. For me, it was xvimagesink which caused the troubles.
Either
gst-launch-1.0 playbin video-sink=ximagesink uri=...
or
gst-launch-1.0 playbin video-sink=glimagesink uri=...
worked fine.

Gstreamer 1.0: Video from tutorials is not playing on MacOS

I am trying to compile this tutorial Tutorial_01 on my MacOS 10.11.3 with Xcode 7.2 and not getting any video: I can hear an audio but it seems like the video window is lost somewhere.
I tried playing the same media with command line gat-launch-1.0:
gst-launch-1.0 -v playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm
and it works just fine opening the media in OpenGL Renderer.
Any ideas?
Thanks in advance,
Max
Update: Getting this warning while in debug mode:
0:00:00.314802000 [336m64763[00m 0x7f93e4854a30 [32;01mFIXME [00m [00m videodecoder gstvideodecoder.c:1057:GstFlowReturn gst_video_decoder_drain_out(GstVideoDecoder *, gboolean):<vp8dec0>[00m Sub-class should implement drain()
looks like you need to run Glib event loop on mac.
Define the variable
GMainLoop *main_loop;
Then run loop after pipeline creation:
main_loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (main_loop);
Probably you need callback for controlling loop so you can use
g_timeout_add.
Hope it helps
Update:
GStreamer Bus - this link should help too
I don't think playbin2 is still a valid source plugin anymore. It's functionality has been migrated into playbin (I think).
But anyway - check the error codes if something is not working. They usually give a good readable error of what is wrong.
gstreamer.com Is not an official resource of the gstreamer project and focuses on the outdated 0.10 release branch. I recommend looking for examples at http://gstreamer.freedesktop.org. Even the gstreamer.com start page recommends that.

Why gst_element_factory_find can't find factory "decodebin"?

I have installed gstreamer-1.4.0 in order to create simple app for decoding video files.
The pipeline which I try to create looks simple:
filesrc location="file.h264" ! decodebin ! filesink location="file.raw"
This pipeline works fine when i launch it using gst-launch-1.0, however when I try to run my program written in C, it cannot find factory called "decodebin".
GstElementFactory *factory;
factory = gst_element_factory_find("decodebin");
if( !factory )
// fail
Above code always fails (factory is NULL). gst-inspect-1.0 recognizes "decodebin" correctly, so my guess is that something's wrong with GST_PLUGIN_PATH or something similar, but I have no idea how should I configure it properly. But it's just my guess based on the fact that my app creates other elements from factories such as filesrc or filesink which are in plugin called coreelements, and still decodebin which is from plugin 'playback' failes.
My question: How can i fix my gstreamer configuration in order to recognize all plugins, not just coreelements?
If i skipped some important info please let me know so that I could append it asap :)
// EDIT:
Let's say i've installed gstreamer from sources (i'm using ubuntu 14.04).
I've also installed all plugins (base, bag, good), also from sources.
Installation directory was /opt/gstreamer-1.4.0/, maybe this causes some problem.
If I execute command:
echo $GST_PLUGINS_PATH
all I get is an empty line, similar effect when i try to display values of other GST_* environmental variables.
more specific question: Which directories should I append to which variables in order to make non coreelements plugins work?
And if this question is too general, than:
how gst_element_factory_find("factory_name") checks if a given factory exists?
Don't know if what i did fixed everything, but for now i solved my problem by copying libplayback.so and other compiled plugins binaries to the folder with libcoreelements.so
It appears that the problem was caused by the non-standard installation directories,
so my solution is a hotfix, since I still don't know how was it possible that gst-inspect-1.0 recognized all plugins whilst gst_element_factory_find() couldn't. Any further inside will be appreciated :)

"Your GStreamer installation is missing a plug-in." (GstURIDecodeBin)

I have: gstreamer-sdk, gstreamer-ffmpeg, gstreamer-plugins-good, bad, and ugly. I googled everywhere for this error and have found nothing relevant. I'm going a little nuts trying to figure out this error:
Error received from element decodebin20: Your GStreamer installation is missing a plug-in.
Debugging information: gstdecodebin2.c(3576): gst_decode_bin_expose (): /GstPlayBin2:playbin20/GstURIDecodeBin:uridecodebin0/GstDecodeBin2:decodebin20:
no suitable plugins found
It throws when I run my gstreamer program. Any ideas on why?
You may not be missing any plugins at all.
This error can be a result of just an unlinked pipeline.
Playbin2(decodebin2) got some changes that made it unable to automatically link up some pipelines that formally worked, for example transcoding a decoder to an encoder. In my case, explicitly adding the ffdec_h264 that it used to add automatically fixed it.
Relying on the Playbin2 can be very frustrating when it does not work. Using the setup below, you can create a .png diagram of the pipeline in various phases of construction. It's very helpful in finding why it isn't linking up.
export GST_DEBUG_DUMP_DOT_DIR=~/gstdump
for f in $GST_DEBUG_DUMP_DOT_DIR/*.dot ; do dot -T png $f >$f.png; done
This tool also lets you learn from it how to link up pipelines, and replace them with explicit ones that are easier to debug and less likely to break.
In Fedora, I resolved this issue removing gstreamer1-vaapi.x86_64:
sudo yum remove gstreamer1-vaapi.x86_64
uridecodebin is part of the "base" plugin set, so make sure you have gstreamer-plugins-base.
Another thing to look into is your LD_LIBRARY_PATH and GST_PLUGIN_PATH. If they point to a different GStreamer installation, it could cause problems like this. Also, if you didn't install GStreamer with a package manager, you may need to set your LD_LIBRARY_PATH to point to it (or better yet, install it with a package manager).
Pleas try to use gst-inspect command to find out if environment is correctly setup.
use gst-launch -v playbin2 uri = "your_uri_here" to find more information to trace this issue.

Resources