doc: update ffmpeg.md (#18) d7d6b0d447

This commit is contained in:
jaywcjlove
2022-11-06 14:50:52 +00:00
parent 1268895153
commit 26d1abef96
2 changed files with 260 additions and 30 deletions

View File

@ -42,8 +42,9 @@
<p>本备忘清单是 <a href="https://ffmpeg.org/">FFmpeg</a> 中常见视频处理操作的备忘清单</p> <p>本备忘清单是 <a href="https://ffmpeg.org/">FFmpeg</a> 中常见视频处理操作的备忘清单</p>
</div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true"> </div></header><div class="menu-tocs"><div class="menu-btn"><svg aria-hidden="true" fill="currentColor" height="1em" width="1em" viewBox="0 0 16 16" version="1.1" data-view-component="true">
<path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path> <path fill-rule="evenodd" d="M2 4a1 1 0 100-2 1 1 0 000 2zm3.75-1.5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zm0 5a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5zM3 8a1 1 0 11-2 0 1 1 0 012 0zm-1 6a1 1 0 100-2 1 1 0 000 2z"></path>
</svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" href="#ffmpeg-参考">FFmpeg 参考</a><a aria-hidden="true" class="leve3 tocs-link" href="#安装">安装</a><a aria-hidden="true" class="leve3 tocs-link" href="#示例">示例</a><a aria-hidden="true" class="leve3 tocs-link" href="#常用开关">常用开关</a><a aria-hidden="true" class="leve3 tocs-link" href="#音频">音频</a><a aria-hidden="true" class="leve3 tocs-link" href="#比特率">比特率</a><a aria-hidden="true" class="leve4 tocs-link" href="#视频">视频</a><a aria-hidden="true" class="leve2 tocs-link" href="#视频编辑">视频编辑</a><a aria-hidden="true" class="leve3 tocs-link" href="#裁剪">裁剪</a><a aria-hidden="true" class="leve3 tocs-link" href="#缩放">缩放</a><a aria-hidden="true" class="leve3 tocs-link" href="#视频帧速率">视频帧速率</a><a aria-hidden="true" class="leve3 tocs-link" href="#剪切视频部分">剪切视频部分</a><a aria-hidden="true" class="leve3 tocs-link" href="#h265-2-pass-编码">H265 2-pass 编码</a><a aria-hidden="true" class="leve3 tocs-link" href="#视频比特率设置">视频比特率设置</a><a aria-hidden="true" class="leve3 tocs-link" href="#固定旋转">固定旋转</a><a aria-hidden="true" class="leve3 tocs-link" href="#放慢视频速度">放慢视频速度</a><a aria-hidden="true" class="leve3 tocs-link" href="#缩放到特定宽度">缩放到特定宽度</a><a aria-hidden="true" class="leve2 tocs-link" href="#重新包装">重新包装</a><a aria-hidden="true" class="leve3 tocs-link" href="#提取音频流">提取音频流</a><a aria-hidden="true" class="leve3 tocs-link" href="#创建缩略图">创建缩略图</a><a aria-hidden="true" class="leve3 tocs-link" href="#处理-id3-标签">处理 id3 标签</a><a aria-hidden="true" class="leve3 tocs-link" href="#重新采样转换音频">重新采样/转换音频</a><a aria-hidden="true" class="leve3 tocs-link" href="#切换容器转换类型">切换容器(转换类型)</a><a aria-hidden="true" class="leve3 tocs-link" href="#音视频同步">音视频同步</a><a aria-hidden="true" class="leve3 tocs-link" href="#图片中的视频">图片中的视频</a><a aria-hidden="true" class="leve3 tocs-link" href="#将视频拆分为图像">将视频拆分为图像</a><a aria-hidden="true" class="leve3 tocs-link" href="#转换为-gif">转换为 Gif</a><a aria-hidden="true" class="leve3 tocs-link" href="#移除音频">移除音频</a><a aria-hidden="true" class="leve3 tocs-link" href="#字幕">字幕</a><a aria-hidden="true" class="leve3 tocs-link" href="#音量">音量</a><a aria-hidden="true" class="leve2 tocs-link" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="ffmpeg-参考"><a aria-hidden="true" tabindex="-1" href="#ffmpeg-参考"><span class="icon icon-link"></span></a>FFmpeg 参考</h2><div class="wrap-body"> </svg></div><div class="menu-modal"><a aria-hidden="true" class="leve2 tocs-link" href="#ffmpeg-参考">FFmpeg 参考</a><a aria-hidden="true" class="leve3 tocs-link" href="#安装">安装</a><a aria-hidden="true" class="leve3 tocs-link" href="#示例">示例</a><a aria-hidden="true" class="leve3 tocs-link" href="#全局选项">全局选项</a><a aria-hidden="true" class="leve3 tocs-link" href="#主要选项">主要选项</a><a aria-hidden="true" class="leve3 tocs-link" href="#基础参数">基础参数</a><a aria-hidden="true" class="leve3 tocs-link" href="#视频参数">视频参数</a><a aria-hidden="true" class="leve3 tocs-link" href="#码率设置">码率设置</a><a aria-hidden="true" class="leve3 tocs-link" href="#尺寸规格">尺寸规格</a><a aria-hidden="true" class="leve3 tocs-link" href="#音频参数">音频参数</a><a aria-hidden="true" class="leve2 tocs-link" href="#视频编辑">视频编辑</a><a aria-hidden="true" class="leve3 tocs-link" href="#裁剪">裁剪</a><a aria-hidden="true" class="leve3 tocs-link" href="#缩放">缩放</a><a aria-hidden="true" class="leve3 tocs-link" href="#视频帧速率">视频帧速率</a><a aria-hidden="true" class="leve3 tocs-link" href="#剪切视频部分">剪切视频部分</a><a aria-hidden="true" class="leve3 tocs-link" href="#h265-2-pass-编码">H265 2-pass 编码</a><a aria-hidden="true" class="leve3 tocs-link" href="#视频比特率设置">视频比特率设置</a><a aria-hidden="true" class="leve3 tocs-link" href="#固定旋转">固定旋转</a><a aria-hidden="true" class="leve3 tocs-link" href="#放慢视频速度">放慢视频速度</a><a aria-hidden="true" class="leve3 tocs-link" href="#缩放到特定宽度">缩放到特定宽度</a><a aria-hidden="true" class="leve2 tocs-link" href="#重新包装">重新包装</a><a aria-hidden="true" class="leve3 tocs-link" href="#提取音频流">提取音频流</a><a aria-hidden="true" class="leve3 tocs-link" href="#创建缩略图">创建缩略图</a><a aria-hidden="true" class="leve3 tocs-link" href="#处理-id3-标签">处理 id3 标签</a><a aria-hidden="true" class="leve3 tocs-link" href="#重新采样转换音频">重新采样/转换音频</a><a aria-hidden="true" class="leve3 tocs-link" href="#切换容器转换类型">切换容器(转换类型)</a><a aria-hidden="true" class="leve3 tocs-link" href="#音视频同步">音视频同步</a><a aria-hidden="true" class="leve3 tocs-link" href="#图片中的视频">图片中的视频</a><a aria-hidden="true" class="leve3 tocs-link" href="#将视频拆分为图像">将视频拆分为图像</a><a aria-hidden="true" class="leve3 tocs-link" href="#转换为-gif">转换为 Gif</a><a aria-hidden="true" class="leve3 tocs-link" href="#移除音频">移除音频</a><a aria-hidden="true" class="leve3 tocs-link" href="#字幕">字幕</a><a aria-hidden="true" class="leve3 tocs-link" href="#音量">音量</a><a aria-hidden="true" class="leve2 tocs-link" href="#另见">另见</a></div></div><div class="h1wrap-body"><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="ffmpeg-参考"><a aria-hidden="true" tabindex="-1" href="#ffmpeg-参考"><span class="icon icon-link"></span></a>FFmpeg 参考</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="安装"><a aria-hidden="true" tabindex="-1" href="#安装"><span class="icon icon-link"></span></a>安装</h3><div class="wrap-body"> </div></div><div class="h2wrap-body"><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="安装"><a aria-hidden="true" tabindex="-1" href="#安装"><span class="icon icon-link"></span></a>安装</h3><div class="wrap-body">
<!--rehype:wrap-class=row-span-2-->
<p>Linux</p> <p>Linux</p>
<pre><code class="code-highlight"><span class="code-line">$ apt-get install ffmpeg <pre><code class="code-highlight"><span class="code-line">$ apt-get install ffmpeg
</span><span class="code-line">$ yum install ffmpeg </span><span class="code-line">$ yum install ffmpeg
@ -51,36 +52,264 @@
<p>MacOS</p> <p>MacOS</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ brew <span class="token function">install</span> ffmpeg <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ brew <span class="token function">install</span> ffmpeg
</span></code></pre> </span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="示例"><a aria-hidden="true" tabindex="-1" href="#示例"><span class="icon icon-link"></span></a>示例</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="示例"><a aria-hidden="true" tabindex="-1" href="#示例"><span class="icon icon-link"></span></a>示例</h3><div class="wrap-body">
<!--rehype:wrap-class=row-span-2-->
<p>mp4 转 avi:</p> <p>mp4 转 avi:</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> input.mp4 output.avi <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> input.mp4 output.avi
</span></code></pre> </span></code></pre>
<p>webm 转 mp4:</p> <p>webm 转 mp4:</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> movie.webm movie.mp4 <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> movie.webm movie.mp4
</span></code></pre> </span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="常用开关"><a aria-hidden="true" tabindex="-1" href="#常用开关"><span class="icon icon-link"></span></a>常用开关</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="全局选项"><a aria-hidden="true" tabindex="-1" href="#全局选项"><span class="icon icon-link"></span></a>全局选项</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line"><span class="token parameter variable">-codecs</span> <span class="token comment"># 列出编解码器</span>
</span><span class="code-line"><span class="token parameter variable">-c:v</span> <span class="token comment"># 视频编解码器(-vcodec)-'copy'复制流</span>
</span><span class="code-line"><span class="token parameter variable">-c:a</span> <span class="token comment"># 音频编解码器(-acodec)</span>
</span><span class="code-line"><span class="token parameter variable">-fs</span> SIZE <span class="token comment"># 限制文件大小(字节)</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="音频"><a aria-hidden="true" tabindex="-1" href="#音频"><span class="icon icon-link"></span></a>音频</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line"><span class="token parameter variable">-aq</span> QUALITY <span class="token comment"># 音频质量(特定于编解码器)</span>
</span><span class="code-line"><span class="token parameter variable">-ar</span> <span class="token number">44100</span> <span class="token comment"># 音频采样率 (Hz)</span>
</span><span class="code-line"><span class="token parameter variable">-ac</span> <span class="token number">1</span> <span class="token comment"># 音频通道1=单声道2=立体声)</span>
</span><span class="code-line"><span class="token parameter variable">-an</span> <span class="token comment"># 没有音频</span>
</span><span class="code-line"><span class="token parameter variable">-vol</span> N <span class="token comment"># 音量256=正常)</span>
</span></code></pre>
</div></div></div><div class="wrap h3body-exist"><div class="wrap-header h3wrap"><h3 id="比特率"><a aria-hidden="true" tabindex="-1" href="#比特率"><span class="icon icon-link"></span></a>比特率</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line"><span class="token parameter variable">-b:v</span> 1M <span class="token comment"># 视频比特率1M = 1Mbit/s</span>
</span><span class="code-line"><span class="token parameter variable">-b:a</span> 1M <span class="token comment"># 音频比特率</span>
</span></code></pre>
<h4 id="视频"><a aria-hidden="true" tabindex="-1" href="#视频"><span class="icon icon-link"></span></a>视频</h4>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line"><span class="token parameter variable">-aspect</span> RATIO <span class="token comment"># 纵横比4:3、16:9 或 1.25</span> <table><thead><tr><th align="left">:-</th><th>-</th></tr></thead><tbody><tr><td align="left"><code>-y</code></td><td>覆盖输出文件</td></tr><tr><td align="left"><code>-n</code></td><td>不要覆盖输出文件</td></tr></tbody></table>
</span><span class="code-line"><span class="token parameter variable">-r</span> RATE <span class="token comment"># 每秒帧率</span> </div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="主要选项"><a aria-hidden="true" tabindex="-1" href="#主要选项"><span class="icon icon-link"></span></a>主要选项</h3><div class="wrap-body">
</span><span class="code-line"><span class="token parameter variable">-s</span> WIDTHxHEIGHT <span class="token comment"># 帧大小</span>
</span><span class="code-line"><span class="token parameter variable">-vn</span> <span class="token comment"># 没有视频</span>
<table><thead><tr><th align="left">:-</th><th>-</th></tr></thead><tbody><tr><td align="left"><code>-f fmt</code></td><td>强制输入或输出文件格式</td></tr><tr><td align="left"><code>-i fName</code></td><td>输入文件名,未指定显示内容流的摘要</td></tr><tr><td align="left"><code>-c codecName</code></td><td>指定编解码器 [输入或输出]</td></tr><tr><td align="left"><code>-fs Nbytes</code></td><td>以 Nbytes 指定最大输出文件大小</td></tr></tbody></table>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="基础参数"><a aria-hidden="true" tabindex="-1" href="#基础参数"><span class="icon icon-link"></span></a>基础参数</h3><div class="wrap-body">
<table><thead><tr><th align="left">:-</th><th>-</th></tr></thead><tbody><tr><td align="left"><code>-codecs</code></td><td>列出可用编码</td></tr><tr><td align="left"><code>-formats</code></td><td>列出支持的格式</td></tr><tr><td align="left"><code>-protocols</code></td><td>列出支持的协议</td></tr><tr><td align="left"><code>-i input.mp4</code></td><td>指定输入文件</td></tr><tr><td align="left"><code>-c:v libx264</code></td><td>指定视频编码</td></tr><tr><td align="left"><code>-c:a aac</code></td><td>指定音频编码</td></tr><tr><td align="left"><code>-vcodec libx264</code></td><td>旧写法</td></tr><tr><td align="left"><code>-acodec aac</code></td><td>旧写法</td></tr><tr><td align="left"><code>-fs SIZE</code></td><td>指定文件大小</td></tr></tbody></table>
</div></div></div><div class="wrap h3body-not-exist col-span-2 row-span-2"><div class="wrap-header h3wrap"><h3 id="视频参数"><a aria-hidden="true" tabindex="-1" href="#视频参数"><span class="icon icon-link"></span></a>视频参数</h3><div class="wrap-body">
<!--rehype:wrap-class=col-span-2 row-span-2-->
<table><thead><tr><th align="left">:-</th><th>-</th></tr></thead><tbody><tr><td align="left"><code>-b bRate</code></td><td>设置视频比特率(单位 kbit/s)</td></tr><tr><td align="left"><code>-fixaspect</code></td><td>固定纵横比</td></tr><tr><td align="left"><code>-bt tolerance</code></td><td>设置视频比特率容差(单位 kbit/s)</td></tr><tr><td align="left"><code>-maxrate bRate</code></td><td>设置最大视频比特率容差(单位 kbit/s)</td></tr><tr><td align="left"><code>-minrate bRate</code></td><td>设置最小视频比特率容差(单位 kbit/s)</td></tr><tr><td align="left"><code>-bufsize size</code></td><td>设置速率控制缓冲区大小(以 kByte 为单位)</td></tr><tr><td align="left"><code>-sameq</code></td><td>使用与源相同的视频质量(意味着 VBR)</td></tr><tr><td align="left"><code>-newvideo</code></td><td>将新的视频流添加到当前输出流</td></tr><tr><td align="left"><code>-aspect RATIO</code></td><td>纵横比(4:3、16:9 或 1.25)</td></tr><tr><td align="left"><code>-r RATE</code></td><td>每秒帧率</td></tr><tr><td align="left"><code>-s WIDTHxHEIGHT</code></td><td>帧大小</td></tr><tr><td align="left"><code>-vn</code></td><td>没有视频</td></tr></tbody></table>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="码率设置"><a aria-hidden="true" tabindex="-1" href="#码率设置"><span class="icon icon-link"></span></a>码率设置</h3><div class="wrap-body">
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line"><span class="token parameter variable">-b:v</span> 1M <span class="token comment"># 视频比特率(1M = 1Mbit/s)</span>
</span><span class="code-line"><span class="token parameter variable">-b:a</span> 1M <span class="token comment"># 音频比特率(1M = 1Mbit/s)</span>
</span></code></pre> </span></code></pre>
</div></div></div><div class="wrap h3body-not-exist"><div class="wrap-header h3wrap"><h3 id="尺寸规格"><a aria-hidden="true" tabindex="-1" href="#尺寸规格"><span class="icon icon-link"></span></a>尺寸规格</h3><div class="wrap-body">
<table><thead><tr><th align="left">:-</th><th>-</th><th>-</th><th>-</th></tr></thead><tbody><tr><td align="left"><code>K</code><code>k</code></td><td>103</td><td>1000 字节</td><td>千字节 Kilobytes</td></tr><tr><td align="left"><code>M</code></td><td>106</td><td>1000000 字节</td><td>兆字节 Megabytes</td></tr><tr><td align="left"><code>G</code></td><td>109</td><td>1000000000</td><td>千兆字节 Gigabytes</td></tr><tr><td align="left"><code>Ki</code></td><td>210</td><td>1024</td><td>千字节 Kibibyte</td></tr><tr><td align="left"><code>Mi</code></td><td>220</td><td>1048576</td><td>兆字节 Mebibyte</td></tr><tr><td align="left"><code>Gi</code></td><td>230</td><td>1073741824</td><td>Gibibyte</td></tr></tbody></table>
</div></div></div><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="音频参数"><a aria-hidden="true" tabindex="-1" href="#音频参数"><span class="icon icon-link"></span></a>音频参数</h3><div class="wrap-body">
<!--rehype:wrap-class=col-span-2-->
<table><thead><tr><th align="left">:-</th><th>-</th></tr></thead><tbody><tr><td align="left"><code>-ab bRate</code></td><td>设置音频比特率(单位 kbit/s)</td></tr><tr><td align="left"><code>-aframes N</code></td><td>设置要录制的音频帧数 [-frames:a 的别名]</td></tr><tr><td align="left"><code>-aq q</code></td><td>设置音频质量(特定于编解码器VBR) [-q:a 的别名]</td></tr><tr><td align="left"><code>-an</code></td><td>禁用录音</td></tr><tr><td align="left"><code>-acodec codec</code></td><td>设置音频编解码器。[-codec:a 的别名] 使用 'copy' 复制流。</td></tr><tr><td align="left"><code>-vol</code></td><td>以 256 的倍数更改音频音量,其中 256 = 100%(正常)音量。例如 512 = 200%</td></tr><tr><td align="left"><code>-newaudio</code></td><td>将新的音频流添加到当前输出流</td></tr><tr><td align="left"><code>-alang code</code></td><td>设置当前音频流的 ISO 639 语言代码(3 个字母)</td></tr></tbody></table>
</div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="视频编辑"><a aria-hidden="true" tabindex="-1" href="#视频编辑"><span class="icon icon-link"></span></a>视频编辑</h2><div class="wrap-body"> </div></div></div></div></div><div class="wrap h2body-exist"><div class="wrap-header h2wrap"><h2 id="视频编辑"><a aria-hidden="true" tabindex="-1" href="#视频编辑"><span class="icon icon-link"></span></a>视频编辑</h2><div class="wrap-body">
<!--rehype:body-class=cols-2--> <!--rehype:body-class=cols-2-->
</div></div><div class="h2wrap-body cols-2"><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="裁剪"><a aria-hidden="true" tabindex="-1" href="#裁剪"><span class="icon icon-link"></span></a>裁剪</h3><div class="wrap-body"> </div></div><div class="h2wrap-body cols-2"><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="裁剪"><a aria-hidden="true" tabindex="-1" href="#裁剪"><span class="icon icon-link"></span></a>裁剪</h3><div class="wrap-body">
@ -107,7 +336,7 @@
<p>将输出文件的帧速率强制为 24 fps</p> <p>将输出文件的帧速率强制为 24 fps</p>
<pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-r</span> <span class="token number">1</span> <span class="token parameter variable">-i</span> input.m2v <span class="token parameter variable">-r</span> <span class="token number">24</span> output.avi <pre class="language-bash"><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-r</span> <span class="token number">1</span> <span class="token parameter variable">-i</span> input.m2v <span class="token parameter variable">-r</span> <span class="token number">24</span> output.avi
</span></code></pre> </span></code></pre>
<p>将输入文件的帧速率仅对原始格式有效强制为 1 fps将输出文件的帧速率强制为 24 fps</p> <p>将输入文件的帧速率(仅对原始格式有效)强制为 1 fps将输出文件的帧速率强制为 24 fps</p>
</div></div></div><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="剪切视频部分"><a aria-hidden="true" tabindex="-1" href="#剪切视频部分"><span class="icon icon-link"></span></a>剪切视频部分</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-not-exist col-span-2"><div class="wrap-header h3wrap"><h3 id="剪切视频部分"><a aria-hidden="true" tabindex="-1" href="#剪切视频部分"><span class="icon icon-link"></span></a>剪切视频部分</h3><div class="wrap-body">
<!--rehype:wrap-class=col-span-2--> <!--rehype:wrap-class=col-span-2-->
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> <span class="token operator">&#x3C;</span>input<span class="token operator">></span> <span class="token parameter variable">-ss</span> 00:01:45 <span class="token parameter variable">-t</span> 00:02:35 <span class="token parameter variable">-vcodec</span> copy <span class="token parameter variable">-acodec</span> copy <span class="token operator">&#x3C;</span>output<span class="token operator">></span> <pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> <span class="token operator">&#x3C;</span>input<span class="token operator">></span> <span class="token parameter variable">-ss</span> 00:01:45 <span class="token parameter variable">-t</span> 00:02:35 <span class="token parameter variable">-vcodec</span> copy <span class="token parameter variable">-acodec</span> copy <span class="token operator">&#x3C;</span>output<span class="token operator">></span>
@ -150,7 +379,7 @@
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> file.mp4 <span class="token parameter variable">-vn</span> <span class="token parameter variable">-acodec</span> copy output.aac <pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> file.mp4 <span class="token parameter variable">-vn</span> <span class="token parameter variable">-acodec</span> copy output.aac
</span></code></pre> </span></code></pre>
<!--rehype:className=wrap-text --> <!--rehype:className=wrap-text -->
<p><code>-vn</code>无视频<code>-acodec copy</code> 结合起来。请注意,输出文件扩展名必须与输入文件中的音频编解码器匹配,<code>-acodec copy</code> 才能工作。</p> <p><code>-vn</code>(无视频)<code>-acodec copy</code> 结合起来。请注意,输出文件扩展名必须与输入文件中的音频编解码器匹配,<code>-acodec copy</code> 才能工作。</p>
</div></div></div><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="创建缩略图"><a aria-hidden="true" tabindex="-1" href="#创建缩略图"><span class="icon icon-link"></span></a>创建缩略图</h3><div class="wrap-body"> </div></div></div><div class="wrap h3body-not-exist row-span-2"><div class="wrap-header h3wrap"><h3 id="创建缩略图"><a aria-hidden="true" tabindex="-1" href="#创建缩略图"><span class="icon icon-link"></span></a>创建缩略图</h3><div class="wrap-body">
<!--rehype:wrap-class=row-span-2--> <!--rehype:wrap-class=row-span-2-->
<p>在 10 秒时创建一个缩略图</p> <p>在 10 秒时创建一个缩略图</p>
@ -191,7 +420,7 @@
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> input.mov <span class="token parameter variable">-itsoffset</span> <span class="token number">3</span> <span class="token parameter variable">-i</span> input.mov <span class="token parameter variable">-map</span> <span class="token number">0</span>:v <span class="token parameter variable">-map</span> <span class="token number">1</span>:a <span class="token parameter variable">-codec:a</span> copy <span class="token parameter variable">-codec:v</span> copy output.mov <pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> input.mov <span class="token parameter variable">-itsoffset</span> <span class="token number">3</span> <span class="token parameter variable">-i</span> input.mov <span class="token parameter variable">-map</span> <span class="token number">0</span>:v <span class="token parameter variable">-map</span> <span class="token number">1</span>:a <span class="token parameter variable">-codec:a</span> copy <span class="token parameter variable">-codec:v</span> copy output.mov
</span></code></pre> </span></code></pre>
<!--rehype:className=wrap-text --> <!--rehype:className=wrap-text -->
<p>将视频延迟 3 秒即将音频提前 3 秒</p> <p>将视频延迟 3 秒(即将音频提前 3 秒)</p>
<pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> input.mov <span class="token parameter variable">-itsoffset</span> <span class="token number">3</span> <span class="token parameter variable">-i</span> input.mov <span class="token parameter variable">-map</span> <span class="token number">1</span>:v <span class="token parameter variable">-map</span> <span class="token number">0</span>:a <span class="token parameter variable">-codec:a</span> copy <span class="token parameter variable">-codec:v</span> copy output.mov <pre class="wrap-text "><code class="language-bash code-highlight"><span class="code-line">$ ffmpeg <span class="token parameter variable">-i</span> input.mov <span class="token parameter variable">-itsoffset</span> <span class="token number">3</span> <span class="token parameter variable">-i</span> input.mov <span class="token parameter variable">-map</span> <span class="token number">1</span>:v <span class="token parameter variable">-map</span> <span class="token number">0</span>:a <span class="token parameter variable">-codec:a</span> copy <span class="token parameter variable">-codec:v</span> copy output.mov
</span></code></pre> </span></code></pre>
<!--rehype:className=wrap-text --> <!--rehype:className=wrap-text -->
@ -242,6 +471,7 @@
<li><a href="https://lzone.de/cheat-sheet/ffmpeg">FFmpeg Cheat Sheet</a> <em>(lzone.de)</em></li> <li><a href="https://lzone.de/cheat-sheet/ffmpeg">FFmpeg Cheat Sheet</a> <em>(lzone.de)</em></li>
<li><a href="https://devhints.io/ffmpeg">FFmpeg Cheat Sheet</a> <em>(devhints.io)</em></li> <li><a href="https://devhints.io/ffmpeg">FFmpeg Cheat Sheet</a> <em>(devhints.io)</em></li>
<li><a href="https://github.com/yuanqing/ffmpeg-cheatsheet">FFmpeg Cheat Sheet</a> <em>(github.com)</em></li> <li><a href="https://github.com/yuanqing/ffmpeg-cheatsheet">FFmpeg Cheat Sheet</a> <em>(github.com)</em></li>
<li><a href="https://cheatography.com/thetartankilt/cheat-sheets/ffmpeg/">FFmpeg Cheat Sheet</a> <em>(cheatography.com)</em></li>
</ul> </ul>
</div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang, All rights reserved.</footer></footer><script> </div></div><div class="h2wrap-body"></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang, All rights reserved.</footer></footer><script>
if(('onhashchange' in window) && ((typeof document.documentMode==='undefined') || document.documentMode==8)) { if(('onhashchange' in window) && ((typeof document.documentMode==='undefined') || document.documentMode==8)) {

View File

@ -250,9 +250,9 @@
<span>XPath</span></a><!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));--></p> <span>XPath</span></a><!--rehype:style=background: rgb(91 163 230/var(\-\-bg\-opacity));--></p>
<!--rehype:class=home-card--> <!--rehype:class=home-card-->
</div></div><div class="h2wrap-body"></div></div><div class="wrap h2body-not-exist"><div class="wrap-header h2wrap"><h2 id="linux-命令"><a aria-hidden="true" tabindex="-1" href="#linux-命令"><span class="icon icon-link"></span></a>Linux 命令</h2><div class="wrap-body"> </div></div><div class="h2wrap-body"></div></div><div class="wrap h2body-not-exist"><div class="wrap-header h2wrap"><h2 id="linux-命令"><a aria-hidden="true" tabindex="-1" href="#linux-命令"><span class="icon icon-link"></span></a>Linux 命令</h2><div class="wrap-body">
<p class="home-card"><a href="./docs/ansible.html" style="background: rgb(238 0 0/var(\-\-bg\-opacity));" class="contributing" data-info="👆看看还缺点儿什么?"><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em" viewBox="0 0 65 65"> <p class="home-card"><a href="./docs/ansible.html" style="background: rgb(238 0 0/var(\-\-bg\-opacity));" class="contributing tag" data-lang="RedHad" data-info="👆看看还缺点儿什么?"><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em" viewBox="0 0 65 65">
<path fill="currentColor" d="M32,0 C49.672,0 64,14.328 64,32 C64,49.674 49.674,64 32,64 C14.326,64 0,49.674 0,32 C0,14.326 14.328,0 32,0 Z M32.539,12.688 C31.666,12.688 30.875,13.156 30.511,14.04 L16.52,47.664 L21.303,47.664 L26.837,33.801 L43.352,47.144 C44.016,47.681 44.496,47.924 45.119,47.924 C46.367,47.924 47.457,46.988 47.457,45.638 C47.457,45.418 47.379,45.068 47.239,44.694 L34.512,14.04 C34.148,13.156 33.412,12.688 32.539,12.688 Z M32.54,19.548 L40.82,39.986 L28.312,30.133 L32.54,19.548 Z" transform="translate(.38 .76)"></path> <path fill="currentColor" d="M32,0 C49.672,0 64,14.328 64,32 C64,49.674 49.674,64 32,64 C14.326,64 0,49.674 0,32 C0,14.326 14.328,0 32,0 Z M32.539,12.688 C31.666,12.688 30.875,13.156 30.511,14.04 L16.52,47.664 L21.303,47.664 L26.837,33.801 L43.352,47.144 C44.016,47.681 44.496,47.924 45.119,47.924 C46.367,47.924 47.457,46.988 47.457,45.638 C47.457,45.418 47.379,45.068 47.239,44.694 L34.512,14.04 C34.148,13.156 33.412,12.688 32.539,12.688 Z M32.54,19.548 L40.82,39.986 L28.312,30.133 L32.54,19.548 Z" transform="translate(.38 .76)"></path>
</svg><span>Ansible</span></a><!--rehype:style=background: rgb(238 0 0/var(\-\-bg\-opacity));&class=contributing&data-info=👆看看还缺点儿什么?--> </svg><span>Ansible</span></a><!--rehype:style=background: rgb(238 0 0/var(\-\-bg\-opacity));&class=contributing tag&data-lang=RedHad&data-info=👆看看还缺点儿什么?-->
<a href="./docs/awk.html" style="background: rgb(16 185 129/var(\-\-bg\-opacity));"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em"> <a href="./docs/awk.html" style="background: rgb(16 185 129/var(\-\-bg\-opacity));"><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" fill="currentColor" height="1em" width="1em">
<path d="M107.946667 838.4l57.173333 23.893333v-385.28l-103.68 250.026667c-17.493333 43.52 3.413333 93.44 46.506667 111.36z m832-157.866667L728.32 169.813333a85.888 85.888 0 0 0-77.226667-52.48c-11.093333 0-22.613333 1.706667-33.706666 6.4L302.933333 253.866667a85.290667 85.290667 0 0 0-46.08 110.933333l211.626667 510.72a85.248 85.248 0 0 0 110.933333 46.08l314.026667-130.133333a85.077333 85.077333 0 0 0 46.506667-110.933334zM336.213333 373.333333c-23.466667 0-42.666667-19.2-42.666666-42.666666s19.2-42.666667 42.666666-42.666667 42.666667 19.2 42.666667 42.666667-19.2 42.666667-42.666667 42.666666z m-85.333333 469.333334c0 46.933333 38.4 85.333333 85.333333 85.333333h61.866667l-147.2-355.84v270.506667z"></path> <path d="M107.946667 838.4l57.173333 23.893333v-385.28l-103.68 250.026667c-17.493333 43.52 3.413333 93.44 46.506667 111.36z m832-157.866667L728.32 169.813333a85.888 85.888 0 0 0-77.226667-52.48c-11.093333 0-22.613333 1.706667-33.706666 6.4L302.933333 253.866667a85.290667 85.290667 0 0 0-46.08 110.933333l211.626667 510.72a85.248 85.248 0 0 0 110.933333 46.08l314.026667-130.133333a85.077333 85.077333 0 0 0 46.506667-110.933334zM336.213333 373.333333c-23.466667 0-42.666667-19.2-42.666666-42.666666s19.2-42.666667 42.666666-42.666667 42.666667 19.2 42.666667 42.666667-19.2 42.666667-42.666667 42.666666z m-85.333333 469.333334c0 46.933333 38.4 85.333333 85.333333 85.333333h61.866667l-147.2-355.84v270.506667z"></path>
</svg><span>Awk</span></a><!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));--> </svg><span>Awk</span></a><!--rehype:style=background: rgb(16 185 129/var(\-\-bg\-opacity));-->