【问题标题】:Gstreamer Process finished with exit code 132 on OSX with Hello World exampleGstreamer 进程在 OSX 上以 Hello World 示例完成,退出代码为 132
【发布时间】:2021-10-13 11:53:42
【问题描述】:

当我为 Gstreamers python API 运行 Hello World tutorial 时,我收到以下错误:

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

但是当我在终端中运行 Gstreamer 命令时,该命令的目的基本相同,窗口会正确打开,没有任何问题:

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

寻找解决方案或推动正确的方向来解决这个问题。

环境:

  • 硬件:
    • 型号名称:MacBook Pro
    • 型号标识符:MacBookPro13,3
    • 处理器名称:四核 Intel Core i7
    • 处理器速度:2.7 GHz
  • 操作系统:
    • 系统版本:macOS 11.6 (20G165)
    • 内核版本:Darwin 20.6.0
  • GStreamer 1.18.4
  • pygobject 3.42.0
  • python 3.9.7

教程中的代码:

#!/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)

【问题讨论】:

    标签: macos gstreamer gstreamer-1.0 python-gstreamer


    【解决方案1】:

    这可能是由于与 MacOS 上的 OpenGL 相关的一些要求。请注意,在您的示例中,playbin 将尝试打开一些 OpenGL 窗口以显示其中的视频。如需更多信息,请访问this 链接。

    以下是一个简单的示例,如何使用 hello world 应用程序在 C++ 中解决该问题:

    #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;
    }
    

    构建和运行:

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

    【讨论】:

      猜你喜欢
      • 2014-07-29
      • 1970-01-01
      • 2021-05-10
      • 2015-07-05
      • 2020-01-31
      • 1970-01-01
      • 1970-01-01
      • 2021-03-22
      相关资源
      最近更新 更多