[win10] ffmpeg 学习笔记

目录

1.官方宣传

2.下载与安装

2.1 下载

2.2 安装

3.用法

 3.1  ...\ffmpeg\bin 下三个exe的解释

3.1.1 ffmpeg.exe

3.1.2 ffplay.exe

3.1.3 ffprobe.exe

3.2 ffmpeg 命令行

扫描二维码关注公众号,回复: 3825474 查看本文章

 


1.官方宣传

        一个完整的跨平台解决方案,用于录制,转换和流式传输音频和视频。FFmpeg是领先的多媒体框架,能够解码编码 转码复用流式传输过滤播放人类和机器创建的任何内容。它支持最晦涩难懂的古代格式,直至最前沿。无论它们是由某些标准委员会,社区还是公司设计的。它还具有高度可移植性:FFmpeg 在各种构建环境,机器架构和配置下,跨Linux,Mac OS X,Microsoft Windows,BSD,Solaris等编译,运行和传递我们的测试基础架构 FATE

2.下载与安装

2.1 下载

官网:https://ffmpeg.zeranoe.com/builds/

  • FFmpeg分为3个版本:StaticSharedDev
  • 前两个版本可以直接在命令行中使用。包含了三个exe:ffmpeg.exeffplay.exeffprobe.exe
  • Static版本中的exe体积较大,那是因为相关的Dll都已经编译进exe里面去了。
  • Shared版本中exe的体积相对小很多,是因为它们运行的时候还需要到相关的dll中调用相应的功能
  • Dev版本用于开发,里面包含了库文件xxx.lib以及头文件xxx

本博主下载的是 ffmpeg-20181028-bdfd2e3-win64-static 

2.2 安装

他没有安装程序,我们需要把包含exe的那个文件夹放入环境变量,重启电脑即可。

3.用法

 3.1  ...\ffmpeg\bin 下三个exe的解释

       借由雷神的 https://blog.csdn.net/leixiaohua1020/article/details/15811977,我们可以了解ffmpeg.exe、ffplay.exe和ffprobe.exe 的用法

3.1.1 ffmpeg.exe


ffmpeg是用于转码的应用程序。

一个简单的转码命令可以这样写:

将input.avi转码成output.ts,并设置视频的码率为640kbps

ffmpeg -i input.avi -b:v 640k output.ts

具体的使用方法可以参考: ffmpeg参数中文详细解释
详细的使用说明(英文):http://ffmpeg.org/ffmpeg.html

3.1.2 ffplay.exe


ffplay是用于播放的应用程序。

一个简单的播放命令可以这样写:

播放test.avi

ffplay test.avi


具体的使用方法可以参考:ffplay的快捷键以及选项
详细的使用说明(英文):http://ffmpeg.org/ffplay.html

3.1.3 ffprobe.exe
 

ffprobe是用于查看文件格式的应用程序。

这个就不多介绍了。

详细的使用说明(英文):http://ffmpeg.org/ffprobe.html

3.2 ffmpeg 命令行

在cmd中 ffmpeg.exe -h 查看ffmpeg说明,可以看到:

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/bsf
    See 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 methods

Global 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        disposition

Video 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 data

Audio 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 filters

Subtitle 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

4.思考:接下来我们该做什么?

        博主从来没有见过-h出来这么多命令的exe,这简直就是在劝退所有初学者......ok,我先摸索摸索路子,船到桥头自然直嘛。记录一下,我找到一个中文版的教程https://www.longqi.cf/tools/2015/02/13/ffmpegcn/,看了一下,其实就是翻译,不过没乱码~感谢感谢,还有一个新一点的http://wiki.11ten.net/Resources/ffmpeg-%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3.html

接下来我们慢慢剖析这些命令行,没事,博主头铁。

参考

1.https://www.jianshu.com/p/7ed3be01228b 

2.https://blog.csdn.net/leixiaohua1020/article/details/15811977

猜你喜欢

转载自blog.csdn.net/qq_39575835/article/details/83505205
今日推荐