FFMPEG常用命令

2023-11-08

FFmpeg编码和支持

  1. FFmpeg源代码中包含的编码格式很多,常见不常见的都可以在编译皮质列表中见到,可以通过的编译配置命令:
./configure --list-encoders

常见的编码器的格式有:AAC,AC3,H.264,H.265、MPEG4、MPEG2VIDEO、PCM以及FLV1的编码器支持

  1. FFmpeg的解码器支持,解码的主要作用是在输入的时候进行解码,也可以理解为将压缩过的编码进行解压缩,其可以通过编译配置命令查询。
./configure --list-decoders

通过查询相关命令可以发现常见的编码格式有:H.264、H.265、MPEG4以及MP3

  1. FFmpeg的封装支持,其封装指将压缩后的编码封装到容器序列中,常见的容器格式可以通过配置命令查询:
./configure --list-muxers

从封装(复用)格式所使用的的信息可以看到,FFmpeg支撑生成裸流文件,如H.264,AAC,PCM以及常见的某些格式:MP3、MP4,FLV,M3U8

  1. FFmpeg的解封装支持,解封装支持是指将读入的容器格式解开,将里面压缩的音频流,视频流以及字幕流、数据流提取出来,通过配置相关命令:
./configure --list-demuxers

从解封装的格式信息可以看到,支持解封状的的信息特别多有:MP3、MP4,FLV、MOV,AVI、(image)

  1. FFmpeg的通信协议支持,FFmepg不仅仅支持本地的多媒体支持处理,而且还支持网络流媒体处理,相关的流媒体协议可以通过配置命令查询:
 ./configure --list-protocols 

从协议的信息中可以看到,其支持的相关的信息包括,MMS,HTTP,HTTPS,HLS(M3U8),RTMP以及RTP甚至TCP和UTP

FFmpeg工具的使用基础

FFmpeg中常用的工具主要有FFmpeg、ffprobe,ffplay;他们分别作为多媒体的编解码工具,内容分析工具以及播放器。

  1. ffmpeg:是一个非常快速的视频和音频转换器,也可以从实时音频/视频源中获取。它还可以在任意采样率之间进行转换,并使用高质量的多相滤波器动态调整视频大小.
    ffmpeg信息查询的部分的主要参数具体如下所示:
usage:ffmpege [options] [[ infile options] -i infile] ... {[outfile options] outfiles}...
#执行命令
ffmget -formats 查看当前使用ffmpeg支持封装和解封装支持的格式
D. = Demuxing supported
 .E = Muxing supported
 --
 D  3dostr          3DO STR
  E 3g2             3GP2 (3GPP2 file format)
  E 3gp             3GP (3GPP file format)
 D  4xm             4X Technologies
  E a64             a64 - video for Commodore 64
 D  aa              Audible AA format files
 D  aac             raw ADTS AAC (Advanced Audio Coding)
 DE ac3             raw AC-3
 D  acm             Interplay ACM
 D  act             ACT Voice file format
 D  adf             Artworx Data Format
 D  adp             ADP
 D  ads             Sony PS2 ADS
  E adts            ADTS AAC (Advanced Audio Coding)
 DE adx             CRI ADX

ffmpeg -encoders 可以查看是否支持某种编码格式
 V..... = Video                                  #视屏
 A..... = Audio									 #音频
 S..... = Subtitle								 #字幕
 .F.... = Frame-level multithreading			 #帧级别的多线程支持
 ..S... = Slice-level multithreading			 #分片级别的多线程支持
 ...X.. = Codec is experimental					 #该编码为实验编码
 ....B. = Supports draw_horiz_band				 #draw,horiz,band
 .....D = Supports direct rendering method 1     #直接渲染模式支持
 ------
 V....D 012v                 Uncompressed 4:2:2 10-bit
 V....D 4xm                  4X Movie
 V....D 8bps                 QuickTime 8BPS video
 V....D aasc                 Autodesk RLE
 V....D agm                  Amuse Graphics Movie
 VF...D aic                  Apple Intermediate Codec
 V....D alias_pix            Alias/Wavefront PIX image
 V....D amv                  AMV Video
 V....D anm                  Deluxe Paint Animation
 V....D ansi                 ASCII/ANSI art
 VF...D apng                 APNG (Animated Portable Network Graphics) image
 V....D arbc                 Gryphon's Anim Compressor
 V....D asv1                 ASUS V1
 V....D asv2                 ASUS V2
 V....D aura                 Auravision AURA

ffmpeg -filters
#可以观察查看支持那些的滤镜
 #第一列:3个字段支持
 #第二列:滤镜名
 #第三例:转化方式
 #第三例:滤镜作用
  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
 ... abench            A->A       Benchmark part of a filtergraph.
 ... acompressor       A->A       Audio compressor.
 ... acontrast         A->A       Simple audio dynamic range compression/expansion filter.
 ... acopy             A->A       Copy the input audio unchanged to the output.
 ... acue              A->A       Delay filtering to match a cue.
 ... acrossfade        AA->A      Cross fade two input audio streams.
 ... acrossover        A->N       Split audio into per-bands streams.
 ... acrusher          A->A       Reduce audio bit resolution.
 .S. adeclick          A->A       Remove impulsive noise from input audio.
 .S. adeclip           A->A       Remove clipping from input audio.
 T.. adelay            A->A       Delay one or more audio channels.
 ... aderivative       A->A       Compute derivative of input audio.
 ... aecho             A->A       Add echoing to the audio.
 ... aemphasis         A->A       Audio emphasis.
 ... aeval             A->A       Filter audio signal according to a specified expression.
 T.. afade             A->A       Fade in/out input audio.
 TSC afftdn            A->A       Denoise audio samples using FFT.
 ... afftfilt          A->A       Apply arbitrary expressions to samples in frequency domain.
 .S. afir              AA->N      Apply Finite Impulse Response filter with supplied coefficients in 2nd stream.
 ... aformat           A->A       Convert the input audio to one of the specified formats.

ffmpeg -h muxer=flv
#通过ffmpeg -h 可以查看具体参数的对应的类型信息
其中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

  1. ffmpeg的封装转换(转封装)功能包含在AVFormat模块中,通过libavformat库进行Mux和Demux操作;多媒体的格式有很多种,这些格式中的很多参数是公用的,可以通过ffmpeg --help full 信息,找到AVFormatContext参数部分,该参数下的所以皮参数均为封装转换可使用的参数。
    在这里插入图片描述

  2. FFmpeg的转码参数,ffmpeg编码部分的功能主要是通过模块AVCodec来完成的,通过libavcodec库进行Encode与Decode操作。多媒体格式的种类有很多,但是还有很多通用的基本操作参数。
    在这里插入图片描述

  3. ffmpeg的基本转码原理,ffmpeg工具的主要用途为编码、解码、转码以及媒体格式转换,ffmpeg常用于转码操作,可以设置相关的转码参数,如果转码操作实际封装的改变:
    在这里插入图片描述

ffprobe常用命令

在ffmpeg套件中,除了ffmpeg作为对每日处理工具外,还有很多ffprobe多媒体信息查看工具,可以通过ffprobe主要用来查看多媒体文件的信息。
ffprobe:常用的参数比较多,可以通过ffprobe --hep查看详细的帮助信息。

usage: ffprobe [OPTIONS] [INPUT_FILE]
 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 alloc

使用ffprobe -show _packets input.flv查看多媒体数据信息:

[PACKET]
codec_type=video
stream_index=0
pts=4023
pts_time=160.920000
dts=4023
dts_time=160.920000
duration=1
duration_time=0.040000
convergence_duration=N/A
convergence_duration_time=N/A
size=3346
pos=15109472
flags=__

使用show_packets查看的多媒体数据包信心是用PACKET标签括祁连,其中包含的信息有:
在这里插入图片描述

command:ffprobe -show_data -show_packets output.avi
#-show_data 查看对应的内容
[PACKET]
codec_type=audio
stream_index=1
pts=7119
pts_time=170.856000
dts=7119
dts_time=170.856000
duration=1
duration_time=0.024000
convergence_duration=N/A
convergence_duration_time=N/A
size=384
pos=16293212
flags=K_
data=
00000000: fffb 9464 e500 0661 5cc8 6671 e000 bb0b  ...d...a\.fq....
00000010: 899f cdc8 0055 ed63 3db9 9780 0103 0fe8  .....U.c=.......
00000020: 271a 5000 67d2 b2c1 fffe 3f0b f979 25e7  '.P.g.....?..y%.
00000030: 217a 919a 1437 b07f fff2 e073 9c26 5ab0  !z...7.....s.&Z.
00000040: f232 203e 8577 b069 ffff f3fc c525 ea43  .2 >.w.i.....%.C
00000050: 18b8 319a afa1 5dec 1a3e 85ff fffe 87c0  ..1...]..>......
00000060: 4b21 90d3 487c 89b4 32ef 60d1 f42b bd83  K!..H|..2.`..+..
00000070: 4fff ffff e54d 21f2 2da1 9056 13f6 5b4e  O....M!.-..V..[N
00000080: 558a 15d8 60d1 f42b b0c1 d317 fc07 fffe  U...`..+........
00000090: b000 900f 2cf3 0820 8200 05e0 1b46 2d8a  ....,.. .....F-.
000000a0: 4792 5630 e321 6db9 3c5c 140e 645e 202c  G.V0.!m.<\..d^ ,
000000b0: 2855 f0f8 a8b8 80b3 ffc5 0e2a 7416 fc22  (U.........*t.."
000000c0: 0b91 39fa c069 38ef e5d2 70ca 59ff 994c  ..9..i8...p.Y..L
000000d0: 6a6a 4c41 4d45 332e 3130 30aa aa4c 414d  jjLAME3.100..LAM
000000e0: 4533 2e31 3030 aaaa aaaa aaaa aaaa aaaa  E3.100..........
000000f0: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................
00000100: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................
00000110: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................
00000120: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................
00000130: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................
00000140: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................
00000150: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................
00000160: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................
00000170: aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa  ................

[/PACKET]
command: ffprobe -show_frames output.flv
#-show_frames 输出帧信息将使用的FRAME标签包含起来
[FRAME]
media_type=audio
stream_index=1
key_frame=1
pkt_pts=6874
pkt_pts_time=164.976000
pkt_dts=6874
pkt_dts_time=164.976000
best_effort_timestamp=6874
best_effort_timestamp_time=164.976000
pkt_duration=1
pkt_duration_time=0.024000
pkt_pos=15670606
pkt_size=384
sample_fmt=fltp
nb_samples=1152
channels=2
channel_layout=stereo
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=4125
pkt_pts_time=165.000000
pkt_dts=4125
pkt_dts_time=165.000000
best_effort_timestamp=4125
best_effort_timestamp_time=165.000000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=15670998
pkt_size=6275
width=1280
height=720
pix_fmt=yuv420p
sample_aspect_ratio=1:1
pict_type=P
coded_picture_number=4124
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
color_range=unknown
color_space=unknown
color_primaries=unknown
color_transfer=unknown
chroma_location=left
[SIDE_DATA]
side_data_type=QP table data
[/SIDE_DATA]
[SIDE_DATA]
side_data_type=QP table properties
[/SIDE_DATA]
[/FRAME]

在这里插入图片描述
在这里插入图片描述

command ffprobe -show_streams output.avi
#查看多媒体文件中的流信息
index=0
codec_name=mpeg4
codec_long_name=MPEG-4 part 2
profile=Simple Profile
codec_type=video
codec_time_base=1/25
codec_tag_string=FMP4
codec_tag=0x34504d46
width=1280
height=720
coded_width=1280
coded_height=720
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=1
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
quarter_sample=false
divx_packed=false
id=N/A
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/25
start_pts=0
start_time=0.000000
duration_ts=4272
duration=170.880000
bit_rate=630122
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=4272
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]

在这里插入图片描述
在这里插入图片描述

command ffprobe -of xxx -show_streams output.avi
通过将输出的信息的以xxx(xml,json)指定的形式输出信息
{
Input #0, avi, from 'output.avi':
  Metadata:
    encoder         : Lavf58.29.100
  Duration: 00:02:50.90, start: 0.000000, bitrate: 771 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 630 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 128 kb/s
    "streams": [
        {
            "index": 0,
            "codec_name": "mpeg4",
            "codec_long_name": "MPEG-4 part 2",
            "profile": "Simple Profile",
            "codec_type": "video",
            "codec_time_base": "1/25",
            "codec_tag_string": "FMP4",
            "codec_tag": "0x34504d46",
            "width": 1280,
            "height": 720,
            "coded_width": 1280,
            "coded_height": 720,
            "has_b_frames": 0,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "16:9",
            "pix_fmt": "yuv420p",
            "level": 1,
            "chroma_location": "left",
            "refs": 1,
            "quarter_sample": "false",
            "divx_packed": "false",
            "r_frame_rate": "25/1",
            "avg_frame_rate": "25/1",
            "time_base": "1/25",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 4272,
            "duration": "170.880000",
            "bit_rate": "630122",
            "nb_frames": "4272",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        },
        {
            "index": 1,
            "codec_name": "mp3",
            "codec_long_name": "MP3 (MPEG audio layer 3)",
            "codec_type": "audio",
            "codec_time_base": "1/48000",
            "codec_tag_string": "U[0][0][0]",
            "codec_tag": "0x0055",
            "sample_fmt": "fltp",
            "sample_rate": "48000",
            "channels": 2,
            "channel_layout": "stereo",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "3/125",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 7121,
            "duration": "170.904000",
            "bit_rate": "128018",
            "nb_frames": "7121",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ]
}

ffplay:重用命令

ffplay不仅仅是播放器,同时可以作为ffmpeg的codec引擎,format引擎,以及filter引擎的工具,还可以进行可视化的媒体参数分析,其可以通过ffplay --help查看相关参数。
在这里插入图片描述
其包含的超级参数如下所示:
在这里插入图片描述
在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

FFMPEG常用命令 的相关文章

  • VS2019中QT槽函数连接及使用

    1 qt连接VS 连接前提是在下载qt的时候将 MSVC 2017装上 点击扩展 选择管理扩展 搜索qt 选择下载 之后下载结束并重新打开后 会弹出一个 QT option 将路径填进去 2 VS中qt的使用 在qt中可以直接添加信号与槽

随机推荐

  • Windows如何关闭电脑休眠(适用所有Windows系统版本)

    方法一 此方法适用所有Windows系统版本电脑 1 点击开始按钮 在搜索框中输入cmd 右键点击选择以管理员身份运行 2 在打开的命令提示符窗口中 输入命令 powercfg h off 然后回车就可以了 3 如果想重新开启休眠功能 同样
  • 时间选择组件默认显示前7天日期

    1 div class st time div
  • windows下openGLES 3.0 配合 vs 环境搭建(二)

    在 http blog csdn net dardgen2015 article details 51563914 中 讨论了怎样搭建openGLes 3 0的环境 但是这种方法需要CMake的配合 不是很方便 接下来我们看看怎样搭建可以不
  • Double型比较大小 compareTo()

    public class DoubleCompare public static void main String args Double d1 100 0 Double d2 90 0 Double d3 150 005 int i 10
  • vue3自定义指令批量注册(按钮防重指令)

    vue3文档中很简单的描述了一下自定义指令
  • es分布式架构和原理分析

    es的分布式架构 前言 这篇初识ElasticSearch文章中 说明了es的集群的核心概念 回顾一下 关于节点 一个运行中的 es实例称为一个节点 而集群是由一个或者多个拥有相同cluster name 配置的节点组成 它们共同承担数据和
  • 计算机四级网络工程师(计算机网络单选)- 知识点

    计算机四级网络工程师 操作系统单选 计算机四级网络工程师 操作系统多选 计算机四级网络工程师 计算机网络单选 计算机四级网络工程师 计算机网络多选 一 Ethernet 1 Ethernet帧结构一般包含前导码 帧前定界符 目的地址 源地址
  • Device Association Service占用CPU - 解决方案

    问题 电脑开启蓝牙后 连接蓝牙设备时 服务主机 Device Association Service服务可能会占用大量CPU 在任务管理器中可以查看 若占用CPU持续超过10 则属于异常状态 由于本人问题已经解决 因此没有问题截图 下文介绍
  • 用R做中文LDA主题模型可视化分析

    LDA主题模型在2002年被David M Blei Andrew Y Ng 是的 就是吴恩达老师 和Michael I Jordan三位第一次提出 近几年随着社会化媒体的兴起 文本数据成为越来越重要的分析资料 海量的文本数据对社会科学研究
  • 99_好题整理1—鸡兔同笼

    F 鸡兔同笼 内存限制 128 MiB 时间限制 3000 ms标准输入输出 题目描述 已知鸡和兔的总数量为n 总腿数为m 输入n和m 依次输出鸡和兔的数目 如果无解 则输出 No answer 不要引号 输入格式 第一行输入一个数据a 代
  • 实用 SQL 语句收藏这篇就够了

    前言 文章沿着设计一个假想的应用 awesome app 为主线 从零创建修改数据库 表格 字段属性 索引 字符集 默认值 自增 增删改查 多表查询 内置函数等实用 SQL 语句 收藏此文 告别零散又低效地搜索经常使用的 SQL 语句 所有
  • STM32程序卡死HardFault_Handler

    在工作过程中移植部分功能程序后发现程序经常性莫名卡死 然后就一直在HardFault Handler中断卡死 解决如下 1 首先去网上查询了出现HardFault Handler是由于什么原因造成 1 堆栈溢出 这个可能性不大 2 数组越界
  • Scrapy+bs4爬取京东商品对应的评论信息

    Scrapy bs4爬取京东商品对应的评论信息 spiders comm py coding utf 8 import json import jsonpath import scrapy from bs4 import Beautiful
  • tomcat端口介绍以及配置启用https

    一 tomcat 默认端口
  • 步进电动机 - 特征篇(一)

    第1章 步进电动机特征篇 1 1 步进电动机特征 步进电动机是如同时钟的秒针一般 每次旋转一定角度的电动机 首先 介绍一下步进电动机的特征 链接 https www orientalmotor com cn web seminar stki
  • 添加区块到区块链当中003

    package main import crypto sha256 fmt 0 定义结构 创建前哈希值 创建当前哈希值 和数据 type Block struct Prevhash byte 前哈希 Hash byte 当前哈希 TODO
  • 【三维重建】【深度学习】NeRF_Pytorch代码--预备基础知识

    三维重建 深度学习 NeRF Pytorch代码 预备基础知识 给定一个场景的多视角的图像 神经辐射场 NeRF 通过图像重建误差优化一个神经场景表征 优化后可以实现逼真的新视角合成效果 NeRF最先是应用在新视点合成方向 由于其超强的隐式
  • 面试/笔试第三弹 —— 数据库面试问题集锦

    写在前面 找工作告一段落 期间经历了很多事情 也思考了许多问题 最后也收获了一些沉甸甸的东西 成长和一些来自阿里 百度 京东 sp 华为等厂的Offer 好在一切又回到正轨 接下来要好好总结一番才不枉这段经历 遂将此过程中笔者的一些笔试 面
  • 【JAVASCRIPT】javascript随机生成颜色8种方法

    实现1 JavaScript代码 var getRandomColor function return function color return color 0123456789abcdef Math floor Math random
  • FFMPEG常用命令

    FFmpeg编码和支持 FFmpeg源代码中包含的编码格式很多 常见不常见的都可以在编译皮质列表中见到 可以通过的编译配置命令 configure list encoders 常见的编码器的格式有 AAC AC3 H 264 H 265 M