Gstreamer1.0缺少插件:Python代码中的decodebin2

时间:2016-03-19 19:52:12

标签: plugins gstreamer python-gstreamer

以下用于向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:\ nno找到合适的插件')

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。

decodebin2应该根据插件库的make install日志在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 创建时间:GMT Mon Aug 17 17:02:26 2015

    文件没有MPEG4 IOD / OD

    Track#1 Info - TrackID 1 - TimeScale 50000 - 持续时间00:00:08.360 媒体信息:语言“英语” - 输入“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 - 持续时间00:00:08.405 媒体信息:语言“英语” - 输入“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>时,

log @ pastebin.com/BjJ8Z5Bd timeline1.log 2>& 1'

1 个答案:

答案 0 :(得分:1)

GStreamer 1.x中没有“decodebin2”,你在这里使用它。它现在被称为“decodebin”,相当于0.10中的“decodebin2”。

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

相关问题