【问题标题】:Gstreamer1.0 missing plugin: decodebin2 in Python codeGstreamer1.0 缺少插件:Python 代码中的 decodebin2
【发布时间】:2016-07-06 12:12:20
【问题描述】:

以下将三个文件添加到 GES 时间线的 Python 代码引发了其他人也遇到过的以下错误:

(GError('您的 GStreamer 安装缺少插件。',), 'gstdecodebin2.c(3928): gst_decode_bin_expose (): /GESPipeline:gespipeline0/GESTimeline:gestimeline0/GESVideoTrack:gesvideotrack0/GnlComposition:gnlcomposition1/ GnlSource:gnlsource0/GstBin:videosrcbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin4:\n找不到合适的插件')

from gi.repository import GES
from gi.repository import GstPbutils
from gi.repository import Gtk
from gi.repository import Gst
from gi.repository import GObject
import sys
import signal

VIDEOPATH = "file:///path/to/my/video/folder/"

class Timeline:
    def __init__(self, files):
    print Gst._version # prints 1

    self.pipeline = GES.Pipeline()
    container_caps = Gst.Caps.new_empty_simple("video/quicktime")
    video_caps = Gst.Caps.new_empty_simple("video/x-h264")
    audio_caps = Gst.Caps.new_empty_simple("audio/mpeg")
    self.container_profile = GstPbutils.EncodingContainerProfile.new("jane_profile", "mp4 concatation", container_caps, None )#Gst.Caps("video/mp4", None))

    self.video_profile = GstPbutils.EncodingVideoProfile.new(video_caps, None, None, 0)
    self.audio_profile = GstPbutils.EncodingAudioProfile.new(audio_caps, None, None, 0)
    self.container_profile.add_profile(self.video_profile)
    self.container_profile.add_profile(self.audio_profile)

    self.bus = self.pipeline.get_bus()
    self.bus.add_signal_watch()
    self.bus.connect("message", self.busMessageCb)

    self.timeline = GES.Timeline.new_audio_video()
    self.layer = self.timeline.append_layer()
    signal.signal(signal.SIGINT, self.handle_sigint)
    self.start_on_timeline = 0

    for file in files:
        asset = GES.UriClipAsset.request_sync(VIDEOPATH + file)
        print asset.get_duration()
        duration = asset.get_duration()
        clip = self.layer.add_asset(asset, self.start_on_timeline, 0, duration, GES.TrackType.UNKNOWN)
        self.start_on_timeline += duration
        print 'start:' + str(self.start_on_timeline)

    self.timeline.commit()
    self.pipeline.set_timeline(self.timeline) 

def handle_sigint(self, sig, frame):
    Gtk.main_quit()

def busMessageCb(self, unused_bus, message):
    print message
    print message.type
    if message.type == Gst.MessageType.EOS:
        print "eos"
        Gtk.main_quit()
    elif message.type == Gst.MessageType.ERROR:
        error = message.parse_error()
        print (error)
        Gtk.main_quit()


if __name__=="__main__":
   GObject.threads_init()
   Gst.init(None)
   GES.init()
   gv = GES.version() # prints 1.2

   timeline = Timeline(['one.mp4', 'two.mp4', 'two.mp4'])
   done = timeline.pipeline.set_render_settings('file:///home/directory/output.mp4', timeline.container_profile)
   print 'done: {0}'.format(done)
   timeline.pipeline.set_mode(GES.PipelineFlags.RENDER)
   timeline.pipeline.set_state(Gst.State.PAUSED)
   Gtk.main()

我已将 GST_PLUGIN_PATH_1_0 环境变量设置为“/usr/local/lib:/usr/local/lib/gstreamer-1.0:/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux- gnu/gstreamer-1.0"

我编译并安装了 gstreamer1.0-1.2.4,以及该版本的基本、好、坏和丑包。 GES 安装了 1.2.1 版本,因为这是最接近我找到的 gstreamer 版本。我还安装了 libav-1.2.4。

根据 plugin-base 的 make install 日志,decodebin2 应该在 base 中,并链接到 libgstplayback,它是我的 GST_PLUGIN_PATH_1_0 的一部分:

   /usr/local/lib/gstreamer-1.0 libgstplayback_la-gstdecodebin2.lo

我确实有 gstreamer0.10,当我执行“gst-inspect-1.0 -b”时,decodebin2 作为黑名单版本存在,因为它位于 gstreamer0.10 库路径中,而不是 1.0 的库路径中。

我尝试清除 ~/.cache/gstreamer 文件并再次运行 gst-inspect-1.0 以重新生成插件注册表,但我仍然不断收到 Python 代码中的错误。此示例代码可能是错误的,因为这是我第一次尝试使用 Gstreamer 编辑服务编写时间线。我使用的是 Ubuntu Trusty 或 14.04。

该文件是一个 mp4 文件,这就是我为所需库安装 gst-libav 的原因。 MP4Box -info 在文件上的输出是:

  • 电影信息 * 时间刻度 90000 - 持续时间 00:00:08.405 零碎文件编号 - 2 首曲目 适合渐进式下载的文件(mdat 之前的 moov) 文件品牌 mp42 - 版本 0 创建时间:格林威治标准时间 2015 年 8 月 17 日星期一 17:02:26

    文件没有 MPEG4 IOD/OD

    Track #1 Info - TrackID 1 - TimeScale 50000 - Duration 00:00:08.360 媒体信息:语言“English” - 输入“vide:avc1” - 209 个样本 视觉轨道布局:x=0 y=0 宽度=1920 高度=1080 MPEG-4 配置:视觉流 - ObjectTypeIndication 0x21 AVC/H264 视频 - 视觉尺寸 1920 x 1080 AVC 信息:1 SPS - 1 PPS - Profile Main @ Level 4.2 NAL 单元长度位:32 像素纵横比 1:1 - 指示轨道尺寸 1920 x 1080 自同步

    Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:00:08.405 媒体信息:语言“English” - 类型“soun:mp4a” - 394 个样本 MPEG-4 配置:音频流 - ObjectTypeIndication 0x40 MPEG-4 音频 MPEG-4 音频 AAC LC - 2 通道 - SampleRate 48000 在流 1 上同步

当我运行 'GST_DEBUG=3,gnl*:5 python ./timeline1.py >timeline1.log 2>&1' 时记录 @pastebin.com/BjJ8Z5Bd

【问题讨论】:

    标签: plugins gstreamer python-gstreamer


    【解决方案1】:

    您在此处使用的 GStreamer 1.x 中没有“decodebin2”。它现在只是称为“decodebin”,相当于 0.10 中的“decodebin2”。

    但是,您的问题不是找不到 decodebin。您的问题是您缺少播放此特定媒体文件的插件。它是什么类型的媒体文件?

    【讨论】:

    • 嗨 Sebastian,很高兴收到您的来信,因为我知道您是 Gstreamer 项目的主要贡献者,我希望 Gstreamer 将成为我视频工作的基础。 MP4Box 中的 MP4 详细信息已添加到我的问题中。为什么我的代码会要求基于 Gstreamer0.10 的元素?
    • 尝试将 container_caps 从“video/quicktime”更改为“video/mpeg”(也将“version”设置为 4)。但是,'timeline.pipeline.set_render_settings('file:///home/ian/output.mp4',timeline.container_profile)' 返回 false 并且没有播放任何内容。
    • 它不要求 0.10 个元素。不确定您在哪里看到它要求 decodebin2 :) 问题不在于输出格式,而在于读取输入文件并对其进行解码。你使用什么样的输入文件?您可能还会错过输出中的某些内容,但现在还没有。
    • 也许我从字面上看错误消息:'...gstdecodebin2.c(3928)...?我认为 GES 会为我构建管道,并且由于命令行上的 gst-launch-1.0 playbin uri=file:///path/to/my.mp4' 工作正常,我原以为 Python 代码也可以。
    • 如果 gst-launch-1.0 与文件上的 playbin 一起工作,GES 也应该。如果没有完整的调试日志,无法在此处了解更多信息。但是你读的那个错误太字面了。 gstdecodebin2.c(3928) 是产生此错误的源文件和行,此错误表示此处缺少所需的插件。从调试日志中应该可以看到缺少的内容。
    猜你喜欢
    • 2023-04-02
    • 2012-07-30
    • 1970-01-01
    • 1970-01-01
    • 2014-08-19
    • 2019-01-21
    • 2016-10-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多