Exemple #1
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
Exemple #2
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
Exemple #3
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())
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())
Exemple #5
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())
Exemple #6
0
def generate_text_clip(text, number):
    filename = "tmp/" + name + "/clips/" + name + number + ".mp4"

    if not os.path.exists(filename):
        audio_filename = make_tts(text, number)
        audio = AudioFileClip(audio_filename)
        image = ImageClip(background_image).set_fps(30)
        video = image.set_duration(audio.duration)
        withaudio = video.set_audio(audio)

        fontsize = (len(text) + 10) / withaudio.w
        text_clip = TextClip(text,
                             fontsize=fontsize,
                             size=(withaudio.w, withaudio.h)).set_pos("center")

        final_clip = CompositeVideoClip(
            [withaudio, text_clip.set_duration(video.duration)])

        final_clip.write_videofile(filename)
    return filename