首页 > 其他分享 >FFmpeg Filtering Introduction

FFmpeg Filtering Introduction

时间:2024-11-11 09:22:37浏览次数:1  
标签:Filtering FFmpeg Introduction crop filter split input output main

Filtering in FFmpeg is enabled through the libavfilter library.

In libavfilter, a filter can have multiple inputs and multiple outputs. To illustrate the sorts of things that are possible, we consider the following filtergraph.

[main]
input --> split ---------------------> overlay --> output
| ^
|[tmp] [flip]|
+-----> crop --> vflip -------+
This filtergraph splits the input stream in two streams, then sends one stream through the crop filter and the vflip filter, before merging it back with the other stream by overlaying it on top. You can use the following command to achieve this:

ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
The result will be that the top half of the video is mirrored onto the bottom half of the output video.

Filters in the same linear chain are separated by commas, and distinct linear chains of filters are separated by semicolons. In our example, crop,vflip are in one linear chain, split and overlay are separately in another. The points where the linear chains join are labelled by names enclosed in square brackets. In the example, the split filter generates two outputs that are associated to the labels [main] and [tmp].

The stream sent to the second output of split, labelled as [tmp], is processed through the crop filter, which crops away the lower half part of the video, and then vertically flipped. The overlay filter takes in input the first unchanged output of the split filter (which was labelled as [main]), and overlay on its lower half the output generated by the crop,vflip filterchain.

Some filters take in input a list of parameters: they are specified after the filter name and an equal sign, and are separated from each other by a colon.

There exist so-called source filters that do not have an audio/video input, and sink filters that will not have audio/video output.

https://www.octfgroup.com/

标签:Filtering,FFmpeg,Introduction,crop,filter,split,input,output,main
From: https://www.cnblogs.com/sathcal/p/18539062

相关文章

  • ffmpeg graph2dot
    Thegraph2dotprogramincludedintheFFmpegtoolsdirectorycanbeusedtoparseafiltergraphdescriptionandissueacorrespondingtextualrepresentationinthedotlanguage.Invokethecommand:graph2dot-htoseehowtousegraph2dot.Youcanthenpas......
  • ffmpeg Filtergraph description
    Afiltergraphisadirectedgraphofconnectedfilters.Itcancontaincycles,andtherecanbemultiplelinksbetweenapairoffilters.Eachlinkhasoneinputpadononesideconnectingittoonefilterfromwhichittakesitsinput,andoneoutputpad......
  • ffmpeg Timeline editing
    Somefilterssupportagenericenableoption.Forthefilterssupportingtimelineediting,thisoptioncanbesettoanexpressionwhichisevaluatedbeforesendingaframetothefilter.Iftheevaluationisnon-zero,thefilterwillbeenabled,otherwis......
  • ffmpeg Library public interfaces
    EverylibraryinFFmpegprovidesasetofpublicAPIsinitsinstalledheaders,whicharethoselistedinthevariableHEADERSinthatlibrary’sMakefile.Allidentifiersdefinedinthoseheaders(exceptforthoseexplicitlydocumentedotherwise),andcor......
  • ffmpeg Adding new interfaces
    nynewpublicidentifiersininstalledheadersareconsiderednewAPI-thisincludesnewfunctions,structs,macros,enumvalues,typedefs,newfieldsinexistingstructs,newinstalledheaders,etc.ConsiderthefollowingguidelineswhenaddingnewAPIs......
  • ffmpeg Removing interfaces
    Duetoabovementionedcompatibilityguarantees,removingAPIsisaninvolvedprocessthatshouldonlybeundertakenwithgoodreason.Typicallyadeficient,restrictive,orotherwiseinadequateAPIisreplacedbyasuperiorone,thoughitdoesattimesha......
  • ffmpeg Vim configuration
    InordertoconfigureVimtofollowFFmpegformattingconventions,pastethefollowingsnippetintoyour.vimrc:"indentationrulesforFFmpeg:4spaces,notabssetexpandtabsetshiftwidth=4setsofttabstop=4setcindentsetcinoptions=(0"Allowt......
  • ffmpeg Comments
    UsetheJavaDoc/Doxygenformat(seeexamplesbelow)sothatcodedocumentationcanbegeneratedautomatically.Allnontrivialfunctionsshouldhaveacommentabovethemexplainingwhatthefunctiondoes,evenifitisjustonesentence.Allstructuresand......
  • ffmpeg Naming conventions
    Namesoffunctions,variables,andstructmembersmustbelowercase,usingunderscores(_)toseparatewords.Forexample,‘avfilter_get_video_buffer’isanacceptablefunctionnameand‘AVFilterGetVideo’isnot.Struct,union,enum,andtypedeffedtypen......
  • ffmpeg Code behaviour
    CorrectnessThecodemustbevalid.Itmustnotcrash,abort,accessinvalidpointers,leakmemory,causedataracesorsignedintegeroverflow,orotherwisecauseundefinedbehaviour.Errorcodesshouldbecheckedand,whenapplicable,forwardedtotheca......