Python script to generate the video thumbnails
Using avconv
This commit is contained in:
parent
c301ad3a60
commit
537a2cb1f5
7
Makefile
7
Makefile
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
LATEX=lualatex
|
||||||
TARGET=presentation.tex
|
TARGET=presentation.tex
|
||||||
|
|
||||||
DOT=$(wildcard figs/*.dot)
|
DOT=$(wildcard figs/*.dot)
|
||||||
|
@ -15,13 +16,17 @@ all: paper
|
||||||
|
|
||||||
twopi -Tsvg -o$(@) $(<)
|
twopi -Tsvg -o$(@) $(<)
|
||||||
|
|
||||||
|
thumbs:
|
||||||
|
|
||||||
|
python make_video_preview.py ${TARGET}
|
||||||
|
|
||||||
bib: $(TARGET:.tex=.aux)
|
bib: $(TARGET:.tex=.aux)
|
||||||
|
|
||||||
BSTINPUTS=:./sty bibtex $(TARGET:.tex=.aux)
|
BSTINPUTS=:./sty bibtex $(TARGET:.tex=.aux)
|
||||||
|
|
||||||
paper: $(TARGET) $(SVG:.svg=.pdf) $(DOT:.dot=.pdf)
|
paper: $(TARGET) $(SVG:.svg=.pdf) $(DOT:.dot=.pdf)
|
||||||
|
|
||||||
TEXINPUTS=:./sty xelatex $(TARGET)
|
TEXINPUTS=:./sty $(LATEX) $(TARGET)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.spl *.idx *.aux *.log *.snm *.out *.toc *.nav *intermediate *~ *.glo *.ist *.bbl *.blg $(SVG:.svg=.pdf) $(DOT:.dot=.svg) $(DOT:.dot=.pdf)
|
rm -f *.spl *.idx *.aux *.log *.snm *.out *.toc *.nav *intermediate *~ *.glo *.ist *.bbl *.blg $(SVG:.svg=.pdf) $(DOT:.dot=.svg) $(DOT:.dot=.pdf)
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
from subprocess import call
|
||||||
|
|
||||||
|
video = re.compile('.*video.*{(?P<file>.*\..*?)(\?.*?(start=(?P<starttime>\d*).*)?)?}')
|
||||||
|
with open(sys.argv[1],'r') as tex:
|
||||||
|
for line in tex.readlines():
|
||||||
|
found = video.search(line)
|
||||||
|
if found:
|
||||||
|
starttime = found.group('starttime')
|
||||||
|
if starttime:
|
||||||
|
starttime = int(starttime)
|
||||||
|
else:
|
||||||
|
starttime = 0
|
||||||
|
cmd = "avconv -i " + found.group('file') + " -r 1 -vframes 1 -ss " + str(starttime) + " " + found.group('file').split('.')[0] + "_thumb.jpg"
|
||||||
|
print("%s starting at %d" % (found.group('file'), starttime))
|
||||||
|
print("> " + cmd)
|
||||||
|
call(cmd, shell=True)
|
Loading…
Reference in New Issue