Skip to content

Commit

Permalink
Adding default start timecode
Browse files Browse the repository at this point in the history
  • Loading branch information
fppont committed Sep 23, 2021
1 parent 6b499f6 commit cb7a251
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ffprobe/ffprobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, path_to_video):
self.audio = []
self.subtitle = []
self.attachment = []
self.timecode = None

for line in iter(p.stdout.readline, b''):
line = line.decode('UTF-8', 'ignore')
Expand Down Expand Up @@ -92,6 +93,11 @@ def __init__(self, path_to_video):
elif stream:
data_lines.append(line)

if 'timecode' in line:
if match := re.search('(\d\d:\d\d:\d\d:\d\d)', line, re.IGNORECASE):
self.timecode = match.group(1)


p.stdout.close()
p.stderr.close()

Expand All @@ -108,7 +114,7 @@ def __init__(self, path_to_video):
raise IOError('No such media file or stream is not responding: ' + self.path_to_video)

def __repr__(self):
return "<FFprobe: {metadata}, {video}, {audio}, {subtitle}, {attachment}>".format(**vars(self))
return "<FFprobe: {metadata}, {video}, {audio}, {subtitle}, {attachment}, {timecode}>".format(**vars(self))


class FFStream:
Expand Down

0 comments on commit cb7a251

Please sign in to comment.