<div class="page-header only-word">
        <div class="content flex-center " style="">
        <div class="container">
            <header class="post-header">
        <h1 class="post-title" style="">SD-webui Animatediff使用（AI生成动画的一种方法）</h1>
        <div class="post-metas">
                            <span>最后更新于 2024-10-17</span>
                                    <a href="https://moecat.cc/author/nicocat/">
                    <span class="meta-author">
                        <img alt='nicocat' src='https://weavatar.com/avatar/1aeca73a20d6fea54d81269e6bc00175745e013f9a221a1ccd9492e2ff726287?s=24&#038;d=mm&#038;r=g' srcset='https://weavatar.com/avatar/1aeca73a20d6fea54d81269e6bc00175745e013f9a221a1ccd9492e2ff726287?s=48&#038;d=mm&#038;r=g 2x' class='avatar avatar-24 photo avatar-small' height='24' width='24' loading='lazy' decoding='async'/>                        nicocat                    </span>
                </a>
                                <span>5972 次阅读</span>
                            </div>
    </header>
            </div>
    </div>
</div>
<p class="wp-block-paragraph">Stable Diffusion Animatediff 使用教程，快速入门</p>



<p class="wp-block-paragraph">由于作者更新，网上大部分教程已过时失效，所以我决定根据官方说明写一篇简易入门教程</p>



<p class="wp-block-paragraph">限于本人水平，如果你有能力，建议自行参阅<a href="https://github.com/continue-revolution/sd-webui-animatediff/tree/master/docs" target="_blank" rel="nofollow noopener noreferrer">作者本人的说明</a>，本篇文档仅根据本人使用经验编写</p>



<p class="wp-block-paragraph">Read the stable diffusion animatediff official English user turtial guide <a href="https://github.com/continue-revolution/sd-webui-animatediff/tree/master/docs" target="_blank" rel="nofollow noopener noreferrer">here</a>.</p>



<h2 class="wp-block-heading">下载：</h2>



<p class="wp-block-paragraph">1.使用绘世启动器，在版本管理——安装新拓展中搜索animatediff安装sd-webui-animatediff即可</p>



<p class="wp-block-paragraph">2.通过官方说明安装，在此不做说明</p>



<h2 class="wp-block-heading">使用准备：</h2>



<p class="wp-block-paragraph">在<a href="https://hf-mirror.com/conrevo/AnimateDiff-A1111/tree/main" target="_blank" rel="noreferrer noopener">作者的模型仓库</a>下载以下模型并按要求操作：</p>



<p class="wp-block-paragraph">1.在motion_module下载v3及以后的模型，sd1.5下载含有sd15的模型，sdxl下载sdxl的模型，</p>



<p class="wp-block-paragraph">下载完成后放入“\extensions\sd-webui-animatediff\model”文件夹</p>



<p class="wp-block-paragraph">2.在lora下载任意lora模型放入“\models\Lora”以备使用</p>



<p class="wp-block-paragraph">3.有使用controlnet需求的在controlnet下载相应的controlnet模型放入“\models\ControlNet”以备使用</p>



<p class="wp-block-paragraph"></p>



<h2 class="wp-block-heading">开始使用</h2>



<p class="wp-block-paragraph">以下为基于sd1.5的使用说明，限于本人硬件水平，sdxl的用户请自行结合实际情况和官方说明文档使用</p>



<h3 class="wp-block-heading">1.编写标准的提示词</h3>



<p class="wp-block-paragraph">比如：</p>



<p class="has-text-align-center wp-block-paragraph">正面提示词</p>



<pre class="wp-block-code"><code>1girl,(loli:0.8),(solo:1.1),looking at viewer,brown hair,outdoor,depth of field,(((low twintails:1.3))),((hair flower:1.2)),ahoge,(hairband:1.1),hairflower,hairclip,((pleated skirt:1.2)),((layered skirt:1.2)),(dress:1.1),((white shirt:1.2)),petals,flower,sidelocks,short hair,bangs,blush,blue skirt,sleeves past wrists,green eyes,bangs,((light smile:1.1)),long sleeves,hair between eyes,blue skirt,small breasts,open clothes,cardigan,red neckerchief,neckerchief,((white loose socks:1.2)),masterpiece,(official wallpaper:1.1),&lt;lora:mm_sd15_v2_lora_ZoomOut:1&gt;,</code></pre>



<p class="has-text-align-center wp-block-paragraph">负面提示词</p>



<pre class="wp-block-code"><code>(worst quality, low quality:1.4),(fuze:1.4),(worst quality:1.1),(low quality:1.4),((grayscale)),badhandv4,(missing fingers:1.1),(more fingers:1.1),EasyNegative,(bad hands:1.1),((poorly drawn hands:1.1)),fused fingers,malformed limbs,too many fingers,mutated hands,extra limb,((mosaic:1.1)),((mosaic_censoring:1.1)),BadDream,lowres,text,error,extra digit,fewer digits,jpeg artifacts,deformed,leg rings,cropped,signature,watermark,username,(fat:1.2),</code></pre>



<p class="wp-block-paragraph">注意：在编写完正面提示词后，请添加一个作者提供的镜头Lora，比如示例提示词中的&lt;lora:mm_sd15_v2_lora_ZoomOut:1&gt;,</p>



<h3 class="wp-block-heading">2.编辑参数</h3>



<p class="wp-block-paragraph">根据显卡性能适当调整输出的分辨率和迭代步数，达不到8GB显存的用户强烈建议512*512以下，因为使用共享显存会夸张地延长生成需要的时间</p>



<p class="wp-block-paragraph">animatediff参数：</p>



<p class="wp-block-paragraph">点击启用</p>



<p class="wp-block-paragraph">模型：根据你选用的stablediffusion大模型选择对应的作者提供的动画模型</p>



<p class="wp-block-paragraph">闭环（RP选项）</p>



<p class="wp-block-paragraph">该选项将决定生成的动画循环的程度，从左到右依次增强，选择A模型将积极使第一帧与最后一帧相同，从而使生成的动画循环播放而不显得突兀</p>



<p class="wp-block-paragraph">帧插值（酌情使用，需要安装deform，新手使用该插件容易破坏环境，在此不做说明）</p>



<p class="wp-block-paragraph">总帧数：就是总共生成多少帧，如果你使用了视频，则是匹配到视频的第几帧</p>



<p class="wp-block-paragraph">帧率：每秒播放多少帧</p>



<p class="wp-block-paragraph">循环数量：gif循环播放多少次</p>



<p class="wp-block-paragraph">上下文单批数量：依次处理的帧数量，sd1.5建议设置为16，sdxl建议设置为8（作者说明）</p>



<p class="wp-block-paragraph">步幅、重叠和帧插值（以下摘自作者原文，我的建议是建议保持默认参数）</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<ol class="wp-block-list">
<li><strong>Stride</strong>&nbsp;— Max motion stride as a power of 2 (default: 1).
<ol class="wp-block-list">
<li>Due to the limitation of the infinite context generator, this parameter is effective only when&nbsp;<code>Number of frames</code>&nbsp;&gt;&nbsp;<code>Context batch size</code>, including when ControlNet is enabled and the source video frame number &gt;&nbsp;<code>Context batch size</code>&nbsp;and&nbsp;<code>Number of frames</code>&nbsp;is 0.</li>



<li>"Absolutely no closed loop" is only possible when&nbsp;<code>Stride</code>&nbsp;is 1.</li>



<li>For each 1 &lt;=&nbsp;2i&nbsp;&lt;=&nbsp;<code>Stride</code>, the infinite context generator will try to make frames&nbsp;2i&nbsp;apart temporal consistent. For example, if&nbsp;<code>Stride</code>&nbsp;is 4 and&nbsp;<code>Number of frames</code>&nbsp;is 8, it will make the following frames temporal consistent:
<ul class="wp-block-list">
<li><code>Stride</code>&nbsp;== 1: [0, 1, 2, 3, 4, 5, 6, 7]</li>



<li><code>Stride</code>&nbsp;== 2: [0, 2, 4, 6], [1, 3, 5, 7]</li>



<li><code>Stride</code>&nbsp;== 4: [0, 4], [1, 5], [2, 6], [3, 7]</li>
</ul>
</li>
</ol>
</li>



<li><strong>Overlap</strong>&nbsp;— Number of frames to overlap in context. If overlap is -1 (default): your overlap will be&nbsp;<code>Context batch size</code>&nbsp;// 4.
<ol class="wp-block-list">
<li>Due to the limitation of the infinite context generator, this parameter is effective only when&nbsp;<code>Number of frames</code>&nbsp;&gt;&nbsp;<code>Context batch size</code>, including when ControlNet is enabled and the source video frame number &gt;&nbsp;<code>Context batch size</code>&nbsp;and&nbsp;<code>Number of frames</code>&nbsp;is 0.</li>
</ol>
</li>



<li><strong>Interp X</strong>&nbsp;— Replace each input frame with X interpolated output frames.</li>
</ol>
</blockquote>
</blockquote>



<h2 class="wp-block-heading">生成效果：</h2>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="480" height="720" src="https://nicocat.cc/wp-content/uploads/2024/10/1729155704-00003-3009101076.gif" alt="" class="wp-image-280" style="width:156px;height:auto"/ title="SD-webui Animatediff使用（AI生成动画的一种方法）"></figure>



<p class="wp-block-paragraph"></p>
