ffmpeg: 一款跨平台开源媒体格式转换器
ffmpeg是非常干练简洁的媒体格式转换器,支持的格式非常广泛,几乎所有媒体格式之间的剪裁、提取、合并、转化都可以使用这一个工具来完成。
支持的媒体格式
ffmpeg -formats
ffmpeg version N-81989-g7845c13 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 32.100 / 55. 32.100
libavcodec 57. 61.103 / 57. 61.103
libavformat 57. 52.100 / 57. 52.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 64.100 / 6. 64.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 2.100 / 2. 2.100
libpostproc 54. 0.100 / 54. 0.100
File formats:
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
D aea MD STUDIO audio
D afc AFC
DE aiff Audio IFF
D aix CRI AIX
DE alaw PCM A-law
D alias_pix Alias/Wavefront PIX image
DE amr 3GPP AMR
D anm Deluxe Paint Animation
D apc CRYO APC
D ape Monkey's Audio
DE apng Animated Portable Network Graphics
D aqtitle AQTitle subtitles
DE asf ASF (Advanced / Active Streaming Format)
D asf_o ASF (Advanced / Active Streaming Format)
E asf_stream ASF (Advanced / Active Streaming Format)
DE ass SSA (SubStation Alpha) subtitle
DE ast AST (Audio Stream)
DE au Sun AU
DE avi AVI (Audio Video Interleaved)
D avisynth AviSynth script
E avm2 SWF (ShockWave Flash) (AVM2)
D avr AVR (Audio Visual Research)
D avs AVS
D bethsoftvid Bethesda Softworks VID
D bfi Brute Force & Ignorance
D bfstm BFSTM (Binary Cafe Stream)
D bin Binary text
D bink Bink
DE bit G.729 BIT file format
D bmp_pipe piped bmp sequence
D bmv Discworld II BMV
D boa Black Ops Audio
D brender_pix BRender PIX image
D brstm BRSTM (Binary Revolution Stream)
D c93 Interplay C93
E caca caca (color ASCII art) output device
DE caf Apple CAF (Core Audio Format)
DE cavsvideo raw Chinese AVS (Audio Video Standard) video
D cdg CD Graphics
D cdxl Commodore CDXL video
D cine Phantom Cine
D concat Virtual concatenation script
E crc CRC testing
E dash DASH Muxer
DE data raw data
DE daud D-Cinema audio
D dcstr Sega DC STR
D dds_pipe piped dds sequence
DE decklink Blackmagic DeckLink output
D dfa Chronomaster DFA
DE dirac raw Dirac
DE dnxhd raw DNxHD (SMPTE VC-3)
D dpx_pipe piped dpx sequence
D dsf DSD Stream File (DSF)
D dshow DirectShow capture
D dsicin Delphine Software International CIN
D dss Digital Speech Standard (DSS)
DE dts raw DTS
D dtshd raw DTS-HD
DE dv DV (Digital Video)
D dvbsub raw dvbsub
D dvbtxt dvbtxt
E dvd MPEG-2 PS (DVD VOB)
D dxa DXA
D ea Electronic Arts Multimedia
D ea_cdata Electronic Arts cdata
DE eac3 raw E-AC-3
D epaf Ensoniq Paris Audio File
D exr_pipe piped exr sequence
DE f32be PCM 32-bit floating-point big-endian
DE f32le PCM 32-bit floating-point little-endian
E f4v F4V Adobe Flash Video
DE f64be PCM 64-bit floating-point big-endian
DE f64le PCM 64-bit floating-point little-endian
DE ffm FFM (FFserver live feed)
DE ffmetadata FFmpeg metadata in text
E fifo FIFO queue pseudo-muxer
D film_cpk Sega FILM / CPK
DE filmstrip Adobe Filmstrip
DE flac raw FLAC
D flic FLI/FLC/FLX animation
DE flv FLV (Flash Video)
E framecrc framecrc testing
E framehash Per-frame hash testing
E framemd5 Per-frame MD5 testing
D frm Megalux Frame
D fsb FMOD Sample Bank
DE g722 raw G.722
DE g723_1 raw G.723.1
D g729 G.729 raw format demuxer
D gdigrab GDI API Windows frame grabber
D genh GENeric Header
DE gif GIF Animation
DE gsm raw GSM
DE gxf GXF (General eXchange Format)
DE h261 raw H.261
DE h263 raw H.263
DE h264 raw H.264 video
E hash Hash testing
E hds HDS Muxer
DE hevc raw HEVC video
E hls Apple HTTP Live Streaming
D hls,applehttp Apple HTTP Live Streaming
D hnm Cryo HNM v4
DE ico Microsoft Windows ICO
D idcin id Cinematic
D idf iCE Draw File
D iff IFF (Interchange File Format)
DE ilbc iLBC storage
DE image2 image2 sequence
DE image2pipe piped image2 sequence
D ingenient raw Ingenient MJPEG
D ipmovie Interplay MVE
E ipod iPod H.264 MP4 (MPEG-4 Part 14)
DE ircam Berkeley/IRCAM/CARL Sound Format
E ismv ISMV/ISMA (Smooth Streaming)
D iss Funcom ISS
D iv8 IndigoVision 8000 video
DE ivf On2 IVF
D ivr IVR (Internet Video Recording)
D j2k_pipe piped j2k sequence
DE jacosub JACOsub subtitle format
D jpeg_pipe piped jpeg sequence
D jpegls_pipe piped jpegls sequence
D jv Bitmap Brothers JV
E latm LOAS/LATM
D lavfi Libavfilter virtual input device
D libgme Game Music Emu demuxer
D libmodplug ModPlug demuxer
D live_flv live RTMP FLV (Flash Video)
D lmlm4 raw lmlm4
D loas LOAS AudioSyncStream
DE lrc LRC lyrics
D lvf LVF
D lxf VR native stream (LXF)
DE m4v raw MPEG-4 video
E matroska Matroska
D matroska,webm Matroska / WebM
E md5 MD5 testing
D mgsts Metal Gear Solid: The Twin Snakes
DE microdvd MicroDVD subtitle format
DE mjpeg raw MJPEG video
E mkvtimestamp_v2 extract pts as timecode v2 format, as defined by mkvtoolnix
DE mlp raw MLP
D mlv Magic Lantern Video (MLV)
D mm American Laser Games MM
DE mmf Yamaha SMAF
E mov QuickTime / MOV
D mov,mp4,m4a,3gp,3g2,mj2 QuickTime / MOV
E mp2 MP2 (MPEG audio layer 2)
DE mp3 MP3 (MPEG audio layer 3)
E mp4 MP4 (MPEG-4 Part 14)
D mpc Musepack
D mpc8 Musepack SV8
DE mpeg MPEG-1 Systems / MPEG program stream
E mpeg1video raw MPEG-1 video
E mpeg2video raw MPEG-2 video
DE mpegts MPEG-TS (MPEG-2 Transport Stream)
D mpegtsraw raw MPEG-TS (MPEG-2 Transport Stream)
D mpegvideo raw MPEG video
DE mpjpeg MIME multipart JPEG
D mpl2 MPL2 subtitles
D mpsub MPlayer subtitles
D msf Sony PS3 MSF
D msnwctcp MSN TCP Webcam stream
D mtaf Konami PS2 MTAF
D mtv MTV
DE mulaw PCM mu-law
D musx Eurocom MUSX
D mv Silicon Graphics Movie
D mvi Motion Pixels MVI
DE mxf MXF (Material eXchange Format)
E mxf_d10 MXF (Material eXchange Format) D-10 Mapping
E mxf_opatom MXF (Material eXchange Format) Operational Pattern Atom
D mxg MxPEG clip
D nc NC camera feed
D nistsphere NIST SPeech HEader REsources
D nsv Nullsoft Streaming Video
E null raw null video
DE nut NUT
D nuv NuppelVideo
E oga Ogg Audio
DE ogg Ogg
E ogv Ogg Video
DE oma Sony OpenMG audio
E opus Ogg Opus
D paf Amazing Studio Packed Animation File
D pam_pipe piped pam sequence
D pbm_pipe piped pbm sequence
D pcx_pipe piped pcx sequence
D pgm_pipe piped pgm sequence
D pgmyuv_pipe piped pgmyuv sequence
D pictor_pipe piped pictor sequence
D pjs PJS (Phoenix Japanimation Society) subtitles
D pmp Playstation Portable PMP
D png_pipe piped png sequence
D ppm_pipe piped ppm sequence
E psp PSP MP4 (MPEG-4 Part 14)
D psxstr Sony Playstation STR
D pva TechnoTrend PVA
D pvf PVF (Portable Voice Format)
D qcp QCP
D qdraw_pipe piped qdraw sequence
D r3d REDCODE R3D
DE rawvideo raw video
D realtext RealText subtitle format
D redspark RedSpark
D rl2 RL2
DE rm RealMedia
DE roq raw id RoQ
D rpl RPL / ARMovie
D rsd GameCube RSD
DE rso Lego Mindstorms RSO
DE rtp RTP output
E rtp_mpegts RTP/mpegts output format
DE rtsp RTSP output
DE s16be PCM signed 16-bit big-endian
DE s16le PCM signed 16-bit little-endian
DE s24be PCM signed 24-bit big-endian
DE s24le PCM signed 24-bit little-endian
DE s32be PCM signed 32-bit big-endian
DE s32le PCM signed 32-bit little-endian
DE s8 PCM signed 8-bit
D sami SAMI subtitle format
DE sap SAP output
D sbg SBaGen binaural beats script
E sdl,sdl2 SDL2 output device
D sdp SDP
D sdr2 SDR2
E segment segment
D sgi_pipe piped sgi sequence
D shn raw Shorten
D siff Beam Software SIFF
E singlejpeg JPEG single image
D sln Asterisk raw pcm
DE smjpeg Loki SDL MJPEG
D smk Smacker
E smoothstreaming Smooth Streaming Muxer
D smush LucasArts Smush
D sol Sierra SOL
DE sox SoX native
DE spdif IEC 61937 (used on S/PDIF - IEC958)
E spx Ogg Speex
DE srt SubRip subtitle
D stl Spruce subtitle format
E stream_segment,ssegment streaming segment muxer
D subviewer SubViewer subtitle format
D subviewer1 SubViewer v1 subtitle format
D sunrast_pipe piped sunrast sequence
D sup raw HDMV Presentation Graphic Stream subtitles
D svag Konami PS2 SVAG
E svcd MPEG-2 PS (SVCD)
DE swf SWF (ShockWave Flash)
D tak raw TAK
D tedcaptions TED Talks captions
E tee Multiple muxer tee
D thp THP
D tiertexseq Tiertex Limited SEQ
D tiff_pipe piped tiff sequence
D tmv 8088flex TMV
DE truehd raw TrueHD
DE tta TTA (True Audio)
D tty Tele-typewriter
D txd Renderware TeXture Dictionary
DE u16be PCM unsigned 16-bit big-endian
DE u16le PCM unsigned 16-bit little-endian
DE u24be PCM unsigned 24-bit big-endian
DE u24le PCM unsigned 24-bit little-endian
DE u32be PCM unsigned 32-bit big-endian
DE u32le PCM unsigned 32-bit little-endian
DE u8 PCM unsigned 8-bit
E uncodedframecrc uncoded framecrc testing
D v210 Uncompressed 4:2:2 10-bit
D v210x Uncompressed 4:2:2 10-bit
D vag Sony PS2 VAG
DE vc1 raw VC-1 video
DE vc1test VC-1 test bitstream
E vcd MPEG-1 Systems / MPEG program stream (VCD)
D vfwcap VfW video capture
D vivo Vivo
D vmd Sierra VMD
E vob MPEG-2 PS (VOB)
D vobsub VobSub subtitle format
DE voc Creative Voice
D vpk Sony PS2 VPK
D vplayer VPlayer subtitles
D vqf Nippon Telegraph and Telephone Corporation (NTT) TwinVQ
DE w64 Sony Wave64
DE wav WAV / WAVE (Waveform Audio)
D wc3movie Wing Commander III movie
E webm WebM
E webm_chunk WebM Chunk Muxer
DE webm_dash_manifest WebM DASH Manifest
E webp WebP
D webp_pipe piped webp sequence
DE webvtt WebVTT subtitle
D wsaud Westwood Studios audio
D wsd Wideband Single-bit Data (WSD)
D wsvqa Westwood Studios VQA
DE wtv Windows Television (WTV)
DE wv raw WavPack
D wve Psion 3 audio
D xa Maxis XA
D xbin eXtended BINary text (XBIN)
D xmv Microsoft XMV
D xvag Sony PS3 XVAG
D xwma Microsoft xWMA
D yop Psygnosis YOP
DE yuv4mpegpipe YUV4MPEG pipe
常用格式转换
ffmpeg [input_options] -i in_file [output_options] out_file
例如:
ffmpeg -i a.flv b.mp4
输出信息:
ffmpeg version N-81989-g7845c13 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 32.100 / 55. 32.100
libavcodec 57. 61.103 / 57. 61.103
libavformat 57. 52.100 / 57. 52.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 64.100 / 6. 64.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 2.100 / 2. 2.100
libpostproc 54. 0.100 / 54. 0.100
[flv @ 001e7a00] video stream discovered after head already parsed
[flv @ 001e7a00] audio stream discovered after head already parsed
Input #0, flv, from 'a.flv':
Metadata:
metadatacreator : Yet Another Metadata Injector for FLV - Version 1.8
hasKeyframes : true
hasVideo : true
hasAudio : true
hasMetadata : true
canSeekToEnd : true
datasize : 13175907
videosize : 11565985
audiosize : 1574242
lasttimestamp : 116
lastkeyframetimestamp: 116
lastkeyframelocation: 13176734
Duration: 00:01:55.95, start: 0.067000, bitrate: 909 kb/s
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709/unknown/unknown), 1280x720, 29.97 fps, 29.97 tbr, 1k tbn, 60k tbc
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
[libx264 @ 05c392e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA4 FMA3 LZCNT BMI1
[libx264 @ 05c392e0] profile High, level 3.1
[libx264 @ 05c392e0] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'b.mp4':
Metadata:
metadatacreator : Yet Another Metadata Injector for FLV - Version 1.8
hasKeyframes : true
hasVideo : true
hasAudio : true
hasMetadata : true
canSeekToEnd : true
datasize : 13175907
videosize : 11565985
audiosize : 1574242
lasttimestamp : 116
lastkeyframetimestamp: 116
lastkeyframelocation: 13176734
encoder : Lavf57.52.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
Metadata:
encoder : Lavc57.61.103 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.61.103 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 3476 fps=8.3 q=-1.0 Lsize= 17339kB time=00:01:56.07 bitrate=1223.7kbits/s speed=0.277x
video:15341kB audio:1880kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.682512%
[libx264 @ 05c392e0] frame I:46 Avg QP:16.65 size: 11708
[libx264 @ 05c392e0] frame P:1880 Avg QP:23.16 size: 6445
[libx264 @ 05c392e0] frame B:1550 Avg QP:24.63 size: 1970
[libx264 @ 05c392e0] consecutive B-frames: 32.5% 19.2% 14.9% 33.4%
[libx264 @ 05c392e0] mb I I16..4: 26.7% 69.7% 3.6%
[libx264 @ 05c392e0] mb P I16..4: 4.3% 11.3% 0.8% P16..4: 17.8% 3.8% 1.4% 0.0% 0.0% skip:60.8%
[libx264 @ 05c392e0] mb B I16..4: 0.4% 0.7% 0.1% B16..8: 16.3% 2.0% 0.2% direct: 1.0% skip:79.3% L0:45.3% L1:48.3% BI: 6.4%
[libx264 @ 05c392e0] 8x8 transform intra:68.5% inter:73.0%
[libx264 @ 05c392e0] coded y,uvDC,uvAC intra: 19.3% 38.0% 8.7% inter: 3.9% 6.7% 1.0%
[libx264 @ 05c392e0] i16 v,h,dc,p: 35% 23% 10% 32%
[libx264 @ 05c392e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 15% 41% 2% 2% 3% 2% 2% 2%
[libx264 @ 05c392e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 16% 29% 5% 6% 6% 4% 4% 3%
[libx264 @ 05c392e0] i8c dc,h,v,p: 55% 19% 20% 6%
[libx264 @ 05c392e0] Weighted P-Frames: Y:9.2% UV:5.9%
[libx264 @ 05c392e0] ref P L0: 74.4% 11.3% 10.3% 3.7% 0.3%
[libx264 @ 05c392e0] ref B L0: 88.8% 9.8% 1.4%
[libx264 @ 05c392e0] ref B L1: 98.3% 1.7%
[libx264 @ 05c392e0] kb/s:1083.54
[aac @ 05a90060] Qavg: 789.592