|
|
@ -6,67 +6,66 @@ ffprobe用于检测多媒体流格式;ffplay用于播放视频,包括本地与 |
|
|
|
|
|
|
|
|
|
|
|
# 一、ffmpeg命令行 |
|
|
|
# 一、ffmpeg命令行 |
|
|
|
## 1、命令行参数介绍 |
|
|
|
## 1、命令行参数介绍 |
|
|
|
Print help / information / capabilities:<br> |
|
|
|
|
|
|
|
-help show help<br> |
|
|
|
| Print help/info: | Description | |
|
|
|
-version show version<br> |
|
|
|
|:-------------------|:-------------------------------| |
|
|
|
-formats show available formats<br> |
|
|
|
| --help topic | show help | |
|
|
|
-muxers show available muxers<br> |
|
|
|
| -version | show version | |
|
|
|
-demuxers show available demuxers<br> |
|
|
|
| -formats | show available formats | |
|
|
|
-devices show available devices<br> |
|
|
|
| -muxers | show available muxers | |
|
|
|
-codecs show available codecs<br> |
|
|
|
| -demuxers | show available demuxers | |
|
|
|
-decoders show available decoders<br> |
|
|
|
| -devices | show available devices | |
|
|
|
-encoders show available encoders<br> |
|
|
|
| -codecs | show available codecs | |
|
|
|
-bsfs show available bit stream filters<br> |
|
|
|
| -decoders | show available decoders | |
|
|
|
-protocols show available protocols<br> |
|
|
|
| -encoders | show available encoders | |
|
|
|
-filters show available filters<br> |
|
|
|
| -protocols | show available protocols | |
|
|
|
-pix_fmts show available pixel formats<br> |
|
|
|
| -filters | show available filters | |
|
|
|
-sample_fmts show available audio sample formats<br> |
|
|
|
| -pix_fmts | show available pixel formats | |
|
|
|
-hwaccels show available HW acceleration methods<br> |
|
|
|
| -sample_fmts | show available sample formats | |
|
|
|
|
|
|
|
| -hwaccels | show available HW acceleration | |
|
|
|
Global options (affect whole program instead of just one file:<br> |
|
|
|
|
|
|
|
-v loglevel set logging level<br> |
|
|
|
| Global options: | Description | |
|
|
|
-y overwrite output files<br> |
|
|
|
|:-------------------|:-------------------------------| |
|
|
|
-n never overwrite output files<br> |
|
|
|
| -v loglevel | set logging level | |
|
|
|
-filter_threads number of non-complex filter threads<br> |
|
|
|
| -y | overwrite output files | |
|
|
|
-stats print progress report during encoding<br> |
|
|
|
| -n | never overwrite output files | |
|
|
|
-vol volume change audio volume (256=normal)<br> |
|
|
|
| -filter_threads | number of filter threads | |
|
|
|
|
|
|
|
| -vol volume | change audio volume(256=normal)| |
|
|
|
Per-file main options:<br> |
|
|
|
|
|
|
|
-f fmt force format<br> |
|
|
|
| main options: | Description | |
|
|
|
-c codec codec name<br> |
|
|
|
|:-------------------|:-------------------------------| |
|
|
|
-codec codec codec name<br> |
|
|
|
| -f fmt | force format | |
|
|
|
-t duration record or transcode "duration" seconds of audio/video<br> |
|
|
|
| -c codec | codec name | |
|
|
|
-to time_stop record or transcode stop time<br> |
|
|
|
| -codec codec | codec name | |
|
|
|
-fs limit_size set the limit file size in bytes<br> |
|
|
|
| -t duration | duration seconds of audio/video| |
|
|
|
-ss time_off set the start time offset<br> |
|
|
|
| -to time_stop | record or transcode stop time | |
|
|
|
-sseof time_off set the start time offset relative to EOF<br> |
|
|
|
| -ss time_off | set the start time offset | |
|
|
|
-frames number set the number of frames to output<br> |
|
|
|
| -frames number | set the number of frames | |
|
|
|
|
|
|
|
| -discard | discard | |
|
|
|
Video options:<br> |
|
|
|
| -disposition | disposition | |
|
|
|
-vframes number set the number of video frames to output<br> |
|
|
|
|
|
|
|
-r rate set frame rate (Hz value, fraction or abbreviation)<br> |
|
|
|
| Video options: | Description | |
|
|
|
-s size set frame size (WxH or abbreviation)<br> |
|
|
|
|:-------------------|:-------------------------------| |
|
|
|
-aspect aspect set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)<br> |
|
|
|
| -vframes number | set the number of video frames | |
|
|
|
-vn disable video<br> |
|
|
|
| -r rate | set frame rate (Hz value) | |
|
|
|
-vcodec codec force video codec ('copy' to copy stream)<br> |
|
|
|
| -s size | set frame size | |
|
|
|
-vf filter_graph set video filters<br> |
|
|
|
| -aspect aspect | set aspect ratio (4:3, 16:9) | |
|
|
|
-ab bitrate audio bitrate (please use -b:a)<br> |
|
|
|
| -vn | disable video | |
|
|
|
-b bitrate video bitrate (please use -b:v)<br> |
|
|
|
| -vcodec codec | force video codec | |
|
|
|
|
|
|
|
| -vf filter_graph | set video filters | |
|
|
|
Audio options:<br> |
|
|
|
| -ab bitrate | audio bitrate (please use -b:a)| |
|
|
|
-aframes number set the number of audio frames to output<br> |
|
|
|
| -b bitrate | video bitrate (please use -b:v)| |
|
|
|
-aq quality set audio quality (codec-specific)<br> |
|
|
|
|
|
|
|
-ar rate set audio sampling rate (in Hz)<br> |
|
|
|
| Audio options: | Description | |
|
|
|
-ac channels set number of audio channels<br> |
|
|
|
|:-------------------|:-------------------------------| |
|
|
|
-an disable audio<br> |
|
|
|
| -aframes number | set the number of audio frames | |
|
|
|
-acodec codec force audio codec ('copy' to copy stream)<br> |
|
|
|
| -aq quality | set audio quality | |
|
|
|
-vol volume change audio volume (256=normal)<br> |
|
|
|
| -ar rate | set audio sampling rate (in Hz)| |
|
|
|
-af filter_graph set audio filters<br> |
|
|
|
| -ac channels | set number of audio channels | |
|
|
|
|
|
|
|
| -an | disable audio | |
|
|
|
Subtitle options:<br> |
|
|
|
| -acodec codec | force audio codec | |
|
|
|
-s size set frame size<br> |
|
|
|
| -vol volume | change audio volume(256=normal)| |
|
|
|
-sn disable subtitle<br> |
|
|
|
| -af filter_graph | set audio filters | |
|
|
|
-scodec codec force subtitle codec ('copy' to copy stream)<br> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
命令行整体格式:以ffmpeg开头,参数之间用空格隔开,每个参数key以"-"开头,后面跟着参数value,输出文件放在命令行最后。<br> |
|
|
|
命令行整体格式:以ffmpeg开头,参数之间用空格隔开,每个参数key以"-"开头,后面跟着参数value,输出文件放在命令行最后。<br> |
|
|
|
|
|
|
|
|
|
|
@ -184,6 +183,9 @@ ffmpeg -ss 20 -accurate_seek -t 10 -i input.mp4 -an -r 5 %3d.jpg<br> |
|
|
|
使用setpts设置视频速度,atempo设置音频速度:<br> |
|
|
|
使用setpts设置视频速度,atempo设置音频速度:<br> |
|
|
|
ffmpeg -i in.mp4 -filter_complex [0:v]setpts=%.2f*PTS[v];[0:a]atempo=%.2f[a] -map [v] -map [a] out.mp4<br> |
|
|
|
ffmpeg -i in.mp4 -filter_complex [0:v]setpts=%.2f*PTS[v];[0:a]atempo=%.2f[a] -map [v] -map [a] out.mp4<br> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 3.12 旋转视频 |
|
|
|
|
|
|
|
ffmpeg -i in.mp4 -c copy -metadata:s\:v:0 rotate=90 out.mp4<br> |
|
|
|
|
|
|
|
|
|
|
|
# 二、ffplay命令行 |
|
|
|
# 二、ffplay命令行 |
|
|
|
ffplay主要用于播放视频,也可以播放网络流,示例如下:<br> |
|
|
|
ffplay主要用于播放视频,也可以播放网络流,示例如下:<br> |
|
|
|
ffplay -i beyond.mp4<br> |
|
|
|
ffplay -i beyond.mp4<br> |
|
|
|