auto-generate pause-loop as mp4 and dv-file

This commit is contained in:
MaZderMind 2014-03-07 17:29:49 +01:00
parent cd3712582f
commit ffd0862783
3 changed files with 317 additions and 0 deletions

1
2014/.gitignore vendored
View file

@ -1,3 +1,4 @@
*.mp4 *.mp4
*.dv
schedule.de.xml schedule.de.xml

238
2014/artwork/pause.svg Normal file
View file

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="720"
height="576"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="pause.svg">
<defs
id="defs20">
<filter
id="filter3772"
style="color-interpolation-filters:sRGB;"
inkscape:label="Drop Shadow">
<feFlood
id="feFlood3774"
flood-opacity="0.5"
flood-color="rgb(255,255,255)"
result="flood" />
<feComposite
id="feComposite3776"
in2="SourceGraphic"
in="flood"
operator="in"
result="composite1" />
<feGaussianBlur
id="feGaussianBlur3778"
in="composite"
stdDeviation="3"
result="blur" />
<feOffset
id="feOffset3780"
dx="1"
dy="1"
result="offset" />
<feComposite
id="feComposite3782"
in2="offset"
in="SourceGraphic"
operator="over"
result="composite2" />
</filter>
<filter
color-interpolation-filters="sRGB"
id="filter3772-5"
inkscape:label="Drop Shadow">
<feFlood
id="feFlood3774-9"
flood-opacity="0.5"
flood-color="rgb(255,255,255)"
result="flood" />
<feComposite
id="feComposite3776-9"
in2="SourceGraphic"
in="flood"
operator="in"
result="composite1" />
<feGaussianBlur
id="feGaussianBlur3778-3"
stdDeviation="3"
result="blur" />
<feOffset
id="feOffset3780-4"
dx="1"
dy="1"
result="offset" />
<feComposite
id="feComposite3782-9"
in2="offset"
in="SourceGraphic"
operator="over"
result="composite2" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="543.97851"
inkscape:cy="296.83429"
inkscape:document-units="px"
inkscape:current-layer="layer_background"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="993"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1">
<sodipodi:guide
orientation="0,1"
position="0,576"
id="guide2996" />
<sodipodi:guide
orientation="0,1"
position="0,0"
id="guide2998" />
<sodipodi:guide
orientation="1,0"
position="0,0"
id="guide3000" />
<sodipodi:guide
orientation="1,0"
position="1024,0"
id="guide3002" />
<sodipodi:guide
orientation="1,0"
position="32,0"
id="guide3029" />
<sodipodi:guide
orientation="0,1"
position="0,544"
id="guide3031" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Background"
inkscape:groupmode="layer"
id="layer_background"
transform="translate(0,-476)">
<g
id="g_background"
transform="translate(3.2142857,-29.821429)">
<image
xlink:href="file:///%workdir/foto-soft.jpg"
y="313.82144"
x="-200.2142856"
id="image_background"
height="768"
width="1024" />
<image
xlink:href="file:///%workdir/logo_ohne_rand-332.png"
y="537.82141"
x="28.785715"
id="image_logo"
height="166"
width="166" />
</g>
<g
id="g3091x">
<rect
style="fill:#ffffff;fill-opacity:0.50196078"
ry="0.0062701544"
y="777"
x="0"
height="230"
width="1024"
id="rect_banderole_1" />
</g>
<g
style="opacity:%opacity1"
id="g3849">
<text
sodipodi:linespacing="80.000001%"
id="text2992"
y="836.83752"
x="75.964493"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:80.00000119%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;filter:url(#filter3772);font-family:Sans"
xml:space="preserve"><tspan
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:80.00000119%;fill:#7b9199;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
id="tspan2996"
y="883.23755"
x="85.964493"
sodipodi:role="line"> Berlin</tspan><tspan
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:80.00000119%;fill:#7b9199;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
id="tspan3002"
y="929.63751"
x="75.964493"
sodipodi:role="line">19. - 21. März 2014</tspan></text>
<text
sodipodi:linespacing="80.000001%"
id="text2992-5"
y="837.2262"
x="77.218193"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:80.00000119%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
xml:space="preserve"><tspan
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:80.00000119%;fill:#f2f4f5;fill-opacity:1;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
y="837.2262"
x="77.218193"
id="tspan2994-9"
sodipodi:role="line">FOSSGIS Konferenz</tspan><tspan
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:80.00000119%;fill:#f2f4f5;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
id="tspan2998-1"
y="883.62622"
x="77.218193"
sodipodi:role="line">2014</tspan><tspan
style="font-size:20px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:80.00000119000000609%;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold;fill:#f2f4f5;fill-opacity:1"
id="tspan3002-3"
y="990.82617"
x="77.218193"
sodipodi:role="line">fossgis.de/konferenz/2014/</tspan></text>
</g>
<g
style="opacity:%opacity2"
id="g3849">
<text
sodipodi:linespacing="80.000001%"
id="text2992-5"
y="837.2262"
x="77.218193"
style="font-size:40px;font-style:normal;font-weight:normal;line-height:80.00000119%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
xml:space="preserve"><tspan
style="font-size:48px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:80.00000119%;fill:#f2f4f5;fill-opacity:1;stroke:none;font-family:Droid Sans;-inkscape-font-specification:Droid Sans Bold"
id="tspan2998-1"
y="883.62622"
x="77.218193"
sodipodi:role="line">Pause</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -101,6 +101,44 @@ def vorspannFrames():
for i in range(0, frames): for i in range(0, frames):
yield (frame+i, 1, 0, 1) yield (frame+i, 1, 0, 1)
def pauseFrames():
# 12 Sekunden
# 2 Sekunden Text1 stehen
frame = 0
frames = 2*fps
for i in range(0, frames):
yield (frame+i, 1, 0)
# 2 Sekunden Fadeout Text1
frame = frame+i+1
frames = 2*fps
for i in range(0, frames):
yield (frame+i, 1-easeOutCubic(i, 0, 1, frames), 0)
# 2 Sekunden Fadein Text2
frame = frame+i+1
frames = 2*fps
for i in range(0, frames):
yield (frame+i, 0, easeOutCubic(i, 0, 1, frames))
# 2 Sekunden Text2 stehen
frame = frame+i+1
frames = 2*fps
for i in range(0, frames):
yield (frame+i, 0, 1)
# 2 Sekunden Fadeout Text2
frame = frame+i+1
frames = 2*fps
for i in range(0, frames):
yield (frame+i, 0, 1-easeOutCubic(i, 0, 1, frames))
# 2 Sekunden Fadein Text1
frame = frame+i+1
frames = 2*fps
for i in range(0, frames):
yield (frame+i, easeOutCubic(i, 0, 1, frames), 0)
def abspann(lizenz, workdir='artwork', outdir='..'): def abspann(lizenz, workdir='artwork', outdir='..'):
@ -180,6 +218,44 @@ def vorspann(id, title, personnames, workdir='artwork', outdir='..'):
shutil.rmtree(os.path.join(workdir, '.frames')) shutil.rmtree(os.path.join(workdir, '.frames'))
ensure_files_removed(os.path.join(workdir, '.gen.svg')) ensure_files_removed(os.path.join(workdir, '.gen.svg'))
def pause(workdir='artwork', outdir='..'):
if debug:
print "erzeuge Pause-Loop"
filename = os.path.join(outdir, 'pause.mp4')
dvfilename = os.path.join(outdir, 'pause.dv')
ensure_path_exists(os.path.join(workdir, '.frames'))
with open(os.path.join(workdir, 'pause.svg'), 'r') as pause_file:
pause = pause_file.read()
for (frameNr, opacity1, opacity2) in pauseFrames():
if debug:
print "frameNr {0:2d} => opacity1 {1:0.2f}, opacity2 {2:0.2f}".format(frameNr, opacity1, opacity2)
pairs = \
('%opacity1', str(opacity1)), \
('%opacity2', str(opacity2)), \
('%workdir', os.path.realpath(workdir) )
with open(os.path.join(workdir, '.gen.svg'), 'w') as gen_file:
gen_pause = reduce(lambda a, kv: a.replace(*kv), pairs, pause)
gen_file.write( gen_pause )
os.system('cd {0} && rsvg-convert .gen.svg > .frames/{1:04d}.png'.format(workdir, frameNr))
ensure_files_removed(filename)
os.system('cd {0} && avconv -f image2 -i .frames/%04d.png -c:v libx264 -preset veryslow -qp 0 "{1}"'.format(workdir, filename) + ('' if debug else '>/dev/null 2>&1'))
ensure_files_removed(dvfilename)
os.system('cd {0} && avconv -f image2 -i .frames/%04d.png -target pal-dv "{1}"'.format(workdir, dvfilename) + ('' if debug else '>/dev/null 2>&1'))
if debug:
print "aufräumen"
shutil.rmtree(os.path.join(workdir, '.frames'))
ensure_files_removed(os.path.join(workdir, '.gen.svg'))
def events(): def events():
print "downloading pentabarf schedule" print "downloading pentabarf schedule"
@ -204,6 +280,7 @@ if debug:
print "!!! DEBUG MODE !!!" print "!!! DEBUG MODE !!!"
vorspann(667, 'OpenJUMP - Überblick, Neuigkeiten, Zusammenarbeit/Schnittstellen mit proprietärer Software', 'Matthias Scholz') vorspann(667, 'OpenJUMP - Überblick, Neuigkeiten, Zusammenarbeit/Schnittstellen mit proprietärer Software', 'Matthias Scholz')
abspann('by-sa') abspann('by-sa')
pause()
sys.exit(0) sys.exit(0)
@ -217,6 +294,7 @@ for (id, title, personnames) in events():
tasks.put( ('abspann', 'by-sa') ) tasks.put( ('abspann', 'by-sa') )
tasks.put( ('abspann', 'by-nc-sa') ) tasks.put( ('abspann', 'by-nc-sa') )
tasks.put( ('abspann', 'cc-zero') ) tasks.put( ('abspann', 'cc-zero') )
tasks.put( ('pause') )
num_worker_threads = multiprocessing.cpu_count() num_worker_threads = multiprocessing.cpu_count()
print "{0} tasks in queue, starting {1} worker threads".format( tasks.qsize(), num_worker_threads ) print "{0} tasks in queue, starting {1} worker threads".format( tasks.qsize(), num_worker_threads )