Skip to content

Commit

Permalink
more useful default settings and eleminating the cue identifierers
Browse files Browse the repository at this point in the history
* the presence of the 'sips' executable is now autodetected to let it
  work out of the box on non-mac machines

* TIMESYNC_ADJUST isn't neccessary on more recent ffmpeg executables.
  if not set to -1 the time stamps will not start with 0:00.000, which
  is not accepted by some applicationes
  (see: matvp91/indigo-player#56)

* explicit cue identifierers in the output don't make much sense and
  also tend to be incompatible. (e.g. in case of indigo-player)
  • Loading branch information
mur.at ML group committed Mar 3, 2020
1 parent 00f05bb commit 5da6cc9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sprites/makesprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import math
import glob
import pipes
from distutils.spawn import find_executable
from dateutil import relativedelta
##################################
# Generate tooltip thumbnail images & corresponding WebVTT file for a video (e.g MP4).
Expand All @@ -24,15 +25,15 @@

#TODO determine optimal number of images/segment distance based on length of video? (so longer videos don't have huge sprites)

USE_SIPS = True #True to use sips if using MacOSX (creates slightly smaller sprites), else set to False to use ImageMagick
THUMB_RATE_SECONDS=45 # every Nth second take a snapshot
THUMB_WIDTH=100 #100-150 is width recommended by JWPlayer; I like smaller files
USE_SIPS = bool(find_executable('sips')) #True to use sips if using MacOSX (creates slightly smaller sprites), else set to False to use ImageMagick
THUMB_RATE_SECONDS=10 # every Nth second take a snapshot
THUMB_WIDTH=320 #100-150 is width recommended by JWPlayer; I like smaller files
SKIP_FIRST=True #True to skip a thumbnail of second 1; often not a useful image, plus JWPlayer doesn't seem to show it anyway, and user knows beginning without needing preview
SPRITE_NAME = "sprite.jpg" #jpg is much smaller than png, so using jpg
VTTFILE_NAME = "thumbs.vtt"
THUMB_OUTDIR = "thumbs"
USE_UNIQUE_OUTDIR = False #true to make a unique timestamped output dir each time, else False to overwrite/replace existing outdir
TIMESYNC_ADJUST = -.5 #set to 1 to not adjust time (gets multiplied by thumbRate); On my machine,ffmpeg snapshots show earlier images than expected timestamp by about 1/2 the thumbRate (for one vid, 10s thumbrate->images were 6s earlier than expected;45->22s early,90->44 sec early)
TIMESYNC_ADJUST = -1 #set to -1 to not adjust time (gets multiplied by thumbRate); On my machine,ffmpeg snapshots show earlier images than expected timestamp by about 1/2 the thumbRate (for one vid, 10s thumbrate->images were 6s earlier than expected;45->22s early,90->44 sec early)
logger = logging.getLogger(sys.argv[0])
logSetup=False

Expand Down Expand Up @@ -187,7 +188,7 @@ def makevtt(spritefile,numsegments,coords,gridsize,writefile,thumbRate=None):
end = get_time_str(clipend,adjust=adjust)
clipstart = clipend
clipend += thumbRate
vtt.append("Img %d" % imgnum)
# vtt.append("Img %d" % imgnum)
vtt.append("%s --> %s" % (start,end)) #00:00.000 --> 00:05.000
vtt.append("%s#xywh=%s" % (basefile,xywh))
vtt.append("") #Linebreak
Expand Down

0 comments on commit 5da6cc9

Please sign in to comment.