示例#1
0
def make_hands():
    clips = []

    backgrounds = glob.glob('images/*.jpg')
    background_clip = Clip(random.choice(backgrounds))

    clips.append(background_clip)

    hands = glob.glob('hands/*.mp4')
    hand = random.choice(hands)

    x = random.randint(-400, -200)
    distance = 100

    duration = 0

    for i in range(0, 6):
        clip = Clip(hand)
        clip.chroma()
        clip.fadein(0.1)
        clip.fadeout(0.1)
        clip.set_offset(i * 0.5)
        clip.position(x=x)
        clips.append(clip)

        x += distance
        duration = clip.duration + i * 0.5

    composition = Composition(clips, width=1280, height=720, duration=duration)
    composition.preview()
示例#2
0
def make_video():

    clips=[]

    for video in mergeSequence:
        #print mergeSequence
    #print each video of the sequence and tagsself.and colors

    #filename = "./videos/" + video['id']
        filename = video["path"]
    #print video
    #print filename
        clip = Clip(filename, start=video['start'], end= video['end'])
        if "abstract" in video["tags"]:
            clip.fadein(1)
            clip.fadeout(1.5)
        for video in beginning:
            clip.fadein(3)
        for video in ending:
            clip.fadeout(1.5)
        for video in randomSounds:
            clip.fadein(1)
            clip.fadeout(1.5)


        clip.glow()
        clips.append(clip)
        print (mergeSequence[0]["id"])

    composition = Composition(clips,singletrack=True, width=800, height=800)
    videoName = "render/videoMergeClassic" + datetime.datetime.now().strftime("%Y%m%d%H%M%S") +".mp4"
    composition.save(videoName)
示例#3
0
def make_video():

    clips = []

    for video in mergeSequence:
        #print mergeSequence
        #print each video of the sequence and tagsself.and colors

        #filename = "./videos/" + video['id']
        filename = video["path"]
        #print video
        #print filename
        clip = Clip(filename, start=video['start'], end=video['end'])
        if "abstract" in video["tags"]:
            clip.fadein(1)
            clip.fadeout(1.5)
        for video in beginning:
            clip.fadein(3)
        for video in ending:
            clip.fadeout(1.5)
        for video in randomSounds:
            clip.fadein(1)
            clip.fadeout(1.5)

        clip.glow()
        clips.append(clip)
        print mergeSequence[0]["id"]

    composition = Composition(clips, singletrack=True, width=800, height=800)
    composition.save('mergeVideo3_nature4.mp4')
示例#4
0
def make_video():

    clips = []
    blankclip = Clip('black.mp4')
    clips.append(blankclip)

    for video in mergeSequence:
        #print mergeSequence
        #print each video of the sequence and tagsself.and colors

        #filename = "./videos/" + video['id']
        filename = video["path"]
        #print video
        print(filename)
        # if filename.endswith('mp3'):
        #    continue
        clip = Clip(filename, start=video['start'], end=video['end'])
        # clip.position(x=0, y=0, w='100%', h='100%', distort=True)
        # clip.fx('crop', {
        #     'center': 1
        # })
        # clip.fx('affine', {
        #     'transition.geometry': '0/0:640x640',
        #     'transition.fill': 1,
        #     'transition.distort': 1,
        #     'transition.scale': 1,
        #     'scale': 1
        # })

        if "abstract" in video["tags"]:
            clip.fadein(1)
            clip.fadeout(1.5)
        if video in beginning:
            clip.fadein(3)
        if video in ending:
            clip.fadeout(1.5)
        if video in randomSounds:
            clip.fadein(1)
            clip.fadeout(1.5)

        clip.glow()
        clips.append(clip)
        print(mergeSequence[0]["id"])
    # clips = clips[0:3]
    composition = Composition(clips, singletrack=True)
    videoName = "render/videoMergeClassic" + datetime.datetime.now().strftime(
        "%Y%m%d%H%M%S") + ".mp4"
    #composition.save(videoName)
    composition.preview()
def make_video(tag):

    clips = []

    for video in mergeSequence:
        #print mergeSequence
        #print each video of the sequence and tagsself.and colors

        #filename = "./videos/" + video['id']
        filename = video["path"]
        #print video
        #print filename
        clip = Clip(filename, start=video['start'], end=video['end'])
        if "abstract" in video["tags"]:
            clip.fadein(1)
            clip.fadeout(1.5)
        if video in beginning:
            clip.fadein(3)
        if video in ending:
            clip.fadeout(1.5)
        if video in randomSounds:
            clip.fadein(1)
            clip.fadeout(1.5)

        clip.glow()
        clips.append(clip)
        #print (mergeSequence[0]["id"])

    composition = Composition(clips, singletrack=True, width=800, height=800)
    #videoName = "render/videoConnected10" + datetime.datetime.now().strftime("%Y%m%d%H%M%S") +".mp4"
    # videoName = "render/video_" + tag +  datetime.datetime.now().strftime("%Y%m%d%H%M%S") +".mp4"
    videoName = "render/video_" + tag + datetime.datetime.now().strftime(
        "%Y%m%d%H%M%S") + ".mov"
    composition.save(videoName)
    #composition.save(videoName)
    #datetime.datetime.now().strftime("%Y%m%d%H%M&S")

    #setup a client (api adress, localhost)
    client = udp_client.UDPClient("127.0.0.1", 8000)
    print("testing message")

    #composition.preview()

    #now built the messagingSenderId
    msg = osc_message_builder.OscMessageBuilder(address="/video")
    msg.add_arg("nature")
    msg = msg.build()
    client.send(msg)
示例#6
0
import time
from vidpy import Clip, Composition

hands = glob.glob('hands/*.mp4')
hand = random.choice(hands)
print hand

clips = []
x = -400
start = 0

backgrounds = ['#2cffff', '#fc282a', '#fcdb2a', '#2452d8']

for i in range(0, 6):  # same as for i in [0, 1, 2, 3, 4]
    clip = Clip(hand)
    clip.chroma()
    clip.set_offset(start)
    clip.position(x=x)
    clip.fadein(0.2)
    clip.fadeout(0.2)

    clips.append(clip)

    start += 0.5
    x += 150

composition = Composition(clips, bgcolor=random.choice(backgrounds))

outname = 'coolhands_{}.mp4'.format(int(time.time()))
composition.save(outname)