Revert previous change

This commit is contained in:
Dylan 2024-01-23 17:31:23 +00:00
parent 17167bd27c
commit 9493004920

View File

@ -49,10 +49,8 @@ def get_video_length_seconds(filename):
def calcEdits(vlen,loopTimes): def calcEdits(vlen,loopTimes):
st="r" st="r"
currTime=0.0
for i in range(loopTimes): for i in range(loopTimes):
st+=f'e{str(currTime)}-9999,0' st+=f'e{str((vlen*i))}-9999,0'
currTime+=vlen
return st return st
def loop_video_until_length(filename, length): def loop_video_until_length(filename, length):
@ -61,9 +59,9 @@ def loop_video_until_length(filename, length):
if video_length < length: if video_length < length:
loops = int(length/video_length) loops = int(length/video_length)
new_filename = tempfile.mkstemp(suffix=".mp4")[1] new_filename = tempfile.mkstemp(suffix=".mp4")[1]
edits = calcEdits(video_length,loops) #edits = calcEdits(video_length,loops)
#out = subprocess.call(["ffmpeg","-stream_loop",str(loops),"-i",filename,"-c","copy","-y",new_filename],stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT) out = subprocess.call(["ffmpeg","-stream_loop",str(loops),"-i",filename,"-c","copy","-y",new_filename],stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
subprocess.run(["./MP4Box", "-add",filename,"-edits",f'1={edits}',new_filename]) #subprocess.run(["./MP4Box", "-add",filename,"-edits",f'1={edits}',new_filename])
return new_filename return new_filename
else: else:
return filename return filename