Skip to content

Commit

Permalink
added comment of fix and an index variable
Browse files Browse the repository at this point in the history
  • Loading branch information
aldilaff committed Apr 13, 2017
1 parent 69e51c1 commit f156c95
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions moviepy/video/io/ffmpeg_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,9 @@ def ffmpeg_parse_infos(filename, print_infos=False, check_duration=True):
if check_duration:
try:
keyword = ('frame=' if is_GIF else 'Duration: ')
if is_GIF:
line = [l for l in lines if keyword in l][-1]
else:
line = [l for l in lines if keyword in l][0]
# for large GIFS the "full" duration is presented as the last element in the list.
index = -1 if is_GIF else 0
line = [l for l in lines if keyword in l][index]
match = re.findall("([0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9])", line)[0]
result['duration'] = cvsecs(match)
except:
Expand Down

0 comments on commit f156c95

Please sign in to comment.