~ubuntu-branches/ubuntu/saucy/lazygal/saucy

« back to all changes in this revision

Viewing changes to lazygal/mediautils.py

  • Committer: Bazaar Package Importer
  • Author(s): Michal Čihař
  • Date: 2010-08-26 14:28:54 UTC
  • mfrom: (1.1.5 upstream) (2.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100826142854-131ez5ko2ajoe8tt
Tags: 0.5.1-1
* New upstream version.
  - Fixes problems with PyExiv 0.2.
  - Updates translations.
  - Fixed image-index theme.
* Bump standards to 3.9.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    import gobject
22
22
    import pygst
23
23
    pygst.require('0.10')
 
24
    # http://29a.ch/tags/pygst
 
25
    argv = sys.argv
 
26
    sys.argv = []
24
27
    import gst
 
28
    sys.argv = argv
25
29
except ImportError:
26
30
    HAVE_GST = False
27
31
else:
83
87
                raise TranscodeError(message.parse_error())
84
88
 
85
89
 
86
 
class GstVideoInspector(GstVideoOpener):
87
 
 
88
 
    def __init__(self):
89
 
        super(GstVideoInspector, self).__init__()
90
 
 
91
 
        fakesink = gst.element_factory_make("fakesink")
92
 
        self.pipeline.add(fakesink)
93
 
        self.decode.link(fakesink)
94
 
 
95
 
    def inspect(self, file_path):
96
 
        self.open(file_path)
97
 
 
98
 
        props = {}
99
 
        return props
100
 
 
101
 
 
102
90
class GstVideoConverter(GstVideoOpener):
103
91
 
104
92
    def __init__(self):
190
178
        self.oggmux.link(self.oqueue)
191
179
 
192
180
 
193
 
class VideoThumbnailer(GstVideoConverter):
194
 
 
195
 
    def __init__(self):
196
 
        super(VideoThumbnailer, self).__init__()
197
 
 
198
 
        # Working pipeline
199
 
        # gst-launch-0.10 filesrc location=surf_luge.mov num-buffers=1
200
 
        # ! decodebin ! queue ! ffmpegcolorspace ! jpegenc
201
 
        # ! filesink location=surf_luge_thumb.jpg sync=false
202
 
        # other :
203
 
        # decodebin2 ! videoscale ! video/x-raw-yuv,width=160,height=160 !
204
 
        # jpegenc name=enc
205
 
 
206
 
        # Video
207
 
        self.decode_video()
208
 
 
209
 
 
210
181
if __name__ == '__main__':
211
182
    import sys, os
212
183
    converter = OggTheoraConverter()
213
 
    thumbnailer = VideoThumbnailer()
214
184
    for file_path in sys.argv[1:]:
215
185
        fn, ext = os.path.splitext(file_path)
216
186
        ogg_path = fn + '.ogg'
217
187
        converter.convert(file_path, ogg_path)
218
 
        thumb_path = fn + '_thumb.jpg'
219
 
        thumbnailer.convert(file_path, thumb_path)
220
188
 
221
189
 
222
190
# vim: ts=4 sw=4 expandtab