Collect metrics around cutting time

pull/133/head
Mike Lang 5 years ago
parent 8ad61e9870
commit 4f900c5925

@ -328,6 +328,7 @@ def read_chunks(fileobj, chunk_size=16*1024):
yield chunk yield chunk
@timed('cut', type='fast', normalize=lambda _, segments, start, end: (end - start).total_seconds())
def fast_cut_segments(segments, start, end): def fast_cut_segments(segments, start, end):
"""Yields chunks of a MPEGTS video file covering the exact timestamp range. """Yields chunks of a MPEGTS video file covering the exact timestamp range.
segments should be a list of segments as returned by get_best_segments(). segments should be a list of segments as returned by get_best_segments().
@ -400,6 +401,7 @@ def fast_cut_segments(segments, start, end):
yield chunk yield chunk
@timed('cut', type='full', normalize=lambda _, segments, start, end, encode_args: (end - start).total_seconds())
def full_cut_segments(segments, start, end, encode_args): def full_cut_segments(segments, start, end, encode_args):
# how far into the first segment to begin # how far into the first segment to begin
cut_start = max(0, (start - segments[0].start).total_seconds()) cut_start = max(0, (start - segments[0].start).total_seconds())

Loading…
Cancel
Save