从https://ffbinaries.com/downloads 下载最新的4.1版本的Windows 64位FFmpeg,FFmpeg是一个快速的音频/视频转换工具,FFmpeg可以作为一个命令行程序单独使用。

通过执行以下命令将FFmpeg信息重定位到ffmpeg_help.txt文件中便于查看,其内容如下,FFmpeg使用方法为:ffmpeg.exe [options] [[infile options] -i infile]... {[outfile options] outfile}...

ffmpeg.exe --help > ffmpeg_help.txt
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...Getting help:-h      -- print basic options-h long -- print more options-h full -- print all options (including all format and codec specific options, very long)-h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsfSee man ffmpeg for detailed description of the options.Print help / information / capabilities:
-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
-sources device     list sources of the input device
-sinks device       list sinks of the output device
-hwaccels           show available HW acceleration methodsGlobal options (affect whole program instead of just one file:
-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
-y                  overwrite output files
-n                  never overwrite output files
-ignore_unknown     Ignore unknown stream types
-filter_threads     number of non-complex filter threads
-filter_complex_threads  number of threads for -filter_complex
-stats              print progress report during encoding
-max_error_rate maximum error rate  ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.
-bits_per_raw_sample number  set the number of bits per raw sample
-vol volume         change audio volume (256=normal)Per-file main options:
-f fmt              force format
-c codec            codec name
-codec codec        codec name
-pre preset         preset name
-map_metadata outfile[,metadata]:infile[,metadata]  set metadata information of outfile from infile
-t duration         record or transcode "duration" seconds of audio/video
-to time_stop       record or transcode stop time
-fs limit_size      set the limit file size in bytes
-ss time_off        set the start time offset
-sseof time_off     set the start time offset relative to EOF
-seek_timestamp     enable/disable seeking by timestamp with -ss
-timestamp time     set the recording timestamp ('now' to set the current time)
-metadata string=string  add metadata
-program title=string:st=number...  add program with specified streams
-target type        specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-")
-apad               audio pad
-frames number      set the number of frames to output
-filter filter_graph  set stream filtergraph
-filter_script filename  read stream filtergraph description from a file
-reinit_filter      reinit filtergraph on input parameter changes
-discard            discard
-disposition        dispositionVideo options:
-vframes number     set the number of video frames to output
-r rate             set frame rate (Hz value, fraction or abbreviation)
-s size             set frame size (WxH or abbreviation)
-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-bits_per_raw_sample number  set the number of bits per raw sample
-vn                 disable video
-vcodec codec       force video codec ('copy' to copy stream)
-timecode hh:mm:ss[:;.]ff  set initial TimeCode value.
-pass n             select the pass number (1 to 3)
-vf filter_graph    set video filters
-ab bitrate         audio bitrate (please use -b:a)
-b bitrate          video bitrate (please use -b:v)
-dn                 disable dataAudio options:
-aframes number     set the number of audio frames to output
-aq quality         set audio quality (codec-specific)
-ar rate            set audio sampling rate (in Hz)
-ac channels        set number of audio channels
-an                 disable audio
-acodec codec       force audio codec ('copy' to copy stream)
-vol volume         change audio volume (256=normal)
-af filter_graph    set audio filtersSubtitle options:
-s size             set frame size (WxH or abbreviation)
-sn                 disable subtitle
-scodec codec       force subtitle codec ('copy' to copy stream)
-stag fourcc/tag    force subtitle tag/fourcc
-fix_sub_duration   fix subtitles duration
-canvas_size size   set canvas size (WxH or abbreviation)
-spre preset        set the subtitle options to the indicated preset

以下汇总FFmpeg的常用操作:

1. 在Windows上查看已连接的捕获设备(capture devices)如摄像头,执行以下命令,如果安装了DirectShow也可以将vfwcap替换为dshow:

ffmpeg.exe -y -f vfwcap -i list
ffmpeg.exe -list_devices true -f dshow -i dummy

在Windows上将从capture device上获取的视频流数据保存成mp4文件,执行:

ffmpeg.exe -y -f vfwcap -r 25 -i 0 out.mp4

2. 在Linux上,当插上usb摄像头(/dev/video0)时,查看可用设备的可用格式(包括支持的像素格式、视频格式、帧大小),执行:

./ffmpeg -f v4l2 -list_formats all -i /dev/video0

在Linux上将从/dev/video0上获取的视频流数据保存成mkv文件,执行:

./ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -input_format mjpeg -i /dev/video0 output.mkv

3. 在不同的媒体文件之间转换,如将1.mkv转换为1.mp4并设置其大小为1920x1080,执行:

ffmpeg.exe -i 1.mkv -s 1920x1080 1.mp4

4. 从视频文件中提取图像,如从视频文件tree.avi中提取图像并保存成png,图像名为image-001.png, image-002.png等,执行:

ffmpeg.exe -i tree.avi -r 1 -f image2 image-%3d.png

5. 压缩视频文件,如减少视频比特率(video bit rate),执行:

ffmpeg.exe -i tree.avi -b:v 100k tree2.avi

6. 剪切视频文件,如开始剪切的时间点为10秒处(00:00:10),剪切时间长度为5秒,则执行:

ffmpeg.exe -i tree.avi -ss 00:00:10 -t 5 tree.mp4

7. 将rtsp视频流保存成视频文件,执行:

ffmpeg.exe -i rtsp://184.72.239.149/vod/mp4://BigBuckBunny_115k.mov -vcodec copy out.mp4

8. 在windows上获取视频设备名,执行:

ffmpeg.exe -list_devices true -f dshow -i dummy

9. 在windows上获取指定视频设备支持的编解码格式及视频size,执行:

ffmpeg.exe -f dshow -list_options true -i video="Integrated Webcam"

10. 在windows上通过dshow生成mjpeg数据,执行:

ffmpeg.exe -f dshow -vcodec mjpeg -s 640x480 -framerate 30 -i video="Integrated Webcam" outfile.mpg

GitHub:https://github.com/fengbingchun/OpenCV_Test

FFmpeg中可执行文件ffmpeg用法汇总相关推荐

  1. FFmpeg中可执行文件ffplay用法汇总

    从https://ffbinaries.com/downloads 下载最新的4.1版本的windows 64位FFplay.目前linux下的只有3.2版本的.FFplay是一个由FFmpeg和SD ...

  2. FFmpeg中可执行文件ffprobe用法汇总

    从https://ffbinaries.com/downloads 下载最新的4.1版本的Windows 64位FFprobe,FFprobe用于从多媒体流中获取相关信息或查看文件格式信息,并以可读的 ...

  3. C#中DllImport使用法汇总

    (转) 最近使用DllImport,从网上百度后发现,大部分内容都是相同,又从MSDN中搜集下,现将内容汇总,与大家分享. 大家在实际工作学习C#的时候,可能会问:为什么我们要为一些已经存在的功能(比 ...

  4. C++/C++11中std::string用法汇总

    C++/C++11中std::string是个模板类,它是一个标准库.使用string类型必须首先包含<string>头文件.作为标准库的一部分,string定义在命名空间std中. st ...

  5. java typeof_js中typeof的用法汇总

    JavaScript中的typeof其实非常复杂,它可以用来做很多事情,但同时也有很多怪异的表现.本文列举出了它的多个用法,而且还指出了存在的问题以及解决办法. > typeof undefin ...

  6. C/C++中static关键字用法汇总

    1. 函数内static局部变量:变量在程序初始化时被分配,直到程序退出前才被释放,也就是static是按照程序的生命周期来分配释放变量的,而不是变量自己的生命周期.多次调用,仅需一次初始化. 2. ...

  7. C++中const指针用法汇总

    这里以int类型为例,进行说明,在C++中const是类型修饰符: int a; 定义一个普通的int类型变量a,可对此变量的值进行修改. const int a = 3;与 int const a ...

  8. C++/C++11中std::set用法汇总

    一个容器就是一些特定类型对象的集合.顺序容器(sequential container)为程序员提供了控制元素存储和访问顺序的能力.这种顺序不依赖于元素的值,而是与元素加入容器时的位置相对应.与之相对 ...

  9. 基于c语言中调试工具的用法汇总(不包含gdb)【转】

    转自:http://www.jb51.net/article/36829.htm 是不是只有编译的时候才知道程序写了错误?有没有在未编译的时候就让机器帮你检查错误的工具呢? 答案是:有!!splint ...

最新文章

  1. 计算机网络技术教法改革方案,计算机网络实验论文,关于“计算机网络”教学改革相关参考文献资料-免费论文范文...
  2. 【Python】 基础语法
  3. 网络(6)-TCP/IP对拥塞控制、滑动窗口如何实现可靠性?
  4. 批处理引擎MapReduce程序设计
  5. java string类型时间比较大小吗_Java String类型时间比较大小
  6. vlan划分_基于MAC地址划分VLAN配置示例
  7. response 设置头的类型 (转)
  8. SAS详细的下载与安装流程
  9. 【OCP题库-12c】最新CUUG OCP 071考试题库(71题)
  10. 2018年下半年系统集成项目管理工程师真题及答案解析
  11. Hibernate拦截器字段加密解密
  12. 理解充分条件与必要条件
  13. SAP中通过历史记录查询追溯BOM工程变更处理物料升级未生效问题实例
  14. 计算机应用基础压缩文件操作题目演示,计算机应用基础操作题题目
  15. 合并算法详解原理和代码
  16. k30s,MIUI12.5开发版线刷为稳定版12.0.3
  17. 2022新版PMP考试有哪些变化?
  18. Axure-图片放大缩小
  19. 单模光电转换器怎么接_光纤收发器怎么连接?光纤收发器安装图解大全!
  20. java面向对象编程思想的理解

热门文章

  1. Java BufferImage图片处理(获取宽高、图片截取、转换灰度图)
  2. 自定义apt升级脚本
  3. JS中编写函数去除HTML标签,js函数获取html中className所在的内容并去除标签
  4. LeetCode刷题记录14——257. Binary Tree Paths(easy)
  5. 设置echarts的grid、tooltip、柱状图渐变色、折线图渐变色
  6. 在Ubuntu 14.04 64bit上安装批量图片处理器XnConvert
  7. Blender与Substance painter制作三维手枪
  8. UITableView HeaderView,FooterView 使用SnapKit布局导致约束异常
  9. 编码小记(未整理-持续更新)
  10. 项目微管理29 - 转正