# ffmpeg视频转码

手机里转码视频有一点找虐，但很多下载工具，比如youtube-dl等等都是用的ffmpeg。

```
pkg install ffmpeg
```

参数比较多利用参考：

[ffmpeg常用参数](https://bbs.zsxwz.com/thread-2291.htm)

几个常用视频转换命令：

```
# 下载m3u8视频
ffmpeg -allowed_extensions ALL -i xxx.m3u8 -c copy -bsf:a aac_adtstoasc xxx.mp4

# 配合for循环，批量转码
for i in ./*.flv
do
ffmpeg -i $i ${i}.mp4
done

# 视频剪切
ffmpeg -ss 0:0 -t 0:10 -i input.mov output.mp4

# 视频截图
ffmpeg -i input.mov -vf fps=1 -q:v 2 output%03d.png

# 转为mp4格式
ffmpeg -i input.mov output.mp4
```

更多可以参考：

[ffmpeg几个常用视频转换命令](https://bbs.zsxwz.com/thread-2691.htm)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://termux-wiki.zsxwz.com/ffmpeg-shi-pin-zhuan-ma.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
