dummy clips should have real length

This commit is contained in:
jb-alvarado 2019-03-27 09:34:13 +01:00
parent 3f16900448
commit 1854284029
2 changed files with 14 additions and 22 deletions

View File

@ -78,7 +78,8 @@ ffmpeg_copy_settings = ["-c", "copy", "-bsf:v", "h264_mp4toannexb", "-threads",
# day_start means at witch hour starts the day, as integer # day_start means at witch hour starts the day, as integer
# filler_path are for the GUI only at the moment # filler_path are for the GUI only at the moment
# filler_clip get handle different, when a new length needs to calculate # filler_clip get handle different, when a new length needs to calculate
# blackclip is for stream copy mode # blackclip is for stream copy mode,
# best for this is a ~4 hours clip with black color and soft noise sound
# time_shift adds or subtract seconds to the clip start, # time_shift adds or subtract seconds to the clip start,
# this is usefull for example for hls, because it have a big delay # this is usefull for example for hls, because it have a big delay
@ -94,7 +95,7 @@ playlist_path = /playlists
clips_root = /media clips_root = /media
filler_path = /media/filler/filler-clips filler_path = /media/filler/filler-clips
filler_clip = /media/filler/seperator.clock.mp4 filler_clip = /media/filler/seperator.clock.mp4
blackclip = /opt/dummy20.mkv blackclip = /opt/dummy.mkv
day_start = 06:00:00.000 day_start = 06:00:00.000
time_shift = 35 time_shift = 35
map_extension = map_extension =

View File

@ -481,7 +481,7 @@ def gen_dummy(duration):
# when source path exist, generate input with seek and out time # when source path exist, generate input with seek and out time
# when path not exist, generate dummy clip # when path not exist, generate dummy clip
def src_or_dummy(src, dur, seek, out, dummy_len=None): def src_or_dummy(src, dur, seek, out):
if src: if src:
prefix = src.split('://')[0] prefix = src.split('://')[0]
@ -493,12 +493,9 @@ def src_or_dummy(src, dur, seek, out, dummy_len=None):
else: else:
mailer('Clip not exist:', get_time(None), src) mailer('Clip not exist:', get_time(None), src)
logger.error('Clip not exist: {}'.format(src)) logger.error('Clip not exist: {}'.format(src))
if dummy_len and not _pre_comp.copy: return gen_dummy(out - seek)
return gen_dummy(dummy_len)
else:
return gen_dummy(out - seek)
else: else:
return gen_dummy(dummy_len) return gen_dummy(out - seek)
# prepare input clip # prepare input clip
@ -646,7 +643,6 @@ class GetSourceIter:
self.last = False self.last = False
self.list_date = get_date(True) self.list_date = get_date(True)
self.is_dummy = False self.is_dummy = False
self.dummy_len = 20
self.has_begin = False self.has_begin = False
self.init_time = get_time('full_sec') self.init_time = get_time('full_sec')
self.last_error = '' self.last_error = ''
@ -711,11 +707,8 @@ class GetSourceIter:
self.duration = 20 self.duration = 20
mailer('Clip not exist:', get_time(None), self.src) mailer('Clip not exist:', get_time(None), self.src)
logger.error('Clip not exist: {}'.format(self.src)) logger.error('Clip not exist: {}'.format(self.src))
if self.dummy_len and not _pre_comp.copy: self.src = None
self.src = None self.out = 20
else:
self.src = None
self.dummy_len = 20
elif is_float(output): elif is_float(output):
self.duration = float(output) self.duration = float(output)
else: else:
@ -740,7 +733,7 @@ class GetSourceIter:
if is_float(node["duration"]): if is_float(node["duration"]):
self.duration = node["duration"] self.duration = node["duration"]
else: else:
self.duration = self.dummy_len self.duration = 20
if is_float(node["out"]): if is_float(node["out"]):
self.out = node["out"] self.out = node["out"]
@ -791,7 +784,6 @@ class GetSourceIter:
self.seek = 0.0 self.seek = 0.0
self.out = 20 self.out = 20
self.duration = 20 self.duration = 20
self.dummy_len = 20
self.ad = False self.ad = False
day_in_sec = 86400.0 day_in_sec = 86400.0
@ -801,13 +793,12 @@ class GetSourceIter:
if 0 <= time < _playlist.start: if 0 <= time < _playlist.start:
time += day_in_sec time += day_in_sec
time_diff = _buffer.length + _buffer.tol + self.dummy_len + time time_diff = _buffer.length + _buffer.tol + self.out - self.seek + time
new_len = self.dummy_len - (time_diff - ref_time) new_len = self.out - self.seek - (time_diff - ref_time)
if new_len <= 1800: if new_len <= 1800:
self.out = abs(new_len) self.out = abs(new_len)
self.duration = 20 self.duration = abs(new_len)
self.dummy_len = abs(new_len)
self.list_date = get_date(False) self.list_date = get_date(False)
self.last_mod_time = 0.0 self.last_mod_time = 0.0
self.first = False self.first = False
@ -816,7 +807,7 @@ class GetSourceIter:
else: else:
self.list_date = get_date(True) self.list_date = get_date(True)
self.src_cmd = gen_dummy(self.dummy_len) self.src_cmd = gen_dummy(self.out - self.seek)
self.is_dummy = True self.is_dummy = True
self.set_filtergraph() self.set_filtergraph()
@ -893,7 +884,7 @@ class GetSourceIter:
# when playlist is finish and we have time left # when playlist is finish and we have time left
self.list_date = get_date(False) self.list_date = get_date(False)
self.last_time = self.begin self.last_time = self.begin
self.dummy_len = self.time_left self.out = self.time_left
self.error_handling('Playlist is not valid!') self.error_handling('Playlist is not valid!')