Gstreamer Process finished with exit code 132 on OSX with Hello World example

Viewed 145

When I run the Hello World tutorial for the Gstreamers python API I get the following error:

GST_DEBUG=3 python tutorial_1.py
0:00:01.787091000 98337 0x7fde78071920 ERROR              gldisplay gstgldisplay_cocoa.m:171:gst_gl_display_cocoa_setup_nsapp: Custom NSApp initialization failed
0:00:01.787178000 98337 0x7fde78071920 ERROR                glutils gstglutils.c:229:gst_gl_element_propagate_display_context:<sink> Could not get GL display connection
0:00:01.788032000 98337 0x7fde78071920 WARN                 playbin gstplaybin2.c:4757:autoplug_select_cb:<playbin0> Could not activate sink glimagesink
0:00:01.792032000 98337 0x7fde78071920 FIXME           videodecoder gstvideodecoder.c:1052:gst_video_decoder_drain_out:<vp8dec0> Sub-class should implement drain()
0:00:01.859639000 98337 0x7fde78071980 FIXME           videodecoder gstvideodecoder.c:1052:gst_video_decoder_drain_out:<vp8dec0> Sub-class should implement drain()
zsh: illegal hardware instruction  GST_DEBUG=3 python tutorial_1.py

But when I run a Gstreamer command in terminal that serves essentially the same purpose the window opens correctly with no issues:

gst-launch-1.0 -v playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm

Looking for a solution or a push in right direction to resolve this.

Environment:

  • Hardware:
    • Model Name: MacBook Pro
    • Model Identifier: MacBookPro13,3
    • Processor Name: Quad-Core Intel Core i7
    • Processor Speed: 2,7 GHz
  • OS:
    • System Version: macOS 11.6 (20G165)
    • Kernel Version: Darwin 20.6.0
  • GStreamer 1.18.4
  • pygobject 3.42.0
  • python 3.9.7

Code from the tutorial:

#!/usr/bin/env python3
import sys

import gi

gi.require_version('GLib', '2.0')
gi.require_version('GObject', '2.0')
gi.require_version('Gst', '1.0')

from gi.repository import Gst, GObject, GLib

pipeline = None
bus = None
message = None

# initialize GStreamer
Gst.init(sys.argv[1:])

# build the pipeline
pipeline = Gst.parse_launch(
    "playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm"
)

# start playing
pipeline.set_state(Gst.State.PLAYING)

# wait until EOS or error
bus = pipeline.get_bus()
msg = bus.timed_pop_filtered(
    Gst.CLOCK_TIME_NONE,
    Gst.MessageType.ERROR | Gst.MessageType.EOS
)

# free resources
pipeline.set_state(Gst.State.NULL)
2 Answers

It is likely due to some requirements related to OpenGL on MacOS. Please note that in your example the playbin will try to open some OpenGL window to display the video inside. For an additional information please visit this link.

The following is a simple example how to solve that problem in C++ using the hello world app:

#include <gst/gst.h>

#include <thread>

#include <CoreFoundation/CoreFoundation.h>

int
main (int argc, char *argv[])
{
  std::thread t([&]{
    GstElement *pipeline;
    GstBus *bus;
    GstMessage *msg;

    /* Initialize GStreamer */
    gst_init(&argc, &argv);

    /* Build the pipeline */
    pipeline =
      gst_parse_launch
      ("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm",
      NULL);

    /* Start playing */
    gst_element_set_state(pipeline, GST_STATE_PLAYING);

    /* Wait until error or EOS */
    bus = gst_element_get_bus(pipeline);
    msg = gst_bus_timed_pop_filtered(
        bus, GST_CLOCK_TIME_NONE,
        static_cast<GstMessageType>(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));

    /* Free resources */
    if (msg != NULL)
      gst_message_unref(msg);
    gst_object_unref(bus);
    gst_element_set_state(pipeline, GST_STATE_NULL);
    gst_object_unref(pipeline);
  });
  CFRunLoopRun();
  t.join();
  return 0;
}

Building and running:

$ clang++ -std=c++17  -ggdb -O0  gst.cpp $(pkg-config --cflags --libs gstreamer-1.0) -framework CoreFoundation
$ ./a.out
Related