2016-03-19 105 views
0

,增加了三個文件的GES時間表以下Python代碼拋出了以下錯誤,其他人也有過:Gstreamer1.0缺少插件:decodebin2在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:

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環境變量中發現\ n無合適的插件')以 「/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的日誌插件基地,並鏈接到libgstplayback,這是我GST_PLUGIN_PATH_1_0的一部分是基礎:

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

我有gstreamer0.10和decodebin2是在我做'gst-inspect-1.0 -b'時,它被列入黑名單,因爲它位於gstreamer0.10庫路徑中,而不是1.0版本。

我試圖清除〜/ .cache/GStreamer的文件並運行GST-檢查-1.0再次重新生成插件註冊表,但我仍然不斷收到錯誤在Python代碼。這個示例代碼可能是錯誤的,因爲它是我第一次使用Gstreamer編輯服務編寫時間線。我在Ubuntu Trusty或14.04上。

該文件是一個mp4文件,這就是爲什麼我爲所需的庫安裝gst-libav的原因。 MP4Box的輸出-info上的文件是:

  • 電影資料* 時間刻度90000 - 持續時間00:00:08.405 碎片文件沒有 - 2音軌 文件適用於漸進式下載(MOOV MDAT之前) 文件品牌MP42 - 版本0 創建時間:週一北京時間8月17日17時02分26秒2015年

    文件沒有MPEG4 IOD/OD

    #1軌跡信息 - 的TrackID 1 - 時間表50000 - 持續時間00:00:08.360 媒體信息:語言「英語」 - 輸入「vide:avc1」 - 209樣本 AVC/H264可視軌道佈局:x = 0 y = 0 width = 1920 height = 1080 AVC/H264視頻 - 可視尺寸1920×1080 AVC信息:1個SPS - 1 PPS - 分析主@水平4.2 NAL單元長度位:32 像素寬高比1:1 - 指示的音軌尺寸1920×1080 自同步

    軌#2信息 - 的TrackID 2 - 時間表48000 - 持續時間00:00:08。405 MPEG-4音頻MPEG-4音頻AAC LC - 2聲道 - SampleRate 48000同步於流I運行時1

日誌@pastebin.com/BjJ8Z5Bd關於 'GST_DEBUG = 3,GNL *:5蟒./timeline1.py> timeline1.log 2> & 1'

回答

0

沒有「在您使用的GStreamer 1.x中的「decodebin2」。它現在只叫「解碼器」,相當於0.10中的「解碼器2」。

然而,您的問題不在於找不到decodebin。你的問題是你缺少一個插件來播放這個特定的媒體文件。它是什麼樣的媒體文件?

+0

嗨塞巴斯蒂安,很高興收到您的來信,因爲我認識到您的名字是Gstreamer項目的關鍵貢獻者,我希望Gstreamer將成爲我與視頻合作的基礎。來自MP4Box的MP4細節被添加到我的問題中。爲什麼我的代碼然後要求基於Gstreamer0.10的元素? –

+0

嘗試從'video/quicktime'將container_caps更改爲'video/mpeg'(同時將'version'設置爲4)。但是,'timeline.pipeline.set_render_settings('file:///home/ian/output.mp4',timeline.container_profile)'返回false並且不播放任何內容。 –

+0

這不是要求0.10元素。不知道你在哪裏看到它要求decodebin2 :) 問題不是輸出格式,但問題是讀取輸入文件並解碼它。你使用什麼樣的輸入文件?你可能會錯過輸出的東西,但現在還沒有。 –