处理的内容
接收抖音(抖音)美女舞蹈视频,分别提取视频和音频。
from movie import *
from movie import find_video_period
from movie import find_audio_period
file_path = r"./素材/给你点赞 #戏曲漫步大赏.mp4"
audio = (AudioFileClip(file_path).subclip(3,12)
.audio_fadein(1)
.audio_fadeout(1))
audio_period = find_audio_period(audio)
print ('Analyzed the audio, found a period of %.02f seconds'%audio_period)
clip = (VideoFileClip(file_path, audio=False)
.subclip(4,12))
# .crop(x1=332, x2=910, y2=686))
video_period = find_video_period(clip, tmin=6)
print ('Analyzed the video, found a period of %.02f seconds'%video_period)
edited_right = (0,video_period)
.speedx(final_duration=2*audio_period)
.fx, duration=audio.duration))
edited_left = edi)
dancing_knights = (clips_array([[edited_left, edited_right]])
.fadein(1).fadeout(1).set_audio(audio))
txt_title = (TextClip("戏曲漫步大赏", fontsize=70,
font="STXINGKA.TTF", color="white")
.margin(top=15, opacity=0)
.set_position(("center","top")))
#片头图片定格+标题
title = (CompositeVideoClip([dancing_knig(), txt_title])
.fadein(.5)
.set_duration(.5))
# 结尾字幕
txt_credits = """
CREDITS
戏曲漫步大赏
Video editing © 老纳老纳
"""
credits = (TextClip(txt_credits, color='white',
font="STXINGKA.TTF", fontsize=35, kerning=-2,
interline=-1, bg_color='black', size=)
.set_duration)
.fadein(.5)
.fadeout(.5))
# 视频合成
final = concatenate_videoclips([title, dancing_knights, credits])
("xqmb2.mp4", fps=clip.fps,
audio_bitrate="1000k", bitrate="4000k")
Moviepy视频处理示例:抖音美女的舞蹈