Ejemplo n.º 1
0
def test_credits():
    credit_file = "# This is a comment\n" \
                  "# The next line says : leave 4 blank lines\n" \
                  ".blank 2\n" \
                  "\n" \
                  "..Executive Story Editor\n" \
                  "MARCEL DURAND\n" \
                  "\n" \
                  ".blank 2\n" \
                  "\n" \
                  "..Associate Producers\n" \
                  "MARTIN MARCEL\n" \
                  "DIDIER MARTIN\n" \
                  "\n" \
                  "..Music Supervisor\n" \
                  "JEAN DIDIER\n"

    file_location = os.path.join(TMP_DIR, "credits.txt")
    vid_location = os.path.join(TMP_DIR, "credits.mp4")
    with open(file_location, "w") as file:
        file.write(credit_file)

    image = credits1(file_location,
                     600,
                     gap=100,
                     stroke_color="blue",
                     stroke_width=5)
    image = image.set_duration(3)
    image.write_videofile(vid_location, fps=24)
    assert os.path.isfile(vid_location)
Ejemplo n.º 2
0
def test_credits():
    credit_file = "# This is a comment\n" \
                  "# The next line says : leave 4 blank lines\n" \
                  ".blank 2\n" \
                  "\n" \
                  "..Executive Story Editor\n" \
                  "MARCEL DURAND\n" \
                  "\n" \
                  ".blank 2\n" \
                  "\n" \
                  "..Associate Producers\n" \
                  "MARTIN MARCEL\n" \
                  "DIDIER MARTIN\n" \
                  "\n" \
                  "..Music Supervisor\n" \
                  "JEAN DIDIER\n"

    file_location = os.path.join(TMP_DIR, "credits.txt")
    vid_location = os.path.join(TMP_DIR, "credits.mp4")
    with open(file_location, "w") as file:
        file.write(credit_file)

    image = credits1(file_location, 600, gap=100, stroke_color="blue",
                     stroke_width=5)
    image = image.set_duration(3)
    image.write_videofile(vid_location, fps=24)
    assert os.path.isfile(vid_location)
Ejemplo n.º 3
0
def stoprecording():
	e.set()
	p.join()
	clip = (VideoFileClip('tmp/output.avi', audio=False))
	credits = credits1('settings/credits.txt',3*clip.w/4,gap=10,fontsize=20,color="white")
	scrolling_credits = credits.set_pos(lambda t:('center',-10*t)).set_start(3).crossfadein(1)
	titre = TextClip(txt="Tuto XXX", color="white",bg_color="black",fontsize=20).set_pos((80,15))
	logo = ImageClip("settings/logo.png").set_pos((0,0)).resize(height=50)
	final = CompositeVideoClip([clip,logo,scrolling_credits,titre])
	final.subclip(0,clip.duration).write_videofile("output/demo.mp4",fps=20) 
def createCredits(collaborators, speed=200):
    text_file = open("Output.txt", "w")
    text_file.write(".blank 4\n..Collaborators :\n" + collaborators.replace(",","\n"))
    text_file.close()

    credits = credits1('Output.txt',3*1920/4)
    scrolling_credits = credits.set_pos(lambda t:('center',-1*speed*t))


    final = CompositeVideoClip([scrolling_credits], size=screensize)
    return final
Ejemplo n.º 5
0
def subtitle():
    ending_clip = VideoFileClip(whu_path + '.mp4', audio=False)

    credits = credits1('.\\result\\text.txt', 3 * ending_clip.w / 4, stroke_color='pink',
                       stroke_width=3, )
    scrolling_credits = credits.set_pos(lambda t: ('center', -30 * t))

    tail = CompositeVideoClip([ending_clip,
                               scrolling_credits,
                               ], duration=30)

    tail.write_videofile(whu_path + '1.mp4')
Ejemplo n.º 6
0
    def genVideo(self):
        #加载一个图片clip
        clip = [ImageClip(self.imagepath)]

        # 用一个文本文件内容生成字幕
        #credits = credits1('../../credits/credits.txt', 3 * clip.w / 4)
        credits = credits1(self.textpath, 3 * clip.w / 4)
        scrolling_credits = credits.set_pos(lambda t: ('center', -10 * t))

        # 添加音频
        audio = AudioFileClip(self.musicpath)

        final = CompositeVideoClip([clip, scrolling_credits])
        final_video = final.set_audio(audio)
        final_video.write_videofile(str(self.name) + '.mp4',
                                    fps=30,
                                    codec='mpeg4',
                                    preset='ultrafast',
                                    audio_codec="libmp3lame",
                                    threads=4)
Ejemplo n.º 7
0
from moviepy.editor import *
from moviepy.video.tools.credits import credits1

# Load the mountains clip, cut it, slow it down, make it look darker
clip = VideoFileClip('../../videos/badl-0001.mov', audio=False).\
           subclip(37,46).\
           speedx( 0.4).\
           fx( vfx.colorx, 0.7)

# Save the first frame to later make a mask with GIMP (only once)
#~ clip.save_frame('../../credits/mountainMask2.png')

# Load the mountain mask made with GIMP
mountainmask = ImageClip('../../credits/mountainMask2.png', ismask=True)

# Generate the credits from a text file
credits = credits1('../../credits/credits.txt', 3 * clip.w / 4)
scrolling_credits = credits.set_pos(lambda t: ('center', -10 * t))

# Make the credits scroll. Here, 10 pixels per second
final = CompositeVideoClip(
    [clip, scrolling_credits,
     clip.set_mask(mountainmask)])

final.subclip(8, 10).to_videofile("../../credits_mountains.avi")
Ejemplo n.º 8
0
from moviepy import *
from moviepy.video.tools.credits import credits1

# Load the mountains clip, cut it, slow it down, make it look darker
clip = (VideoFileClip("../../videos/badl-0001.mov",
                      audio=False).subclip(37,
                                           46).speedx(0.4).fx(vfx.colorx, 0.7))

# Save the first frame to later make a mask with GIMP (only once)
# ~ clip.save_frame('../../credits/mountainMask2.png')

# Load the mountain mask made with GIMP
mountainmask = ImageClip("../../credits/mountainMask2.png", is_mask=True)

# Generate the credits from a text file
credits = credits1("../../credits/credits.txt", 3 * clip.w / 4)
scrolling_credits = credits.set_pos(lambda t: ("center", -10 * t))

# Make the credits scroll. Here, 10 pixels per second
final = CompositeVideoClip(
    [clip, scrolling_credits,
     clip.with_mask(mountainmask)])

final.subclip(8, 10).write_videofile("../../credits_mountains.avi")
Ejemplo n.º 9
0
from moviepy.editor import *
from moviepy.video.tools.credits import credits1

# Load the mountains clip, cut it, slow it down, make it look darker
clip = (VideoFileClip('../../videos/badl-0001.mov', audio=False)
           .subclip(37,46)
           .speedx( 0.4)
           .fx( vfx.colorx, 0.7))

# Save the first frame to later make a mask with GIMP (only once)
#~ clip.save_frame('../../credits/mountainMask2.png')


# Load the mountain mask made with GIMP
mountainmask = ImageClip('../../credits/mountainMask2.png',ismask=True)

# Generate the credits from a text file
credits = credits1('../../credits/credits.txt',3*clip.w/4)
scrolling_credits = credits.set_pos(lambda t:('center',-10*t))


# Make the credits scroll. Here, 10 pixels per second
final = CompositeVideoClip([clip,
                            scrolling_credits,
                            clip.set_mask(mountainmask)])
                            
final.subclip(8,10).write_videofile("../../credits_mountains.avi")
Ejemplo n.º 10
0
author = CompositeVideoClip([first_frame,
                             clip_the_author])  # Overlay text on image

# Make the end clip
last_frame = ImageClip('frame_end.png').set_duration(3)
the_end = TextClip("The End", fontsize=50, color="black")
clip_the_end = the_end.set_pos('center').set_duration(3)
end = CompositeVideoClip([last_frame, clip_the_end])

# Make the credits clip
last_frame = ImageClip('frame_end.png').set_duration(5)
the_credits = credits1('credits.txt',
                       int(0.5 * w),
                       stretch=0,
                       color='black',
                       stroke_color='black',
                       stroke_width=2,
                       font='Impact-Normal',
                       fontsize=30,
                       gap=30)
clip_the_credits = the_credits.set_pos(lambda t:
                                       ('center', -5 * t)).set_duration(5)
credits = CompositeVideoClip([last_frame, clip_the_credits])

# Join up the clips
final = concatenate_videoclips([
    title, author, clip, loop1, loop2, loop3, loop4, clip_tracked, end, credits
]).set_audio(audioclip)

# Write to file
final.write_videofile('ornithography_1.mp4', fps=25)
Ejemplo n.º 11
0
#!/usr/bin/env python

from moviepy.editor import *
from moviepy.video.tools.credits import credits1

# Load the mountains clip, cut it, slow it down, make it look darker
clip = (VideoFileClip('tmp/output.avi', audio=False))
           

# Generate the credits from a text file
credits = credits1('settings/credits.txt',3*clip.w/4,gap=10,fontsize=20,color="white")
scrolling_credits = credits.set_pos(lambda t:('center',-10*t)).set_start(3).crossfadein(1)
titre = TextClip(txt="Tuto XXX", color="white",bg_color="black",fontsize=20).set_pos((80,15))
logo = ImageClip("settings/logo.png").set_pos((0,0)).resize(height=50)

final = CompositeVideoClip([clip,logo,scrolling_credits,titre])
                            
final.subclip(0,20).write_videofile("output/logo.mp4",fps=20)
Ejemplo n.º 12
0
from moviepy.editor import *
from moviepy.video.tools.credits import credits1

# Load the mountains clip, cut it, slow it down, make it look darker
clip = (VideoFileClip('../sub1.mp4',
                      audio=False).subclip(0,
                                           5).speedx(0.4).fx(vfx.colorx, 0.7))

# Save the first frame to later make a mask with GIMP (only once)
clip.save_frame('mountainMask2.png')

# Load the mountain mask made with GIMP
mountainmask = ImageClip('mountainMask2.png', ismask=True)

# Generate the credits from a text file
credits = credits1('credits.txt', 3 * clip.w / 4)
scrolling_credits = credits.set_pos(lambda t: ('center', -10 * t))

# Make the credits scroll. Here, 10 pixels per second
final = CompositeVideoClip(
    [clip, scrolling_credits,
     clip.set_mask(mountainmask)])

final.subclip(8, 10).preview()