]> code.delx.au - transcoding/blobdiff - encode.py
Better fix for oac copy crash
[transcoding] / encode.py
index c788bb632d8df67107b85633068dfe5d61a4289e..ca27aaede3e8313d8157638c2dfc1d6e4c80bb48 100755 (executable)
--- a/encode.py
+++ b/encode.py
@@ -57,9 +57,13 @@ class Command(object):
        def __init__(self, profile, opts):
                self.profile = profile
                self.opts = opts
+               self.init()
                self.audio_tmp = "audio." + self.codec2exts[profile.acodec]
                self.video_tmp = "video." + self.codec2exts[profile.vcodec]
-       
+
+       def init(self):
+               pass
+
        def print_install_message(self):
                print >>sys.stderr, "Problem with command: %s", self.name
                if self.package:
@@ -151,6 +155,11 @@ class Mencoder(Command):
                "mp3lame": "-lameopts",
        }
 
+       def init(self):
+               if self.opts.copyac3:
+                       self.profile.acodec = "copyac3"
+                       self.profile.aopts = None
+
        def insert_options(self, cmd):
                def try_opt(opt, var):
                        if var is not None:
@@ -161,6 +170,8 @@ class Mencoder(Command):
                if self.opts.detelecine:
                        self.opts.ofps = "24000/1001"
                        cmd += ["-vf-add", "pullup,softskip"]
+               if self.opts.copyac3:
+                       cmd += ["-noskip", "-mc", "0"]
                try_opt("-fps", self.opts.ifps)
                try_opt("-ofps", self.opts.ofps)
                try_opt("-ss", self.opts.startpos)
@@ -186,10 +197,8 @@ class Mencoder(Command):
                p = self.profile
 
                acodec = p.acodec
-               if self.opts.copyac3:
+               if acodec == "copyac3":
                        acodec = "copy"
-                       p.acodec = "copyac3"
-                       p.aopts = None
 
                cmd = []
                cmd += ["mencoder", self.opts.input]