首页 > 其他分享 >ffmpeg Detailed description

ffmpeg Detailed description

时间:2024-11-10 10:42:21浏览次数:1  
标签:Detailed ffmpeg stream frames filtergraph input elementary output description

ffmpeg builds a transcoding pipeline out of the components listed below. The program’s operation then consists of input data chunks flowing from the sources down the pipes towards the sinks, while being transformed by the components they encounter along the way.

The following kinds of components are available:

  • Demuxers (short for "demultiplexers") read an input source in order to extract
    • global properties such as metadata or chapters;
    • list of input elementary streams and their properties

    One demuxer instance is created for each -i option, and sends encoded packets to decoders or muxers.

    In other literature, demuxers are sometimes called splitters, because their main function is splitting a file into elementary streams (though some files only contain one elementary stream).

    A schematic representation of a demuxer looks like this:

    ┌──────────┬───────────────────────┐
    │ demuxer  │                       │ packets for stream 0
    ╞══════════╡ elementary stream 0   ├──────────────────────⮞
    │          │                       │
    │  global  ├───────────────────────┤
    │properties│                       │ packets for stream 1
    │   and    │ elementary stream 1   ├──────────────────────⮞
    │ metadata │                       │
    │          ├───────────────────────┤
    │          │                       │
    │          │     ...........       │
    │          │                       │
    │          ├───────────────────────┤
    │          │                       │ packets for stream N
    │          │ elementary stream N   ├──────────────────────⮞
    │          │                       │
    └──────────┴───────────────────────┘
         ⯅
         │
         │ read from file, network stream,
         │     grabbing device, etc.
         │
    
  • Decoders receive encoded (compressed) packets for an audio, video, or subtitle elementary stream, and decode them into raw frames (arrays of pixels for video, PCM for audio). A decoder is typically associated with (and receives its input from) an elementary stream in a demuxer, but sometimes may also exist on its own (see Loopback decoders).

    A schematic representation of a decoder looks like this:

              ┌─────────┐
     packets  │         │ raw frames
    ─────────⮞│ decoder ├────────────⮞
              │         │
              └─────────┘
    
  • Filtergraphs process and transform raw audio or video frames. A filtergraph consists of one or more individual filters linked into a graph. Filtergraphs come in two flavors - simple and complex, configured with the -filter and -filter_complex options, respectively.

    A simple filtergraph is associated with an output elementary stream; it receives the input to be filtered from a decoder and sends filtered output to that output stream’s encoder.

    A simple video filtergraph that performs deinterlacing (using the yadif deinterlacer) followed by resizing (using the scale filter) can look like this:

                 ┌────────────────────────┐
                 │  simple filtergraph    │
     frames from ╞════════════════════════╡ frames for
     a decoder   │  ┌───────┐  ┌───────┐  │ an encoder
    ────────────⮞├─⮞│ yadif ├─⮞│ scale ├─⮞│────────────⮞
                 │  └───────┘  └───────┘  │
                 └────────────────────────┘
    

    A complex filtergraph is standalone and not associated with any specific stream. It may have multiple (or zero) inputs, potentially of different types (audio or video), each of which receiving data either from a decoder or another complex filtergraph’s output. It also has one or more outputs that feed either an encoder or another complex filtergraph’s input.

    The following example diagram represents a complex filtergraph with 3 inputs and 2 outputs (all video):

              ┌─────────────────────────────────────────────────┐
              │               complex filtergraph               │
              ╞═════════════════════════════════════════════════╡
     frames   ├───────┐  ┌─────────┐      ┌─────────┐  ┌────────┤ frames
    ─────────⮞│input 0├─⮞│ overlay ├─────⮞│ overlay ├─⮞│output 0├────────⮞
              ├───────┘  │         │      │         │  └────────┤
     frames   ├───────┐╭⮞│         │    ╭⮞│         │           │
    ─────────⮞│input 1├╯ └─────────┘    │ └─────────┘           │
              ├───────┘                 │                       │
     frames   ├───────┐ ┌─────┐ ┌─────┬─╯              ┌────────┤ frames
    ─────────⮞│input 2├⮞│scale├⮞│split├───────────────⮞│output 1├────────⮞
              ├───────┘ └─────┘ └─────┘                └────────┤
              └─────────────────────────────────────────────────┘
    

    Frames from second input are overlaid over those from the first. Frames from the third input are rescaled, then the duplicated into two identical streams. One of them is overlaid over the combined first two inputs, with the result exposed as the filtergraph’s first output. The other duplicate ends up being the filtergraph’s second output.

  • Encoders receive raw audio, video, or subtitle frames and encode them into encoded packets. The encoding (compression) process is typically lossy - it degrades stream quality to make the output smaller; some encoders are lossless, but at the cost of much higher output size. A video or audio encoder receives its input from some filtergraph’s output, subtitle encoders receive input from a decoder (since subtitle filtering is not supported yet). Every encoder is associated with some muxer’s output elementary stream and sends its output to that muxer.

    A schematic representation of an encoder looks like this:

                 ┌─────────┐
     raw frames  │         │ packets
    ────────────⮞│ encoder ├─────────⮞
                 │         │
                 └─────────┘
    
  • Muxers (short for "multiplexers") receive encoded packets for their elementary streams from encoders (the transcoding path) or directly from demuxers (the streamcopy path), interleave them (when there is more than one elementary stream), and write the resulting bytes into the output file (or pipe, network stream, etc.).

    A schematic representation of a muxer looks like this:

                           ┌──────────────────────┬───────────┐
     packets for stream 0  │                      │   muxer   │
    ──────────────────────⮞│  elementary stream 0 ╞═══════════╡
                           │                      │           │
                           ├──────────────────────┤  global   │
     packets for stream 1  │                      │properties │
    ──────────────────────⮞│  elementary stream 1 │   and     │
                           │                      │ metadata  │
                           ├──────────────────────┤           │
                           │                      │           │
                           │     ...........      │           │
                           │                      │           │
                           ├──────────────────────┤           │
     packets for stream N  │                      │           │
    ──────────────────────⮞│  elementary stream N │           │
                           │                      │           │
                           └──────────────────────┴─────┬─────┘
                                                        │
                         write to file, network stream, │
                             grabbing device, etc.      │
                                                        │
                                                        ▼

 

https://www.octfgroup.com/

标签:Detailed,ffmpeg,stream,frames,filtergraph,input,elementary,output,description
From: https://www.cnblogs.com/sathcal/p/18537702

相关文章

  • ffmpeg Streamcopy
    Thesimplestpipelinein ffmpeg issingle-stream streamcopy,thatiscopyingone inputelementarystream’spacketswithoutdecoding,filtering,orencodingthem.Asanexample,consideraninputfilecalled INPUT.mkv with3elementarystreams,fromwhi......
  • ffmpeg Trancoding
    Transcoding istheprocessofdecodingastreamandthenencodingitagain.Sinceencodingtendstobecomputationallyexpensiveandinmostcasesdegradesthestreamquality(i.e.itis lossy),youshouldonlytranscodewhenyouneedtoandperformstrea......
  • FFmpeg Filtering
    Whentranscoding,audioandvideostreamscanbefilteredbeforeencoding,witheitherasimpleorcomplexfiltergraph.3.3.1SimplefiltergraphsSimplefiltergraphsarethosethathaveexactlyoneinputandoutput,bothofthesametype(audioorvideo).......
  • FFmpeg Stream selection
    ffmpegprovidesthe-mapoptionformanualcontrolofstreamselectionineachoutputfile.Userscanskip-mapandletffmpegperformautomaticstreamselectionasdescribedbelow.The-vn/-an/-sn/-dnoptionscanbeusedtoskipinclusionofvideo,......
  • ffmpeg Synopsis
    1Synopsisffmpeg[global_options]{[input_file_options]-iinput_url}...{[output_file_options]output_url}...2Descriptionffmpegisauniversalmediaconverter.Itcanreadawidevarietyofinputs-includinglivegrabbing/recordingdevices-filter,......
  • About FFmpeg
    FFmpegistheleadingmultimediaframework,abletodecode,encode,transcode,mux,demux,stream,filterandplayprettymuchanythingthathumansandmachineshavecreated.Itsupportsthemostobscureancientformatsuptothecuttingedge.Nomatteri......
  • FFmpeg Libraries for developers
    libavutilisalibrarycontainingfunctionsforsimplifyingprogramming,includingrandomnumbergenerators,datastructures,mathematicsroutines,coremultimediautilities,andmuchmore.libavcodecisalibrarycontainingdecodersandencodersforaudio......
  • php使用ffmpeg实现向视频中添加文字字幕的方法
    这篇文章主要介绍了PHP使用ffmpeg给视频增加字幕显示的方法,实例分析了php操作ffmpeg给视频增加字母的技巧,具有一定参考借鉴价值,需要的朋友可以参考下。具体如下:$dir='./';if($handle=opendir($dir)){while(false!==($file=readdir($handle))){if(is_file($dir.$......
  • PHP中的FFmpeg安装及使用
    FFmpeg简介FFmpeg是视频处理最常用的开源软件。它功能强大,用途广泛,大量用于视频网站和商业软件(比如Youtube和iTunes),也是许多音频和视频格式的标准编码/解码实现。关于FFMPEG视音频编解码的知识可以参考大神雷霄骅的系列教程https://blog.csdn.net/leixiaohua1020/article/detai......
  • FFmpeg 简单介绍及使用
    1.简介FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。采用LGPL或GPL许可证。它提供了录制、转换以及流化音视频的完整解决方案。它包含了非常先进的音频/视频编解码库libavcodec,为了保证高可移植性和编解码质量,libavcodec里很多code都是从头开......