From 1da2ac047575608dce448c48087207d27e8e1b83 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 6 Mar 2017 09:36:39 +0100 Subject: [PATCH] hidden tags, 480p, rename --- encode.py | 36 ++++++++++---------- keywords.py | 96 +++++++++++++++++++++++++++++------------------------ render.py | 9 +++++ 3 files changed, 79 insertions(+), 62 deletions(-) diff --git a/encode.py b/encode.py index 88ad69c..e15f116 100755 --- a/encode.py +++ b/encode.py @@ -25,32 +25,15 @@ for xml in sorted(glob('output/*/*.xml')): continue audio_xml = xml.replace('.xml', '.audio.xml') mp4 = xml.replace('.xml', '.mp4') + mp4_480p = mp4.replace('.mp4', '.480p.mp4') pre = mp4 + '.pre.mp4' + pre_480p = mp4_480p + '.pre.mp4' video = mp4 + '.v.mp4' audio = mp4 + '.wav' if not os.path.exists(mp4) or os.path.getmtime(xml) > os.path.getmtime(mp4): subprocess.call([ 'qmelt', xml, '-consumer', 'avformat:' + video, 'vcodec=libx264', 'strict=-2' ]) - ''' - subprocess.call([ - 'qmelt', audio_xml, '-consumer', 'avformat:' + audio, - ]) - cmd = [ - 'ffmpeg', '-y', - '-i', video, - '-i', audio, - '-map', '0:v', - '-map', '1:a', - '-c:v', 'copy', - '-strict', '-2', - pre - ] - subprocess.call(cmd) - os.unlink(video) - os.unlink(audio) - shutil.move(pre, mp4) - ''' duration = get_videoduration(video) cmd = [ 'ffmpeg', '-y', @@ -58,8 +41,23 @@ for xml in sorted(glob('output/*/*.xml')): '-c:a', 'copy', '-c:v', 'copy', '-t', duration, + '-movflags', '+faststart', pre ] subprocess.call(cmd) os.unlink(video) shutil.move(pre, mp4) + cmd = [ + 'ffmpeg', '-y', + '-i', mp4, + '-c:a', 'copy', + '-vf', 'scale=854:480', + '-c:v', 'libx264', + '-preset', 'medium', + '-b:v', '750k', + '-profile:v', 'high', + '-movflags', '+faststart', + pre_480p + ] + subprocess.call(cmd) + shutil.move(pre_480p, mp4_480p) diff --git a/keywords.py b/keywords.py index 33d9659..f3868da 100644 --- a/keywords.py +++ b/keywords.py @@ -6,11 +6,11 @@ KEYWORDS = { "anarchism", "animism", "aporia", - "archipelago", - "ascending/descending", + "archipelagoes", + "ascend", "assimilation", - "diagram", - "mountain", + "descend", + "highlands", "piracy", "water", "zomia" @@ -22,10 +22,9 @@ KEYWORDS = { "boundary", "buffalo", "colonialism", - "forest", - "peasants", + "peasant", "royalty", - "shadow puppet", + "shadow puppets", "tiger" ], "C": [ @@ -34,21 +33,23 @@ KEYWORDS = { "contagion", "corruption", "cosmology", - "modern leader", + "leaders", "money", "royalty", "transmission" ], "D": [ - "burial/grave", + "burial", "decay", - "dispersal/disaggregation", + "dispersal", + "disaggregate", "forensics", "human remains", "humidity", "rain", "river", - "soil" + "soil", + "tombs" ], "E": [ "evasion", @@ -56,30 +57,32 @@ KEYWORDS = { "contagion", "ecology", "efficacy", - "transmission of ideology" + "transmission" ], "F": [ + "fauna", "fiction", "flight", - "flora/fauna", + "flora", "fluidity", "forest", "friction", "frontier", - "magic/shamans", + "shamans", "outlaw" ], "G": [ - "authors/writing", - "cpm/mcp/mpaja", + "authors", + "writing", + "cpm/mcp", "espionage", "geography", - "ghost/spirit", - "guerilla", + "ghost", "spirit", + "guerillas", "transmission" ], "H": [ - "air conditioner", + "air-conditioner", "diagram", "heat", "humidity", @@ -89,14 +92,16 @@ KEYWORDS = { "oppression", "rain", "river", - "sweat/labor", + "sweat", + "labor", "trade", "water" ], "I": [ "aerial shot", "agriculture", - "authors/writing", + "authors", + "writing", "construction", "identity", "imitation", @@ -104,7 +109,8 @@ KEYWORDS = { "invulnerability", "irrigation", "tattoo", - "unreadable sign" + "illegible", + "unreadable" ], "J": [ "jellyfish", @@ -114,29 +120,32 @@ KEYWORDS = { ], "K": [ "family", - "kinship/kingship", + "kinship", + "kingship", "modern nepotism", "royalty" ], "L": [ "1900-1947", - "authors/writing", - "body in water", + "authors", + "writing", + "water bodies", "colonialism", - "cpm/mcp/mpaja", + "cpm/mcp", "espionage", - "guerilla", + "guerillas", "japanese occupation", "legibility", "river", "shape-shifter", - "unreadable sign" + "unreadable" ], "M": [ "aerial shot", "cosmology", "india bce", - "magic/shamans", + "magic", + "shamans", "mandala", "manpower", "map", @@ -152,7 +161,8 @@ KEYWORDS = { "survey" ], "O": [ - "india/china", + "india", + "china", "ocean", "opium", "opium war", @@ -164,12 +174,11 @@ KEYWORDS = { "bateson", "buffalo", "colonialism", - "deleuze/guattari", - "deleuzian diagram", + "deleuze & guattari", "highland tribe", "irrigation", "padi", - "peasants", + "peasant", "periphery", "plateau", "politics", @@ -200,7 +209,7 @@ KEYWORDS = { "cosmology", "emanation of power", "fanaticism", - "ghost/spirit", + "ghost", "spirit", "mandala", "map", "network", @@ -208,7 +217,7 @@ KEYWORDS = { "royalty", "sea", "slavery", - "society/state", + "society against state", "soul" ], "T": [ @@ -222,13 +231,13 @@ KEYWORDS = { "tiger", "tiger", "colonialism", - "cpm/mcp/mpaja", + "cpm/mcp", "espionage", "forest", - "indian prisoners", + "indian convicts", "japanese occupation", "map", - "singapore before 1900", + "singapore", "slavery", "survey", "theodolite", @@ -257,8 +266,8 @@ KEYWORDS = { "weretiger", "water", "water", - "body in water", - "magic/shamans", + "water bodies", + "magic", "shamans", "ritual", "tamil tigers", "tiger", @@ -273,19 +282,20 @@ KEYWORDS = { "Y": [ "first contact", "foreigner", - "magic/shamans", + "magic", + "shamans", "obedience", "youth", "yielding" ], "Z": [ "animal", - "archipelago", + "archipelagoes", "evasion", "forest", "jellyfish", "modern nepotism", - "mountain", + "highlands", "oppression", "royalty", "shape-shifter", diff --git a/render.py b/render.py index 8792a08..7f49ec1 100755 --- a/render.py +++ b/render.py @@ -17,6 +17,10 @@ base_url = 'http://127.0.0.1:2620' FRAME_DURATION = 1/60 +HIDDEN_TAGS = [ + "women with white males" +] + api = None def get_api(): @@ -58,6 +62,9 @@ if not os.path.exists('VOCALS.json'): 'path': path, 'duration': ox.avinfo(path)['duration'] }) + while len(VOCALS[letter]) < 10: + VOCALS[letter] += VOCALS[letter] + VOCALS[letter] = VOCALS[letter][:10] with open('VOCALS.json', 'w') as fd: json.dump(VOCALS, fd, indent=2, sort_keys=True) else: @@ -234,6 +241,8 @@ def sequence(seq, letter): n = min(n, duration-position) if not tags_text: tags_text = list(sorted(set(tags))) + tags_text = [t for t in tags_text if t not in HIDDEN_TAGS] + ttag = random_choice(seq, tags_text) tags_text.remove(ttag) text = {