# HG changeset patch # User renatofilho # Date 1195650619 0 # Node ID e8a82fc5f075ed9c36bd7ead6d24137b118e8cee # Parent 15d85ba360bb44b5120afe960a0a78a2f1c00c25 [svn r889] updated to use theora diff -r 15d85ba360bb -r e8a82fc5f075 gmyth-stream/server/lib/request_handler.py --- a/gmyth-stream/server/lib/request_handler.py Mon Nov 19 18:06:11 2007 +0000 +++ b/gmyth-stream/server/lib/request_handler.py Wed Nov 21 13:10:19 2007 +0000 @@ -411,9 +411,9 @@ def serve_transcode(self, body): type = self.query.get("type", None)[0] - if type.upper() == "FILE": - self.send_error(404, "Transcode local files not allowed") - return + #if type.upper() == "FILE": + # self.send_error(404, "Transcode local files not allowed") + # #return transcoder = self._get_transcoder() try: diff -r 15d85ba360bb -r e8a82fc5f075 gmyth-stream/server/plugins/transcoders/gmencoder.py --- a/gmyth-stream/server/plugins/transcoders/gmencoder.py Mon Nov 19 18:06:11 2007 +0000 +++ b/gmyth-stream/server/plugins/transcoders/gmencoder.py Wed Nov 21 13:10:19 2007 +0000 @@ -46,14 +46,14 @@ self._insert_param("-i", \ "%s://%s" % (self.params_first("type", "file"), self.params_first("uri", ""))) - self._insert_param("--video-encode", self.params_first("ve", "ffenc_mpeg1video")) - self._insert_param("--video-opts", "bitrate=300000,pass=512,quantizer=0.01,quant-type=1") - #self._insert_param("--video-fps", self.params_first("fps", "")) + self._insert_param("--video-encode", self.params_first("ve", "theoraenc")) + self._insert_param("--video-opts", self.params_first ("video-opts", "quality=30,sharpness=2")) self._insert_param("--video-fps", self.params_first("fps", "10")) - self._insert_param("--video-width", self.params_first("width", "320")) - self._insert_param("--video-height", self.params_first("height", "240")) - self._insert_param("--audio-rate", "32000") - self._insert_param("--audio-encode", self.params_first("ae", "")) + self._insert_param("--video-width", self.params_first("width", "240")) + self._insert_param("--video-height", self.params_first("height", "144")) + self._insert_param("--audio-encode", self.params_first("ae", "vorbisenc")) + self._insert_param("--audio-opts", self.params_first ("audio-opts", "managed=true")) + self._insert_param("--mux-element", self.params_first("mux", "oggmux")) # _parse_params def start(self, outfd): @@ -72,8 +72,8 @@ self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE, stdout=subprocess.PIPE) - if outfile: - outfd.write("OK ") + if outfile: + outfd.write("OK ") except Exception, e: self.log.error(self.tid, "Error: executing GMencoder: %s" % e) diff -r 15d85ba360bb -r e8a82fc5f075 gmyth-stream/server/plugins/transcoders/mencoder.py --- a/gmyth-stream/server/plugins/transcoders/mencoder.py Mon Nov 19 18:06:11 2007 +0000 +++ b/gmyth-stream/server/plugins/transcoders/mencoder.py Wed Nov 21 13:10:19 2007 +0000 @@ -42,7 +42,6 @@ self.args["local"] = params_first("local", False) self.args["language"] = params_first("language", False) self.args["subtitle"] = params_first("subtitle", False) - self.args["format"] = params_first("format", "mpeg1") self.args["outfile"] = params_first("outfile", "-") # input_opt @@ -50,16 +49,15 @@ self.args["input"] = params_first("uri", "-") # audio_opts - self.args["acodec"] = params_first("acodec", "mp2") - self.args["abitrate"] = params_first("abitrate", 192) - self.args["volume"] = params_first("volume", 5) + self.args["acodec"] = params_first("acodec", "mp3lame") + self.args["abitrate"] = params_first("abitrate", 128) + self.args["volume"] = params_first("volume", 9) # video_opts - self.args["mux"] = params_first("mux", "mpeg") self.args["fps"] = params_first("fps", 25) - self.args["vcodec"] = params_first("vcodec", "mpeg1video") - self.args["vbitrate"] = params_first("vbitrate", 400) - self.args["width"] = params_first("width", 320) + self.args["vcodec"] = params_first("vcodec", "msmpeg4v2") + self.args["vbitrate"] = params_first("vbitrate", 500) + self.args["width"] = params_first("width", 400) self.args["height"] = params_first("height", 240) # _setup_params() @@ -77,20 +75,17 @@ def _setup_video(self): - video = " -of %s" % self.args["mux"] - video += " -ofps %s" % self.args["fps"] + #video = " -of %s" % self.args["mux"] + video = " -ofps %s" % self.args["fps"] vcodec = self.args["vcodec"] if vcodec == "nuv" or vcodec == "xvid"\ or vcodec == "qtvideo" or vcodec == "copy": video += " -ovc %s" % vcodec else: - video += " -ovc lavc -lavcopts vcodec=%s:vbitrate=%s" % ( + video += " -ovc lavc -lavcopts vcodec=%s:vhq:vbitrate=%s" % ( vcodec, self.args["vbitrate"]) - if self.args["mux"] == "mpeg": - video += " -mpegopts format=%s" % self.args["format"] - video += " -vf scale=%s:%s" % (self.args["width"], self.args["height"]) return video # _setup_video() @@ -274,6 +269,7 @@ def _run_mencoder(self, input=None, output=None): try: + print self.mencoder_opts self.proc = subprocess.Popen(self.mencoder_opts, stdin=input, stdout=output, close_fds=True) except Exception, e: