Skip to content

Commit

Permalink
Restore loopable video creation
Browse files Browse the repository at this point in the history
this function was removed and is now restored, fixes issue #5
  • Loading branch information
Trekky12 committed Jan 30, 2021
1 parent 4e69b5d commit fd3534e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions slideshow/SlideManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import logging
import re
import importlib
import copy

from .ImageSlide import ImageSlide
from .VideoSlide import VideoSlide
Expand Down Expand Up @@ -65,6 +66,10 @@ def __init__(self, config={}, input_files=[], audio_files=[]):
else:
self.addSlide(file)

if self.config["loopable"] and len(self.slides) > 0:
first_slide = copy.copy(self.slides[0])
self.slides.append(first_slide)

for file in audio_files:
self.addAudio(file)

Expand Down Expand Up @@ -166,8 +171,6 @@ def getImageSlides(self):
return [slide for slide in self.getSlides() if isinstance(slide, ImageSlide)]

def getSlides(self):
if self.config["loopable"]:
return self.slides + [self.slides[0]]
return self.slides

def removeSlide(self, index):
Expand Down Expand Up @@ -758,7 +761,9 @@ def getFinalVideoCommand(self, output_file, burnSubtitles, srtInput,
# filters
"-filter_complex_script \"%s\"" % (temp_filter_script),
# define duration
"-t %s" % (self.getTotalDuration()),
# if video should be loopable, skip the start fade-in (-ss) and the end fade-out (video is stopped after the fade-in of the last image which is the same as the first-image)
"-ss %s -t %s" %(self.getSlideFadeOutDuration(0)/ self.config["fps"], self.getOffset(-1, False)) if self.config["loopable"] else "-t %s" %(self.getTotalDuration()),
#"-t %s" % (self.getTotalDuration()),
# define output
"-map", "[out]:v",
"-c:v %s" % (self.config["output_codec"]) if self.config["output_codec"] else "",
Expand Down

0 comments on commit fd3534e

Please sign in to comment.