[svn r889] updated to use theora trunk
authorrenatofilho
Wed Nov 21 13:10:19 2007 +0000 (2007-11-21)
branchtrunk
changeset 883e8a82fc5f075
parent 882 15d85ba360bb
child 884 d3d62eca131c
[svn r889] updated to use theora
gmyth-stream/server/lib/request_handler.py
gmyth-stream/server/plugins/transcoders/gmencoder.py
gmyth-stream/server/plugins/transcoders/mencoder.py
     1.1 --- a/gmyth-stream/server/lib/request_handler.py	Mon Nov 19 18:06:11 2007 +0000
     1.2 +++ b/gmyth-stream/server/lib/request_handler.py	Wed Nov 21 13:10:19 2007 +0000
     1.3 @@ -411,9 +411,9 @@
     1.4  
     1.5      def serve_transcode(self, body):
     1.6          type = self.query.get("type", None)[0]
     1.7 -        if type.upper() == "FILE":
     1.8 -            self.send_error(404, "Transcode local files not allowed")
     1.9 -            return
    1.10 +        #if type.upper() == "FILE":
    1.11 +        #    self.send_error(404, "Transcode local files not allowed")
    1.12 +        #   #return
    1.13  
    1.14          transcoder = self._get_transcoder()
    1.15          try:
     2.1 --- a/gmyth-stream/server/plugins/transcoders/gmencoder.py	Mon Nov 19 18:06:11 2007 +0000
     2.2 +++ b/gmyth-stream/server/plugins/transcoders/gmencoder.py	Wed Nov 21 13:10:19 2007 +0000
     2.3 @@ -46,14 +46,14 @@
     2.4          self._insert_param("-i", \
     2.5              "%s://%s" % (self.params_first("type", "file"),
     2.6                           self.params_first("uri", "")))
     2.7 -        self._insert_param("--video-encode", self.params_first("ve", "ffenc_mpeg1video"))
     2.8 -        self._insert_param("--video-opts", "bitrate=300000,pass=512,quantizer=0.01,quant-type=1")
     2.9 -        #self._insert_param("--video-fps", self.params_first("fps", ""))
    2.10 +        self._insert_param("--video-encode", self.params_first("ve", "theoraenc"))
    2.11 +        self._insert_param("--video-opts", self.params_first ("video-opts", "quality=30,sharpness=2"))
    2.12          self._insert_param("--video-fps", self.params_first("fps", "10"))
    2.13 -        self._insert_param("--video-width", self.params_first("width", "320"))
    2.14 -        self._insert_param("--video-height", self.params_first("height", "240"))
    2.15 -        self._insert_param("--audio-rate", "32000")
    2.16 -        self._insert_param("--audio-encode", self.params_first("ae", ""))
    2.17 +        self._insert_param("--video-width", self.params_first("width", "240"))
    2.18 +        self._insert_param("--video-height", self.params_first("height", "144"))
    2.19 +        self._insert_param("--audio-encode", self.params_first("ae", "vorbisenc"))
    2.20 +        self._insert_param("--audio-opts", self.params_first ("audio-opts", "managed=true"))
    2.21 +        self._insert_param("--mux-element", self.params_first("mux", "oggmux"))
    2.22      # _parse_params
    2.23  
    2.24      def start(self, outfd):
    2.25 @@ -72,8 +72,8 @@
    2.26              self.proc = subprocess.Popen(self.opts, stdin=subprocess.PIPE,
    2.27                                           stdout=subprocess.PIPE)
    2.28  
    2.29 -	    if outfile:
    2.30 -           	outfd.write("OK   ")
    2.31 +            if outfile:
    2.32 +               outfd.write("OK   ")
    2.33  
    2.34          except Exception, e:
    2.35              self.log.error(self.tid, "Error: executing GMencoder: %s" % e)
     3.1 --- a/gmyth-stream/server/plugins/transcoders/mencoder.py	Mon Nov 19 18:06:11 2007 +0000
     3.2 +++ b/gmyth-stream/server/plugins/transcoders/mencoder.py	Wed Nov 21 13:10:19 2007 +0000
     3.3 @@ -42,7 +42,6 @@
     3.4          self.args["local"]    = params_first("local", False)
     3.5          self.args["language"] = params_first("language", False)
     3.6          self.args["subtitle"] = params_first("subtitle", False)
     3.7 -        self.args["format"]   = params_first("format", "mpeg1")
     3.8          self.args["outfile"]  = params_first("outfile", "-")
     3.9  
    3.10          # input_opt
    3.11 @@ -50,16 +49,15 @@
    3.12          self.args["input"]    = params_first("uri", "-")
    3.13  
    3.14          # audio_opts
    3.15 -        self.args["acodec"]   = params_first("acodec", "mp2")
    3.16 -        self.args["abitrate"] = params_first("abitrate", 192)
    3.17 -        self.args["volume"]   = params_first("volume", 5)
    3.18 +        self.args["acodec"]   = params_first("acodec", "mp3lame")
    3.19 +        self.args["abitrate"] = params_first("abitrate", 128)
    3.20 +        self.args["volume"]   = params_first("volume", 9)
    3.21  
    3.22          # video_opts
    3.23 -        self.args["mux"]      = params_first("mux", "mpeg")
    3.24          self.args["fps"]      = params_first("fps", 25)
    3.25 -        self.args["vcodec"]   = params_first("vcodec", "mpeg1video")
    3.26 -        self.args["vbitrate"] = params_first("vbitrate", 400)
    3.27 -        self.args["width"]    = params_first("width", 320)
    3.28 +        self.args["vcodec"]   = params_first("vcodec", "msmpeg4v2")
    3.29 +        self.args["vbitrate"] = params_first("vbitrate", 500)
    3.30 +        self.args["width"]    = params_first("width", 400)
    3.31          self.args["height"]   = params_first("height", 240)
    3.32      # _setup_params()
    3.33  
    3.34 @@ -77,20 +75,17 @@
    3.35  
    3.36  
    3.37      def _setup_video(self):
    3.38 -        video = " -of %s" % self.args["mux"]
    3.39 -        video += " -ofps %s" % self.args["fps"]
    3.40 +        #video = " -of %s" % self.args["mux"]
    3.41 +        video = " -ofps %s" % self.args["fps"]
    3.42  
    3.43          vcodec = self.args["vcodec"]
    3.44          if vcodec == "nuv" or vcodec == "xvid"\
    3.45                 or vcodec == "qtvideo" or vcodec == "copy":
    3.46              video += " -ovc %s" % vcodec
    3.47          else:
    3.48 -            video += " -ovc lavc -lavcopts vcodec=%s:vbitrate=%s" % (
    3.49 +            video += " -ovc lavc -lavcopts vcodec=%s:vhq:vbitrate=%s" % (
    3.50                  vcodec, self.args["vbitrate"])
    3.51  
    3.52 -        if self.args["mux"] == "mpeg":
    3.53 -            video += " -mpegopts format=%s" % self.args["format"]
    3.54 -
    3.55          video += " -vf scale=%s:%s" % (self.args["width"], self.args["height"])
    3.56          return video
    3.57      # _setup_video()
    3.58 @@ -274,6 +269,7 @@
    3.59  
    3.60      def _run_mencoder(self, input=None, output=None):
    3.61          try:
    3.62 +            print self.mencoder_opts
    3.63              self.proc = subprocess.Popen(self.mencoder_opts, stdin=input,
    3.64                                           stdout=output, close_fds=True)
    3.65          except Exception, e: