diff options
-rw-r--r-- | mediagoblin/media_types/video/transcoders.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/mediagoblin/media_types/video/transcoders.py b/mediagoblin/media_types/video/transcoders.py index 152de288..7a8166c4 100644 --- a/mediagoblin/media_types/video/transcoders.py +++ b/mediagoblin/media_types/video/transcoders.py @@ -477,8 +477,8 @@ from playbin') _log.debug('thumbnail message: {0}'.format(message)) if message.type == gst.MESSAGE_ERROR: - _log.error('thumbnail error: {0}'.format(message)) - gobject.idle_add(self.on_thumbnail_error) + _log.error('thumbnail error: {0}'.format(message.parse_error())) + gobject.idle_add(self.on_thumbnail_error, message) if message.type == gst.MESSAGE_STATE_CHANGED: prev_state, cur_state, pending_state = \ @@ -570,9 +570,17 @@ pending: {2}'.format( return False - def on_thumbnail_error(self): + def on_thumbnail_error(self, message): _log.error('Thumbnailing failed.') self.disconnect() + if 'Error calculating the output scaled size - integer overflow' in message.parse_error()[1]: + _log.error('Retrying with manually set sizes...') + info = VideoTranscoder().discover(self.source_path) + h = info['videoheight'] + w = info['videowidth'] + ratio = 180 / int(w) + h = int(h * ratio) + self.__init__(self.source_path, self.dest_path, 180, h) def disconnect(self): self.state = self.STATE_HALTING @@ -1007,4 +1015,4 @@ if __name__ == '__main__': print('I\'m a callback!') transcoder.transcode(*args, progress_callback=cb) elif options.action == 'discover': - print transcoder.discover(*args).__dict__ + print transcoder.discover(*args) |