8 LIVE_PIPELINE_TEMPLATE = """
9 videotestsrc num-buffers=1 pattern=black ! \
10 textoverlay valignment=center halignment=center font-desc="Sans, 72" text="{0}" ! \
12 audiotestsrc num-buffers=100 freq={1:f} ! \
16 #FONT_DESC = "Andale Mono, 72"
17 FONT_DESC = "Mono, 72"
19 FILE_PIPELINE_TEMPLATE = """
20 matroskamux name=mux ! filesink location="{2}/sample_{0}.mkv"
21 videotestsrc num-buffers=1 pattern=black ! \
22 textoverlay valignment=center halignment=center font-desc="%s" text="{0}" ! \
23 queue ! schroenc rate-control=3 ! mux.
24 audiotestsrc num-buffers=100 freq={1:f} ! \
25 queue ! audioconvert ! vorbisenc quality=0.5 ! queue ! mux.
29 def create_test_videofont(pipeline_template, notes_range, destination_dir=None):
30 for i, note_number in enumerate(notes_range):
31 note = vidi.SpnNote(note_number)
33 print("%2d %s" % (i, note))
35 pipeline_string = pipeline_template.format(note.name, note.frequency, destination_dir)
37 player = vidi.Player.from_pipeline_string(pipeline_string)
44 print("usage: %s [<videofont_destination_dir>]" %
45 os.path.basename(sys.argv[0]))
49 if len(sys.argv) > 1 and sys.argv[1] in ["-h", "--help"]:
53 notes_range = vidi.PIANO_88_KEYS_RANGE
56 destination_dir = os.path.realpath(sys.argv[1])
57 if os.path.exists(destination_dir):
58 sys.stderr.write("The destination already exists '%s'!\n"
62 os.mkdir(destination_dir)
63 create_test_videofont(FILE_PIPELINE_TEMPLATE, notes_range,
66 create_test_videofont(LIVE_PIPELINE_TEMPLATE, notes_range)
69 if __name__ == "__main__":