对于ffmpeg命令行的使用 之前一直都是通过百度(惭愧),一边找 一边用 感觉写起来比较麻烦 就在这记录下 方便以后温习,今天小编就来聊一聊关于ffmpeg在哪里设置?接下来我们就一起去研究一下吧!

ffmpeg在哪里设置(ffmpeg命令行工具)

ffmpeg在哪里设置

对于ffmpeg命令行的使用 之前一直都是通过百度(惭愧),一边找 一边用 感觉写起来比较麻烦 就在这记录下 方便以后温习

我们都知道从官网下来的可以直接运行的程序有三个 一个是ffmpeg.exe ffplay.exe ffprobe.exe

关于ffmpeg的官网里边 一般是提供三种(static shared dev)

第一个static是提供了之前说的那三个程序 并且人家把各个dll集成了进去 导致程序的大小比较大

第二个shared 也提供了那三个程序 只不过大小就小得多 因为它还提供了各种dll

第三个就完全适用于开发人员 提供了lib以及头文件

这边我们就直接来说说提供的那三个程序怎么用(直接点是没用的哈 直接在命令行里边用就好)

ffmpeg是用来转码的工具 ffplay是用来播放的 ffprobe是用来查看文件格式的

**************************************************************************************************************************************

首先我们来看下ffmpeg

http://ffmpeg.org/ffmpeg.html 官方说明

我自己输入 ffmpeg -h

首先会显示ffmpeg的版本 以及编译这个用的GCC的版本 以及编译之前configure的选项 之后就是依赖各种库的版本

后来才意识到之前为什么会写错 现在 我们再来重温一遍ffmpeg的书写格式

ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url} ...

ffmpeg 全局的选项(可省略) {输入文件选项 -i 文件} {输出文件选项 文件}

**************************************************************************************************************************************

ffplay 是用SDL来写的一个播放器

(官方的解释:ffplay是一个非常简单和可移植的媒体播放器,使用ffmpeg库和SDL库。它主要用作各种ffmpeg API的测试床。)

他的功能可谓是很强大 但是就是没有图形化的操作界面 只能通过键盘来操作

这边就分 快捷键以及选项来进行说明

http://ffmpeg.org/ffplay.html 官网的使用说明

我们先来看下ffplay -h

因为显示的东西太多 我这边就来挑选着记录

前边显示的和ffmpeg的差不多

我们先看下他的用法:ffplay [options] input_file

接下来看下主选项:

Main options:

-L show license

-h topic show help

-? topic show help

-help topic show help

--help topic show help

-version show version

-buildconf show build configuration

-formats show available formats

-muxers show available muxers

-demuxers show available demuxers

-devices show available devices

-codecs show available codecs

-decoders show available decoders

-encoders show available encoders

-bsfs show available bit stream filters

-protocols show available protocols

-filters show available filters

-pix_fmts show available pixel formats

-layouts show standard channel layouts

-sample_fmts show available audio sample formats

-colors show available color names

-loglevel loglevel set logging level

-v loglevel set logging level

-report generate a report

-max_alloc bytes set maximum size of a single allocated block

-sources device list sources of the input device 显示输入设备的自动检测源。

-sinks device list sinks of the output device 显示输出设备的自动检测接收器。

-x width force displayed width

-y height force displayed height

-s size set frame size (WxH or abbreviation)

-fs force full screen 强制全屏(和ffmpeg中的fs是不一样的用法)

-an disable audio

-vn disable video

-sn disable subtitling

-ss pos seek to a given position in seconds 以秒为单位寻找给定位置

-t duration play "duration" seconds of audio/video 播放音频/视频的“ duration”秒

-bytes val seek by bytes 0=off 1=on -1=auto 按字节查找 0=OFF 1=ON -1=AUTO

-nodisp disable graphical display 禁用图形显示

-noborder borderless window 无边界窗口

-volume volume set startup volume 0=min 100=max 设置启动 volume0=min 100=max

-f fmt force format

-window_title window title set window title 窗口标题集窗口标题

-af filter_graph set audio filters 设置音频过滤器

-showmode mode select show mode (0 = video, 1 = waves, 2 = RDFT) 选择显示模式(0=视频,1=波形,2=RDFT)

-i input_file read specified file 读取指定文件

-codec decoder_name force decoder

-autorotate automatically rotate video 自动旋转视频

下面是几个高级选项:

Advanced options:

-cpuflags flags force specific cpu flags 强制特定CPU标志

-hide_banner hide_banner do not show program banner 不要显示程序横幅

-ast stream_specifier select desired audio stream 选择所需的音频流

-vst stream_specifier select desired video stream 选择所需视频流

-sst stream_specifier select desired subtitle stream 选择想要的字幕流

-pix_fmt format set pixel format 设置像素格式

-stats show status 显示当前状态

-fast non spec compliant optimizations 不符合规范的优化

-genpts generate pts 生成PTS

-drp let decoder reorder pts 0=off 1=on -1=auto 让解码器重新排序0=OFF 1=ON -1=AUTO

-lowres

-sync type set audio-video sync. type (type=audio/video/ext) 设置音视频同步类型(type=音频/视频/ext)

-autoexit exit at the end 最后退出

-exitonkeydown exit on key down 按下键退出

-exitonmousedown exit on mouse down 鼠标向下退出

-loop loop count set number of times the playback shall be looped 设置回放的次数

-framedrop drop frames when cpu is too slow CPU太慢时丢弃帧

-infbuf don't limit the input buffer size (useful with realtime streams) 不要限制输入缓冲区的大小(对实时流有用)

-vf filter_graph set video filters 设置视频滤波器

-rdftspeed msecs rdft speed rdft速度

-default generic catch all option 捕获通用所有选项

-acodec decoder_name force audio decoder

-scodec decoder_name force subtitle decoder

-vcodec decoder_name force video decoder

接下来就是快捷键了(其实就是在已经在播放的时候 有什么功能)

While playing:

q, ESC quit 退出

f toggle full screen 全屏

p, SPC pause 暂停

m toggle mute 切换静音

9, 0 decrease and increase volume respectively 减少量和增加量

/, * decrease and increase volume respectively 减少量和增加量

a cycle audio channel in the current program 循环当前程序中的音频通道

v cycle video channel 循环视频信道

t cycle subtitle channel in the current program 循环当前程序中的字幕通道

c cycle program 循环程序

w cycle video filters or show modes 循环视频过滤器或显示模式

s activate frame-step mode 激活帧步模式(逐帧显示)

left/right seek backward/forward 10 seconds 先后/向前10S

down/up seek backward/forward 1 minute 先后/向前1minute

page down/page up seek backward/forward 10 minutes 先后/向前10minute

right mouse click seek to percentage in file corresponding to fraction of width 在文件中寻求与宽度分数相对应的百分比

left double-click(双击) toggle full screen 切换全屏

**************************************************************************************************************************************

ffprobe

http://ffmpeg.org/ffprobe.html 官方说明

ffprobe -h 显示的太多 我这边就不全贴上来了 就把主选项写一下

开始 和之前的ffmpeg显示的是一样的

我们来看下用法: ffprobe [OPTIONS] [INPUT_FILE]

下面的就是主选项:

Main options:

-L show license

-h topic show help

-? topic show help

-help topic show help

--help topic show help

-version show version

-buildconf show build configuration

-formats show available formats

-muxers show available muxers

-demuxers show available demuxers

-devices show available devices

-codecs show available codecs

-decoders show available decoders

-encoders show available encoders

-bsfs show available bit stream filters

-protocols show available protocols

-filters show available filters

-pix_fmts show available pixel formats

-layouts show standard channel layouts

-sample_fmts show available audio sample formats

-colors show available color names

-loglevel loglevel set logging level

-v loglevel set logging level

-report generate a report

-max_alloc bytes set maximum size of a single allocated block

-cpuflags flags force specific cpu flags 强制特定CPU标志

-hide_banner hide_banner do not show program banner 不要显示程序横幅

-sources device list sources of the input device

-sinks device list sinks of the output device

-f format force format

-unit show unit of the displayed values 显示所显示值的单位

-prefix use SI prefixes for the displayed values 对显示的值使用si前缀

-byte_binary_prefix use binary prefixes for byte units 字节单位使用二进制前缀

-sexagesimal use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units 使用六十进制格式小时:毫米:单位时间的微秒

-pretty prettify the format of displayed values, make it more human readable 美化显示值的格式,使其更具可读性。

-print_format format set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml) 设置输出打印格式(可用格式有:默认格式、紧凑格式、csv格式、平面格式、ini格式、json格式、xml格式)

-of format alias for -print_format 别名-打印格式

-select_streams stream_specifier select the specified streams 选择指定的流

-sections print sections structure and section information, and exit 打印区段结构和区段信息,并退出

-show_data show packets data 显示数据包数据

-show_data_hash show packets data hash 显示数据包数据散列

-show_error show probing error 显示探测误差

-show_format show format/container info 显示格式/容器信息

-show_frames show frames info 显示帧信息

-show_format_entry entry show a particular entry from the format/container info 显示格式/容器信息中的特定条目

-show_entries entry_list show a set of specified entries 显示一组指定的条目

-show_log show log

-show_packets show packets info 显示数据包信息

-show_programs show programs info 显示程序信息

-show_streams show streams info 显示流信息

-show_chapters show chapters info 展示章节信息

-count_frames count the number of frames per stream 计算每个流的帧数。

-count_packets count the number of packets per stream 计算每个流的数据包数。

-show_program_version show ffprobe version 显示 ffprobe版本

-show_library_versions show library versions 显示库版本

-show_versions show program and library versions 显示程序和库版本

-show_pixel_formats show pixel format descriptions 显示像素格式描述

-show_private_data show private data 显示私有数据

-private same as show_private_data 类似 show_private_data

-bitexact force bitexact output 强制位数输出

-read_intervals read_intervals set read intervals 设定读间隔

-default generic catch all option 通用捕获所有选项

-i input_file read specified file 读取指定文件

,