'match_thr
The smaller, the better-looping the gifs are.
min_time_span
Only GIFs with a duration longer than min_time_span (in seconds)
will be extracted.
nomatch_thr
If None, then it is chosen equal to match_thr'

def select_scenes(self, match_thr, min_time_span, nomatch_thr=None, time_distance=0):

    if (nomatch_thr is None):
        nomatch_thr = match_thr
    dict_starts = defaultdict((lambda : []))
    for (start, end, d_min, d_max) in self:
        dict_starts[start].append([end, d_min, d_max])
    starts_ends = sorted(dict_starts.items(), key=(lambda k: k[0]))
    result = []
    min_start = 0
    for (start, ends_distances) in starts_ends:
        if (start < min_start):
            continue
        ends = [end for (end, d_min, d_max) in ends_distances]
        great_matches = [(end, d_min, d_max) for (end, d_min, d_max) in ends_distances if (d_max < match_thr)]
        great_long_matches = [(end, d_min, d_max) for (end, d_min, d_max) in great_matches if ((end - start) > min_time_span)]
        if (great_long_matches == []):
            continue
        poor_matches = set([end for (end, d_min, d_max) in ends_distances if (d_min > nomatch_thr)])
        short_matches = [end for end in ends if ((end - start) <= 0.6)]
        if (len(poor_matches.intersection(short_matches)) == 0):
            continue
        end = max([end for (end, d_min, d_max) in great_long_matches])
        (end, d_min, d_max) = [e for e in great_long_matches if (e[0] == end)][0]
        result.append(FramesMatch(start, end, d_min, d_max))
        min_start = (start + time_distance)
    return FramesMatches(result)
