+ o = self.opts
+ p = self.profile
+
+ if o.dump:
+ fps = "???"
+ else:
+ fps = midentify(p.video_tmp, "ID_VIDEO_FPS")
+
+ self.do_exec([
+ "mkvmerge",
+ "-o", o.output + ".mkv",
+ "--default-duration", "0:%sfps"%fps,
+ p.video_tmp,
+ p.audio_tmp,
+ ])
+
+
+
+class MencoderFixRemux(Command):
+ def init(self):
+ self.check_command("mencoder")
+ self.check_no_file("remux.avi")
+
+ orig = self.opts
+ self.opts = duplicate_opts(orig)
+ orig.input = "remux.avi"
+ orig.dvd = orig.chapter = orig.startpos = orig.endpos = None
+
+ def run(self):
+ o = self.opts
+ cmd = [
+ "mencoder",
+ "-o", "remux.avi",
+ "-oac", "copy", "-ovc", "copy",
+ "-mc", "0.1",
+ o.input,
+ ]
+ do_opt = partial(append_cmd, cmd)
+ do_opt("-dvd-device", o.dvd)
+ do_opt("-chapter", o.chapter)
+ do_opt("-ss", o.startpos)
+ do_opt("-endpos", o.endpos)
+ self.do_exec(cmd)
+
+
+
+
+
+class MPlayer(Command):
+ def init(self):
+ self.check_command("mplayer")
+ self.check_no_file("video.y4m")
+ self.check_no_file("audio.wav")
+
+ def run(self):
+ os.mkfifo("video.y4m")
+ os.mkfifo("audio.wav")
+ cmd = []
+ cmd += ["mplayer", self.opts.input]
+ cmd += ["-benchmark", "-noconsolecontrols", "-noconfig", "all"]
+ cmd += ["-vo", "yuv4mpeg:file=video.y4m"]
+ cmd += ["-ao", "pcm:waveheader:file=audio.wav"]
+ insert_mplayer_options(cmd, self.opts)
+ cmd += self.profile.extra
+ self.do_exec(cmd, wait=False)
+
+
+class MencoderCopyAC3(Command):
+ def init(self):
+ self.check_command("mplayer")
+ self.check_no_file("audio.ac3")
+ self.profile.audio_tmp = "audio.ac3"
+
+ def run(self):
+ cmd = []
+ cmd += ["mencoder", self.opts.input]
+ cmd += ["-noconfig", "all"]
+ cmd += ["-ovc", "copy", "-oac", "copy"]
+ cmd += ["-of", "rawaudio", "-o", "audio.ac3"]
+ insert_mplayer_options(cmd, self.opts)
+ cmd += self.profile.extra
+ self.do_exec(cmd)
+
+
+class X264(Command):
+ def init(self):
+ self.check_command("x264")
+ self.profile.video_tmp = "video.h264"
+
+ def run(self):
+ p = self.profile
+ cmd = []
+ cmd += ["x264", "--no-progress"]
+ cmd += p.x264opts
+ cmd += ["-o", p.video_tmp]
+ cmd += ["video.y4m"]
+ self.do_exec(cmd, wait=False)
+
+
+class Lame(Command):
+ def init(self):
+ self.check_command("lame")
+ self.profile.audio_tmp = "audio.mp3"
+
+ def run(self):
+ p = self.profile
+ cmd = []
+ cmd += ["lame", "--quiet"]
+ cmd += p.lameopts
+ cmd += ["audio.wav"]
+ cmd += [p.audio_tmp]
+ self.do_exec(cmd, wait=False)
+
+
+class Faac(Command):
+ def init(self):
+ self.check_command("faac")
+ self.profile.audio_tmp = "audio.aac"
+
+ def run(self):
+ p = self.profile
+ cmd = []
+ cmd += ["faac"]
+ cmd += ["-o", p.audio_tmp]
+ cmd += p.faacopts
+ cmd += ["audio.wav"]
+ self.do_exec(cmd, wait=False)