[transmageddon] Fix issue where profiles requsting multipass encoding gets coupled with an encoder which do not supp



commit f9f4985500ca821d00734033fe07b75b0fe4be5c
Author: Christian Fredrik Kalager Schaller <uraeus linuxrising org>
Date:   Wed Jun 25 10:23:27 2014 +0200

    Fix issue where profiles requsting multipass encoding gets
    coupled with an encoder which do not support it

 src/transcoder_engine.py |   17 +++++++++--------
 src/transmageddon.py     |   19 ++++++++++---------
 2 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/src/transcoder_engine.py b/src/transcoder_engine.py
index cda74e9..d0f6542 100644
--- a/src/transcoder_engine.py
+++ b/src/transcoder_engine.py
@@ -94,11 +94,11 @@ class Transcoder(GObject.GObject):
                    if not (self.audiodata[x]['outputaudiocaps'].intersect(Gst.caps_from_string("audio/mpeg, 
mpegversion=1, layer=3"))).is_empty():   
                        self.streamdata['container']=Gst.caps_from_string("application/x-id3")
                x=x+1
-       if not self.streamdata['container']==False: 
+       else: 
            self.encodebinprofile = GstPbutils.EncodingContainerProfile.new("containerformat", None , 
self.streamdata['container'], None)
-           # print("container is " +str(self.streamdata['container'].to_string()))
-       # What to do if we are not doing video passthrough (we only support video inside a 
-       # container format
+
+           # What to do if we are not doing video passthrough (we only support video inside a 
+           # container format
            if self.videodata[0]['outputvideocaps'] !=False:
                if (self.videodata[0]['dopassthrough']==False) and (self.streamdata['passcounter'] == int(0)):
                    self.videoflipper = Gst.ElementFactory.make('videoflip', None)
@@ -121,8 +121,7 @@ class Transcoder(GObject.GObject):
                    videopreset=None
                    self.videoprofile = 
GstPbutils.EncodingVideoProfile.new(self.videodata[0]['outputvideocaps'], videopreset, Gst.Caps.new_any(), 0)
                    self.encodebinprofile.add_profile(self.videoprofile)
-                   #print("videocaps is "+str(self.videodata[0]['outputvideocaps'].to_string()))
-                   #print(self.videoprofile)
+        
        # We do not need to do anything special for passthrough for audio, since we are not
        # including any extra elements between uridecodebin and encodebin
        x=0
@@ -136,7 +135,8 @@ class Transcoder(GObject.GObject):
                    audioprofile.set_name("audioprofilename"+str(x))
                    self.encodebinprofile.add_profile(audioprofile)
            x=x+1 
-           # print("audiocodec is " +str(self.audiodata[0]['outputaudiocaps'].to_string()))
+
+       # Dealing with Video multipass encoding
        if (self.streamdata['passcounter'] != int(0) and self.streamdata['multipass'] != int(0)):
            videoencoderplugin = codecfinder.get_video_encoder_element(self.videodata[0]['outputvideocaps'])
            self.videoencoder = Gst.ElementFactory.make(videoencoderplugin,"videoencoder")
@@ -173,6 +173,7 @@ class Transcoder(GObject.GObject):
        self.pipeline.add(self.uridecoder)
        
        if self.streamdata['passcounter'] != int(0):
+           print(self.streamdata['passcounter'])
            self.videoencoder.link(self.multipassfakesink)
        else:
            self.transcodefileoutput = Gst.ElementFactory.make("filesink", \
@@ -328,8 +329,8 @@ class Transcoder(GObject.GObject):
                if os.access(self.cachefile, os.F_OK):
                    os.remove(self.cachefile)
                    os.remove(self.cachefile+'.mbtree')
+           # print(self.streamdata['passcounter'])
            self.emit('got-eos')
-           self.streamdata['passcounter'] = 0
            self.pipeline.set_state(Gst.State.NULL)
        elif mtype == Gst.MessageType.APPLICATION:
            self.pipeline.set_state(Gst.State.NULL)
diff --git a/src/transmageddon.py b/src/transmageddon.py
index 93f1d9e..f8e21b7 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -88,10 +88,10 @@ supported_containers = [
 supported_video_container_map = {
     'Ogg':        [ 'Theora', 'Dirac', 'On2 vp8' ],
     'MXF':        [ 'H264', 'MPEG2', 'MPEG4' ],
-    'Matroska':   [ 'On2 vp8', 'Theora', 'H264', 'Dirac',
+    'Matroska':   [ 'On2 vp8', 'Theora', 'H264', 'Dirac', 'divx5',
                     'MPEG4', 'MPEG2', 'H263+' ],
     'AVI':        [ 'H264', 'Dirac', 'MPEG2', 'MPEG4',
-                    'Windows Media Video 2', 'On2 vp8' ],
+                    'Windows Media Video 2', 'On2 vp8', 'xvid', 'divx5' ],
     'Quicktime':  [ 'H264', 'Dirac', 'MPEG2', 'MPEG4', 'On2 vp8' ],
     'MPEG4':      [ 'H264', 'MPEG2', 'MPEG4' ],
     'FLV':        [ 'H264'],
@@ -106,8 +106,8 @@ supported_video_container_map = {
 supported_audio_container_map = {
     'Ogg':   [ 'Vorbis', 'FLAC', 'Speex', 'Celt Ultra', 'Opus' ],
     'MXF':         [ 'mp3', 'AAC', 'AC3' ],
-    'Matroska':    [ 'FLAC', 'AAC', 'AC3', 'Vorbis' ],
-    'AVI':         [ 'mp3', 'AC3', 'Windows Media Audio 2' ],
+    'Matroska':    [ 'FLAC', 'AAC', 'AC3', 'Vorbis'],
+    'AVI':         [ 'mp3', 'AC3', 'Windows Media Audio 2'],
     'Quicktime':   [ 'AAC', 'AC3', 'mp3' ],
     'MPEG4':       [ 'AAC', 'mp3' ],
     '3GPP':        [ 'AAC', 'mp3', 'AMR-NB' ],
@@ -614,6 +614,7 @@ class TransmageddonUI(Gtk.ApplicationWindow):
            self.ProgressBar.set_text(_("Done Transcoding"))
            self.ProgressBar.set_fraction(1.0)
            self.start_time = False
+           print("this is only on EOS")
            self.streamdata['multipass'] = 0
            self.streamdata['passcounter'] = 0
            x=0
@@ -635,7 +636,7 @@ class TransmageddonUI(Gtk.ApplicationWindow):
            else:
                self.StatusBar.push(context_id, (_("Pass %(count)d Complete. ") % \
                    {'count': self.streamdata['passcounter']}))
-               self.streamdtata['passcounter'] = self.streamdata['passcounter']+1
+               self.streamdata['passcounter'] = self.streamdata['passcounter']+1
                self._start_transcoding()
 
    def dvdreadproperties(self, parent, element):
@@ -825,11 +826,10 @@ class TransmageddonUI(Gtk.ApplicationWindow):
            self.audiodata[self.audiostreamcounter]['language'] = 
GstTag.tag_get_language_name(output.langcode)
        self.languagelabel.set_markup(''.join(('<u><small>''Language: ', 
str(self.audiodata[self.audiostreamcounter]['language']),'</small></u>')))
 
-   def _start_transcoding(self): 
+   def _start_transcoding(self):
+       print(self.streamdata['passcounter']) # = 0 # make sure this is reset before a new transcode starts
        self._transcoder = transcoder_engine.Transcoder(self.streamdata,
                         self.audiodata, self.videodata)
-        
-
        self._transcoder.connect("ready-for-querying", self.ProgressBarUpdate)
        self._transcoder.connect("got-eos", self._on_eos)
        self._transcoder.connect("missing-plugin", self.install_plugin)
@@ -982,7 +982,8 @@ class TransmageddonUI(Gtk.ApplicationWindow):
            videoencoder = Gst.ElementFactory.make(videoencoderplugin,"videoencoder")
            properties=videoencoder.get_property_names()
            if "multipass-cache-file" not in properties:
-              self.multipass=0
+              self.streamdata['multipass']=0
+              self.streamdata['passcounter']=0
            else:
                self.streamdata['passcounter']=int(1)
                self.StatusBar.push(context_id, (_("Pass %(count)d Progress") % {'count': 
self.streamdata['passcounter']}))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]