only extract audio, video if source has it
This commit is contained in:
parent
2ad9961d59
commit
46a80d8418
1 changed files with 4 additions and 1 deletions
|
@ -43,8 +43,11 @@ class Video(gst.Pipeline):
|
||||||
self.sbin.props.expose_all_streams = True
|
self.sbin.props.expose_all_streams = True
|
||||||
self.add(self.src, self.sbin)
|
self.add(self.src, self.sbin)
|
||||||
|
|
||||||
if self.video:
|
|
||||||
info = ox.avinfo(uri)
|
info = ox.avinfo(uri)
|
||||||
|
self.audio = self.audio and info['audio'] != []
|
||||||
|
self.video = self.video and info['video'] != []
|
||||||
|
|
||||||
|
if self.video:
|
||||||
ratio = info['video'][0]['width'] / info['video'][0]['height']
|
ratio = info['video'][0]['width'] / info['video'][0]['height']
|
||||||
self.width = int(round(self.height * ratio))
|
self.width = int(round(self.height * ratio))
|
||||||
if self.width % 4:
|
if self.width % 4:
|
||||||
|
|
Loading…
Reference in a new issue