示例#1
0
def test_duration():
    clip = TextClip("hello world", size=(1280, 720), color="white", font=FONT)
    clip = clip.set_duration(5)
    assert clip.duration == 5
    clip.close()

    clip2 = clip.fx(blink, d_on=1, d_off=1)
    clip2 = clip2.set_duration(5)
    assert clip2.duration == 5
    close_all_clips(locals())
示例#2
0
def test_duration():

    clip = TextClip('hello world', size=(1280,720), color='white')
    clip = clip.set_duration(5) #  Changed due to #598.
    assert clip.duration == 5
    clip.close()

    clip2 = clip.fx(blink, d_on=1, d_off=1)
    clip2 = clip2.set_duration(5)
    assert clip2.duration == 5
    close_all_clips(locals())
示例#3
0
def test_duration():

    clip = TextClip('hello world', size=(1280,720), color='white')
    clip = clip.set_duration(5) #  Changed due to #598.
    assert clip.duration == 5
    clip.close()

    clip2 = clip.fx(blink, d_on=1, d_off=1)
    clip2 = clip2.set_duration(5)
    assert clip2.duration == 5
    close_all_clips(locals())
示例#4
0
def test_duration(util):
    clip = TextClip("hello world",
                    size=(1280, 720),
                    color="white",
                    font=util.FONT)
    clip = clip.with_duration(5)
    assert clip.duration == 5
    clip.close()

    clip2 = clip.fx(blink, duration_on=1, duration_off=1)
    clip2 = clip2.with_duration(5)
    assert clip2.duration == 5
示例#5
0
def test_duration():
    #TextClip returns the following error under Travis (issue with Imagemagick)
    #convert.im6: not authorized `@/tmp/tmpWL7I3M.txt' @ error/property.c/InterpretImageProperties/3057.
    #convert.im6: no images defined `PNG32:/tmp/tmpRZVqGQ.png' @ error/convert.c/ConvertImageCommand/3044.
    if TRAVIS:
       return
    
    clip = TextClip('hello world', size=(1280,720), color='white')
    clip.set_duration(5)
    assert clip.duration == 5

    clip2 = clip.fx(blink, d_on=1, d_off=1)
    clip2.set_duration(5)
    assert clip2.duration == 5
示例#6
0
def test_duration():
    #TextClip returns the following error under Travis (issue with Imagemagick)
    #convert.im6: not authorized `@/tmp/tmpWL7I3M.txt' @ error/property.c/InterpretImageProperties/3057.
    #convert.im6: no images defined `PNG32:/tmp/tmpRZVqGQ.png' @ error/convert.c/ConvertImageCommand/3044.
    if TRAVIS:
        return

    clip = TextClip('hello world', size=(1280, 720), color='white')
    clip = clip.set_duration(5)
    assert clip.duration == 5

    clip2 = clip.fx(blink, d_on=1, d_off=1)
    clip2.set_duration(5)
    assert clip2.duration == 5
示例#7
0
def make_clip(clip, text, height, width, font, font_color, fontsize):
    if font is None:
        return clip
    #TODO: make text caption style configurable
    #Swimming changes text color to light blue, moves text up and resized
    #it
    #It also adds black stroke that's why resizing is needed
    #And adds icon of swimming on the bottom
    if text.startswith("KOP:"):
        text = text[4:]
        font_color_c = "#00aaff"
        pos = "top"
        swimm = True
        stroke_color = "black"
        factor = 2
        mult = 1.4 * factor
    else:
        font_color_c = font_color
        pos = "bottom"
        swimm = False
        stroke_color = None
        mult = 1
        factor = 1
    if width is None:
        text_space_size = None
    else:
        text_space_size = (width * factor, 40 * factor)
    text_caption = TextClip(text,
                            size=text_space_size,
                            method="caption",
                            align="center",
                            color=font_color_c,
                            fontsize=fontsize * mult,
                            font=font,
                            stroke_color=stroke_color)
    if swimm:
        text_caption = text_caption.fx(resize, height=text_caption.h / 2)
    text_caption = text_caption.set_pos(("center", "center"))
    #print (clip.size, tc.size)
    #TODO: makes transparent bar size same size (based on highest caption)
    #adds 60% transparent bar under the caption
    #Bar starts 5 pixels above caption and ends at the bottom
    if not swimm:
        text_caption_bar = text_caption.on_color(size=(clip.w,
                                                       text_caption.h + 5),
                                                 color=(0, 0, 0),
                                                 pos=('center'),
                                                 col_opacity=0.6)
        text_caption_with_bar = text_caption_bar.set_pos(('center', 'bottom'))
    else:
        text_caption_with_bar = text_caption.set_pos(('center', 20))
    clips = [clip, text_caption_with_bar]
    if swimm:
        swimm_size = fontsize
        #TODO: make location of this configurable
        swim_clip = \
        SVGImageClip("/home/mabu/programiranje/overlay/projects/glein/images/swimming-15.svg",
                width=swimm_size, height=swimm_size).set_pos(('center',
            clip.h-20-swimm_size))
        clips.append(swim_clip)
    return (CompositeVideoClip(clips) \
            .set_duration(clip.duration))