首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >FFmpeg介绍及使用

FFmpeg介绍及使用

原创
作者头像
望天
修改2019-11-07 13:22:36
3.9K0
修改2019-11-07 13:22:36
举报

FFmpeg介绍及使用

1. FFmpeg简介

FFmpeg是音视频领域很有名的一个库, 这里从两方面介绍, 一方面根据FFMPEG的命令行工具介绍, 介绍这些命令行工具的使用方法, 满足一般用户要求. 还有一方面从组件/库的划分来介绍, 介绍FFMPEG是有哪些组件和库组成, 每一个库的作用, 便于后续的自定义开发.

全文整体脉络可以用一张图表示:

图片
图片

2. 从命令行工具角度介绍

FFmpeg命令行工具有以下四个:

  • ffmepg
  • ffprobe
  • ffplay
  • ffserver

2.1 ffmpeg命令

ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and resize video on the fly with a high quality polyphase filter.

ffmpeg主要作用是音视频转换, 这里转换有两个含义, 一个是封装容器的转换(比如mp4转flv), 一个是指封装格式的转换(比如h264转h265). 其次也支持图像大小转换, 音频重采样.

下面慢慢揭开ffmpeg命令的面纱:

对于ffmpeg, 当我们忘记了命令或者需要查找想要的命令时, 可以通过 ffmpeg --help查看帮助, 此时会输出很多内容, 我们慢慢解读这些输出的内容:

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

最上面的Getting help:是说如何获得帮助. 使用ffmpeg --help long 会输出高级参数, 使用ffmpeg --help full会输出全部帮助信息. 使用ffmpeg -h topic可以指定要输出的帮助类型.

接下来的-formats/-muxers/-demuxers/-devices/-codecs/-encoders/-bsfs/-protocols/-filters分别表示打印出所有格式/复用/解复用/设备/编码器/解码器/bitstream filters/协议/滤镜. 我们接下来举几个例子说明:

2.1.1 ffmpeg -formats

当遇到无法解析的视频文件或者无法生成视频文件时, 可以使用这个命令查看是否支持对应的视频文件格式.

File formats: D. = Demuxing supported.E = Muxing supported DE h264 raw H.264 video DE flv FLV (Flash Video)

输出内容DE h264 raw H.264 video分为3部分:

第一列DE是封装格式的Demuxing(解复用)支持和Muxing(复用)支持.

第二列h264是文件封装格式.

第三列raw H.264 video是文件格式的详细说明, 表明是裸的h264视频, 也就是没有压缩过的h264.

2.1.1.1 ffmpeg -muxers

如果我们只想看复用格式, 可以使用ffmpeg -muxers, 输出如下所示:

File formats: D. = Demuxing supported .E = Muxing supportedundefined E h264 raw H.264 video E flv FLV (Flash Video)

输出内容的解读方式和ffmpeg -formats一样.

2.1.1.1.1 ffmpeg -h muxer=flv

当我们需要查看某种具体的复用格式时, 可以使用ffmpeg -h muxer=MUXER_NAME来查看. 比如ffmpeg -h muxer=flv输出内容如下, 其中包含了只有flv复用格式才支持的参数.

Muxer flv FLV (Flash Video): Common extensions: flv. Mime type: video/x-flv. Default video codec: flv1. Default audio codec: mp3. flv muxer AVOptions: -flvflags <flags> E........ FLV muxer flags (default 0) aac_seq_header_detect E........ Put AAC sequence header based on stream data no_sequence_end E........ disable sequence end for FLV no_metadata E........ disable metadata for FLV no_duration_filesize E........ disable duration and filesize zero value metadata for FLV add_keyframe_index E........ Add keyframe index metadata

FLV的muxer包含两大部分.

第一部分Muxer flv [FLV (Flash Video)]:是FLV封装的默认配置描述, 如扩展名, MIME类型, 默认的视频编码格式, 默认的音频编码格式.

第二部分flv muxer AVOptions:为FLV封装时支持的配置参数及相关说明, 通过这些参数, 我们可以更好的了解flv复用的能力.

2.1.1.2 ffmpeg -demuxers

如果我们只想看解复用格式, 可以使用ffmpeg -demuxers, 输出如下所示:

File formats: D. = Demuxing supported .E = Muxing supported -- D flv FLV (Flash Video) D h264 raw H.264 video

输出内容的解读方式和ffmpeg -formats一样.

2.1.1.2.1 ffmpeg -h demuxer=flv

当我们需要查看某种具体的解复用格式时, 可以使用ffmpeg -h demuxer=MUXER_NAME来查看. 比如ffmpeg -h demuxer=flv输出内容如下:

Demuxer flv FLV (Flash Video): Common extensions: flv. flvdec AVOptions: -flv_metadata <boolean> .D.V..... Allocate streams according to the onMetaData array (default false) -missing_streams <int> .D.V..XR. (from 0 to 255) (default 0)

FLV的demuxer的信息包含两大部分, 具体如下:

第一部分Demuxer flv [FLV (Flash Video)]:为FLV解封装默认的配置, 如扩展文件名.

第二部分flvdec AVOptions:是FLV解封装设置的参数和相关说明.

2.1.2 ffmpeg -decoders

ffmpeg -decoders会输出所有支持的解码器, 输出内容如下:

Decoders: V..... = Video A..... = Audio S..... = Subtitle .F.... = Frame-level multithreading ..S... = Slice-level multithreading ...X.. = Codec is experimental ....B. = Supports draw_horiz_band .....D = Supports direct rendering method 1undefined VFS..D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10

VFS..D h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10分为三列,

第一列VFS..D共6个字段, 第一个字段可以取值V/A/S, 表示这个解码器是音频编码器还是视频编码器还是字幕编码器, 第二个字段F表示帧级别的多线程支持, 第三个字段S表示分片级别的多线程, 第四个字段X表示该编码属于实验版本, 第五个字段B表示支持draw horiz band模式, 第六个字段D表示支持直接渲染模式. 比如h264的VFS..D表示视频解码器, 支持帧级别和分片级别的多线程, 支持直接渲染模式.

第二列h264是编码格式.

第三列H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10是编码格式的详细说明.

2.1.2.1 ffmpeg -h decoder=h264

如果我们想知道h264解码器的更多信息, 可以使用 ffmpeg -h decoder=h264命令:

Decoder h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10: General capabilities: dr1 delay threads Threading capabilities: frame and slice H264 Decoder AVOptions: -enable_er <boolean> .D.V..... Enable error resilience on damaged frames (unsafe) (default auto) -x264_build <int> .D.V..... Assume this x264 version if no x264 version found in any SEI (from -1 to INT_MAX) (default -1)

第一部分Decoder h264 [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]是解码h264时可以采用的常用支持, 和多线程支持. 这里的frame and slice说明h264支持帧级别/Slice级别的多线程解码.

第二部分H264 Decoder AVOptions:是解码h264可以采用的解码参数和说明.

2.1.3 ffmpeg -encoders

ffmpeg -encoders会输出所有支持的解码器, 输出内容如下:

Decoders: V..... = Video A..... = Audio S..... = Subtitle .F.... = Frame-level multithreading ..S... = Slice-level multithreading ...X.. = Codec is experimental ....B. = Supports draw_horiz_band .....D = Supports direct rendering method 1undefined V..... libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264) V..... libx264rgb libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264) V..... h264_videotoolbox VideoToolbox H.264 Encoder (codec h264)

V..... libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)分为三列,

第一列V.....共6个字段, 第一个字段可以取值V/A/S, 表示这个编码器是音频编码器还是视频编码器还是字幕编码器, 第二个字段F表示帧级别的多线程支持, 第三个字段S表示分片级别的多线程, 第四个字段X表示该编码属于实验版本, 第五个字段B表示支持draw horiz band模式, 第六个字段D表示支持直接渲染模式. 这里和解码器decoders是一致的. 比如libx264V.....表示视频编码器.

第二列libx264是编码格式.

第三列H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)是编码格式的详细说明.

2.1.3.1 ffmpeg -h encoder=h264

如果我们想知道某个具体的编码器参数, 可以通过ffmpeg -h encoder=ENCODER_NAME, 比如ffmpeg -h encoder=h264输出如下:

Encoder libx264 libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10: General capabilities: delay threads Threading capabilities: auto Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21 libx264 AVOptions: -preset <string> E..V..... Set the encoding preset (cf. x264 --fullhelp) (default "medium") -tune <string> E..V..... Tune the encoding params (cf. x264 --fullhelp) -profile <string> E..V..... Set profile restrictions (cf. x264 --fullhelp) -fastfirstpass <boolean> E..V..... Use fast settings when encoding first pass (default true) -level <string> E..V..... Specify level (as defined by Annex A) ...... Encoder libx264rgb libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB: General capabilities: delay threads Threading capabilities: auto Supported pixel formats: bgr0 bgr24 rgb24 libx264rgb AVOptions: -preset <string> E..V..... Set the encoding preset (cf. x264 --fullhelp) (default "medium") -tune <string> E..V..... Tune the encoding params (cf. x264 --fullhelp) ...... Encoder h264_videotoolbox VideoToolbox H.264 Encoder: General capabilities: delay Threading capabilities: none Supported pixel formats: videotoolbox_vld nv12 yuv420p h264_videotoolbox AVOptions: -profile <int> E..V..... Profile (from 0 to 4) (default 0) baseline E..V..... Baseline Profile main E..V..... Main Profile high E..V..... High Profile -level <int> E..V..... Level (from 0 to 52) (default 0) 1.3 E..V..... Level 1.3, only available with Baseline Profile ......

这里列出了三个h264编码器, 分别为libx264, libx264rgb, h264_videotoolbox. 每个编码器的帮助都分为两个部分:

第一部分Encoder libx264 [libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]:是该h264编码器支持的基本编码方式. 对比这三个编码器, 可以发现虽然都是说基本编码能力支持, 多线程编码能力支持和支持的像素色彩格式, 但是不同编码器支持的能力差别很大.

第二部分libx264 AVOptions:是该编码器编码h264时可以采用的编码参数和说明. 不同的编码器的参数之前差别很大, 设置时需要注意.

2.1.4 ffmpeg -filters

如果想知道ffmpeg支持的滤镜/滤波器种类, 可以使用ffmpeg -filters查看. ffmpeg的滤镜种类丰富, 功能强大, 叠加方便.

Filters: T.. = Timeline support .S. = Slice threading ..C = Command support A = Audio input/output V = Video input/output N = Dynamic number and/or type of input/output | = Source or sink filter undefined T.C overlay VV->V Overlay a video source on top of the input. TS. colorkey V->V Turns a certain color into transparency. Operates on RGB colors.

输出信息一共四列:

第一列总共三个字段TSC, 第一个字段 T表示时间轴支持, 第二个字段S表示分片线程处理支持, 第三个字段C表示命令支持.

第二列overlay是滤镜名

第三列VV->V是转换方式, 比如音视转音频, 视频转视频, 创建音频, 创建视频, 多个视频合并为一个视频等操作.

第四列Overlay a video source on top of the input.是滤镜作用说明.

2.1.4.1 ffmpeg -h filter=colorkey

如果需要详细查看某个滤镜的详细介绍, 可以通过ffmpeg -h filter=FILTER_NAME来查看. 比如ffmpeg -h filter=colorkey输出如下:

Filter colorkey Turns a certain color into transparency. Operates on RGB colors. slice threading supported Inputs: #0: default (video) Outputs: #0: default (video) colorkey AVOptions: color <color> ..FV..... set the colorkey key color (default "black") similarity <float> ..FV..... set the colorkey similarity value (from 0.01 to 1) (default 0.01) blend <float> ..FV..... set the colorkey key blend value (from 0 to 1) (default 0)

colorkey滤镜的输出信息主要包含两大部分:

第一部分Filter colorkey说明了所支持的色彩格式信息, 支持的多线程处理方式, 以及输入输出支持.

第二部分colorkey AVOptions:是所支持的参数和说明.

2.1.5 sample

  1. ffmpeg -i ~/input.rmvb -vcodec mpeg4 -b:v 200k -r 15 -an output.mp4

-vcodec codec force video codec ('copy' to copy stream)

Set the video codec. This is an alias for -codec:v.

-b bitrate video bitrate (please use -b:v)

封装格式从RMVB转换为MP4, 视频编码转换为mpeg4, 视频码率转换为200kbit/s, 视频帧率转换为15fps, 转码后不包括音频(-an)

2.1.6 others

ffmpeg功能十分强大, 更详细命令可以参考

http://ffmpeg.org/ffmpeg.html

http://ffmpeg.org/ffmpeg-all.html

2.2 ffprobe

ffprobe gathers information from multimedia streams and prints it in human- and machine-readable fashion.

从ffprobe的介绍可知, ffprobe主要有两个作用, 一个是从多媒体文件中获得信息, 二是输出这些信息.

2.2.1 ffprobe -h

ffprobe命令比较多, 我们可以通过ffprobe -h来查看.

-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_packets, -show_streams, -show_frames, -show_packets.

比如我们可以通过ffprobe -show_packets input.mp4查看多媒体数据包信息. 其输出如下:

PACKET codectype=audio 多媒体类型, 视频包/音频包 stream_index=1 多媒体的stream多音 pts=9564160 多媒体的显示时间值 pts_time=216.874376 根据不同格式计算后的多媒体的显示时间 dts=9564160 多媒体的解码时间值 dts_time=216.874376 根据不同格式计算后的多媒体的解码时间 duration=1024 多媒体包占用的时间值 duration_time=0.023220 根据不同格式计算后的多媒体包所占用的时间值 convergence_duration=N/A convergence_duration_time=N/A size=364 多媒体包的大小 pos=14727208 多媒体包所在文件的便宜位置 flags=K 多媒体包标记, 如关键包和非关键包 /PACKET

还可以通过ffprobe -show_data -show_packets input.mp4查看包中的具体数据:

PACKET codec_type=video stream_index=0 pts=19513494 pts_time=216.816600 dts=19510491 dts_time=216.783233 duration=3003 duration_time=0.033367 convergence_duration=N/A convergence_duration_time=N/A size=41 pos=14721293 flags=__ data= 00000000: 0000 0025 419a 2493 c21e 4ca6 07ff 0000 ...%A.$...L..... 00000010: 0300 0003 0000 0300 0003 0000 0300 0003 ................ 00000020: 0000 0300 0003 0001 ff .........

2.2.1.1 ffprobe -print_format / -of修改输出格式

-print_format format  set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)

-of format          alias for -print_format

ffprobe -of csv --show_packets input.mp4

http://ffmpeg.org/ffprobe.html

http://ffmpeg.org/ffprobe-all.html

2.3 ffplay

FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs.

SDL,跨平台,便于测试ffmpeg的codec/format/filter

最新版不到四千行, IJKPlayer发源于此

2.3.1 ffplay -h

-fs                 force full screen -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 -bytes val          seek by bytes 0=off 1=on -1=auto -seek_interval seconds  set seek interval for left/right keys, in seconds -nodisp             disable graphical display -noborder           borderless window -volume volume      set startup volume 0=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) -i input_file       read specified file -codec decoder_name  force decoder -autorotate         automatically rotate videoAdvanced options: -cpuflags flags     force specific cpu flags -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 -drp                let decoder reorder pts 0=off 1=on -1=auto -lowres -sync type          set audio-video sync. type (type=audio/video/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 -infbuf             don't limit the input buffer size (useful with realtime streams) -vf filter_graph    set video filters -rdftspeed msecs    rdft speed -default            generic catch all option -acodec decoder_name  force audio decoder -scodec decoder_name  force subtitle decoder -vcodec decoder_name  force video decoder -find_stream_info   read and decode the streams to fill missing information with heuristics

2.3.2 ffplay -ss 20 -t 10 output.mp4

2.3.3 ffplay -showmode 1 output.mp3 

-showmode mode      select show mode (0 = video, 1 = waves, 2 = RDFT)

2.3.4 ffplay -debug mb_type output.mp4

-debug             <flags>      ED.VAS... print specific debug info (default 0)

pict                         .D.V..... picture info

bitstream                    .D.V.....

mb_type                      .D.V..... macroblock (MB) type

qp                           .D.V..... per-block quantization parameter (QP)

dct_coeff                    .D.V.....

green_metadata               .D.V.....

skip                         .D.V.....

startcode                    .D.V.....

er                           .D.V..... error recognition

mmco                         .D.V..... memory management control operations (H.264)

bugs                         .D.V.....

buffers                      .D.V..... picture buffer allocations

thread_ops                   .D.VA.... threading operations

nomc                         .D.VA.... skip motion compensation

2.3.5 ffplay -flags2 +export_mvs f14163.mp4 -vf codecview=mv=pf+bf+bb

调试宏块和运动矢量

https://trac.ffmpeg.org/wiki/Debug/MacroblocksAndMotionVectors

codecview AVOptions:

  mv                <flags>      ..FV..... set motion vectors to visualize (default 0)

 pf                           ..FV..... forward predicted MVs of P-frames
 bf                           ..FV..... forward predicted MVs of B-frames
 bb                           ..FV..... backward predicted MVs of B-frames

The following sections apply to ffmpeg versions older than October 21 2017.

Analyzing Macroblock Types

ffplay -debug vis_mb_type input.mp4

Analyzing QP Values

ffplay -debug vis_qp input.mp4

http://ffmpeg.org/ffplay.html

http://ffmpeg.org/ffplay-all.html

2.4 ffserver

ffserver is a streaming server for both audio and video. It supports several live feeds, streaming from files and time shifting on live feeds. You can seek to positions in the past on each live feed, provided you specify a big enough feed storage.

http://ffmpeg.org/ffserver.html

http://ffmpeg.org/ffserver-all.html

ffserver has been removed on 2018-01-06. If you still need it checkout commit 2ca65fc or use the 3.4 release branch Or try an alternative such as mkvserver_mk2 https://trac.ffmpeg.org/wiki/ffserver

https://trac.ffmpeg.org/wiki/ffserver

https://github.com/klaxa/mkvserver_mk2

Simple-RTMP-Server 

https://github.com/ossrs/srs

3. 从组件/库角度介绍

3.1 libavutil:大杂烩, 函数不知道应该放哪就放这里.

The libavutil library is a utility library to aid portable multimedia programming. It contains safe portable string functions, random number generators, data structures, additional mathematics functions, cryptography and multimedia related functionality (like enumerations for pixel and sample formats). It is not a library for code needed by both libavcodec and libavformat.

http://www.ffmpeg.org/libavutil.html

http://www.ffmpeg.org/ffmpeg-utils.html

3.2 libswscale:视频格式转换与大小缩放

The libswscale library performs highly optimized image scaling and colorspace and pixel format conversion operations. Specifically, this library performs the following conversions: Rescaling: is the process of changing the video size. Several rescaling options and algorithms are available. This is usually a lossy process. Pixel format conversion: is the process of converting the image format and colorspace of the image, for example from planar YUV420P to RGB24 packed. It also handles packing conversion, that is converts from packed layout (all pixels belonging to distinct planes interleaved in the same buffer), to planar layout (all samples belonging to the same plane stored in a dedicated buffer or "plane").This is usually a lossy process in case the source and destination colorspaces differ.

http://www.ffmpeg.org/libswscale.html

http://www.ffmpeg.org/ffmpeg-scaler.html

3.3 libswresample:音频重采样

The libswresample library performs highly optimized audio resampling, rematrixing and sample format conversion operations. Specifically, this library performs the following conversions: Resampling: is the process of changing the audio rate, for example from a high sample rate of 44100Hz to 8000Hz. Audio conversion from high to low sample rate is a lossy process. Several resampling options and algorithms are available. Format conversion: is the process of converting the type of samples, for example from 16-bit signed samples to unsigned 8-bit or float samples. It also handles packing conversion, when passing from packed layout (all samples belonging to distinct channels interleaved in the same buffer), to planar layout (all samples belonging to the same channel stored in a dedicated buffer or "plane"). Rematrixing: is the process of changing the channel layout, for example from stereo to mono. When the input channels cannot be mapped to the output streams, the process is lossy, since it involves different gain factors and mixing. Various other audio conversions (e.g. stretching and padding) are enabled through dedicated options.

http://www.ffmpeg.org/libswresample.html

http://www.ffmpeg.org/ffmpeg-resampler.html

3.4 libavcodec:编解码

The libavcodec library provides a generic encoding/decoding framework and contains multiple decoders and encoders for audio, video and subtitle streams, and several bitstream filters.

AVCodecContext

http://www.ffmpeg.org/libavcodec.html

http://www.ffmpeg.org/ffmpeg-codecs.html

3.4.1 bitsream-filters

http://www.ffmpeg.org/ffmpeg-bitstream-filters.html

A bitstream filter operates on the encoded stream data, and performs bitstream level modifications without performing decoding.

https://stackoverflow.com/questions/32028437/what-are-bitstream-filters-in-ffmpeg

在不做码流解码的前提下,对已经编码后的比特流做特定的修改、调整。比如添加SEI, SEI可以做直播答题

https://zhuanlan.zhihu.com/p/33720871

3.5 libavformat:封装与解封装

The libavformat library provides a generic framework for multiplexing and demultiplexing (muxing and demuxing) audio, video and subtitle streams. It encompasses multiple muxers and demuxers for multimedia container formats. It also supports several input and output protocols to access a media resource.

http://www.ffmpeg.org/libavformat.html

http://www.ffmpeg.org/ffmpeg-formats.html

http://www.ffmpeg.org/ffmpeg-protocols.html

3.6 libavdevice:音视频输入/输出设备

The libavdevice library provides a generic framework for grabbing from and rendering to many common multimedia input/output devices, and supports several input and output devices, including Video4Linux2, VfW, DShow, and ALSA. The libavdevice library provides the same interface as libavformat. Namely, an input device is considered like a demuxer, and an output device like a muxer, and the interface and generic device options are the same provided by libavformat (see the ffmpeg-formats manual).

http://www.ffmpeg.org/libavdevice.html

http://www.ffmpeg.org/ffmpeg-devices.html

3.7 libavfilter:音视频滤镜

The libavfilter library provides a generic audio/video filtering framework containing several filters, sources and sinks.

http://www.ffmpeg.org/libavfilter.html

http://www.ffmpeg.org/ffmpeg-filters.html

4. 结语

本文暂且告一段落. "从组件/库角度介绍"写的比较简略, 内容主要是ffmpeg官网链接和内容, 因为这里需要结合FFmpeg源码才能更好的描述. 在后续文章介绍"如何debug ffmpeg源码", 以及"ffmpeg定制开发示例"时, 会更详细的描述FFmpeg组件/库.

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • FFmpeg介绍及使用
    • 1. FFmpeg简介
      • 2. 从命令行工具角度介绍
        • 2.1 ffmpeg命令
        • 2.1.1 ffmpeg -formats
        • 2.1.1.1 ffmpeg -muxers
        • 2.1.1.1.1 ffmpeg -h muxer=flv
        • 2.1.1.2 ffmpeg -demuxers
        • 2.1.1.2.1 ffmpeg -h demuxer=flv
        • 2.1.2 ffmpeg -decoders
        • 2.1.2.1 ffmpeg -h decoder=h264
        • 2.1.3 ffmpeg -encoders
        • 2.1.3.1 ffmpeg -h encoder=h264
        • 2.1.4 ffmpeg -filters
        • 2.1.4.1 ffmpeg -h filter=colorkey
        • 2.1.5 sample
        • 2.1.6 others
        • 2.2 ffprobe
        • 2.2.1 ffprobe -h
        • 2.2.1.1 ffprobe -print_format / -of修改输出格式
        • -print_format format  set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml)
        • ffprobe -of csv --show_packets input.mp4
        • 2.3 ffplay
        • 最新版不到四千行, IJKPlayer发源于此
        • 2.3.1 ffplay -h
        • 2.3.2 ffplay -ss 20 -t 10 output.mp4
        • 2.3.3 ffplay -showmode 1 output.mp3 
        • -showmode mode      select show mode (0 = video, 1 = waves, 2 = RDFT)
        • 2.3.4 ffplay -debug mb_type output.mp4
        • -debug             <flags>      ED.VAS... print specific debug info (default 0)
        • 2.3.5 ffplay -flags2 +export_mvs f14163.mp4 -vf codecview=mv=pf+bf+bb
        • 调试宏块和运动矢量
        • https://trac.ffmpeg.org/wiki/Debug/MacroblocksAndMotionVectors
        • codecview AVOptions:
        • The following sections apply to ffmpeg versions older than October 21 2017.
        • Analyzing Macroblock Types
        • ffplay -debug vis_mb_type input.mp4
        • Analyzing QP Values
        • ffplay -debug vis_qp input.mp4
        • 2.4 ffserver
      • 3. 从组件/库角度介绍
        • 3.1 libavutil:大杂烩, 函数不知道应该放哪就放这里.
        • 3.2 libswscale:视频格式转换与大小缩放
        • 3.3 libswresample:音频重采样
        • 3.4 libavcodec:编解码
        • 3.4.1 bitsream-filters
        • 3.5 libavformat:封装与解封装
        • 3.6 libavdevice:音视频输入/输出设备
        • 3.7 libavfilter:音视频滤镜
      • 4. 结语
      相关产品与服务
      命令行工具
      腾讯云命令行工具 TCCLI 是管理腾讯云资源的统一工具。使用腾讯云命令行工具,您可以快速调用腾讯云 API 来管理您的腾讯云资源。此外,您还可以基于腾讯云的命令行工具来做自动化和脚本处理,以更多样的方式进行组合和重用。
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档