本文给大家分享一个最近比较火的AI视频制作方法,这类视频大家可能都看过,就是《女孩的一生》或者《男孩的一生》,这类视频之所以这么火,首先是触动了大家的内心、产生了共鸣,让大家快速感受到了人生的漫漫旅途,其次就是AI制作的新奇方式,让人不免眼前一亮。
其实我去年就注意到了这类视频,只是没想到它的关注度这么高,在B站上,这类视频的最高播放量竟然达到了300多万,真的是出乎我的意料。当然这其中肯定也有账号权重的加成和平台的推荐,但是这个播放量真的挺吸引人的。
于是这几天我自己也制作了一个类似的视频,并发布到了我的微信视频号上,结果当天就产生了5000多的播放量,后来继续发布又达到了1.4万的播放量,看来这个成功很可能是可以复制的,怀着略微激动的心情,特别分享给大家。
本文就给大家分享下此类视频的制作方法,我们要使用的工具是 Stable Diffusion WebUI 和它的一个插件 AnimateDiff,这里简单介绍下它们。
Stable Diffusion WebUI 是当下最流行的AI绘画工具之一,可以在浏览器中使用,操作简单方便,容易上手,有很多扩展插件可以使用。
AnimateDiff 是一个即插即用的模块,不需要额外训练,就能将图片轻松转换为动画视频。
下面开始我们的探索之旅。
手动安装
安装 Stable Diffusion WebUI
关于 Stable Diffusion WebUI 的安装方法,大家一般使用的都是秋叶整合包,文末可领取安装包!
安装 Animatediff 插件
启动 Stable Diffusion WebUI 后,我们在主菜单中找到“扩展插件/Extensions”,点击进入后,按照下图的方式安装插件:
安装成功后,记得重启 Stable Diffusion WebUI。
然后就能在“文生图”和“图生图”的页面下方看到这个插件,如下图所示,点击右侧按钮就能展开插件的参数设置面板。
安装 Animatediff 模型
这里说的模型是 AnimateDiff 生成视频时所使用的模型,这种模型从真实世界的视频中学习了很多运动先验知识,不是 Stable Diffusion 生成静态图片使用的模型。
https://huggingface.co/guoyww/animatediff/tree/main
这些模型还需要搭配 Stable Diffusion 的模型一起使用,如果使用的 Stable Diffusion 模型是1.5版本,建议下载这个最新的 v3 版本。
如果使用的是 Stable Diffusion XL 模型,请下载这个 mm_sdxl_v10_beta。不过根据官方的介绍,因为训练数据的不足,XL模型的效果可能不太好,还是建议使用SD 1.5。
模型下载后放到插件的 model 目录下,如下图所示:
有的同学可能会问:怎么识别 Stable Diffusion 模型的版本?我们下载模型的时候,模型的名字和详情中一般都会标注这个模型的基础模型或者算法版本,1.5 或者 XL,所以不用担心分不清楚。如下图所示:
生成视频
万事俱备,现在就可以开始制作动画视频了。注意生成的视频是没有声音的,你还可能还想给视频加一些配乐、加一些贴纸,我们可以到剪映中再做一下剪辑,下边也会有一个简单的使用介绍。
常见报错
问题一
生成视频
首先看怎么生成视频,只需要简单的两步:
第1步: 选择Stable Diffusion模型,填写提示词和反向提示词,如下图所示:
Stable Diffusion 模型可以根据自己的喜好进行选择,官方推荐了两个,一个是真实模型 realisticVision,另一个是动漫模型 ToonYou,大家可以自行下载,也可以给公众号“yinghuo6ai”发消息“SD”获取下载地址。
提示词的编写有点技术含量,不过也很容易掌握。这种提示词的编写方法称为“Prompt Travel”,可以理解为“提示词旅行”或者“提示词穿梭”,编写时分为三个部分:
- 首行是头部提示,可以不写。
- 中间部分使用“帧号: 提示内容”的格式进行编写,帧号按升序排列,第一帧的索引为0。
- 最后一行是尾部提示,同样是可选的。
头部提示和尾部提示会增加到中间每个帧的提示词前后,用于控制生成视频中关键帧的图片生成。
如果不使用这种提示词编写方法也是可以生成动漫视频的,比如“1girl is dancing”可以生成一个女孩跳舞的视频,只是不太适合本文演示的视频内容。
贴出我使用的提示词:
masterpiece, best quality, wealthy family, solo,
0: a new born cute baby girl lying on a crib crying, top view,gold jewelry,
10: a new born cute baby girl lying on a crib smiling, top view,gold jewelry,
20: (( three-year-old_girl:1.2)),gold jewelry,
30: (( five-year-old_girl:1.3)),gold jewelry, saree clothing,gold jewelry,
40: 7 years old girl in the classroom,school uniform, pretty,noble school,exclusive school,
50: 7 years old girl in the classroom,school uniform, pretty,noble school,exclusive school,
60: 12 years old girl wearing a backpack, school uniform, pretty,noble school,exclusive school,
70: 17 years old girl,((dancing)), saree, pretty,gold jewelry,(school show),
80: 17 years old girl,((dancing)), saree, pretty,gold jewelry,(school show),
90: 17 years old girl dancing, saree, pretty,gold jewelry,
100: 20 years old woman graduates from college, (black PhD hat),on campus, pretty,
110: 20 years old woman graduates from college, (black PhD hat), on campus, pretty,
120: 25 years old woman working in office, computer, ((professional suit)),pretty,
140: 25 years old woman working in office, computer, ((professional suit)),pretty,
150: 26 year old woman in wedding, lehari clothing, pretty,gold jewelry,
160: 26 year old woman in wedding, lehari clothing, pretty,gold jewelry,
170: 27 year old woman, pregnant woman with a big belly, lehari clothing, pretty,gold jewelry,
180: 30 year old woman holding a baby, lehari clothing, pretty,gold jewelry,
190: 30 year old woman holding a baby, lehari clothing, pretty,gold jewelry,
200: 38 year old woman standing in front of the classroom blackboard, Indian teacher uniform,
210: 40 year old woman standing in front of the classroom blackboard, Indian teacher uniform,
220: 50 year old woman, looking at viewer, home party, rice container, saree clothing,gold jewelry,
230: 50 year old woman, looking at viewer, home party,rice container, saree clothing,gold jewelry,
240: 60 year old woman traveling, standing on a large cruise ship,lehari clothing,gold jewelry,
250: 60 year old woman traveling, standing on a large cruise ship,lehari clothing,gold jewelry,
260: 70 year old woman crossed legs, lehari, indian style,
270: 70 year old woman crossed legs, lehari, indian style,
280: a 80 year old woman in a large memorial photograph is displayed hanging on the wall, lehari, indian clothes,gold jewelry,
290: a 80 year old woman in a large memorial photograph is displayed hanging on the wall, lehari, indian clothes,gold jewelry,
little smile, looking at viewer, simple background,
第2步: 配置Animatediff参数,如下图所示:
以下是比较短视频的生成案例
案例一
masterpiece,best quality,man,
10:25 years old man working in office,computer,((professional suit)),pretty,
20:25 years old man working in office,computer,((professional suit)),pretty,
little smile,looking at viewer,simple background,
案例二
masterpiece,best quality,man,
10:25 years old man working in Starbucks,computer,((casual clothing)),pretty,
20:25 years old man working in cramped office,cramped_desk,((casual clothing)),pretty,
30:25 years old man , (business meeting),((casual clothing)),pretty,
40:25 years old man establishing a company, ((casual clothing)),pretty,
50:25 years old man ,BBQ celebration, ((casual clothing)),pretty,
little smile,looking at viewer,simple background,<lora:dongsheng2-000008:1>,
masterpiece, best quality, solo,
0: 25 years old man working in office, computer, ((casual clothing)),pretty,
10: 25 years old man working in Starbucks, computer, ((casual clothing)),pretty,
20: 25 years old man working in cramped office, cramped_desk, ((casual clothing)),pretty,
30: a 5 years old man playing pool, ((casual clothing)),pretty,
40: 7 years old girl in the classroom,school uniform, pretty,noble school,exclusive school,
50: 7 years old girl in the classroom,school uniform, pretty,noble school,exclusive school,
60: 12 years old girl wearing a backpack, school uniform, pretty,noble school,exclusive school,
70: 17 years old girl,((dancing)), saree, pretty,gold jewelry,(school show),
80: 17 years old girl,((dancing)), saree, pretty,gold jewelry,(school show),
90: 17 years old girl dancing, saree, pretty,gold jewelry,
100: 20 years old woman graduates from college, (black PhD hat),on campus, pretty,
110: 20 years old woman graduates from college, (black PhD hat), on campus, pretty,
120: 25 years old woman working in office, computer, ((professional suit)),pretty,
140: 25 years old woman working in office, computer, ((professional suit)),pretty,
150: 26 year old woman in wedding, lehari clothing, pretty,gold jewelry,
160: 26 year old woman in wedding, lehari clothing, pretty,gold jewelry,
170: 27 year old woman, pregnant woman with a big belly, lehari clothing, pretty,gold jewelry,
180: 30 year old woman holding a baby, lehari clothing, pretty,gold jewelry,
190: 30 year old woman holding a baby, lehari clothing, pretty,gold jewelry,
200: 38 year old woman standing in front of the classroom blackboard, Indian teacher uniform,
210: 40 year old woman standing in front of the classroom blackboard, Indian teacher uniform,
220: 50 year old woman, looking at viewer, home party, rice container, saree clothing,gold jewelry,
230: 50 year old woman, looking at viewer, home party,rice container, saree clothing,gold jewelry,
240: 60 year old woman traveling, standing on a large cruise ship,lehari clothing,gold jewelry,
250: 60 year old woman traveling, standing on a large cruise ship,lehari clothing,gold jewelry,
260: 70 year old woman crossed legs, lehari, indian style,
270: 70 year old woman crossed legs, lehari, indian style,
280: a 80 year old woman in a large memorial photograph is displayed hanging on the wall, lehari, indian clothes,gold jewelry,
290: a 80 year old woman in a large memorial photograph is displayed hanging on the wall, lehari, indian clothes,gold jewelry,
little smile, looking at viewer, simple background,
案例三
女孩成长
"0" : "a new born baby girl lying on a crib crying, top view",
"10" : "a new born baby girl lying on a crib crying, top view",
"20" : "a 5 years old toddler",
"30" : "a 5 years old toddler",
"40" : "10 year old girl running",
"50" : "10 year old girl running",
"60" : "20 year old woman graduates from college, on campus",
"70" : "20 year old woman graduates from college, on campus",
"80" : "25 year old woman working in office, professional suit",
"90" : "25 year old woman working in office professional suit",
"100" : "35 year old woman holding a baby, casual clothing",
"110" : "35 year old woman holding a baby, casual clothing",
"120" : "50 year old woman, looking at viewer, casual clothing",
"130" : "50 year old woman, looking at viewer, casual clothing",
"140" : "80 year old woman, looking at viewer, casual clothing",
"150" : "80 year old woman, looking at viewer, casual clothing",
"160" : "90 year old woman, top view, lying on death bed, hospital clothing, eyes closed",
"170" : "90 year old woman, top view, lying on death bed, hospital clothing, eyes closed"
0 : a new born baby girl lying on a crib crying, top view,
10 : a new born baby girl lying on a crib crying, top view,
20 : a 5 years old toddler,
30 : a 5 years old toddler,
40 : 10 year old girl running,
50 : 10 year old girl running,
60 : 20 year old woman graduates from college, on campus,
70 : 20 year old woman graduates from college, on campus,
80 : 25 year old woman working in office, professional suit,
90 : 25 year old woman working in office professional suit,
100 : 35 year old woman holding a baby, casual clothing,
110 : 35 year old woman holding a baby, casual clothing,
120 : 50 year old woman, looking at viewer, casual clothing,
130 : 50 year old woman, looking at viewer, casual clothing,
140 : 80 year old woman, looking at viewer, casual clothing,
150 : 80 year old woman, looking at viewer, casual clothing,
160 : 90 year old woman, top view, lying on death bed, hospital clothing, eyes closed,
170 : 90 year old woman, top view, lying on death bed, hospital clothing, eyes closed ,
案例四
推荐使用模型 AniMerge - Pony XL,
score_9, score_8_up, score_7_up, depth of field, dynamic angle, (photo realistic:1.4), realistic skin:1.4, fashion photography, sharp, analog film grain,
0:Portrait,Elsa of Arendelle,cute,seductive,innocent,light smile,plump lips,slender body,(dark cape),(dark dress),fur trim,single braid,snowflake pattern,snowy mountain background,
10:girl,cute,seductive,innocent,light smile,plump lips,slender body,high detailed gothic dress,(red|white|black),vibrant color,mistery forest background,
20:Full Body Shot, girl, cute, seductive, innocent, light smile:0.3, plump lips, slender body, trees, intricate, gold leaf accents, decorative surfaces, Klimt's Art Nouveau style, forest background,
30 :18 year old, solo, 1girl, long hair, brown hair, blue eyes, long length hair, medium size breasts, petite,, (white sleeve short shirt, fitted shirt), beige executive pants, public, seductive smile,rabbit pose,
40 : Cowboy Shot, girl, cute, seductive, innocent, light smile, plump lips, slender body, solo, dark red dress, fog atmosphere, fashion photography, cinematic photography, vibrant colors, cinematic lighting, abandoned old train station, fog background,
50 : Portrait, girl, fire fairy, cute, seductive, innocent, light smile, plump lips, slender body, french bob copper hair, silver eyes, in high detailed copper light armor, reflective, intricated, big detailed flaming wings, symmetrical wings, chromatic aberration, colorful, bright colors, moonlight passing through hair, enchanted forest background,
60 : Queen Elsa, platinum blonde hair styled in a flowing braid adorned with subtle crystal-like accents, luminous fair skin, piercing ice-blue eyes filled with serene confidence. She wears a luxurious navy blue gown with intricate snowflake-inspired gold embroidery and an opulent cape shimmering with frost-like patterns, evoking the magic of winter. The gown flows gracefully, catching the light with a subtle iridescence that reflects her icy powers.
The camera is positioned at a low angle for a commanding full-body shot, emphasizing her regal presence and the elegant flow of her gown and cape. Cool atmospheric lighting in hues of blue and silver highlights the shimmering details of her dress, while the soft glow from her hands subtly reveals the power within. Ultra-detailed textures, cinematic realism, and artistic elegance, capturing Elsa’s majesty, strength, and the magical essence of winter,
70: girl,mid-twenties, sophisticated bar setting, elegant casual evening attire, soft cocktail dress or stylish blouse, subtle professional makeup, city bar background with soft ambient lighting, sitting at bar counter, delicate wine glass or cocktail, reflective yet confident expression, urban nightlife atmosphere, detailed anime illustration, high-resolution rendering, volumetric mood lighting, contemporary urban style, nuanced facial details, soft color gradient, subdued metallic and deep tone accents, artistic composition, cultural modern elegance, gentle sophistication
0:肖像,阿伦黛尔的艾莎,可爱,迷人,纯真,浅笑盈盈,嘴唇丰满,身材苗条,黑色披风,黑色连衣裙,有毛皮镶边,单麻花辫,雪花图案,雪山背景。
10:女孩,可爱,迷人,纯真,浅笑盈盈,嘴唇丰满,身材苗条,高细节的哥特式连衣裙,红/白/黑色,色彩鲜艳,神秘森林背景。
21:全身照,女孩,可爱,迷人,纯真,浅笑(权重0.3),嘴唇丰满,身材苗条,树木,造型精致,有金叶装饰,装饰性表面,克里姆特新艺术风格,森林背景。
30:18岁,单人,1个女孩,长发,棕色头发,蓝色眼睛,长发,胸部中等大小,身材娇小,(白色短袖衬衫,修身衬衫),米色通勤裤,公共场所,迷人的微笑,兔子坐姿。
40:牛仔半身照,女孩,可爱,迷人,纯真,浅笑,嘴唇丰满,身材苗条,单人,深红色连衣裙,雾气氛围,时尚摄影,电影摄影,色彩鲜艳,电影灯光,废弃的旧火车站,雾气背景。
50:肖像,女孩,火之仙女,可爱,迷人,纯真,浅笑,嘴唇丰满,身材苗条,法式波波头铜色头发,银色眼睛,身着高细节的铜色轻甲,反光,精致复杂,巨大且细节丰富的火焰翅膀,对称的翅膀,色差效果,色彩斑斓,亮色,月光穿过发丝,魔法森林背景。
60:艾莎女王,铂金色的头发梳成一条飘逸的辫子,点缀着若隐若现的水晶般装饰,白皙透亮的肌肤,冰蓝色的双眸目光锐利,充满宁静的自信。她身着一件奢华的深蓝色长袍,上面有以雪花为灵感的精致金色刺绣,还有一件华丽的披风,闪烁着冰霜般的图案,尽显冬日魔法气息。长袍优雅地飘动着,微微闪烁着虹彩光芒,映射出她的冰雪魔力。
镜头采用低角度拍摄,呈现出具有威严感的全身画面,突出她的王者风范以及长袍和披风优雅的飘动姿态。冷色调的蓝色和银色氛围灯光凸显出她裙装闪烁的细节,而她双手散发出的柔和光芒则巧妙地展现出其内在的魔力。超精细的纹理、电影般的真实感以及艺术的优雅感,捕捉到了艾莎的威严、力量以及冬日的神奇特质。
70:女孩,二十五六岁,精致的酒吧环境,优雅休闲的晚装,柔和的鸡尾酒裙或时尚的衬衫,淡雅的职业妆,城市酒吧背景,有着柔和的环境灯光,坐在吧台边,拿着精致的酒杯或鸡尾酒,表情透着自信又若有所思,都市夜生活氛围,精细的动漫插画,高分辨率渲染,立体氛围灯光,当代都市风格,面部细节细腻,柔和的色彩渐变,低调的金属色及深色色调点缀,艺术构图,现代文化的优雅感,优雅精致。
案例五
score_9, score_8_up, score_7_up, depth of field, dynamic angle, (photo realistic:1.4), realistic skin:1.4, fashion photography, sharp, analog film grain
0 :1girl,sweater,white background,
10:1girl,hair with bangs,black long dress,
20: ((black pantyhose)),((asian girl)),((smile, upper teeth, white shirt, blue bow, blue pleated skirt with checker pattern, kneel down on bed)),bright theme,((ultra-detailed)),(highly detailed CG illustration),(expressionless),(best quality:1.2),(1girl:1.2),High quality texture,intricate details,detailed texture,High quality shadow,thin lips,brown eye pupil,depth of field,perspective,20s,(big eyes:1.2),blush,perfect body,lean body,(narrow waist:1.3),large breast,distinct_image,(lustrous skin),solo focus,(brown hair),(streaked hair),((long hair)),<lora:Hand v2:1>,
30:Sexy ,av , Look to the right <lora:baif-05:0.9> , score_9, score_8_up, score_7_up, Portrait, girl, cute, seductive, innocent, light smile, plump lips, slender body, solo, dark green dress, detailed necklace, fog atmosphere, fashion photography, cinematic photography, vibrant colors, cinematic lighting, abandoned old train station, fog background,
40: (1girl:1.3),long hair,(standing:1.3),(looking at viewer:1.4),Elegant,detailed gorgeous face,realistic,(cowboy shot:1.2),(river background:1.2),,MIS,camisole,bare shoulders,ribbon,black skirt,<lora:MIS166:0.75>
Motion module:这里选择动画模型,如果 Stable Diffusion 模型使用的是 1.5 模型,这里请选择 v3_sd15_mm.ckpt,如果 SD 使用的是XL模型,这里请选择
Save format 也就是生成视频的保存格式,这里建议勾选 GIF 和 MP4。
Enable AnimateDiff 勾选后就会在 Stable Diffusion WebUI 生成时创建视频。
Number of frames 视频的总帧数,一定要比上边提示词中使用的提示词要大。
Closed loop 控制视频的循环播放效果,也就是让最后一帧更趋同于第一帧,这在Gif动画时特别有用,不过长视频就不推荐了,这里选择“N”。其它几个选项会逐渐加深对视频循环的倾向,A会让最后一帧和第一帧的画面相同。
其它 Stable Diffusion 的采样器、采样步数、图片的宽高,我们全部使用默认的就可以了,等你熟练操作了,可以试着改改参数。
然后我们就可以去点击生成了,图片生成区域会展示处理进度,最后我们可以查看GIF和MP4,然后点击右上角的下载按钮下载到本地。
视频剪辑
这一步可以在手机中完成,通过手机自带的应用市场安装一个“剪映”APP。
点击“开始创作”选择下载到手机中的视频。
然后在页面下方点击“音频”,继续点击“音乐”,选择一首搭配的音乐就行了(上边可以搜索的哦)。
注意音乐的长度和视频的长度可能不匹配,拖动相应的区域就可以进行剪辑,试试就会用了,其它功能也是多试试,很容易就掌握了。
最后点击右上角的“导出”,我们就可以在手机相册中找到这个视频了。
进阶功能
Animatediff还可以搭配 ControlNet 使用,这样我们就可以做更多的生成控制,比如参考某种风格、使用某种动作姿势,等等。
举个美女跳舞的例子,我们可以先找一个美女跳舞的视频,然后使用 Stable Diffusion+Animatediff 进行重绘,这样我们就可以生成1个新的美女跳舞视频,人物、服饰、背景是新的,但是人物的动作是参考视频的。
首先看 Animatediff 的设置:
然后我们在 ControlNet 中启用 OpenPose 类型:
生成效果差不多是这样的:
当然我们也可以使用其它的 ControlNet 类型,直接在ControlNet给一张参考图片,而不使用视频作为参考。
关于Sora
前段时间OpenAI发布了AI视频生成模型Sora,其在遵循复杂文本提示和生成复杂场景方面表现卓越,着实震惊了世界,但是根据这两天的消息,由于各个方面的原因,Sora短期内都不会公开发布,更谈不上开源了,所以使用 Animatediff 生成视频还是有很大意义的。
Animatediff 官方的计划也是继续开发这个扩展程序,直到有具备强大复杂场景生成能力、易于定制且拥有类似SD1.5良好生态系统的开源视频模型发布为止。