コード例 #1
0
def test_PR_528(util):
    with ImageClip("media/vacation_2017.jpg") as clip:
        new_clip = scroll(clip, w=1000, x_speed=50)
        new_clip = new_clip.with_duration(0.2)
        new_clip.fps = 24
        new_clip.write_videofile(os.path.join(util.TMP_DIR, "pano.mp4"),
                                 logger=None)
コード例 #2
0
ファイル: slideshow.py プロジェクト: buma/GPSOverlay
def panorama(clip, screensize, duration=None, speed=None, freeze_duration=1.5):
    """Makes image panorama of large images

    It pans image from left to right since they are very wide
    It works in two ways if duration is given it calculates speed to pan whole
    panorama in given number of seconds. If speed is given it sets duration so
    that whole pan will happen at given speed

    Parameters
    ---------
    clip
        ImageClip (not resized)
    screensize
        Wanted (width, height) tuple
    duration
        If given wanted duration of pan
    speed
        Number of pixel of move per time unit (duration is calculated)
    freeze_duration : float
        Number of seconds to freeze before scroll and at the end
    """

    #TODO: pause image at start and/or end for some time
    print("DURATION", duration, "SPEED:", speed)
    #FIXME: add workable assert
    #assert duration is None or speed is None
    clip = clip.fx(resize, height=screensize[1])

    width = screensize[0]

    if speed is not None:
        clip = clip.set_duration((clip.w - width) / speed)
    else:
        clip = clip.set_duration(duration)
        speed = (clip.w - width) / duration

    scrolled = scroll(clip, w=width, x_speed=speed)
    return concatenate_videoclips([
        scrolled.to_ImageClip(0).set_duration(freeze_duration),
        scrolled,
        #FIXME: why is +1 actually needed without it there is no freeze at end
        scrolled.to_ImageClip(scrolled.duration
                              ).set_duration(freeze_duration + 1)
    ])
コード例 #3
0
ファイル: test_PR.py プロジェクト: mgaitan/moviepy
def test_PR_528():
    with ImageClip("media/vacation_2017.jpg") as clip:
        new_clip = scroll(clip, w=1000, x_speed=50)
        new_clip = new_clip.set_duration(20)
        new_clip.fps = 24
        new_clip.write_videofile(os.path.join(TMP_DIR, "pano.mp4"))
コード例 #4
0
ファイル: test_PR.py プロジェクト: zchen7/moviepy
def test_PR_528():
    with ImageClip("media/vacation_2017.jpg") as clip:
        new_clip = scroll(clip, w=1000, x_speed=50)
        new_clip = new_clip.set_duration(1)
        new_clip.fps = 24
        new_clip.write_videofile(os.path.join(TMP_DIR, "pano.mp4"))