From 46a80d8418634cb26daa68f40bcf7436fd3939e1 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 1 Jun 2012 11:36:38 +0200 Subject: [PATCH] only extract audio, video if source has it --- oxtimelines/timeline.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oxtimelines/timeline.py b/oxtimelines/timeline.py index 9624a06..8be0054 100644 --- a/oxtimelines/timeline.py +++ b/oxtimelines/timeline.py @@ -43,8 +43,11 @@ class Video(gst.Pipeline): self.sbin.props.expose_all_streams = True self.add(self.src, self.sbin) + info = ox.avinfo(uri) + self.audio = self.audio and info['audio'] != [] + self.video = self.video and info['video'] != [] + if self.video: - info = ox.avinfo(uri) ratio = info['video'][0]['width'] / info['video'][0]['height'] self.width = int(round(self.height * ratio)) if self.width % 4: