changed documentation
git-svn-id: http://yolanda.mister-muffin.de/svn@394 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
0f73d409d5
commit
86f3f3df53
1 changed files with 10 additions and 8 deletions
|
@ -30,8 +30,7 @@ import gst
|
||||||
|
|
||||||
class Encode:
|
class Encode:
|
||||||
"""
|
"""
|
||||||
Encode will allow you to convert all your media that gstreamer is
|
Converts media files gstreamer can play to Ogg Theora + Vorbis.
|
||||||
capable of playing into an ogg/vorbis/theora file
|
|
||||||
"""
|
"""
|
||||||
def _build_pipeline(self):
|
def _build_pipeline(self):
|
||||||
self.player = gst.Pipeline("player")
|
self.player = gst.Pipeline("player")
|
||||||
|
@ -83,22 +82,22 @@ class Encode:
|
||||||
def __init__(self, source, destination, videoquality=16, quick=True, sharpness=2,
|
def __init__(self, source, destination, videoquality=16, quick=True, sharpness=2,
|
||||||
video=True, audio=True, audioquality=0.1):
|
video=True, audio=True, audioquality=0.1):
|
||||||
if not os.path.isfile(source):
|
if not os.path.isfile(source):
|
||||||
raise IOError, "cannot read file"
|
raise IOError, "input file does not exist"
|
||||||
self.source = source
|
self.source = source
|
||||||
self.destination = destination
|
self.destination = destination
|
||||||
if not video and not audio:
|
if not video and not audio:
|
||||||
raise AttributeError, "must contain video or audio"
|
raise AttributeError, "input file does not contain video or audio"
|
||||||
self.video = bool(video)
|
self.video = bool(video)
|
||||||
self.audio = bool(audio)
|
self.audio = bool(audio)
|
||||||
if not 1 <= int(videoquality) <= 63:
|
if not 1 <= int(videoquality) <= 63:
|
||||||
raise ValueError, "videoquality ranges from 1-63"
|
raise ValueError, "videoquality out of range 1-63"
|
||||||
self.videoquality=int(videoquality)
|
self.videoquality=int(videoquality)
|
||||||
self.quick = bool(quick)
|
self.quick = bool(quick)
|
||||||
if not 0 <= int(sharpness) <= 2:
|
if not 0 <= int(sharpness) <= 2:
|
||||||
raise ValueError, "sharpness ranges from 0-2"
|
raise ValueError, "sharpness ouf of range 0-2"
|
||||||
self.sharpness = int(sharpness)
|
self.sharpness = int(sharpness)
|
||||||
if not 0 <= float(audioquality) <= 1.0:
|
if not 0 <= float(audioquality) <= 1.0:
|
||||||
raise ValueError, "audioquality ranges from 0.0-1.0"
|
raise ValueError, "audioquality out of range 0.0-1.0"
|
||||||
self.audioquality = float(audioquality)
|
self.audioquality = float(audioquality)
|
||||||
|
|
||||||
self.failed = False
|
self.failed = False
|
||||||
|
@ -106,6 +105,9 @@ class Encode:
|
||||||
self.mainloop = gobject.MainLoop()
|
self.mainloop = gobject.MainLoop()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
"""
|
||||||
|
Starts the actual encoding process.
|
||||||
|
"""
|
||||||
self.mainloop.run()
|
self.mainloop.run()
|
||||||
return not self.failed
|
return not self.failed
|
||||||
|
|
||||||
|
@ -133,7 +135,7 @@ def main(args):
|
||||||
print 'usage: %s file' % args[0]
|
print 'usage: %s file' % args[0]
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
encode = Encode(args[1], args[1]+".ogg")
|
encode = Encode(args[1], args[1]+".ogv")
|
||||||
encode.run()
|
encode.run()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue