filters.texi 305 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @example
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end example
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is
  93. recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
  94. options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
  95. @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} functions defined in
  96. @file{libavfilter/avfilter.h}.
  97. A filterchain consists of a sequence of connected filters, each one
  98. connected to the previous one in the sequence. A filterchain is
  99. represented by a list of ","-separated filter descriptions.
  100. A filtergraph consists of a sequence of filterchains. A sequence of
  101. filterchains is represented by a list of ";"-separated filterchain
  102. descriptions.
  103. A filter is represented by a string of the form:
  104. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  105. @var{filter_name} is the name of the filter class of which the
  106. described filter is an instance of, and has to be the name of one of
  107. the filter classes registered in the program.
  108. The name of the filter class is optionally followed by a string
  109. "=@var{arguments}".
  110. @var{arguments} is a string which contains the parameters used to
  111. initialize the filter instance. It may have one of two forms:
  112. @itemize
  113. @item
  114. A ':'-separated list of @var{key=value} pairs.
  115. @item
  116. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  117. the option names in the order they are declared. E.g. the @code{fade} filter
  118. declares three options in this order -- @option{type}, @option{start_frame} and
  119. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  120. @var{in} is assigned to the option @option{type}, @var{0} to
  121. @option{start_frame} and @var{30} to @option{nb_frames}.
  122. @item
  123. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  124. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  125. follow the same constraints order of the previous point. The following
  126. @var{key=value} pairs can be set in any preferred order.
  127. @end itemize
  128. If the option value itself is a list of items (e.g. the @code{format} filter
  129. takes a list of pixel formats), the items in the list are usually separated by
  130. '|'.
  131. The list of arguments can be quoted using the character "'" as initial
  132. and ending mark, and the character '\' for escaping the characters
  133. within the quoted text; otherwise the argument string is considered
  134. terminated when the next special character (belonging to the set
  135. "[]=;,") is encountered.
  136. The name and arguments of the filter are optionally preceded and
  137. followed by a list of link labels.
  138. A link label allows one to name a link and associate it to a filter output
  139. or input pad. The preceding labels @var{in_link_1}
  140. ... @var{in_link_N}, are associated to the filter input pads,
  141. the following labels @var{out_link_1} ... @var{out_link_M}, are
  142. associated to the output pads.
  143. When two link labels with the same name are found in the
  144. filtergraph, a link between the corresponding input and output pad is
  145. created.
  146. If an output pad is not labelled, it is linked by default to the first
  147. unlabelled input pad of the next filter in the filterchain.
  148. For example in the filterchain
  149. @example
  150. nullsrc, split[L1], [L2]overlay, nullsink
  151. @end example
  152. the split filter instance has two output pads, and the overlay filter
  153. instance two input pads. The first output pad of split is labelled
  154. "L1", the first input pad of overlay is labelled "L2", and the second
  155. output pad of split is linked to the second input pad of overlay,
  156. which are both unlabelled.
  157. In a complete filterchain all the unlabelled filter input and output
  158. pads must be connected. A filtergraph is considered valid if all the
  159. filter input and output pads of all the filterchains are connected.
  160. Libavfilter will automatically insert @ref{scale} filters where format
  161. conversion is required. It is possible to specify swscale flags
  162. for those automatically inserted scalers by prepending
  163. @code{sws_flags=@var{flags};}
  164. to the filtergraph description.
  165. Here is a BNF description of the filtergraph syntax:
  166. @example
  167. @var{NAME} ::= sequence of alphanumeric characters and '_'
  168. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  169. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  170. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  171. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  172. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  173. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  174. @end example
  175. @section Notes on filtergraph escaping
  176. Filtergraph description composition entails several levels of
  177. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  178. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  179. information about the employed escaping procedure.
  180. A first level escaping affects the content of each filter option
  181. value, which may contain the special character @code{:} used to
  182. separate values, or one of the escaping characters @code{\'}.
  183. A second level escaping affects the whole filter description, which
  184. may contain the escaping characters @code{\'} or the special
  185. characters @code{[],;} used by the filtergraph description.
  186. Finally, when you specify a filtergraph on a shell commandline, you
  187. need to perform a third level escaping for the shell special
  188. characters contained within it.
  189. For example, consider the following string to be embedded in
  190. the @ref{drawtext} filter description @option{text} value:
  191. @example
  192. this is a 'string': may contain one, or more, special characters
  193. @end example
  194. This string contains the @code{'} special escaping character, and the
  195. @code{:} special character, so it needs to be escaped in this way:
  196. @example
  197. text=this is a \'string\'\: may contain one, or more, special characters
  198. @end example
  199. A second level of escaping is required when embedding the filter
  200. description in a filtergraph description, in order to escape all the
  201. filtergraph special characters. Thus the example above becomes:
  202. @example
  203. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  204. @end example
  205. (note that in addition to the @code{\'} escaping special characters,
  206. also @code{,} needs to be escaped).
  207. Finally an additional level of escaping is needed when writing the
  208. filtergraph description in a shell command, which depends on the
  209. escaping rules of the adopted shell. For example, assuming that
  210. @code{\} is special and needs to be escaped with another @code{\}, the
  211. previous string will finally result in:
  212. @example
  213. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  214. @end example
  215. @chapter Timeline editing
  216. Some filters support a generic @option{enable} option. For the filters
  217. supporting timeline editing, this option can be set to an expression which is
  218. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  219. the filter will be enabled, otherwise the frame will be sent unchanged to the
  220. next filter in the filtergraph.
  221. The expression accepts the following values:
  222. @table @samp
  223. @item t
  224. timestamp expressed in seconds, NAN if the input timestamp is unknown
  225. @item n
  226. sequential number of the input frame, starting from 0
  227. @item pos
  228. the position in the file of the input frame, NAN if unknown
  229. @end table
  230. Additionally, these filters support an @option{enable} command that can be used
  231. to re-define the expression.
  232. Like any other filtering option, the @option{enable} option follows the same
  233. rules.
  234. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  235. minutes, and a @ref{curves} filter starting at 3 seconds:
  236. @example
  237. smartblur = enable='between(t,10,3*60)',
  238. curves = enable='gte(t,3)' : preset=cross_process
  239. @end example
  240. @c man end FILTERGRAPH DESCRIPTION
  241. @chapter Audio Filters
  242. @c man begin AUDIO FILTERS
  243. When you configure your FFmpeg build, you can disable any of the
  244. existing filters using @code{--disable-filters}.
  245. The configure output will show the audio filters included in your
  246. build.
  247. Below is a description of the currently available audio filters.
  248. @section aconvert
  249. Convert the input audio format to the specified formats.
  250. @emph{This filter is deprecated. Use @ref{aformat} instead.}
  251. The filter accepts a string of the form:
  252. "@var{sample_format}:@var{channel_layout}".
  253. @var{sample_format} specifies the sample format, and can be a string or the
  254. corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
  255. suffix for a planar sample format.
  256. @var{channel_layout} specifies the channel layout, and can be a string
  257. or the corresponding number value defined in @file{libavutil/channel_layout.h}.
  258. The special parameter "auto", signifies that the filter will
  259. automatically select the output format depending on the output filter.
  260. @subsection Examples
  261. @itemize
  262. @item
  263. Convert input to float, planar, stereo:
  264. @example
  265. aconvert=fltp:stereo
  266. @end example
  267. @item
  268. Convert input to unsigned 8-bit, automatically select out channel layout:
  269. @example
  270. aconvert=u8:auto
  271. @end example
  272. @end itemize
  273. @section adelay
  274. Delay one or more audio channels.
  275. Samples in delayed channel are filled with silence.
  276. The filter accepts the following option:
  277. @table @option
  278. @item delays
  279. Set list of delays in milliseconds for each channel separated by '|'.
  280. At least one delay greater than 0 should be provided.
  281. Unused delays will be silently ignored. If number of given delays is
  282. smaller than number of channels all remaining channels will not be delayed.
  283. @end table
  284. @subsection Examples
  285. @itemize
  286. @item
  287. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  288. the second channel (and any other channels that may be present) unchanged.
  289. @example
  290. adelay=1500|0|500
  291. @end example
  292. @end itemize
  293. @section aecho
  294. Apply echoing to the input audio.
  295. Echoes are reflected sound and can occur naturally amongst mountains
  296. (and sometimes large buildings) when talking or shouting; digital echo
  297. effects emulate this behaviour and are often used to help fill out the
  298. sound of a single instrument or vocal. The time difference between the
  299. original signal and the reflection is the @code{delay}, and the
  300. loudness of the reflected signal is the @code{decay}.
  301. Multiple echoes can have different delays and decays.
  302. A description of the accepted parameters follows.
  303. @table @option
  304. @item in_gain
  305. Set input gain of reflected signal. Default is @code{0.6}.
  306. @item out_gain
  307. Set output gain of reflected signal. Default is @code{0.3}.
  308. @item delays
  309. Set list of time intervals in milliseconds between original signal and reflections
  310. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  311. Default is @code{1000}.
  312. @item decays
  313. Set list of loudnesses of reflected signals separated by '|'.
  314. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  315. Default is @code{0.5}.
  316. @end table
  317. @subsection Examples
  318. @itemize
  319. @item
  320. Make it sound as if there are twice as many instruments as are actually playing:
  321. @example
  322. aecho=0.8:0.88:60:0.4
  323. @end example
  324. @item
  325. If delay is very short, then it sound like a (metallic) robot playing music:
  326. @example
  327. aecho=0.8:0.88:6:0.4
  328. @end example
  329. @item
  330. A longer delay will sound like an open air concert in the mountains:
  331. @example
  332. aecho=0.8:0.9:1000:0.3
  333. @end example
  334. @item
  335. Same as above but with one more mountain:
  336. @example
  337. aecho=0.8:0.9:1000|1800:0.3|0.25
  338. @end example
  339. @end itemize
  340. @section aeval
  341. Modify an audio signal according to the specified expressions.
  342. This filter accepts one or more expressions (one for each channel),
  343. which are evaluated and used to modify a corresponding audio signal.
  344. It accepts the following parameters:
  345. @table @option
  346. @item exprs
  347. Set the '|'-separated expressions list for each separate channel. If
  348. the number of input channels is greater than the number of
  349. expressions, the last specified expression is used for the remaining
  350. output channels.
  351. @item channel_layout, c
  352. Set output channel layout. If not specified, the channel layout is
  353. specified by the number of expressions. If set to @samp{same}, it will
  354. use by default the same input channel layout.
  355. @end table
  356. Each expression in @var{exprs} can contain the following constants and functions:
  357. @table @option
  358. @item ch
  359. channel number of the current expression
  360. @item n
  361. number of the evaluated sample, starting from 0
  362. @item s
  363. sample rate
  364. @item t
  365. time of the evaluated sample expressed in seconds
  366. @item nb_in_channels
  367. @item nb_out_channels
  368. input and output number of channels
  369. @item val(CH)
  370. the value of input channel with number @var{CH}
  371. @end table
  372. Note: this filter is slow. For faster processing you should use a
  373. dedicated filter.
  374. @subsection Examples
  375. @itemize
  376. @item
  377. Half volume:
  378. @example
  379. aeval=val(ch)/2:c=same
  380. @end example
  381. @item
  382. Invert phase of the second channel:
  383. @example
  384. aeval=val(0)|-val(1)
  385. @end example
  386. @end itemize
  387. @section afade
  388. Apply fade-in/out effect to input audio.
  389. A description of the accepted parameters follows.
  390. @table @option
  391. @item type, t
  392. Specify the effect type, can be either @code{in} for fade-in, or
  393. @code{out} for a fade-out effect. Default is @code{in}.
  394. @item start_sample, ss
  395. Specify the number of the start sample for starting to apply the fade
  396. effect. Default is 0.
  397. @item nb_samples, ns
  398. Specify the number of samples for which the fade effect has to last. At
  399. the end of the fade-in effect the output audio will have the same
  400. volume as the input audio, at the end of the fade-out transition
  401. the output audio will be silence. Default is 44100.
  402. @item start_time, st
  403. Specify the start time of the fade effect. Default is 0.
  404. The value must be specified as a time duration; see
  405. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  406. for the accepted syntax.
  407. If set this option is used instead of @var{start_sample}.
  408. @item duration, d
  409. Specify the duration of the fade effect. See
  410. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  411. for the accepted syntax.
  412. At the end of the fade-in effect the output audio will have the same
  413. volume as the input audio, at the end of the fade-out transition
  414. the output audio will be silence.
  415. By default the duration is determined by @var{nb_samples}.
  416. If set this option is used instead of @var{nb_samples}.
  417. @item curve
  418. Set curve for fade transition.
  419. It accepts the following values:
  420. @table @option
  421. @item tri
  422. select triangular, linear slope (default)
  423. @item qsin
  424. select quarter of sine wave
  425. @item hsin
  426. select half of sine wave
  427. @item esin
  428. select exponential sine wave
  429. @item log
  430. select logarithmic
  431. @item par
  432. select inverted parabola
  433. @item qua
  434. select quadratic
  435. @item cub
  436. select cubic
  437. @item squ
  438. select square root
  439. @item cbr
  440. select cubic root
  441. @end table
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Fade in first 15 seconds of audio:
  447. @example
  448. afade=t=in:ss=0:d=15
  449. @end example
  450. @item
  451. Fade out last 25 seconds of a 900 seconds audio:
  452. @example
  453. afade=t=out:st=875:d=25
  454. @end example
  455. @end itemize
  456. @anchor{aformat}
  457. @section aformat
  458. Set output format constraints for the input audio. The framework will
  459. negotiate the most appropriate format to minimize conversions.
  460. It accepts the following parameters:
  461. @table @option
  462. @item sample_fmts
  463. A '|'-separated list of requested sample formats.
  464. @item sample_rates
  465. A '|'-separated list of requested sample rates.
  466. @item channel_layouts
  467. A '|'-separated list of requested channel layouts.
  468. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  469. for the required syntax.
  470. @end table
  471. If a parameter is omitted, all values are allowed.
  472. Force the output to either unsigned 8-bit or signed 16-bit stereo
  473. @example
  474. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  475. @end example
  476. @section allpass
  477. Apply a two-pole all-pass filter with central frequency (in Hz)
  478. @var{frequency}, and filter-width @var{width}.
  479. An all-pass filter changes the audio's frequency to phase relationship
  480. without changing its frequency to amplitude relationship.
  481. The filter accepts the following options:
  482. @table @option
  483. @item frequency, f
  484. Set frequency in Hz.
  485. @item width_type
  486. Set method to specify band-width of filter.
  487. @table @option
  488. @item h
  489. Hz
  490. @item q
  491. Q-Factor
  492. @item o
  493. octave
  494. @item s
  495. slope
  496. @end table
  497. @item width, w
  498. Specify the band-width of a filter in width_type units.
  499. @end table
  500. @section amerge
  501. Merge two or more audio streams into a single multi-channel stream.
  502. The filter accepts the following options:
  503. @table @option
  504. @item inputs
  505. Set the number of inputs. Default is 2.
  506. @end table
  507. If the channel layouts of the inputs are disjoint, and therefore compatible,
  508. the channel layout of the output will be set accordingly and the channels
  509. will be reordered as necessary. If the channel layouts of the inputs are not
  510. disjoint, the output will have all the channels of the first input then all
  511. the channels of the second input, in that order, and the channel layout of
  512. the output will be the default value corresponding to the total number of
  513. channels.
  514. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  515. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  516. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  517. first input, b1 is the first channel of the second input).
  518. On the other hand, if both input are in stereo, the output channels will be
  519. in the default order: a1, a2, b1, b2, and the channel layout will be
  520. arbitrarily set to 4.0, which may or may not be the expected value.
  521. All inputs must have the same sample rate, and format.
  522. If inputs do not have the same duration, the output will stop with the
  523. shortest.
  524. @subsection Examples
  525. @itemize
  526. @item
  527. Merge two mono files into a stereo stream:
  528. @example
  529. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  530. @end example
  531. @item
  532. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  533. @example
  534. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  535. @end example
  536. @end itemize
  537. @section amix
  538. Mixes multiple audio inputs into a single output.
  539. Note that this filter only supports float samples (the @var{amerge}
  540. and @var{pan} audio filters support many formats). If the @var{amix}
  541. input has integer samples then @ref{aresample} will be automatically
  542. inserted to perform the conversion to float samples.
  543. For example
  544. @example
  545. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  546. @end example
  547. will mix 3 input audio streams to a single output with the same duration as the
  548. first input and a dropout transition time of 3 seconds.
  549. It accepts the following parameters:
  550. @table @option
  551. @item inputs
  552. The number of inputs. If unspecified, it defaults to 2.
  553. @item duration
  554. How to determine the end-of-stream.
  555. @table @option
  556. @item longest
  557. The duration of the longest input. (default)
  558. @item shortest
  559. The duration of the shortest input.
  560. @item first
  561. The duration of the first input.
  562. @end table
  563. @item dropout_transition
  564. The transition time, in seconds, for volume renormalization when an input
  565. stream ends. The default value is 2 seconds.
  566. @end table
  567. @section anull
  568. Pass the audio source unchanged to the output.
  569. @section apad
  570. Pad the end of an audio stream with silence.
  571. This can be used together with @command{ffmpeg} @option{-shortest} to
  572. extend audio streams to the same length as the video stream.
  573. A description of the accepted options follows.
  574. @table @option
  575. @item packet_size
  576. Set silence packet size. Default value is 4096.
  577. @item pad_len
  578. Set the number of samples of silence to add to the end. After the
  579. value is reached, the stream is terminated. This option is mutually
  580. exclusive with @option{whole_len}.
  581. @item whole_len
  582. Set the minimum total number of samples in the output audio stream. If
  583. the value is longer than the input audio length, silence is added to
  584. the end, until the value is reached. This option is mutually exclusive
  585. with @option{pad_len}.
  586. @end table
  587. If neither the @option{pad_len} nor the @option{whole_len} option is
  588. set, the filter will add silence to the end of the input stream
  589. indefinitely.
  590. @subsection Examples
  591. @itemize
  592. @item
  593. Add 1024 samples of silence to the end of the input:
  594. @example
  595. apad=pad_len=1024
  596. @end example
  597. @item
  598. Make sure the audio output will contain at least 10000 samples, pad
  599. the input with silence if required:
  600. @example
  601. apad=whole_len=10000
  602. @end example
  603. @item
  604. Use @command{ffmpeg} to pad the audio input with silence, so that the
  605. video stream will always result the shortest and will be converted
  606. until the end in the output file when using the @option{shortest}
  607. option:
  608. @example
  609. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  610. @end example
  611. @end itemize
  612. @section aphaser
  613. Add a phasing effect to the input audio.
  614. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  615. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  616. A description of the accepted parameters follows.
  617. @table @option
  618. @item in_gain
  619. Set input gain. Default is 0.4.
  620. @item out_gain
  621. Set output gain. Default is 0.74
  622. @item delay
  623. Set delay in milliseconds. Default is 3.0.
  624. @item decay
  625. Set decay. Default is 0.4.
  626. @item speed
  627. Set modulation speed in Hz. Default is 0.5.
  628. @item type
  629. Set modulation type. Default is triangular.
  630. It accepts the following values:
  631. @table @samp
  632. @item triangular, t
  633. @item sinusoidal, s
  634. @end table
  635. @end table
  636. @anchor{aresample}
  637. @section aresample
  638. Resample the input audio to the specified parameters, using the
  639. libswresample library. If none are specified then the filter will
  640. automatically convert between its input and output.
  641. This filter is also able to stretch/squeeze the audio data to make it match
  642. the timestamps or to inject silence / cut out audio to make it match the
  643. timestamps, do a combination of both or do neither.
  644. The filter accepts the syntax
  645. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  646. expresses a sample rate and @var{resampler_options} is a list of
  647. @var{key}=@var{value} pairs, separated by ":". See the
  648. ffmpeg-resampler manual for the complete list of supported options.
  649. @subsection Examples
  650. @itemize
  651. @item
  652. Resample the input audio to 44100Hz:
  653. @example
  654. aresample=44100
  655. @end example
  656. @item
  657. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  658. samples per second compensation:
  659. @example
  660. aresample=async=1000
  661. @end example
  662. @end itemize
  663. @section asetnsamples
  664. Set the number of samples per each output audio frame.
  665. The last output packet may contain a different number of samples, as
  666. the filter will flush all the remaining samples when the input audio
  667. signal its end.
  668. The filter accepts the following options:
  669. @table @option
  670. @item nb_out_samples, n
  671. Set the number of frames per each output audio frame. The number is
  672. intended as the number of samples @emph{per each channel}.
  673. Default value is 1024.
  674. @item pad, p
  675. If set to 1, the filter will pad the last audio frame with zeroes, so
  676. that the last frame will contain the same number of samples as the
  677. previous ones. Default value is 1.
  678. @end table
  679. For example, to set the number of per-frame samples to 1234 and
  680. disable padding for the last frame, use:
  681. @example
  682. asetnsamples=n=1234:p=0
  683. @end example
  684. @section asetrate
  685. Set the sample rate without altering the PCM data.
  686. This will result in a change of speed and pitch.
  687. The filter accepts the following options:
  688. @table @option
  689. @item sample_rate, r
  690. Set the output sample rate. Default is 44100 Hz.
  691. @end table
  692. @section ashowinfo
  693. Show a line containing various information for each input audio frame.
  694. The input audio is not modified.
  695. The shown line contains a sequence of key/value pairs of the form
  696. @var{key}:@var{value}.
  697. The following values are shown in the output:
  698. @table @option
  699. @item n
  700. The (sequential) number of the input frame, starting from 0.
  701. @item pts
  702. The presentation timestamp of the input frame, in time base units; the time base
  703. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  704. @item pts_time
  705. The presentation timestamp of the input frame in seconds.
  706. @item pos
  707. position of the frame in the input stream, -1 if this information in
  708. unavailable and/or meaningless (for example in case of synthetic audio)
  709. @item fmt
  710. The sample format.
  711. @item chlayout
  712. The channel layout.
  713. @item rate
  714. The sample rate for the audio frame.
  715. @item nb_samples
  716. The number of samples (per channel) in the frame.
  717. @item checksum
  718. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  719. audio, the data is treated as if all the planes were concatenated.
  720. @item plane_checksums
  721. A list of Adler-32 checksums for each data plane.
  722. @end table
  723. @section astats
  724. Display time domain statistical information about the audio channels.
  725. Statistics are calculated and displayed for each audio channel and,
  726. where applicable, an overall figure is also given.
  727. It accepts the following option:
  728. @table @option
  729. @item length
  730. Short window length in seconds, used for peak and trough RMS measurement.
  731. Default is @code{0.05} (50 miliseconds). Allowed range is @code{[0.1 - 10]}.
  732. @end table
  733. A description of each shown parameter follows:
  734. @table @option
  735. @item DC offset
  736. Mean amplitude displacement from zero.
  737. @item Min level
  738. Minimal sample level.
  739. @item Max level
  740. Maximal sample level.
  741. @item Peak level dB
  742. @item RMS level dB
  743. Standard peak and RMS level measured in dBFS.
  744. @item RMS peak dB
  745. @item RMS trough dB
  746. Peak and trough values for RMS level measured over a short window.
  747. @item Crest factor
  748. Standard ratio of peak to RMS level (note: not in dB).
  749. @item Flat factor
  750. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  751. (i.e. either @var{Min level} or @var{Max level}).
  752. @item Peak count
  753. Number of occasions (not the number of samples) that the signal attained either
  754. @var{Min level} or @var{Max level}.
  755. @end table
  756. @section astreamsync
  757. Forward two audio streams and control the order the buffers are forwarded.
  758. The filter accepts the following options:
  759. @table @option
  760. @item expr, e
  761. Set the expression deciding which stream should be
  762. forwarded next: if the result is negative, the first stream is forwarded; if
  763. the result is positive or zero, the second stream is forwarded. It can use
  764. the following variables:
  765. @table @var
  766. @item b1 b2
  767. number of buffers forwarded so far on each stream
  768. @item s1 s2
  769. number of samples forwarded so far on each stream
  770. @item t1 t2
  771. current timestamp of each stream
  772. @end table
  773. The default value is @code{t1-t2}, which means to always forward the stream
  774. that has a smaller timestamp.
  775. @end table
  776. @subsection Examples
  777. Stress-test @code{amerge} by randomly sending buffers on the wrong
  778. input, while avoiding too much of a desynchronization:
  779. @example
  780. amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
  781. [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
  782. [a2] [b2] amerge
  783. @end example
  784. @section asyncts
  785. Synchronize audio data with timestamps by squeezing/stretching it and/or
  786. dropping samples/adding silence when needed.
  787. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  788. It accepts the following parameters:
  789. @table @option
  790. @item compensate
  791. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  792. by default. When disabled, time gaps are covered with silence.
  793. @item min_delta
  794. The minimum difference between timestamps and audio data (in seconds) to trigger
  795. adding/dropping samples. The default value is 0.1. If you get an imperfect
  796. sync with this filter, try setting this parameter to 0.
  797. @item max_comp
  798. The maximum compensation in samples per second. Only relevant with compensate=1.
  799. The default value is 500.
  800. @item first_pts
  801. Assume that the first PTS should be this value. The time base is 1 / sample
  802. rate. This allows for padding/trimming at the start of the stream. By default,
  803. no assumption is made about the first frame's expected PTS, so no padding or
  804. trimming is done. For example, this could be set to 0 to pad the beginning with
  805. silence if an audio stream starts after the video stream or to trim any samples
  806. with a negative PTS due to encoder delay.
  807. @end table
  808. @section atempo
  809. Adjust audio tempo.
  810. The filter accepts exactly one parameter, the audio tempo. If not
  811. specified then the filter will assume nominal 1.0 tempo. Tempo must
  812. be in the [0.5, 2.0] range.
  813. @subsection Examples
  814. @itemize
  815. @item
  816. Slow down audio to 80% tempo:
  817. @example
  818. atempo=0.8
  819. @end example
  820. @item
  821. To speed up audio to 125% tempo:
  822. @example
  823. atempo=1.25
  824. @end example
  825. @end itemize
  826. @section atrim
  827. Trim the input so that the output contains one continuous subpart of the input.
  828. It accepts the following parameters:
  829. @table @option
  830. @item start
  831. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  832. sample with the timestamp @var{start} will be the first sample in the output.
  833. @item end
  834. Specify time of the first audio sample that will be dropped, i.e. the
  835. audio sample immediately preceding the one with the timestamp @var{end} will be
  836. the last sample in the output.
  837. @item start_pts
  838. Same as @var{start}, except this option sets the start timestamp in samples
  839. instead of seconds.
  840. @item end_pts
  841. Same as @var{end}, except this option sets the end timestamp in samples instead
  842. of seconds.
  843. @item duration
  844. The maximum duration of the output in seconds.
  845. @item start_sample
  846. The number of the first sample that should be output.
  847. @item end_sample
  848. The number of the first sample that should be dropped.
  849. @end table
  850. @option{start}, @option{end}, and @option{duration} are expressed as time
  851. duration specifications; see
  852. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  853. Note that the first two sets of the start/end options and the @option{duration}
  854. option look at the frame timestamp, while the _sample options simply count the
  855. samples that pass through the filter. So start/end_pts and start/end_sample will
  856. give different results when the timestamps are wrong, inexact or do not start at
  857. zero. Also note that this filter does not modify the timestamps. If you wish
  858. to have the output timestamps start at zero, insert the asetpts filter after the
  859. atrim filter.
  860. If multiple start or end options are set, this filter tries to be greedy and
  861. keep all samples that match at least one of the specified constraints. To keep
  862. only the part that matches all the constraints at once, chain multiple atrim
  863. filters.
  864. The defaults are such that all the input is kept. So it is possible to set e.g.
  865. just the end values to keep everything before the specified time.
  866. Examples:
  867. @itemize
  868. @item
  869. Drop everything except the second minute of input:
  870. @example
  871. ffmpeg -i INPUT -af atrim=60:120
  872. @end example
  873. @item
  874. Keep only the first 1000 samples:
  875. @example
  876. ffmpeg -i INPUT -af atrim=end_sample=1000
  877. @end example
  878. @end itemize
  879. @section bandpass
  880. Apply a two-pole Butterworth band-pass filter with central
  881. frequency @var{frequency}, and (3dB-point) band-width width.
  882. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  883. instead of the default: constant 0dB peak gain.
  884. The filter roll off at 6dB per octave (20dB per decade).
  885. The filter accepts the following options:
  886. @table @option
  887. @item frequency, f
  888. Set the filter's central frequency. Default is @code{3000}.
  889. @item csg
  890. Constant skirt gain if set to 1. Defaults to 0.
  891. @item width_type
  892. Set method to specify band-width of filter.
  893. @table @option
  894. @item h
  895. Hz
  896. @item q
  897. Q-Factor
  898. @item o
  899. octave
  900. @item s
  901. slope
  902. @end table
  903. @item width, w
  904. Specify the band-width of a filter in width_type units.
  905. @end table
  906. @section bandreject
  907. Apply a two-pole Butterworth band-reject filter with central
  908. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  909. The filter roll off at 6dB per octave (20dB per decade).
  910. The filter accepts the following options:
  911. @table @option
  912. @item frequency, f
  913. Set the filter's central frequency. Default is @code{3000}.
  914. @item width_type
  915. Set method to specify band-width of filter.
  916. @table @option
  917. @item h
  918. Hz
  919. @item q
  920. Q-Factor
  921. @item o
  922. octave
  923. @item s
  924. slope
  925. @end table
  926. @item width, w
  927. Specify the band-width of a filter in width_type units.
  928. @end table
  929. @section bass
  930. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  931. shelving filter with a response similar to that of a standard
  932. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  933. The filter accepts the following options:
  934. @table @option
  935. @item gain, g
  936. Give the gain at 0 Hz. Its useful range is about -20
  937. (for a large cut) to +20 (for a large boost).
  938. Beware of clipping when using a positive gain.
  939. @item frequency, f
  940. Set the filter's central frequency and so can be used
  941. to extend or reduce the frequency range to be boosted or cut.
  942. The default value is @code{100} Hz.
  943. @item width_type
  944. Set method to specify band-width of filter.
  945. @table @option
  946. @item h
  947. Hz
  948. @item q
  949. Q-Factor
  950. @item o
  951. octave
  952. @item s
  953. slope
  954. @end table
  955. @item width, w
  956. Determine how steep is the filter's shelf transition.
  957. @end table
  958. @section biquad
  959. Apply a biquad IIR filter with the given coefficients.
  960. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  961. are the numerator and denominator coefficients respectively.
  962. @section bs2b
  963. Bauer stereo to binaural transformation, which improves headphone listening of
  964. stereo audio records.
  965. It accepts the following parameters:
  966. @table @option
  967. @item profile
  968. Pre-defined crossfeed level.
  969. @table @option
  970. @item default
  971. Default level (fcut=700, feed=50).
  972. @item cmoy
  973. Chu Moy circuit (fcut=700, feed=60).
  974. @item jmeier
  975. Jan Meier circuit (fcut=650, feed=95).
  976. @end table
  977. @item fcut
  978. Cut frequency (in Hz).
  979. @item feed
  980. Feed level (in Hz).
  981. @end table
  982. @section channelmap
  983. Remap input channels to new locations.
  984. It accepts the following parameters:
  985. @table @option
  986. @item channel_layout
  987. The channel layout of the output stream.
  988. @item map
  989. Map channels from input to output. The argument is a '|'-separated list of
  990. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  991. @var{in_channel} form. @var{in_channel} can be either the name of the input
  992. channel (e.g. FL for front left) or its index in the input channel layout.
  993. @var{out_channel} is the name of the output channel or its index in the output
  994. channel layout. If @var{out_channel} is not given then it is implicitly an
  995. index, starting with zero and increasing by one for each mapping.
  996. @end table
  997. If no mapping is present, the filter will implicitly map input channels to
  998. output channels, preserving indices.
  999. For example, assuming a 5.1+downmix input MOV file,
  1000. @example
  1001. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1002. @end example
  1003. will create an output WAV file tagged as stereo from the downmix channels of
  1004. the input.
  1005. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1006. @example
  1007. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav
  1008. @end example
  1009. @section channelsplit
  1010. Split each channel from an input audio stream into a separate output stream.
  1011. It accepts the following parameters:
  1012. @table @option
  1013. @item channel_layout
  1014. The channel layout of the input stream. The default is "stereo".
  1015. @end table
  1016. For example, assuming a stereo input MP3 file,
  1017. @example
  1018. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1019. @end example
  1020. will create an output Matroska file with two audio streams, one containing only
  1021. the left channel and the other the right channel.
  1022. Split a 5.1 WAV file into per-channel files:
  1023. @example
  1024. ffmpeg -i in.wav -filter_complex
  1025. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1026. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1027. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1028. side_right.wav
  1029. @end example
  1030. @section compand
  1031. Compress or expand the audio's dynamic range.
  1032. It accepts the following parameters:
  1033. @table @option
  1034. @item attacks
  1035. @item decays
  1036. A list of times in seconds for each channel over which the instantaneous level
  1037. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1038. increase of volume and @var{decays} refers to decrease of volume. For most
  1039. situations, the attack time (response to the audio getting louder) should be
  1040. shorter than the decay time, because the human ear is more sensitive to sudden
  1041. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1042. a typical value for decay is 0.8 seconds.
  1043. @item points
  1044. A list of points for the transfer function, specified in dB relative to the
  1045. maximum possible signal amplitude. Each key points list must be defined using
  1046. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1047. @code{x0/y0 x1/y1 x2/y2 ....}
  1048. The input values must be in strictly increasing order but the transfer function
  1049. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1050. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1051. function are @code{-70/-70|-60/-20}.
  1052. @item soft-knee
  1053. Set the curve radius in dB for all joints. It defaults to 0.01.
  1054. @item gain
  1055. Set the additional gain in dB to be applied at all points on the transfer
  1056. function. This allows for easy adjustment of the overall gain.
  1057. It defaults to 0.
  1058. @item volume
  1059. Set an initial volume, in dB, to be assumed for each channel when filtering
  1060. starts. This permits the user to supply a nominal level initially, so that, for
  1061. example, a very large gain is not applied to initial signal levels before the
  1062. companding has begun to operate. A typical value for audio which is initially
  1063. quiet is -90 dB. It defaults to 0.
  1064. @item delay
  1065. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1066. delayed before being fed to the volume adjuster. Specifying a delay
  1067. approximately equal to the attack/decay times allows the filter to effectively
  1068. operate in predictive rather than reactive mode. It defaults to 0.
  1069. @end table
  1070. @subsection Examples
  1071. @itemize
  1072. @item
  1073. Make music with both quiet and loud passages suitable for listening to in a
  1074. noisy environment:
  1075. @example
  1076. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1077. @end example
  1078. @item
  1079. A noise gate for when the noise is at a lower level than the signal:
  1080. @example
  1081. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1082. @end example
  1083. @item
  1084. Here is another noise gate, this time for when the noise is at a higher level
  1085. than the signal (making it, in some ways, similar to squelch):
  1086. @example
  1087. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1088. @end example
  1089. @end itemize
  1090. @section earwax
  1091. Make audio easier to listen to on headphones.
  1092. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1093. so that when listened to on headphones the stereo image is moved from
  1094. inside your head (standard for headphones) to outside and in front of
  1095. the listener (standard for speakers).
  1096. Ported from SoX.
  1097. @section equalizer
  1098. Apply a two-pole peaking equalisation (EQ) filter. With this
  1099. filter, the signal-level at and around a selected frequency can
  1100. be increased or decreased, whilst (unlike bandpass and bandreject
  1101. filters) that at all other frequencies is unchanged.
  1102. In order to produce complex equalisation curves, this filter can
  1103. be given several times, each with a different central frequency.
  1104. The filter accepts the following options:
  1105. @table @option
  1106. @item frequency, f
  1107. Set the filter's central frequency in Hz.
  1108. @item width_type
  1109. Set method to specify band-width of filter.
  1110. @table @option
  1111. @item h
  1112. Hz
  1113. @item q
  1114. Q-Factor
  1115. @item o
  1116. octave
  1117. @item s
  1118. slope
  1119. @end table
  1120. @item width, w
  1121. Specify the band-width of a filter in width_type units.
  1122. @item gain, g
  1123. Set the required gain or attenuation in dB.
  1124. Beware of clipping when using a positive gain.
  1125. @end table
  1126. @subsection Examples
  1127. @itemize
  1128. @item
  1129. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1130. @example
  1131. equalizer=f=1000:width_type=h:width=200:g=-10
  1132. @end example
  1133. @item
  1134. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1135. @example
  1136. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1137. @end example
  1138. @end itemize
  1139. @section flanger
  1140. Apply a flanging effect to the audio.
  1141. The filter accepts the following options:
  1142. @table @option
  1143. @item delay
  1144. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1145. @item depth
  1146. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1147. @item regen
  1148. Set percentage regeneneration (delayed signal feedback). Range from -95 to 95.
  1149. Default value is 0.
  1150. @item width
  1151. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1152. Default valu is 71.
  1153. @item speed
  1154. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1155. @item shape
  1156. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1157. Default value is @var{sinusoidal}.
  1158. @item phase
  1159. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1160. Default value is 25.
  1161. @item interp
  1162. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1163. Default is @var{linear}.
  1164. @end table
  1165. @section highpass
  1166. Apply a high-pass filter with 3dB point frequency.
  1167. The filter can be either single-pole, or double-pole (the default).
  1168. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1169. The filter accepts the following options:
  1170. @table @option
  1171. @item frequency, f
  1172. Set frequency in Hz. Default is 3000.
  1173. @item poles, p
  1174. Set number of poles. Default is 2.
  1175. @item width_type
  1176. Set method to specify band-width of filter.
  1177. @table @option
  1178. @item h
  1179. Hz
  1180. @item q
  1181. Q-Factor
  1182. @item o
  1183. octave
  1184. @item s
  1185. slope
  1186. @end table
  1187. @item width, w
  1188. Specify the band-width of a filter in width_type units.
  1189. Applies only to double-pole filter.
  1190. The default is 0.707q and gives a Butterworth response.
  1191. @end table
  1192. @section join
  1193. Join multiple input streams into one multi-channel stream.
  1194. It accepts the following parameters:
  1195. @table @option
  1196. @item inputs
  1197. The number of input streams. It defaults to 2.
  1198. @item channel_layout
  1199. The desired output channel layout. It defaults to stereo.
  1200. @item map
  1201. Map channels from inputs to output. The argument is a '|'-separated list of
  1202. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1203. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1204. can be either the name of the input channel (e.g. FL for front left) or its
  1205. index in the specified input stream. @var{out_channel} is the name of the output
  1206. channel.
  1207. @end table
  1208. The filter will attempt to guess the mappings when they are not specified
  1209. explicitly. It does so by first trying to find an unused matching input channel
  1210. and if that fails it picks the first unused input channel.
  1211. Join 3 inputs (with properly set channel layouts):
  1212. @example
  1213. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1214. @end example
  1215. Build a 5.1 output from 6 single-channel streams:
  1216. @example
  1217. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1218. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  1219. out
  1220. @end example
  1221. @section ladspa
  1222. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1223. To enable compilation of this filter you need to configure FFmpeg with
  1224. @code{--enable-ladspa}.
  1225. @table @option
  1226. @item file, f
  1227. Specifies the name of LADSPA plugin library to load. If the environment
  1228. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1229. each one of the directories specified by the colon separated list in
  1230. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1231. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1232. @file{/usr/lib/ladspa/}.
  1233. @item plugin, p
  1234. Specifies the plugin within the library. Some libraries contain only
  1235. one plugin, but others contain many of them. If this is not set filter
  1236. will list all available plugins within the specified library.
  1237. @item controls, c
  1238. Set the '|' separated list of controls which are zero or more floating point
  1239. values that determine the behavior of the loaded plugin (for example delay,
  1240. threshold or gain).
  1241. Controls need to be defined using the following syntax:
  1242. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1243. @var{valuei} is the value set on the @var{i}-th control.
  1244. If @option{controls} is set to @code{help}, all available controls and
  1245. their valid ranges are printed.
  1246. @item sample_rate, s
  1247. Specify the sample rate, default to 44100. Only used if plugin have
  1248. zero inputs.
  1249. @item nb_samples, n
  1250. Set the number of samples per channel per each output frame, default
  1251. is 1024. Only used if plugin have zero inputs.
  1252. @item duration, d
  1253. Set the minimum duration of the sourced audio. See
  1254. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1255. for the accepted syntax.
  1256. Note that the resulting duration may be greater than the specified duration,
  1257. as the generated audio is always cut at the end of a complete frame.
  1258. If not specified, or the expressed duration is negative, the audio is
  1259. supposed to be generated forever.
  1260. Only used if plugin have zero inputs.
  1261. @end table
  1262. @subsection Examples
  1263. @itemize
  1264. @item
  1265. List all available plugins within amp (LADSPA example plugin) library:
  1266. @example
  1267. ladspa=file=amp
  1268. @end example
  1269. @item
  1270. List all available controls and their valid ranges for @code{vcf_notch}
  1271. plugin from @code{VCF} library:
  1272. @example
  1273. ladspa=f=vcf:p=vcf_notch:c=help
  1274. @end example
  1275. @item
  1276. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  1277. plugin library:
  1278. @example
  1279. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  1280. @end example
  1281. @item
  1282. Add reverberation to the audio using TAP-plugins
  1283. (Tom's Audio Processing plugins):
  1284. @example
  1285. ladspa=file=tap_reverb:tap_reverb
  1286. @end example
  1287. @item
  1288. Generate white noise, with 0.2 amplitude:
  1289. @example
  1290. ladspa=file=cmt:noise_source_white:c=c0=.2
  1291. @end example
  1292. @item
  1293. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  1294. @code{C* Audio Plugin Suite} (CAPS) library:
  1295. @example
  1296. ladspa=file=caps:Click:c=c1=20'
  1297. @end example
  1298. @item
  1299. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  1300. @example
  1301. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  1302. @end example
  1303. @end itemize
  1304. @subsection Commands
  1305. This filter supports the following commands:
  1306. @table @option
  1307. @item cN
  1308. Modify the @var{N}-th control value.
  1309. If the specified value is not valid, it is ignored and prior one is kept.
  1310. @end table
  1311. @section lowpass
  1312. Apply a low-pass filter with 3dB point frequency.
  1313. The filter can be either single-pole or double-pole (the default).
  1314. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1315. The filter accepts the following options:
  1316. @table @option
  1317. @item frequency, f
  1318. Set frequency in Hz. Default is 500.
  1319. @item poles, p
  1320. Set number of poles. Default is 2.
  1321. @item width_type
  1322. Set method to specify band-width of filter.
  1323. @table @option
  1324. @item h
  1325. Hz
  1326. @item q
  1327. Q-Factor
  1328. @item o
  1329. octave
  1330. @item s
  1331. slope
  1332. @end table
  1333. @item width, w
  1334. Specify the band-width of a filter in width_type units.
  1335. Applies only to double-pole filter.
  1336. The default is 0.707q and gives a Butterworth response.
  1337. @end table
  1338. @section pan
  1339. Mix channels with specific gain levels. The filter accepts the output
  1340. channel layout followed by a set of channels definitions.
  1341. This filter is also designed to remap efficiently the channels of an audio
  1342. stream.
  1343. The filter accepts parameters of the form:
  1344. "@var{l}:@var{outdef}:@var{outdef}:..."
  1345. @table @option
  1346. @item l
  1347. output channel layout or number of channels
  1348. @item outdef
  1349. output channel specification, of the form:
  1350. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  1351. @item out_name
  1352. output channel to define, either a channel name (FL, FR, etc.) or a channel
  1353. number (c0, c1, etc.)
  1354. @item gain
  1355. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  1356. @item in_name
  1357. input channel to use, see out_name for details; it is not possible to mix
  1358. named and numbered input channels
  1359. @end table
  1360. If the `=' in a channel specification is replaced by `<', then the gains for
  1361. that specification will be renormalized so that the total is 1, thus
  1362. avoiding clipping noise.
  1363. @subsection Mixing examples
  1364. For example, if you want to down-mix from stereo to mono, but with a bigger
  1365. factor for the left channel:
  1366. @example
  1367. pan=1:c0=0.9*c0+0.1*c1
  1368. @end example
  1369. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  1370. 7-channels surround:
  1371. @example
  1372. pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  1373. @end example
  1374. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  1375. that should be preferred (see "-ac" option) unless you have very specific
  1376. needs.
  1377. @subsection Remapping examples
  1378. The channel remapping will be effective if, and only if:
  1379. @itemize
  1380. @item gain coefficients are zeroes or ones,
  1381. @item only one input per channel output,
  1382. @end itemize
  1383. If all these conditions are satisfied, the filter will notify the user ("Pure
  1384. channel mapping detected"), and use an optimized and lossless method to do the
  1385. remapping.
  1386. For example, if you have a 5.1 source and want a stereo audio stream by
  1387. dropping the extra channels:
  1388. @example
  1389. pan="stereo: c0=FL : c1=FR"
  1390. @end example
  1391. Given the same source, you can also switch front left and front right channels
  1392. and keep the input channel layout:
  1393. @example
  1394. pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
  1395. @end example
  1396. If the input is a stereo audio stream, you can mute the front left channel (and
  1397. still keep the stereo channel layout) with:
  1398. @example
  1399. pan="stereo:c1=c1"
  1400. @end example
  1401. Still with a stereo audio stream input, you can copy the right channel in both
  1402. front left and right:
  1403. @example
  1404. pan="stereo: c0=FR : c1=FR"
  1405. @end example
  1406. @section replaygain
  1407. ReplayGain scanner filter. This filter takes an audio stream as an input and
  1408. outputs it unchanged.
  1409. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  1410. @section resample
  1411. Convert the audio sample format, sample rate and channel layout. It is
  1412. not meant to be used directly.
  1413. @section silencedetect
  1414. Detect silence in an audio stream.
  1415. This filter logs a message when it detects that the input audio volume is less
  1416. or equal to a noise tolerance value for a duration greater or equal to the
  1417. minimum detected noise duration.
  1418. The printed times and duration are expressed in seconds.
  1419. The filter accepts the following options:
  1420. @table @option
  1421. @item duration, d
  1422. Set silence duration until notification (default is 2 seconds).
  1423. @item noise, n
  1424. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  1425. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  1426. @end table
  1427. @subsection Examples
  1428. @itemize
  1429. @item
  1430. Detect 5 seconds of silence with -50dB noise tolerance:
  1431. @example
  1432. silencedetect=n=-50dB:d=5
  1433. @end example
  1434. @item
  1435. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  1436. tolerance in @file{silence.mp3}:
  1437. @example
  1438. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  1439. @end example
  1440. @end itemize
  1441. @section silenceremove
  1442. Remove silence from the beginning, middle or end of the audio.
  1443. The filter accepts the following options:
  1444. @table @option
  1445. @item start_periods
  1446. This value is used to indicate if audio should be trimmed at beginning of
  1447. the audio. A value of zero indicates no silence should be trimmed from the
  1448. beginning. When specifying a non-zero value, it trims audio up until it
  1449. finds non-silence. Normally, when trimming silence from beginning of audio
  1450. the @var{start_periods} will be @code{1} but it can be increased to higher
  1451. values to trim all audio up to specific count of non-silence periods.
  1452. Default value is @code{0}.
  1453. @item start_duration
  1454. Specify the amount of time that non-silence must be detected before it stops
  1455. trimming audio. By increasing the duration, bursts of noises can be treated
  1456. as silence and trimmed off. Default value is @code{0}.
  1457. @item start_threshold
  1458. This indicates what sample value should be treated as silence. For digital
  1459. audio, a value of @code{0} may be fine but for audio recorded from analog,
  1460. you may wish to increase the value to account for background noise.
  1461. Can be specified in dB (in case "dB" is appended to the specified value)
  1462. or amplitude ratio. Default value is @code{0}.
  1463. @item stop_periods
  1464. Set the count for trimming silence from the end of audio.
  1465. To remove silence from the middle of a file, specify a @var{stop_periods}
  1466. that is negative. This value is then threated as a positive value and is
  1467. used to indicate the effect should restart processing as specified by
  1468. @var{start_periods}, making it suitable for removing periods of silence
  1469. in the middle of the audio.
  1470. Default value is @code{0}.
  1471. @item stop_duration
  1472. Specify a duration of silence that must exist before audio is not copied any
  1473. more. By specifying a higher duration, silence that is wanted can be left in
  1474. the audio.
  1475. Default value is @code{0}.
  1476. @item stop_threshold
  1477. This is the same as @option{start_threshold} but for trimming silence from
  1478. the end of audio.
  1479. Can be specified in dB (in case "dB" is appended to the specified value)
  1480. or amplitude ratio. Default value is @code{0}.
  1481. @item leave_silence
  1482. This indicate that @var{stop_duration} length of audio should be left intact
  1483. at the beginning of each period of silence.
  1484. For example, if you want to remove long pauses between words but do not want
  1485. to remove the pauses completely. Default value is @code{0}.
  1486. @end table
  1487. @subsection Examples
  1488. @itemize
  1489. @item
  1490. The following example shows how this filter can be used to start a recording
  1491. that does not contain the delay at the start which usually occurs between
  1492. pressing the record button and the start of the performance:
  1493. @example
  1494. silenceremove=1:5:0.02
  1495. @end example
  1496. @end itemize
  1497. @section treble
  1498. Boost or cut treble (upper) frequencies of the audio using a two-pole
  1499. shelving filter with a response similar to that of a standard
  1500. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1501. The filter accepts the following options:
  1502. @table @option
  1503. @item gain, g
  1504. Give the gain at whichever is the lower of ~22 kHz and the
  1505. Nyquist frequency. Its useful range is about -20 (for a large cut)
  1506. to +20 (for a large boost). Beware of clipping when using a positive gain.
  1507. @item frequency, f
  1508. Set the filter's central frequency and so can be used
  1509. to extend or reduce the frequency range to be boosted or cut.
  1510. The default value is @code{3000} Hz.
  1511. @item width_type
  1512. Set method to specify band-width of filter.
  1513. @table @option
  1514. @item h
  1515. Hz
  1516. @item q
  1517. Q-Factor
  1518. @item o
  1519. octave
  1520. @item s
  1521. slope
  1522. @end table
  1523. @item width, w
  1524. Determine how steep is the filter's shelf transition.
  1525. @end table
  1526. @section volume
  1527. Adjust the input audio volume.
  1528. It accepts the following parameters:
  1529. @table @option
  1530. @item volume
  1531. Set audio volume expression.
  1532. Output values are clipped to the maximum value.
  1533. The output audio volume is given by the relation:
  1534. @example
  1535. @var{output_volume} = @var{volume} * @var{input_volume}
  1536. @end example
  1537. The default value for @var{volume} is "1.0".
  1538. @item precision
  1539. This parameter represents the mathematical precision.
  1540. It determines which input sample formats will be allowed, which affects the
  1541. precision of the volume scaling.
  1542. @table @option
  1543. @item fixed
  1544. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  1545. @item float
  1546. 32-bit floating-point; this limits input sample format to FLT. (default)
  1547. @item double
  1548. 64-bit floating-point; this limits input sample format to DBL.
  1549. @end table
  1550. @item replaygain
  1551. Choose the behaviour on encountering ReplayGain side data in input frames.
  1552. @table @option
  1553. @item drop
  1554. Remove ReplayGain side data, ignoring its contents (the default).
  1555. @item ignore
  1556. Ignore ReplayGain side data, but leave it in the frame.
  1557. @item track
  1558. Prefer the track gain, if present.
  1559. @item album
  1560. Prefer the album gain, if present.
  1561. @end table
  1562. @item replaygain_preamp
  1563. Pre-amplification gain in dB to apply to the selected replaygain gain.
  1564. Default value for @var{replaygain_preamp} is 0.0.
  1565. @item eval
  1566. Set when the volume expression is evaluated.
  1567. It accepts the following values:
  1568. @table @samp
  1569. @item once
  1570. only evaluate expression once during the filter initialization, or
  1571. when the @samp{volume} command is sent
  1572. @item frame
  1573. evaluate expression for each incoming frame
  1574. @end table
  1575. Default value is @samp{once}.
  1576. @end table
  1577. The volume expression can contain the following parameters.
  1578. @table @option
  1579. @item n
  1580. frame number (starting at zero)
  1581. @item nb_channels
  1582. number of channels
  1583. @item nb_consumed_samples
  1584. number of samples consumed by the filter
  1585. @item nb_samples
  1586. number of samples in the current frame
  1587. @item pos
  1588. original frame position in the file
  1589. @item pts
  1590. frame PTS
  1591. @item sample_rate
  1592. sample rate
  1593. @item startpts
  1594. PTS at start of stream
  1595. @item startt
  1596. time at start of stream
  1597. @item t
  1598. frame time
  1599. @item tb
  1600. timestamp timebase
  1601. @item volume
  1602. last set volume value
  1603. @end table
  1604. Note that when @option{eval} is set to @samp{once} only the
  1605. @var{sample_rate} and @var{tb} variables are available, all other
  1606. variables will evaluate to NAN.
  1607. @subsection Commands
  1608. This filter supports the following commands:
  1609. @table @option
  1610. @item volume
  1611. Modify the volume expression.
  1612. The command accepts the same syntax of the corresponding option.
  1613. If the specified expression is not valid, it is kept at its current
  1614. value.
  1615. @item replaygain_noclip
  1616. Prevent clipping by limiting the gain applied.
  1617. Default value for @var{replaygain_noclip} is 1.
  1618. @end table
  1619. @subsection Examples
  1620. @itemize
  1621. @item
  1622. Halve the input audio volume:
  1623. @example
  1624. volume=volume=0.5
  1625. volume=volume=1/2
  1626. volume=volume=-6.0206dB
  1627. @end example
  1628. In all the above example the named key for @option{volume} can be
  1629. omitted, for example like in:
  1630. @example
  1631. volume=0.5
  1632. @end example
  1633. @item
  1634. Increase input audio power by 6 decibels using fixed-point precision:
  1635. @example
  1636. volume=volume=6dB:precision=fixed
  1637. @end example
  1638. @item
  1639. Fade volume after time 10 with an annihilation period of 5 seconds:
  1640. @example
  1641. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  1642. @end example
  1643. @end itemize
  1644. @section volumedetect
  1645. Detect the volume of the input video.
  1646. The filter has no parameters. The input is not modified. Statistics about
  1647. the volume will be printed in the log when the input stream end is reached.
  1648. In particular it will show the mean volume (root mean square), maximum
  1649. volume (on a per-sample basis), and the beginning of a histogram of the
  1650. registered volume values (from the maximum value to a cumulated 1/1000 of
  1651. the samples).
  1652. All volumes are in decibels relative to the maximum PCM value.
  1653. @subsection Examples
  1654. Here is an excerpt of the output:
  1655. @example
  1656. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  1657. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  1658. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  1659. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  1660. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  1661. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  1662. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  1663. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  1664. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  1665. @end example
  1666. It means that:
  1667. @itemize
  1668. @item
  1669. The mean square energy is approximately -27 dB, or 10^-2.7.
  1670. @item
  1671. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  1672. @item
  1673. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  1674. @end itemize
  1675. In other words, raising the volume by +4 dB does not cause any clipping,
  1676. raising it by +5 dB causes clipping for 6 samples, etc.
  1677. @c man end AUDIO FILTERS
  1678. @chapter Audio Sources
  1679. @c man begin AUDIO SOURCES
  1680. Below is a description of the currently available audio sources.
  1681. @section abuffer
  1682. Buffer audio frames, and make them available to the filter chain.
  1683. This source is mainly intended for a programmatic use, in particular
  1684. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  1685. It accepts the following parameters:
  1686. @table @option
  1687. @item time_base
  1688. The timebase which will be used for timestamps of submitted frames. It must be
  1689. either a floating-point number or in @var{numerator}/@var{denominator} form.
  1690. @item sample_rate
  1691. The sample rate of the incoming audio buffers.
  1692. @item sample_fmt
  1693. The sample format of the incoming audio buffers.
  1694. Either a sample format name or its corresponging integer representation from
  1695. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  1696. @item channel_layout
  1697. The channel layout of the incoming audio buffers.
  1698. Either a channel layout name from channel_layout_map in
  1699. @file{libavutil/channel_layout.c} or its corresponding integer representation
  1700. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  1701. @item channels
  1702. The number of channels of the incoming audio buffers.
  1703. If both @var{channels} and @var{channel_layout} are specified, then they
  1704. must be consistent.
  1705. @end table
  1706. @subsection Examples
  1707. @example
  1708. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  1709. @end example
  1710. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  1711. Since the sample format with name "s16p" corresponds to the number
  1712. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  1713. equivalent to:
  1714. @example
  1715. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  1716. @end example
  1717. @section aevalsrc
  1718. Generate an audio signal specified by an expression.
  1719. This source accepts in input one or more expressions (one for each
  1720. channel), which are evaluated and used to generate a corresponding
  1721. audio signal.
  1722. This source accepts the following options:
  1723. @table @option
  1724. @item exprs
  1725. Set the '|'-separated expressions list for each separate channel. In case the
  1726. @option{channel_layout} option is not specified, the selected channel layout
  1727. depends on the number of provided expressions. Otherwise the last
  1728. specified expression is applied to the remaining output channels.
  1729. @item channel_layout, c
  1730. Set the channel layout. The number of channels in the specified layout
  1731. must be equal to the number of specified expressions.
  1732. @item duration, d
  1733. Set the minimum duration of the sourced audio. See
  1734. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1735. for the accepted syntax.
  1736. Note that the resulting duration may be greater than the specified
  1737. duration, as the generated audio is always cut at the end of a
  1738. complete frame.
  1739. If not specified, or the expressed duration is negative, the audio is
  1740. supposed to be generated forever.
  1741. @item nb_samples, n
  1742. Set the number of samples per channel per each output frame,
  1743. default to 1024.
  1744. @item sample_rate, s
  1745. Specify the sample rate, default to 44100.
  1746. @end table
  1747. Each expression in @var{exprs} can contain the following constants:
  1748. @table @option
  1749. @item n
  1750. number of the evaluated sample, starting from 0
  1751. @item t
  1752. time of the evaluated sample expressed in seconds, starting from 0
  1753. @item s
  1754. sample rate
  1755. @end table
  1756. @subsection Examples
  1757. @itemize
  1758. @item
  1759. Generate silence:
  1760. @example
  1761. aevalsrc=0
  1762. @end example
  1763. @item
  1764. Generate a sin signal with frequency of 440 Hz, set sample rate to
  1765. 8000 Hz:
  1766. @example
  1767. aevalsrc="sin(440*2*PI*t):s=8000"
  1768. @end example
  1769. @item
  1770. Generate a two channels signal, specify the channel layout (Front
  1771. Center + Back Center) explicitly:
  1772. @example
  1773. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  1774. @end example
  1775. @item
  1776. Generate white noise:
  1777. @example
  1778. aevalsrc="-2+random(0)"
  1779. @end example
  1780. @item
  1781. Generate an amplitude modulated signal:
  1782. @example
  1783. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  1784. @end example
  1785. @item
  1786. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  1787. @example
  1788. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  1789. @end example
  1790. @end itemize
  1791. @section anullsrc
  1792. The null audio source, return unprocessed audio frames. It is mainly useful
  1793. as a template and to be employed in analysis / debugging tools, or as
  1794. the source for filters which ignore the input data (for example the sox
  1795. synth filter).
  1796. This source accepts the following options:
  1797. @table @option
  1798. @item channel_layout, cl
  1799. Specifies the channel layout, and can be either an integer or a string
  1800. representing a channel layout. The default value of @var{channel_layout}
  1801. is "stereo".
  1802. Check the channel_layout_map definition in
  1803. @file{libavutil/channel_layout.c} for the mapping between strings and
  1804. channel layout values.
  1805. @item sample_rate, r
  1806. Specifies the sample rate, and defaults to 44100.
  1807. @item nb_samples, n
  1808. Set the number of samples per requested frames.
  1809. @end table
  1810. @subsection Examples
  1811. @itemize
  1812. @item
  1813. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  1814. @example
  1815. anullsrc=r=48000:cl=4
  1816. @end example
  1817. @item
  1818. Do the same operation with a more obvious syntax:
  1819. @example
  1820. anullsrc=r=48000:cl=mono
  1821. @end example
  1822. @end itemize
  1823. All the parameters need to be explicitly defined.
  1824. @section flite
  1825. Synthesize a voice utterance using the libflite library.
  1826. To enable compilation of this filter you need to configure FFmpeg with
  1827. @code{--enable-libflite}.
  1828. Note that the flite library is not thread-safe.
  1829. The filter accepts the following options:
  1830. @table @option
  1831. @item list_voices
  1832. If set to 1, list the names of the available voices and exit
  1833. immediately. Default value is 0.
  1834. @item nb_samples, n
  1835. Set the maximum number of samples per frame. Default value is 512.
  1836. @item textfile
  1837. Set the filename containing the text to speak.
  1838. @item text
  1839. Set the text to speak.
  1840. @item voice, v
  1841. Set the voice to use for the speech synthesis. Default value is
  1842. @code{kal}. See also the @var{list_voices} option.
  1843. @end table
  1844. @subsection Examples
  1845. @itemize
  1846. @item
  1847. Read from file @file{speech.txt}, and synthetize the text using the
  1848. standard flite voice:
  1849. @example
  1850. flite=textfile=speech.txt
  1851. @end example
  1852. @item
  1853. Read the specified text selecting the @code{slt} voice:
  1854. @example
  1855. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1856. @end example
  1857. @item
  1858. Input text to ffmpeg:
  1859. @example
  1860. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  1861. @end example
  1862. @item
  1863. Make @file{ffplay} speak the specified text, using @code{flite} and
  1864. the @code{lavfi} device:
  1865. @example
  1866. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  1867. @end example
  1868. @end itemize
  1869. For more information about libflite, check:
  1870. @url{http://www.speech.cs.cmu.edu/flite/}
  1871. @section sine
  1872. Generate an audio signal made of a sine wave with amplitude 1/8.
  1873. The audio signal is bit-exact.
  1874. The filter accepts the following options:
  1875. @table @option
  1876. @item frequency, f
  1877. Set the carrier frequency. Default is 440 Hz.
  1878. @item beep_factor, b
  1879. Enable a periodic beep every second with frequency @var{beep_factor} times
  1880. the carrier frequency. Default is 0, meaning the beep is disabled.
  1881. @item sample_rate, r
  1882. Specify the sample rate, default is 44100.
  1883. @item duration, d
  1884. Specify the duration of the generated audio stream.
  1885. @item samples_per_frame
  1886. Set the number of samples per output frame, default is 1024.
  1887. @end table
  1888. @subsection Examples
  1889. @itemize
  1890. @item
  1891. Generate a simple 440 Hz sine wave:
  1892. @example
  1893. sine
  1894. @end example
  1895. @item
  1896. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  1897. @example
  1898. sine=220:4:d=5
  1899. sine=f=220:b=4:d=5
  1900. sine=frequency=220:beep_factor=4:duration=5
  1901. @end example
  1902. @end itemize
  1903. @c man end AUDIO SOURCES
  1904. @chapter Audio Sinks
  1905. @c man begin AUDIO SINKS
  1906. Below is a description of the currently available audio sinks.
  1907. @section abuffersink
  1908. Buffer audio frames, and make them available to the end of filter chain.
  1909. This sink is mainly intended for programmatic use, in particular
  1910. through the interface defined in @file{libavfilter/buffersink.h}
  1911. or the options system.
  1912. It accepts a pointer to an AVABufferSinkContext structure, which
  1913. defines the incoming buffers' formats, to be passed as the opaque
  1914. parameter to @code{avfilter_init_filter} for initialization.
  1915. @section anullsink
  1916. Null audio sink; do absolutely nothing with the input audio. It is
  1917. mainly useful as a template and for use in analysis / debugging
  1918. tools.
  1919. @c man end AUDIO SINKS
  1920. @chapter Video Filters
  1921. @c man begin VIDEO FILTERS
  1922. When you configure your FFmpeg build, you can disable any of the
  1923. existing filters using @code{--disable-filters}.
  1924. The configure output will show the video filters included in your
  1925. build.
  1926. Below is a description of the currently available video filters.
  1927. @section alphaextract
  1928. Extract the alpha component from the input as a grayscale video. This
  1929. is especially useful with the @var{alphamerge} filter.
  1930. @section alphamerge
  1931. Add or replace the alpha component of the primary input with the
  1932. grayscale value of a second input. This is intended for use with
  1933. @var{alphaextract} to allow the transmission or storage of frame
  1934. sequences that have alpha in a format that doesn't support an alpha
  1935. channel.
  1936. For example, to reconstruct full frames from a normal YUV-encoded video
  1937. and a separate video created with @var{alphaextract}, you might use:
  1938. @example
  1939. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  1940. @end example
  1941. Since this filter is designed for reconstruction, it operates on frame
  1942. sequences without considering timestamps, and terminates when either
  1943. input reaches end of stream. This will cause problems if your encoding
  1944. pipeline drops frames. If you're trying to apply an image as an
  1945. overlay to a video stream, consider the @var{overlay} filter instead.
  1946. @section ass
  1947. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  1948. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  1949. Substation Alpha) subtitles files.
  1950. @section bbox
  1951. Compute the bounding box for the non-black pixels in the input frame
  1952. luminance plane.
  1953. This filter computes the bounding box containing all the pixels with a
  1954. luminance value greater than the minimum allowed value.
  1955. The parameters describing the bounding box are printed on the filter
  1956. log.
  1957. The filter accepts the following option:
  1958. @table @option
  1959. @item min_val
  1960. Set the minimal luminance value. Default is @code{16}.
  1961. @end table
  1962. @section blackdetect
  1963. Detect video intervals that are (almost) completely black. Can be
  1964. useful to detect chapter transitions, commercials, or invalid
  1965. recordings. Output lines contains the time for the start, end and
  1966. duration of the detected black interval expressed in seconds.
  1967. In order to display the output lines, you need to set the loglevel at
  1968. least to the AV_LOG_INFO value.
  1969. The filter accepts the following options:
  1970. @table @option
  1971. @item black_min_duration, d
  1972. Set the minimum detected black duration expressed in seconds. It must
  1973. be a non-negative floating point number.
  1974. Default value is 2.0.
  1975. @item picture_black_ratio_th, pic_th
  1976. Set the threshold for considering a picture "black".
  1977. Express the minimum value for the ratio:
  1978. @example
  1979. @var{nb_black_pixels} / @var{nb_pixels}
  1980. @end example
  1981. for which a picture is considered black.
  1982. Default value is 0.98.
  1983. @item pixel_black_th, pix_th
  1984. Set the threshold for considering a pixel "black".
  1985. The threshold expresses the maximum pixel luminance value for which a
  1986. pixel is considered "black". The provided value is scaled according to
  1987. the following equation:
  1988. @example
  1989. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  1990. @end example
  1991. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  1992. the input video format, the range is [0-255] for YUV full-range
  1993. formats and [16-235] for YUV non full-range formats.
  1994. Default value is 0.10.
  1995. @end table
  1996. The following example sets the maximum pixel threshold to the minimum
  1997. value, and detects only black intervals of 2 or more seconds:
  1998. @example
  1999. blackdetect=d=2:pix_th=0.00
  2000. @end example
  2001. @section blackframe
  2002. Detect frames that are (almost) completely black. Can be useful to
  2003. detect chapter transitions or commercials. Output lines consist of
  2004. the frame number of the detected frame, the percentage of blackness,
  2005. the position in the file if known or -1 and the timestamp in seconds.
  2006. In order to display the output lines, you need to set the loglevel at
  2007. least to the AV_LOG_INFO value.
  2008. It accepts the following parameters:
  2009. @table @option
  2010. @item amount
  2011. The percentage of the pixels that have to be below the threshold; it defaults to
  2012. @code{98}.
  2013. @item threshold, thresh
  2014. The threshold below which a pixel value is considered black; it defaults to
  2015. @code{32}.
  2016. @end table
  2017. @section blend
  2018. Blend two video frames into each other.
  2019. It takes two input streams and outputs one stream, the first input is the
  2020. "top" layer and second input is "bottom" layer.
  2021. Output terminates when shortest input terminates.
  2022. A description of the accepted options follows.
  2023. @table @option
  2024. @item c0_mode
  2025. @item c1_mode
  2026. @item c2_mode
  2027. @item c3_mode
  2028. @item all_mode
  2029. Set blend mode for specific pixel component or all pixel components in case
  2030. of @var{all_mode}. Default value is @code{normal}.
  2031. Available values for component modes are:
  2032. @table @samp
  2033. @item addition
  2034. @item and
  2035. @item average
  2036. @item burn
  2037. @item darken
  2038. @item difference
  2039. @item divide
  2040. @item dodge
  2041. @item exclusion
  2042. @item hardlight
  2043. @item lighten
  2044. @item multiply
  2045. @item negation
  2046. @item normal
  2047. @item or
  2048. @item overlay
  2049. @item phoenix
  2050. @item pinlight
  2051. @item reflect
  2052. @item screen
  2053. @item softlight
  2054. @item subtract
  2055. @item vividlight
  2056. @item xor
  2057. @end table
  2058. @item c0_opacity
  2059. @item c1_opacity
  2060. @item c2_opacity
  2061. @item c3_opacity
  2062. @item all_opacity
  2063. Set blend opacity for specific pixel component or all pixel components in case
  2064. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  2065. @item c0_expr
  2066. @item c1_expr
  2067. @item c2_expr
  2068. @item c3_expr
  2069. @item all_expr
  2070. Set blend expression for specific pixel component or all pixel components in case
  2071. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  2072. The expressions can use the following variables:
  2073. @table @option
  2074. @item N
  2075. The sequential number of the filtered frame, starting from @code{0}.
  2076. @item X
  2077. @item Y
  2078. the coordinates of the current sample
  2079. @item W
  2080. @item H
  2081. the width and height of currently filtered plane
  2082. @item SW
  2083. @item SH
  2084. Width and height scale depending on the currently filtered plane. It is the
  2085. ratio between the corresponding luma plane number of pixels and the current
  2086. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  2087. @code{0.5,0.5} for chroma planes.
  2088. @item T
  2089. Time of the current frame, expressed in seconds.
  2090. @item TOP, A
  2091. Value of pixel component at current location for first video frame (top layer).
  2092. @item BOTTOM, B
  2093. Value of pixel component at current location for second video frame (bottom layer).
  2094. @end table
  2095. @item shortest
  2096. Force termination when the shortest input terminates. Default is @code{0}.
  2097. @item repeatlast
  2098. Continue applying the last bottom frame after the end of the stream. A value of
  2099. @code{0} disable the filter after the last frame of the bottom layer is reached.
  2100. Default is @code{1}.
  2101. @end table
  2102. @subsection Examples
  2103. @itemize
  2104. @item
  2105. Apply transition from bottom layer to top layer in first 10 seconds:
  2106. @example
  2107. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  2108. @end example
  2109. @item
  2110. Apply 1x1 checkerboard effect:
  2111. @example
  2112. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  2113. @end example
  2114. @item
  2115. Apply uncover left effect:
  2116. @example
  2117. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  2118. @end example
  2119. @item
  2120. Apply uncover down effect:
  2121. @example
  2122. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  2123. @end example
  2124. @item
  2125. Apply uncover up-left effect:
  2126. @example
  2127. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  2128. @end example
  2129. @end itemize
  2130. @section boxblur
  2131. Apply a boxblur algorithm to the input video.
  2132. It accepts the following parameters:
  2133. @table @option
  2134. @item luma_radius, lr
  2135. @item luma_power, lp
  2136. @item chroma_radius, cr
  2137. @item chroma_power, cp
  2138. @item alpha_radius, ar
  2139. @item alpha_power, ap
  2140. @end table
  2141. A description of the accepted options follows.
  2142. @table @option
  2143. @item luma_radius, lr
  2144. @item chroma_radius, cr
  2145. @item alpha_radius, ar
  2146. Set an expression for the box radius in pixels used for blurring the
  2147. corresponding input plane.
  2148. The radius value must be a non-negative number, and must not be
  2149. greater than the value of the expression @code{min(w,h)/2} for the
  2150. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  2151. planes.
  2152. Default value for @option{luma_radius} is "2". If not specified,
  2153. @option{chroma_radius} and @option{alpha_radius} default to the
  2154. corresponding value set for @option{luma_radius}.
  2155. The expressions can contain the following constants:
  2156. @table @option
  2157. @item w
  2158. @item h
  2159. The input width and height in pixels.
  2160. @item cw
  2161. @item ch
  2162. The input chroma image width and height in pixels.
  2163. @item hsub
  2164. @item vsub
  2165. The horizontal and vertical chroma subsample values. For example, for the
  2166. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  2167. @end table
  2168. @item luma_power, lp
  2169. @item chroma_power, cp
  2170. @item alpha_power, ap
  2171. Specify how many times the boxblur filter is applied to the
  2172. corresponding plane.
  2173. Default value for @option{luma_power} is 2. If not specified,
  2174. @option{chroma_power} and @option{alpha_power} default to the
  2175. corresponding value set for @option{luma_power}.
  2176. A value of 0 will disable the effect.
  2177. @end table
  2178. @subsection Examples
  2179. @itemize
  2180. @item
  2181. Apply a boxblur filter with the luma, chroma, and alpha radii
  2182. set to 2:
  2183. @example
  2184. boxblur=luma_radius=2:luma_power=1
  2185. boxblur=2:1
  2186. @end example
  2187. @item
  2188. Set the luma radius to 2, and alpha and chroma radius to 0:
  2189. @example
  2190. boxblur=2:1:cr=0:ar=0
  2191. @end example
  2192. @item
  2193. Set the luma and chroma radii to a fraction of the video dimension:
  2194. @example
  2195. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  2196. @end example
  2197. @end itemize
  2198. @section codecview
  2199. Visualize information exported by some codecs.
  2200. Some codecs can export information through frames using side-data or other
  2201. means. For example, some MPEG based codecs export motion vectors through the
  2202. @var{export_mvs} flag in the codec @option{flags2} option.
  2203. The filter accepts the following option:
  2204. @table @option
  2205. @item mv
  2206. Set motion vectors to visualize.
  2207. Available flags for @var{mv} are:
  2208. @table @samp
  2209. @item pf
  2210. forward predicted MVs of P-frames
  2211. @item bf
  2212. forward predicted MVs of B-frames
  2213. @item bb
  2214. backward predicted MVs of B-frames
  2215. @end table
  2216. @end table
  2217. @subsection Examples
  2218. @itemize
  2219. @item
  2220. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  2221. @example
  2222. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  2223. @end example
  2224. @end itemize
  2225. @section colorbalance
  2226. Modify intensity of primary colors (red, green and blue) of input frames.
  2227. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  2228. regions for the red-cyan, green-magenta or blue-yellow balance.
  2229. A positive adjustment value shifts the balance towards the primary color, a negative
  2230. value towards the complementary color.
  2231. The filter accepts the following options:
  2232. @table @option
  2233. @item rs
  2234. @item gs
  2235. @item bs
  2236. Adjust red, green and blue shadows (darkest pixels).
  2237. @item rm
  2238. @item gm
  2239. @item bm
  2240. Adjust red, green and blue midtones (medium pixels).
  2241. @item rh
  2242. @item gh
  2243. @item bh
  2244. Adjust red, green and blue highlights (brightest pixels).
  2245. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  2246. @end table
  2247. @subsection Examples
  2248. @itemize
  2249. @item
  2250. Add red color cast to shadows:
  2251. @example
  2252. colorbalance=rs=.3
  2253. @end example
  2254. @end itemize
  2255. @section colorchannelmixer
  2256. Adjust video input frames by re-mixing color channels.
  2257. This filter modifies a color channel by adding the values associated to
  2258. the other channels of the same pixels. For example if the value to
  2259. modify is red, the output value will be:
  2260. @example
  2261. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  2262. @end example
  2263. The filter accepts the following options:
  2264. @table @option
  2265. @item rr
  2266. @item rg
  2267. @item rb
  2268. @item ra
  2269. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  2270. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  2271. @item gr
  2272. @item gg
  2273. @item gb
  2274. @item ga
  2275. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  2276. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  2277. @item br
  2278. @item bg
  2279. @item bb
  2280. @item ba
  2281. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  2282. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  2283. @item ar
  2284. @item ag
  2285. @item ab
  2286. @item aa
  2287. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  2288. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  2289. Allowed ranges for options are @code{[-2.0, 2.0]}.
  2290. @end table
  2291. @subsection Examples
  2292. @itemize
  2293. @item
  2294. Convert source to grayscale:
  2295. @example
  2296. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  2297. @end example
  2298. @item
  2299. Simulate sepia tones:
  2300. @example
  2301. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  2302. @end example
  2303. @end itemize
  2304. @section colormatrix
  2305. Convert color matrix.
  2306. The filter accepts the following options:
  2307. @table @option
  2308. @item src
  2309. @item dst
  2310. Specify the source and destination color matrix. Both values must be
  2311. specified.
  2312. The accepted values are:
  2313. @table @samp
  2314. @item bt709
  2315. BT.709
  2316. @item bt601
  2317. BT.601
  2318. @item smpte240m
  2319. SMPTE-240M
  2320. @item fcc
  2321. FCC
  2322. @end table
  2323. @end table
  2324. For example to convert from BT.601 to SMPTE-240M, use the command:
  2325. @example
  2326. colormatrix=bt601:smpte240m
  2327. @end example
  2328. @section copy
  2329. Copy the input source unchanged to the output. This is mainly useful for
  2330. testing purposes.
  2331. @section crop
  2332. Crop the input video to given dimensions.
  2333. It accepts the following parameters:
  2334. @table @option
  2335. @item w, out_w
  2336. The width of the output video. It defaults to @code{iw}.
  2337. This expression is evaluated only once during the filter
  2338. configuration.
  2339. @item h, out_h
  2340. The height of the output video. It defaults to @code{ih}.
  2341. This expression is evaluated only once during the filter
  2342. configuration.
  2343. @item x
  2344. The horizontal position, in the input video, of the left edge of the output
  2345. video. It defaults to @code{(in_w-out_w)/2}.
  2346. This expression is evaluated per-frame.
  2347. @item y
  2348. The vertical position, in the input video, of the top edge of the output video.
  2349. It defaults to @code{(in_h-out_h)/2}.
  2350. This expression is evaluated per-frame.
  2351. @item keep_aspect
  2352. If set to 1 will force the output display aspect ratio
  2353. to be the same of the input, by changing the output sample aspect
  2354. ratio. It defaults to 0.
  2355. @end table
  2356. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  2357. expressions containing the following constants:
  2358. @table @option
  2359. @item x
  2360. @item y
  2361. The computed values for @var{x} and @var{y}. They are evaluated for
  2362. each new frame.
  2363. @item in_w
  2364. @item in_h
  2365. The input width and height.
  2366. @item iw
  2367. @item ih
  2368. These are the same as @var{in_w} and @var{in_h}.
  2369. @item out_w
  2370. @item out_h
  2371. The output (cropped) width and height.
  2372. @item ow
  2373. @item oh
  2374. These are the same as @var{out_w} and @var{out_h}.
  2375. @item a
  2376. same as @var{iw} / @var{ih}
  2377. @item sar
  2378. input sample aspect ratio
  2379. @item dar
  2380. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  2381. @item hsub
  2382. @item vsub
  2383. horizontal and vertical chroma subsample values. For example for the
  2384. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2385. @item n
  2386. The number of the input frame, starting from 0.
  2387. @item pos
  2388. the position in the file of the input frame, NAN if unknown
  2389. @item t
  2390. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  2391. @end table
  2392. The expression for @var{out_w} may depend on the value of @var{out_h},
  2393. and the expression for @var{out_h} may depend on @var{out_w}, but they
  2394. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  2395. evaluated after @var{out_w} and @var{out_h}.
  2396. The @var{x} and @var{y} parameters specify the expressions for the
  2397. position of the top-left corner of the output (non-cropped) area. They
  2398. are evaluated for each frame. If the evaluated value is not valid, it
  2399. is approximated to the nearest valid value.
  2400. The expression for @var{x} may depend on @var{y}, and the expression
  2401. for @var{y} may depend on @var{x}.
  2402. @subsection Examples
  2403. @itemize
  2404. @item
  2405. Crop area with size 100x100 at position (12,34).
  2406. @example
  2407. crop=100:100:12:34
  2408. @end example
  2409. Using named options, the example above becomes:
  2410. @example
  2411. crop=w=100:h=100:x=12:y=34
  2412. @end example
  2413. @item
  2414. Crop the central input area with size 100x100:
  2415. @example
  2416. crop=100:100
  2417. @end example
  2418. @item
  2419. Crop the central input area with size 2/3 of the input video:
  2420. @example
  2421. crop=2/3*in_w:2/3*in_h
  2422. @end example
  2423. @item
  2424. Crop the input video central square:
  2425. @example
  2426. crop=out_w=in_h
  2427. crop=in_h
  2428. @end example
  2429. @item
  2430. Delimit the rectangle with the top-left corner placed at position
  2431. 100:100 and the right-bottom corner corresponding to the right-bottom
  2432. corner of the input image.
  2433. @example
  2434. crop=in_w-100:in_h-100:100:100
  2435. @end example
  2436. @item
  2437. Crop 10 pixels from the left and right borders, and 20 pixels from
  2438. the top and bottom borders
  2439. @example
  2440. crop=in_w-2*10:in_h-2*20
  2441. @end example
  2442. @item
  2443. Keep only the bottom right quarter of the input image:
  2444. @example
  2445. crop=in_w/2:in_h/2:in_w/2:in_h/2
  2446. @end example
  2447. @item
  2448. Crop height for getting Greek harmony:
  2449. @example
  2450. crop=in_w:1/PHI*in_w
  2451. @end example
  2452. @item
  2453. Appply trembling effect:
  2454. @example
  2455. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
  2456. @end example
  2457. @item
  2458. Apply erratic camera effect depending on timestamp:
  2459. @example
  2460. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
  2461. @end example
  2462. @item
  2463. Set x depending on the value of y:
  2464. @example
  2465. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  2466. @end example
  2467. @end itemize
  2468. @section cropdetect
  2469. Auto-detect the crop size.
  2470. It calculates the necessary cropping parameters and prints the
  2471. recommended parameters via the logging system. The detected dimensions
  2472. correspond to the non-black area of the input video.
  2473. It accepts the following parameters:
  2474. @table @option
  2475. @item limit
  2476. Set higher black value threshold, which can be optionally specified
  2477. from nothing (0) to everything (255). An intensity value greater
  2478. to the set value is considered non-black. It defaults to 24.
  2479. @item round
  2480. The value which the width/height should be divisible by. It defaults to
  2481. 16. The offset is automatically adjusted to center the video. Use 2 to
  2482. get only even dimensions (needed for 4:2:2 video). 16 is best when
  2483. encoding to most video codecs.
  2484. @item reset_count, reset
  2485. Set the counter that determines after how many frames cropdetect will
  2486. reset the previously detected largest video area and start over to
  2487. detect the current optimal crop area. Default value is 0.
  2488. This can be useful when channel logos distort the video area. 0
  2489. indicates 'never reset', and returns the largest area encountered during
  2490. playback.
  2491. @end table
  2492. @anchor{curves}
  2493. @section curves
  2494. Apply color adjustments using curves.
  2495. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  2496. component (red, green and blue) has its values defined by @var{N} key points
  2497. tied from each other using a smooth curve. The x-axis represents the pixel
  2498. values from the input frame, and the y-axis the new pixel values to be set for
  2499. the output frame.
  2500. By default, a component curve is defined by the two points @var{(0;0)} and
  2501. @var{(1;1)}. This creates a straight line where each original pixel value is
  2502. "adjusted" to its own value, which means no change to the image.
  2503. The filter allows you to redefine these two points and add some more. A new
  2504. curve (using a natural cubic spline interpolation) will be define to pass
  2505. smoothly through all these new coordinates. The new defined points needs to be
  2506. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  2507. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  2508. the vector spaces, the values will be clipped accordingly.
  2509. If there is no key point defined in @code{x=0}, the filter will automatically
  2510. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  2511. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  2512. The filter accepts the following options:
  2513. @table @option
  2514. @item preset
  2515. Select one of the available color presets. This option can be used in addition
  2516. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  2517. options takes priority on the preset values.
  2518. Available presets are:
  2519. @table @samp
  2520. @item none
  2521. @item color_negative
  2522. @item cross_process
  2523. @item darker
  2524. @item increase_contrast
  2525. @item lighter
  2526. @item linear_contrast
  2527. @item medium_contrast
  2528. @item negative
  2529. @item strong_contrast
  2530. @item vintage
  2531. @end table
  2532. Default is @code{none}.
  2533. @item master, m
  2534. Set the master key points. These points will define a second pass mapping. It
  2535. is sometimes called a "luminance" or "value" mapping. It can be used with
  2536. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  2537. post-processing LUT.
  2538. @item red, r
  2539. Set the key points for the red component.
  2540. @item green, g
  2541. Set the key points for the green component.
  2542. @item blue, b
  2543. Set the key points for the blue component.
  2544. @item all
  2545. Set the key points for all components (not including master).
  2546. Can be used in addition to the other key points component
  2547. options. In this case, the unset component(s) will fallback on this
  2548. @option{all} setting.
  2549. @item psfile
  2550. Specify a Photoshop curves file (@code{.asv}) to import the settings from.
  2551. @end table
  2552. To avoid some filtergraph syntax conflicts, each key points list need to be
  2553. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  2554. @subsection Examples
  2555. @itemize
  2556. @item
  2557. Increase slightly the middle level of blue:
  2558. @example
  2559. curves=blue='0.5/0.58'
  2560. @end example
  2561. @item
  2562. Vintage effect:
  2563. @example
  2564. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  2565. @end example
  2566. Here we obtain the following coordinates for each components:
  2567. @table @var
  2568. @item red
  2569. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  2570. @item green
  2571. @code{(0;0) (0.50;0.48) (1;1)}
  2572. @item blue
  2573. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  2574. @end table
  2575. @item
  2576. The previous example can also be achieved with the associated built-in preset:
  2577. @example
  2578. curves=preset=vintage
  2579. @end example
  2580. @item
  2581. Or simply:
  2582. @example
  2583. curves=vintage
  2584. @end example
  2585. @item
  2586. Use a Photoshop preset and redefine the points of the green component:
  2587. @example
  2588. curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
  2589. @end example
  2590. @end itemize
  2591. @section dctdnoiz
  2592. Denoise frames using 2D DCT (frequency domain filtering).
  2593. This filter is not designed for real time.
  2594. The filter accepts the following options:
  2595. @table @option
  2596. @item sigma, s
  2597. Set the noise sigma constant.
  2598. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  2599. coefficient (absolute value) below this threshold with be dropped.
  2600. If you need a more advanced filtering, see @option{expr}.
  2601. Default is @code{0}.
  2602. @item overlap
  2603. Set number overlapping pixels for each block. Since the filter can be slow, you
  2604. may want to reduce this value, at the cost of a less effective filter and the
  2605. risk of various artefacts.
  2606. If the overlapping value doesn't permit processing the whole input width or
  2607. height, a warning will be displayed and according borders won't be denoised.
  2608. Default value is @var{blocksize}-1, which is the best possible setting.
  2609. @item expr, e
  2610. Set the coefficient factor expression.
  2611. For each coefficient of a DCT block, this expression will be evaluated as a
  2612. multiplier value for the coefficient.
  2613. If this is option is set, the @option{sigma} option will be ignored.
  2614. The absolute value of the coefficient can be accessed through the @var{c}
  2615. variable.
  2616. @item n
  2617. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  2618. @var{blocksize}, which is the width and height of the processed blocks.
  2619. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  2620. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  2621. on the speed processing. Also, a larger block size does not necessarily means a
  2622. better de-noising.
  2623. @end table
  2624. @subsection Examples
  2625. Apply a denoise with a @option{sigma} of @code{4.5}:
  2626. @example
  2627. dctdnoiz=4.5
  2628. @end example
  2629. The same operation can be achieved using the expression system:
  2630. @example
  2631. dctdnoiz=e='gte(c, 4.5*3)'
  2632. @end example
  2633. Violent denoise using a block size of @code{16x16}:
  2634. @example
  2635. dctdnoiz=15:n=4
  2636. @end example
  2637. @anchor{decimate}
  2638. @section decimate
  2639. Drop duplicated frames at regular intervals.
  2640. The filter accepts the following options:
  2641. @table @option
  2642. @item cycle
  2643. Set the number of frames from which one will be dropped. Setting this to
  2644. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  2645. Default is @code{5}.
  2646. @item dupthresh
  2647. Set the threshold for duplicate detection. If the difference metric for a frame
  2648. is less than or equal to this value, then it is declared as duplicate. Default
  2649. is @code{1.1}
  2650. @item scthresh
  2651. Set scene change threshold. Default is @code{15}.
  2652. @item blockx
  2653. @item blocky
  2654. Set the size of the x and y-axis blocks used during metric calculations.
  2655. Larger blocks give better noise suppression, but also give worse detection of
  2656. small movements. Must be a power of two. Default is @code{32}.
  2657. @item ppsrc
  2658. Mark main input as a pre-processed input and activate clean source input
  2659. stream. This allows the input to be pre-processed with various filters to help
  2660. the metrics calculation while keeping the frame selection lossless. When set to
  2661. @code{1}, the first stream is for the pre-processed input, and the second
  2662. stream is the clean source from where the kept frames are chosen. Default is
  2663. @code{0}.
  2664. @item chroma
  2665. Set whether or not chroma is considered in the metric calculations. Default is
  2666. @code{1}.
  2667. @end table
  2668. @section dejudder
  2669. Remove judder produced by partially interlaced telecined content.
  2670. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  2671. source was partially telecined content then the output of @code{pullup,dejudder}
  2672. will have a variable frame rate. May change the recorded frame rate of the
  2673. container. Aside from that change, this filter will not affect constant frame
  2674. rate video.
  2675. The option available in this filter is:
  2676. @table @option
  2677. @item cycle
  2678. Specify the length of the window over which the judder repeats.
  2679. Accepts any integer greater than 1. Useful values are:
  2680. @table @samp
  2681. @item 4
  2682. If the original was telecined from 24 to 30 fps (Film to NTSC).
  2683. @item 5
  2684. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  2685. @item 20
  2686. If a mixture of the two.
  2687. @end table
  2688. The default is @samp{4}.
  2689. @end table
  2690. @section delogo
  2691. Suppress a TV station logo by a simple interpolation of the surrounding
  2692. pixels. Just set a rectangle covering the logo and watch it disappear
  2693. (and sometimes something even uglier appear - your mileage may vary).
  2694. It accepts the following parameters:
  2695. @table @option
  2696. @item x
  2697. @item y
  2698. Specify the top left corner coordinates of the logo. They must be
  2699. specified.
  2700. @item w
  2701. @item h
  2702. Specify the width and height of the logo to clear. They must be
  2703. specified.
  2704. @item band, t
  2705. Specify the thickness of the fuzzy edge of the rectangle (added to
  2706. @var{w} and @var{h}). The default value is 4.
  2707. @item show
  2708. When set to 1, a green rectangle is drawn on the screen to simplify
  2709. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  2710. The default value is 0.
  2711. The rectangle is drawn on the outermost pixels which will be (partly)
  2712. replaced with interpolated values. The values of the next pixels
  2713. immediately outside this rectangle in each direction will be used to
  2714. compute the interpolated pixel values inside the rectangle.
  2715. @end table
  2716. @subsection Examples
  2717. @itemize
  2718. @item
  2719. Set a rectangle covering the area with top left corner coordinates 0,0
  2720. and size 100x77, and a band of size 10:
  2721. @example
  2722. delogo=x=0:y=0:w=100:h=77:band=10
  2723. @end example
  2724. @end itemize
  2725. @section deshake
  2726. Attempt to fix small changes in horizontal and/or vertical shift. This
  2727. filter helps remove camera shake from hand-holding a camera, bumping a
  2728. tripod, moving on a vehicle, etc.
  2729. The filter accepts the following options:
  2730. @table @option
  2731. @item x
  2732. @item y
  2733. @item w
  2734. @item h
  2735. Specify a rectangular area where to limit the search for motion
  2736. vectors.
  2737. If desired the search for motion vectors can be limited to a
  2738. rectangular area of the frame defined by its top left corner, width
  2739. and height. These parameters have the same meaning as the drawbox
  2740. filter which can be used to visualise the position of the bounding
  2741. box.
  2742. This is useful when simultaneous movement of subjects within the frame
  2743. might be confused for camera motion by the motion vector search.
  2744. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  2745. then the full frame is used. This allows later options to be set
  2746. without specifying the bounding box for the motion vector search.
  2747. Default - search the whole frame.
  2748. @item rx
  2749. @item ry
  2750. Specify the maximum extent of movement in x and y directions in the
  2751. range 0-64 pixels. Default 16.
  2752. @item edge
  2753. Specify how to generate pixels to fill blanks at the edge of the
  2754. frame. Available values are:
  2755. @table @samp
  2756. @item blank, 0
  2757. Fill zeroes at blank locations
  2758. @item original, 1
  2759. Original image at blank locations
  2760. @item clamp, 2
  2761. Extruded edge value at blank locations
  2762. @item mirror, 3
  2763. Mirrored edge at blank locations
  2764. @end table
  2765. Default value is @samp{mirror}.
  2766. @item blocksize
  2767. Specify the blocksize to use for motion search. Range 4-128 pixels,
  2768. default 8.
  2769. @item contrast
  2770. Specify the contrast threshold for blocks. Only blocks with more than
  2771. the specified contrast (difference between darkest and lightest
  2772. pixels) will be considered. Range 1-255, default 125.
  2773. @item search
  2774. Specify the search strategy. Available values are:
  2775. @table @samp
  2776. @item exhaustive, 0
  2777. Set exhaustive search
  2778. @item less, 1
  2779. Set less exhaustive search.
  2780. @end table
  2781. Default value is @samp{exhaustive}.
  2782. @item filename
  2783. If set then a detailed log of the motion search is written to the
  2784. specified file.
  2785. @item opencl
  2786. If set to 1, specify using OpenCL capabilities, only available if
  2787. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  2788. @end table
  2789. @section drawbox
  2790. Draw a colored box on the input image.
  2791. It accepts the following parameters:
  2792. @table @option
  2793. @item x
  2794. @item y
  2795. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  2796. @item width, w
  2797. @item height, h
  2798. The expressions which specify the width and height of the box; if 0 they are interpreted as
  2799. the input width and height. It defaults to 0.
  2800. @item color, c
  2801. Specify the color of the box to write. For the general syntax of this option,
  2802. check the "Color" section in the ffmpeg-utils manual. If the special
  2803. value @code{invert} is used, the box edge color is the same as the
  2804. video with inverted luma.
  2805. @item thickness, t
  2806. The expression which sets the thickness of the box edge. Default value is @code{3}.
  2807. See below for the list of accepted constants.
  2808. @end table
  2809. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2810. following constants:
  2811. @table @option
  2812. @item dar
  2813. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2814. @item hsub
  2815. @item vsub
  2816. horizontal and vertical chroma subsample values. For example for the
  2817. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2818. @item in_h, ih
  2819. @item in_w, iw
  2820. The input width and height.
  2821. @item sar
  2822. The input sample aspect ratio.
  2823. @item x
  2824. @item y
  2825. The x and y offset coordinates where the box is drawn.
  2826. @item w
  2827. @item h
  2828. The width and height of the drawn box.
  2829. @item t
  2830. The thickness of the drawn box.
  2831. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2832. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2833. @end table
  2834. @subsection Examples
  2835. @itemize
  2836. @item
  2837. Draw a black box around the edge of the input image:
  2838. @example
  2839. drawbox
  2840. @end example
  2841. @item
  2842. Draw a box with color red and an opacity of 50%:
  2843. @example
  2844. drawbox=10:20:200:60:red@@0.5
  2845. @end example
  2846. The previous example can be specified as:
  2847. @example
  2848. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  2849. @end example
  2850. @item
  2851. Fill the box with pink color:
  2852. @example
  2853. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  2854. @end example
  2855. @item
  2856. Draw a 2-pixel red 2.40:1 mask:
  2857. @example
  2858. drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
  2859. @end example
  2860. @end itemize
  2861. @section drawgrid
  2862. Draw a grid on the input image.
  2863. It accepts the following parameters:
  2864. @table @option
  2865. @item x
  2866. @item y
  2867. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  2868. @item width, w
  2869. @item height, h
  2870. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  2871. input width and height, respectively, minus @code{thickness}, so image gets
  2872. framed. Default to 0.
  2873. @item color, c
  2874. Specify the color of the grid. For the general syntax of this option,
  2875. check the "Color" section in the ffmpeg-utils manual. If the special
  2876. value @code{invert} is used, the grid color is the same as the
  2877. video with inverted luma.
  2878. @item thickness, t
  2879. The expression which sets the thickness of the grid line. Default value is @code{1}.
  2880. See below for the list of accepted constants.
  2881. @end table
  2882. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  2883. following constants:
  2884. @table @option
  2885. @item dar
  2886. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  2887. @item hsub
  2888. @item vsub
  2889. horizontal and vertical chroma subsample values. For example for the
  2890. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  2891. @item in_h, ih
  2892. @item in_w, iw
  2893. The input grid cell width and height.
  2894. @item sar
  2895. The input sample aspect ratio.
  2896. @item x
  2897. @item y
  2898. The x and y coordinates of some point of grid intersection (meant to configure offset).
  2899. @item w
  2900. @item h
  2901. The width and height of the drawn cell.
  2902. @item t
  2903. The thickness of the drawn cell.
  2904. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  2905. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  2906. @end table
  2907. @subsection Examples
  2908. @itemize
  2909. @item
  2910. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  2911. @example
  2912. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  2913. @end example
  2914. @item
  2915. Draw a white 3x3 grid with an opacity of 50%:
  2916. @example
  2917. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  2918. @end example
  2919. @end itemize
  2920. @anchor{drawtext}
  2921. @section drawtext
  2922. Draw a text string or text from a specified file on top of a video, using the
  2923. libfreetype library.
  2924. To enable compilation of this filter, you need to configure FFmpeg with
  2925. @code{--enable-libfreetype}.
  2926. To enable default font fallback and the @var{font} option you need to
  2927. configure FFmpeg with @code{--enable-libfontconfig}.
  2928. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  2929. @code{--enable-libfribidi}.
  2930. @subsection Syntax
  2931. It accepts the following parameters:
  2932. @table @option
  2933. @item box
  2934. Used to draw a box around text using the background color.
  2935. The value must be either 1 (enable) or 0 (disable).
  2936. The default value of @var{box} is 0.
  2937. @item boxcolor
  2938. The color to be used for drawing box around text. For the syntax of this
  2939. option, check the "Color" section in the ffmpeg-utils manual.
  2940. The default value of @var{boxcolor} is "white".
  2941. @item borderw
  2942. Set the width of the border to be drawn around the text using @var{bordercolor}.
  2943. The default value of @var{borderw} is 0.
  2944. @item bordercolor
  2945. Set the color to be used for drawing border around text. For the syntax of this
  2946. option, check the "Color" section in the ffmpeg-utils manual.
  2947. The default value of @var{bordercolor} is "black".
  2948. @item expansion
  2949. Select how the @var{text} is expanded. Can be either @code{none},
  2950. @code{strftime} (deprecated) or
  2951. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  2952. below for details.
  2953. @item fix_bounds
  2954. If true, check and fix text coords to avoid clipping.
  2955. @item fontcolor
  2956. The color to be used for drawing fonts. For the syntax of this option, check
  2957. the "Color" section in the ffmpeg-utils manual.
  2958. The default value of @var{fontcolor} is "black".
  2959. @item fontcolor_expr
  2960. String which is expanded the same way as @var{text} to obtain dynamic
  2961. @var{fontcolor} value. By default this option has empty value and is not
  2962. processed. When this option is set, it overrides @var{fontcolor} option.
  2963. @item font
  2964. The font family to be used for drawing text. By default Sans.
  2965. @item fontfile
  2966. The font file to be used for drawing text. The path must be included.
  2967. This parameter is mandatory if the fontconfig support is disabled.
  2968. @item fontsize
  2969. The font size to be used for drawing text.
  2970. The default value of @var{fontsize} is 16.
  2971. @item text_shaping
  2972. If set to 1, attempt to shape the text (for example, reverse the order of
  2973. right-to-left text and join Arabic characters) before drawing it.
  2974. Otherwise, just draw the text exactly as given.
  2975. By default 1 (if supported).
  2976. @item ft_load_flags
  2977. The flags to be used for loading the fonts.
  2978. The flags map the corresponding flags supported by libfreetype, and are
  2979. a combination of the following values:
  2980. @table @var
  2981. @item default
  2982. @item no_scale
  2983. @item no_hinting
  2984. @item render
  2985. @item no_bitmap
  2986. @item vertical_layout
  2987. @item force_autohint
  2988. @item crop_bitmap
  2989. @item pedantic
  2990. @item ignore_global_advance_width
  2991. @item no_recurse
  2992. @item ignore_transform
  2993. @item monochrome
  2994. @item linear_design
  2995. @item no_autohint
  2996. @end table
  2997. Default value is "default".
  2998. For more information consult the documentation for the FT_LOAD_*
  2999. libfreetype flags.
  3000. @item shadowcolor
  3001. The color to be used for drawing a shadow behind the drawn text. For the
  3002. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  3003. The default value of @var{shadowcolor} is "black".
  3004. @item shadowx
  3005. @item shadowy
  3006. The x and y offsets for the text shadow position with respect to the
  3007. position of the text. They can be either positive or negative
  3008. values. The default value for both is "0".
  3009. @item start_number
  3010. The starting frame number for the n/frame_num variable. The default value
  3011. is "0".
  3012. @item tabsize
  3013. The size in number of spaces to use for rendering the tab.
  3014. Default value is 4.
  3015. @item timecode
  3016. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  3017. format. It can be used with or without text parameter. @var{timecode_rate}
  3018. option must be specified.
  3019. @item timecode_rate, rate, r
  3020. Set the timecode frame rate (timecode only).
  3021. @item text
  3022. The text string to be drawn. The text must be a sequence of UTF-8
  3023. encoded characters.
  3024. This parameter is mandatory if no file is specified with the parameter
  3025. @var{textfile}.
  3026. @item textfile
  3027. A text file containing text to be drawn. The text must be a sequence
  3028. of UTF-8 encoded characters.
  3029. This parameter is mandatory if no text string is specified with the
  3030. parameter @var{text}.
  3031. If both @var{text} and @var{textfile} are specified, an error is thrown.
  3032. @item reload
  3033. If set to 1, the @var{textfile} will be reloaded before each frame.
  3034. Be sure to update it atomically, or it may be read partially, or even fail.
  3035. @item x
  3036. @item y
  3037. The expressions which specify the offsets where text will be drawn
  3038. within the video frame. They are relative to the top/left border of the
  3039. output image.
  3040. The default value of @var{x} and @var{y} is "0".
  3041. See below for the list of accepted constants and functions.
  3042. @end table
  3043. The parameters for @var{x} and @var{y} are expressions containing the
  3044. following constants and functions:
  3045. @table @option
  3046. @item dar
  3047. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  3048. @item hsub
  3049. @item vsub
  3050. horizontal and vertical chroma subsample values. For example for the
  3051. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3052. @item line_h, lh
  3053. the height of each text line
  3054. @item main_h, h, H
  3055. the input height
  3056. @item main_w, w, W
  3057. the input width
  3058. @item max_glyph_a, ascent
  3059. the maximum distance from the baseline to the highest/upper grid
  3060. coordinate used to place a glyph outline point, for all the rendered
  3061. glyphs.
  3062. It is a positive value, due to the grid's orientation with the Y axis
  3063. upwards.
  3064. @item max_glyph_d, descent
  3065. the maximum distance from the baseline to the lowest grid coordinate
  3066. used to place a glyph outline point, for all the rendered glyphs.
  3067. This is a negative value, due to the grid's orientation, with the Y axis
  3068. upwards.
  3069. @item max_glyph_h
  3070. maximum glyph height, that is the maximum height for all the glyphs
  3071. contained in the rendered text, it is equivalent to @var{ascent} -
  3072. @var{descent}.
  3073. @item max_glyph_w
  3074. maximum glyph width, that is the maximum width for all the glyphs
  3075. contained in the rendered text
  3076. @item n
  3077. the number of input frame, starting from 0
  3078. @item rand(min, max)
  3079. return a random number included between @var{min} and @var{max}
  3080. @item sar
  3081. The input sample aspect ratio.
  3082. @item t
  3083. timestamp expressed in seconds, NAN if the input timestamp is unknown
  3084. @item text_h, th
  3085. the height of the rendered text
  3086. @item text_w, tw
  3087. the width of the rendered text
  3088. @item x
  3089. @item y
  3090. the x and y offset coordinates where the text is drawn.
  3091. These parameters allow the @var{x} and @var{y} expressions to refer
  3092. each other, so you can for example specify @code{y=x/dar}.
  3093. @end table
  3094. @anchor{drawtext_expansion}
  3095. @subsection Text expansion
  3096. If @option{expansion} is set to @code{strftime},
  3097. the filter recognizes strftime() sequences in the provided text and
  3098. expands them accordingly. Check the documentation of strftime(). This
  3099. feature is deprecated.
  3100. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  3101. If @option{expansion} is set to @code{normal} (which is the default),
  3102. the following expansion mechanism is used.
  3103. The backslash character '\', followed by any character, always expands to
  3104. the second character.
  3105. Sequence of the form @code{%@{...@}} are expanded. The text between the
  3106. braces is a function name, possibly followed by arguments separated by ':'.
  3107. If the arguments contain special characters or delimiters (':' or '@}'),
  3108. they should be escaped.
  3109. Note that they probably must also be escaped as the value for the
  3110. @option{text} option in the filter argument string and as the filter
  3111. argument in the filtergraph description, and possibly also for the shell,
  3112. that makes up to four levels of escaping; using a text file avoids these
  3113. problems.
  3114. The following functions are available:
  3115. @table @command
  3116. @item expr, e
  3117. The expression evaluation result.
  3118. It must take one argument specifying the expression to be evaluated,
  3119. which accepts the same constants and functions as the @var{x} and
  3120. @var{y} values. Note that not all constants should be used, for
  3121. example the text size is not known when evaluating the expression, so
  3122. the constants @var{text_w} and @var{text_h} will have an undefined
  3123. value.
  3124. @item expr_int_format, eif
  3125. Evaluate the expression's value and output as formatted integer.
  3126. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  3127. The second argument specifies the output format. Allowed values are 'x', 'X', 'd' and
  3128. 'u'. They are treated exactly as in the printf function.
  3129. The third parameter is optional and sets the number of positions taken by the output.
  3130. It can be used to add padding with zeros from the left.
  3131. @item gmtime
  3132. The time at which the filter is running, expressed in UTC.
  3133. It can accept an argument: a strftime() format string.
  3134. @item localtime
  3135. The time at which the filter is running, expressed in the local time zone.
  3136. It can accept an argument: a strftime() format string.
  3137. @item metadata
  3138. Frame metadata. It must take one argument specifying metadata key.
  3139. @item n, frame_num
  3140. The frame number, starting from 0.
  3141. @item pict_type
  3142. A 1 character description of the current picture type.
  3143. @item pts
  3144. The timestamp of the current frame.
  3145. It can take up to two arguments.
  3146. The first argument is the format of the timestamp; it defaults to @code{flt}
  3147. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  3148. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  3149. The second argument is an offset added to the timestamp.
  3150. @end table
  3151. @subsection Examples
  3152. @itemize
  3153. @item
  3154. Draw "Test Text" with font FreeSerif, using the default values for the
  3155. optional parameters.
  3156. @example
  3157. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  3158. @end example
  3159. @item
  3160. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  3161. and y=50 (counting from the top-left corner of the screen), text is
  3162. yellow with a red box around it. Both the text and the box have an
  3163. opacity of 20%.
  3164. @example
  3165. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  3166. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  3167. @end example
  3168. Note that the double quotes are not necessary if spaces are not used
  3169. within the parameter list.
  3170. @item
  3171. Show the text at the center of the video frame:
  3172. @example
  3173. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  3174. @end example
  3175. @item
  3176. Show a text line sliding from right to left in the last row of the video
  3177. frame. The file @file{LONG_LINE} is assumed to contain a single line
  3178. with no newlines.
  3179. @example
  3180. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  3181. @end example
  3182. @item
  3183. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  3184. @example
  3185. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  3186. @end example
  3187. @item
  3188. Draw a single green letter "g", at the center of the input video.
  3189. The glyph baseline is placed at half screen height.
  3190. @example
  3191. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  3192. @end example
  3193. @item
  3194. Show text for 1 second every 3 seconds:
  3195. @example
  3196. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  3197. @end example
  3198. @item
  3199. Use fontconfig to set the font. Note that the colons need to be escaped.
  3200. @example
  3201. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  3202. @end example
  3203. @item
  3204. Print the date of a real-time encoding (see strftime(3)):
  3205. @example
  3206. drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
  3207. @end example
  3208. @item
  3209. Show text fading in and out (appearing/disappearing):
  3210. @example
  3211. #!/bin/sh
  3212. DS=1.0 # display start
  3213. DE=10.0 # display end
  3214. FID=1.5 # fade in duration
  3215. FOD=5 # fade out duration
  3216. ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
  3217. @end example
  3218. @end itemize
  3219. For more information about libfreetype, check:
  3220. @url{http://www.freetype.org/}.
  3221. For more information about fontconfig, check:
  3222. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  3223. For more information about libfribidi, check:
  3224. @url{http://fribidi.org/}.
  3225. @section edgedetect
  3226. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  3227. The filter accepts the following options:
  3228. @table @option
  3229. @item low
  3230. @item high
  3231. Set low and high threshold values used by the Canny thresholding
  3232. algorithm.
  3233. The high threshold selects the "strong" edge pixels, which are then
  3234. connected through 8-connectivity with the "weak" edge pixels selected
  3235. by the low threshold.
  3236. @var{low} and @var{high} threshold values must be chosen in the range
  3237. [0,1], and @var{low} should be lesser or equal to @var{high}.
  3238. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  3239. is @code{50/255}.
  3240. @item mode
  3241. Define the drawing mode.
  3242. @table @samp
  3243. @item wires
  3244. Draw white/gray wires on black background.
  3245. @item colormix
  3246. Mix the colors to create a paint/cartoon effect.
  3247. @end table
  3248. Default value is @var{wires}.
  3249. @end table
  3250. @subsection Examples
  3251. @itemize
  3252. @item
  3253. Standard edge detection with custom values for the hysteresis thresholding:
  3254. @example
  3255. edgedetect=low=0.1:high=0.4
  3256. @end example
  3257. @item
  3258. Painting effect without thresholding:
  3259. @example
  3260. edgedetect=mode=colormix:high=0
  3261. @end example
  3262. @end itemize
  3263. @section extractplanes
  3264. Extract color channel components from input video stream into
  3265. separate grayscale video streams.
  3266. The filter accepts the following option:
  3267. @table @option
  3268. @item planes
  3269. Set plane(s) to extract.
  3270. Available values for planes are:
  3271. @table @samp
  3272. @item y
  3273. @item u
  3274. @item v
  3275. @item a
  3276. @item r
  3277. @item g
  3278. @item b
  3279. @end table
  3280. Choosing planes not available in the input will result in an error.
  3281. That means you cannot select @code{r}, @code{g}, @code{b} planes
  3282. with @code{y}, @code{u}, @code{v} planes at same time.
  3283. @end table
  3284. @subsection Examples
  3285. @itemize
  3286. @item
  3287. Extract luma, u and v color channel component from input video frame
  3288. into 3 grayscale outputs:
  3289. @example
  3290. ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
  3291. @end example
  3292. @end itemize
  3293. @section elbg
  3294. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  3295. For each input image, the filter will compute the optimal mapping from
  3296. the input to the output given the codebook length, that is the number
  3297. of distinct output colors.
  3298. This filter accepts the following options.
  3299. @table @option
  3300. @item codebook_length, l
  3301. Set codebook length. The value must be a positive integer, and
  3302. represents the number of distinct output colors. Default value is 256.
  3303. @item nb_steps, n
  3304. Set the maximum number of iterations to apply for computing the optimal
  3305. mapping. The higher the value the better the result and the higher the
  3306. computation time. Default value is 1.
  3307. @item seed, s
  3308. Set a random seed, must be an integer included between 0 and
  3309. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  3310. will try to use a good random seed on a best effort basis.
  3311. @end table
  3312. @section fade
  3313. Apply a fade-in/out effect to the input video.
  3314. It accepts the following parameters:
  3315. @table @option
  3316. @item type, t
  3317. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  3318. effect.
  3319. Default is @code{in}.
  3320. @item start_frame, s
  3321. Specify the number of the frame to start applying the fade
  3322. effect at. Default is 0.
  3323. @item nb_frames, n
  3324. The number of frames that the fade effect lasts. At the end of the
  3325. fade-in effect, the output video will have the same intensity as the input video.
  3326. At the end of the fade-out transition, the output video will be filled with the
  3327. selected @option{color}.
  3328. Default is 25.
  3329. @item alpha
  3330. If set to 1, fade only alpha channel, if one exists on the input.
  3331. Default value is 0.
  3332. @item start_time, st
  3333. Specify the timestamp (in seconds) of the frame to start to apply the fade
  3334. effect. If both start_frame and start_time are specified, the fade will start at
  3335. whichever comes last. Default is 0.
  3336. @item duration, d
  3337. The number of seconds for which the fade effect has to last. At the end of the
  3338. fade-in effect the output video will have the same intensity as the input video,
  3339. at the end of the fade-out transition the output video will be filled with the
  3340. selected @option{color}.
  3341. If both duration and nb_frames are specified, duration is used. Default is 0.
  3342. @item color, c
  3343. Specify the color of the fade. Default is "black".
  3344. @end table
  3345. @subsection Examples
  3346. @itemize
  3347. @item
  3348. Fade in the first 30 frames of video:
  3349. @example
  3350. fade=in:0:30
  3351. @end example
  3352. The command above is equivalent to:
  3353. @example
  3354. fade=t=in:s=0:n=30
  3355. @end example
  3356. @item
  3357. Fade out the last 45 frames of a 200-frame video:
  3358. @example
  3359. fade=out:155:45
  3360. fade=type=out:start_frame=155:nb_frames=45
  3361. @end example
  3362. @item
  3363. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  3364. @example
  3365. fade=in:0:25, fade=out:975:25
  3366. @end example
  3367. @item
  3368. Make the first 5 frames yellow, then fade in from frame 5-24:
  3369. @example
  3370. fade=in:5:20:color=yellow
  3371. @end example
  3372. @item
  3373. Fade in alpha over first 25 frames of video:
  3374. @example
  3375. fade=in:0:25:alpha=1
  3376. @end example
  3377. @item
  3378. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  3379. @example
  3380. fade=t=in:st=5.5:d=0.5
  3381. @end example
  3382. @end itemize
  3383. @section field
  3384. Extract a single field from an interlaced image using stride
  3385. arithmetic to avoid wasting CPU time. The output frames are marked as
  3386. non-interlaced.
  3387. The filter accepts the following options:
  3388. @table @option
  3389. @item type
  3390. Specify whether to extract the top (if the value is @code{0} or
  3391. @code{top}) or the bottom field (if the value is @code{1} or
  3392. @code{bottom}).
  3393. @end table
  3394. @section fieldmatch
  3395. Field matching filter for inverse telecine. It is meant to reconstruct the
  3396. progressive frames from a telecined stream. The filter does not drop duplicated
  3397. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  3398. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  3399. The separation of the field matching and the decimation is notably motivated by
  3400. the possibility of inserting a de-interlacing filter fallback between the two.
  3401. If the source has mixed telecined and real interlaced content,
  3402. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  3403. But these remaining combed frames will be marked as interlaced, and thus can be
  3404. de-interlaced by a later filter such as @ref{yadif} before decimation.
  3405. In addition to the various configuration options, @code{fieldmatch} can take an
  3406. optional second stream, activated through the @option{ppsrc} option. If
  3407. enabled, the frames reconstruction will be based on the fields and frames from
  3408. this second stream. This allows the first input to be pre-processed in order to
  3409. help the various algorithms of the filter, while keeping the output lossless
  3410. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  3411. or brightness/contrast adjustments can help.
  3412. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  3413. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  3414. which @code{fieldmatch} is based on. While the semantic and usage are very
  3415. close, some behaviour and options names can differ.
  3416. The filter accepts the following options:
  3417. @table @option
  3418. @item order
  3419. Specify the assumed field order of the input stream. Available values are:
  3420. @table @samp
  3421. @item auto
  3422. Auto detect parity (use FFmpeg's internal parity value).
  3423. @item bff
  3424. Assume bottom field first.
  3425. @item tff
  3426. Assume top field first.
  3427. @end table
  3428. Note that it is sometimes recommended not to trust the parity announced by the
  3429. stream.
  3430. Default value is @var{auto}.
  3431. @item mode
  3432. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  3433. sense that it won't risk creating jerkiness due to duplicate frames when
  3434. possible, but if there are bad edits or blended fields it will end up
  3435. outputting combed frames when a good match might actually exist. On the other
  3436. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  3437. but will almost always find a good frame if there is one. The other values are
  3438. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  3439. jerkiness and creating duplicate frames versus finding good matches in sections
  3440. with bad edits, orphaned fields, blended fields, etc.
  3441. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  3442. Available values are:
  3443. @table @samp
  3444. @item pc
  3445. 2-way matching (p/c)
  3446. @item pc_n
  3447. 2-way matching, and trying 3rd match if still combed (p/c + n)
  3448. @item pc_u
  3449. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  3450. @item pc_n_ub
  3451. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  3452. still combed (p/c + n + u/b)
  3453. @item pcn
  3454. 3-way matching (p/c/n)
  3455. @item pcn_ub
  3456. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  3457. detected as combed (p/c/n + u/b)
  3458. @end table
  3459. The parenthesis at the end indicate the matches that would be used for that
  3460. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  3461. @var{top}).
  3462. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  3463. the slowest.
  3464. Default value is @var{pc_n}.
  3465. @item ppsrc
  3466. Mark the main input stream as a pre-processed input, and enable the secondary
  3467. input stream as the clean source to pick the fields from. See the filter
  3468. introduction for more details. It is similar to the @option{clip2} feature from
  3469. VFM/TFM.
  3470. Default value is @code{0} (disabled).
  3471. @item field
  3472. Set the field to match from. It is recommended to set this to the same value as
  3473. @option{order} unless you experience matching failures with that setting. In
  3474. certain circumstances changing the field that is used to match from can have a
  3475. large impact on matching performance. Available values are:
  3476. @table @samp
  3477. @item auto
  3478. Automatic (same value as @option{order}).
  3479. @item bottom
  3480. Match from the bottom field.
  3481. @item top
  3482. Match from the top field.
  3483. @end table
  3484. Default value is @var{auto}.
  3485. @item mchroma
  3486. Set whether or not chroma is included during the match comparisons. In most
  3487. cases it is recommended to leave this enabled. You should set this to @code{0}
  3488. only if your clip has bad chroma problems such as heavy rainbowing or other
  3489. artifacts. Setting this to @code{0} could also be used to speed things up at
  3490. the cost of some accuracy.
  3491. Default value is @code{1}.
  3492. @item y0
  3493. @item y1
  3494. These define an exclusion band which excludes the lines between @option{y0} and
  3495. @option{y1} from being included in the field matching decision. An exclusion
  3496. band can be used to ignore subtitles, a logo, or other things that may
  3497. interfere with the matching. @option{y0} sets the starting scan line and
  3498. @option{y1} sets the ending line; all lines in between @option{y0} and
  3499. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  3500. @option{y0} and @option{y1} to the same value will disable the feature.
  3501. @option{y0} and @option{y1} defaults to @code{0}.
  3502. @item scthresh
  3503. Set the scene change detection threshold as a percentage of maximum change on
  3504. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  3505. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  3506. @option{scthresh} is @code{[0.0, 100.0]}.
  3507. Default value is @code{12.0}.
  3508. @item combmatch
  3509. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  3510. account the combed scores of matches when deciding what match to use as the
  3511. final match. Available values are:
  3512. @table @samp
  3513. @item none
  3514. No final matching based on combed scores.
  3515. @item sc
  3516. Combed scores are only used when a scene change is detected.
  3517. @item full
  3518. Use combed scores all the time.
  3519. @end table
  3520. Default is @var{sc}.
  3521. @item combdbg
  3522. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  3523. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  3524. Available values are:
  3525. @table @samp
  3526. @item none
  3527. No forced calculation.
  3528. @item pcn
  3529. Force p/c/n calculations.
  3530. @item pcnub
  3531. Force p/c/n/u/b calculations.
  3532. @end table
  3533. Default value is @var{none}.
  3534. @item cthresh
  3535. This is the area combing threshold used for combed frame detection. This
  3536. essentially controls how "strong" or "visible" combing must be to be detected.
  3537. Larger values mean combing must be more visible and smaller values mean combing
  3538. can be less visible or strong and still be detected. Valid settings are from
  3539. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  3540. be detected as combed). This is basically a pixel difference value. A good
  3541. range is @code{[8, 12]}.
  3542. Default value is @code{9}.
  3543. @item chroma
  3544. Sets whether or not chroma is considered in the combed frame decision. Only
  3545. disable this if your source has chroma problems (rainbowing, etc.) that are
  3546. causing problems for the combed frame detection with chroma enabled. Actually,
  3547. using @option{chroma}=@var{0} is usually more reliable, except for the case
  3548. where there is chroma only combing in the source.
  3549. Default value is @code{0}.
  3550. @item blockx
  3551. @item blocky
  3552. Respectively set the x-axis and y-axis size of the window used during combed
  3553. frame detection. This has to do with the size of the area in which
  3554. @option{combpel} pixels are required to be detected as combed for a frame to be
  3555. declared combed. See the @option{combpel} parameter description for more info.
  3556. Possible values are any number that is a power of 2 starting at 4 and going up
  3557. to 512.
  3558. Default value is @code{16}.
  3559. @item combpel
  3560. The number of combed pixels inside any of the @option{blocky} by
  3561. @option{blockx} size blocks on the frame for the frame to be detected as
  3562. combed. While @option{cthresh} controls how "visible" the combing must be, this
  3563. setting controls "how much" combing there must be in any localized area (a
  3564. window defined by the @option{blockx} and @option{blocky} settings) on the
  3565. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  3566. which point no frames will ever be detected as combed). This setting is known
  3567. as @option{MI} in TFM/VFM vocabulary.
  3568. Default value is @code{80}.
  3569. @end table
  3570. @anchor{p/c/n/u/b meaning}
  3571. @subsection p/c/n/u/b meaning
  3572. @subsubsection p/c/n
  3573. We assume the following telecined stream:
  3574. @example
  3575. Top fields: 1 2 2 3 4
  3576. Bottom fields: 1 2 3 4 4
  3577. @end example
  3578. The numbers correspond to the progressive frame the fields relate to. Here, the
  3579. first two frames are progressive, the 3rd and 4th are combed, and so on.
  3580. When @code{fieldmatch} is configured to run a matching from bottom
  3581. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  3582. @example
  3583. Input stream:
  3584. T 1 2 2 3 4
  3585. B 1 2 3 4 4 <-- matching reference
  3586. Matches: c c n n c
  3587. Output stream:
  3588. T 1 2 3 4 4
  3589. B 1 2 3 4 4
  3590. @end example
  3591. As a result of the field matching, we can see that some frames get duplicated.
  3592. To perform a complete inverse telecine, you need to rely on a decimation filter
  3593. after this operation. See for instance the @ref{decimate} filter.
  3594. The same operation now matching from top fields (@option{field}=@var{top})
  3595. looks like this:
  3596. @example
  3597. Input stream:
  3598. T 1 2 2 3 4 <-- matching reference
  3599. B 1 2 3 4 4
  3600. Matches: c c p p c
  3601. Output stream:
  3602. T 1 2 2 3 4
  3603. B 1 2 2 3 4
  3604. @end example
  3605. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  3606. basically, they refer to the frame and field of the opposite parity:
  3607. @itemize
  3608. @item @var{p} matches the field of the opposite parity in the previous frame
  3609. @item @var{c} matches the field of the opposite parity in the current frame
  3610. @item @var{n} matches the field of the opposite parity in the next frame
  3611. @end itemize
  3612. @subsubsection u/b
  3613. The @var{u} and @var{b} matching are a bit special in the sense that they match
  3614. from the opposite parity flag. In the following examples, we assume that we are
  3615. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  3616. 'x' is placed above and below each matched fields.
  3617. With bottom matching (@option{field}=@var{bottom}):
  3618. @example
  3619. Match: c p n b u
  3620. x x x x x
  3621. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3622. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3623. x x x x x
  3624. Output frames:
  3625. 2 1 2 2 2
  3626. 2 2 2 1 3
  3627. @end example
  3628. With top matching (@option{field}=@var{top}):
  3629. @example
  3630. Match: c p n b u
  3631. x x x x x
  3632. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  3633. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  3634. x x x x x
  3635. Output frames:
  3636. 2 2 2 1 2
  3637. 2 1 3 2 2
  3638. @end example
  3639. @subsection Examples
  3640. Simple IVTC of a top field first telecined stream:
  3641. @example
  3642. fieldmatch=order=tff:combmatch=none, decimate
  3643. @end example
  3644. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  3645. @example
  3646. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  3647. @end example
  3648. @section fieldorder
  3649. Transform the field order of the input video.
  3650. It accepts the following parameters:
  3651. @table @option
  3652. @item order
  3653. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  3654. for bottom field first.
  3655. @end table
  3656. The default value is @samp{tff}.
  3657. The transformation is done by shifting the picture content up or down
  3658. by one line, and filling the remaining line with appropriate picture content.
  3659. This method is consistent with most broadcast field order converters.
  3660. If the input video is not flagged as being interlaced, or it is already
  3661. flagged as being of the required output field order, then this filter does
  3662. not alter the incoming video.
  3663. It is very useful when converting to or from PAL DV material,
  3664. which is bottom field first.
  3665. For example:
  3666. @example
  3667. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  3668. @end example
  3669. @section fifo
  3670. Buffer input images and send them when they are requested.
  3671. It is mainly useful when auto-inserted by the libavfilter
  3672. framework.
  3673. It does not take parameters.
  3674. @anchor{format}
  3675. @section format
  3676. Convert the input video to one of the specified pixel formats.
  3677. Libavfilter will try to pick one that is suitable as input to
  3678. the next filter.
  3679. It accepts the following parameters:
  3680. @table @option
  3681. @item pix_fmts
  3682. A '|'-separated list of pixel format names, such as
  3683. "pix_fmts=yuv420p|monow|rgb24".
  3684. @end table
  3685. @subsection Examples
  3686. @itemize
  3687. @item
  3688. Convert the input video to the @var{yuv420p} format
  3689. @example
  3690. format=pix_fmts=yuv420p
  3691. @end example
  3692. Convert the input video to any of the formats in the list
  3693. @example
  3694. format=pix_fmts=yuv420p|yuv444p|yuv410p
  3695. @end example
  3696. @end itemize
  3697. @anchor{fps}
  3698. @section fps
  3699. Convert the video to specified constant frame rate by duplicating or dropping
  3700. frames as necessary.
  3701. It accepts the following parameters:
  3702. @table @option
  3703. @item fps
  3704. The desired output frame rate. The default is @code{25}.
  3705. @item round
  3706. Rounding method.
  3707. Possible values are:
  3708. @table @option
  3709. @item zero
  3710. zero round towards 0
  3711. @item inf
  3712. round away from 0
  3713. @item down
  3714. round towards -infinity
  3715. @item up
  3716. round towards +infinity
  3717. @item near
  3718. round to nearest
  3719. @end table
  3720. The default is @code{near}.
  3721. @item start_time
  3722. Assume the first PTS should be the given value, in seconds. This allows for
  3723. padding/trimming at the start of stream. By default, no assumption is made
  3724. about the first frame's expected PTS, so no padding or trimming is done.
  3725. For example, this could be set to 0 to pad the beginning with duplicates of
  3726. the first frame if a video stream starts after the audio stream or to trim any
  3727. frames with a negative PTS.
  3728. @end table
  3729. Alternatively, the options can be specified as a flat string:
  3730. @var{fps}[:@var{round}].
  3731. See also the @ref{setpts} filter.
  3732. @subsection Examples
  3733. @itemize
  3734. @item
  3735. A typical usage in order to set the fps to 25:
  3736. @example
  3737. fps=fps=25
  3738. @end example
  3739. @item
  3740. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  3741. @example
  3742. fps=fps=film:round=near
  3743. @end example
  3744. @end itemize
  3745. @section framepack
  3746. Pack two different video streams into a stereoscopic video, setting proper
  3747. metadata on supported codecs. The two views should have the same size and
  3748. framerate and processing will stop when the shorter video ends. Please note
  3749. that you may conveniently adjust view properties with the @ref{scale} and
  3750. @ref{fps} filters.
  3751. It accepts the following parameters:
  3752. @table @option
  3753. @item format
  3754. The desired packing format. Supported values are:
  3755. @table @option
  3756. @item sbs
  3757. The views are next to each other (default).
  3758. @item tab
  3759. The views are on top of each other.
  3760. @item lines
  3761. The views are packed by line.
  3762. @item columns
  3763. The views are packed by column.
  3764. @item frameseq
  3765. The views are temporally interleaved.
  3766. @end table
  3767. @end table
  3768. Some examples:
  3769. @example
  3770. # Convert left and right views into a frame-sequential video
  3771. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  3772. # Convert views into a side-by-side video with the same output resolution as the input
  3773. ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
  3774. @end example
  3775. @section framestep
  3776. Select one frame every N-th frame.
  3777. This filter accepts the following option:
  3778. @table @option
  3779. @item step
  3780. Select frame after every @code{step} frames.
  3781. Allowed values are positive integers higher than 0. Default value is @code{1}.
  3782. @end table
  3783. @anchor{frei0r}
  3784. @section frei0r
  3785. Apply a frei0r effect to the input video.
  3786. To enable the compilation of this filter, you need to install the frei0r
  3787. header and configure FFmpeg with @code{--enable-frei0r}.
  3788. It accepts the following parameters:
  3789. @table @option
  3790. @item filter_name
  3791. The name of the frei0r effect to load. If the environment variable
  3792. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  3793. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  3794. Otherwise, the standard frei0r paths are searched, in this order:
  3795. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  3796. @file{/usr/lib/frei0r-1/}.
  3797. @item filter_params
  3798. A '|'-separated list of parameters to pass to the frei0r effect.
  3799. @end table
  3800. A frei0r effect parameter can be a boolean (its value is either
  3801. "y" or "n"), a double, a color (specified as
  3802. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  3803. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  3804. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  3805. @var{X} and @var{Y} are floating point numbers) and/or a string.
  3806. The number and types of parameters depend on the loaded effect. If an
  3807. effect parameter is not specified, the default value is set.
  3808. @subsection Examples
  3809. @itemize
  3810. @item
  3811. Apply the distort0r effect, setting the first two double parameters:
  3812. @example
  3813. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  3814. @end example
  3815. @item
  3816. Apply the colordistance effect, taking a color as the first parameter:
  3817. @example
  3818. frei0r=colordistance:0.2/0.3/0.4
  3819. frei0r=colordistance:violet
  3820. frei0r=colordistance:0x112233
  3821. @end example
  3822. @item
  3823. Apply the perspective effect, specifying the top left and top right image
  3824. positions:
  3825. @example
  3826. frei0r=perspective:0.2/0.2|0.8/0.2
  3827. @end example
  3828. @end itemize
  3829. For more information, see
  3830. @url{http://frei0r.dyne.org}
  3831. @section geq
  3832. The filter accepts the following options:
  3833. @table @option
  3834. @item lum_expr, lum
  3835. Set the luminance expression.
  3836. @item cb_expr, cb
  3837. Set the chrominance blue expression.
  3838. @item cr_expr, cr
  3839. Set the chrominance red expression.
  3840. @item alpha_expr, a
  3841. Set the alpha expression.
  3842. @item red_expr, r
  3843. Set the red expression.
  3844. @item green_expr, g
  3845. Set the green expression.
  3846. @item blue_expr, b
  3847. Set the blue expression.
  3848. @end table
  3849. The colorspace is selected according to the specified options. If one
  3850. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  3851. options is specified, the filter will automatically select a YCbCr
  3852. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  3853. @option{blue_expr} options is specified, it will select an RGB
  3854. colorspace.
  3855. If one of the chrominance expression is not defined, it falls back on the other
  3856. one. If no alpha expression is specified it will evaluate to opaque value.
  3857. If none of chrominance expressions are specified, they will evaluate
  3858. to the luminance expression.
  3859. The expressions can use the following variables and functions:
  3860. @table @option
  3861. @item N
  3862. The sequential number of the filtered frame, starting from @code{0}.
  3863. @item X
  3864. @item Y
  3865. The coordinates of the current sample.
  3866. @item W
  3867. @item H
  3868. The width and height of the image.
  3869. @item SW
  3870. @item SH
  3871. Width and height scale depending on the currently filtered plane. It is the
  3872. ratio between the corresponding luma plane number of pixels and the current
  3873. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3874. @code{0.5,0.5} for chroma planes.
  3875. @item T
  3876. Time of the current frame, expressed in seconds.
  3877. @item p(x, y)
  3878. Return the value of the pixel at location (@var{x},@var{y}) of the current
  3879. plane.
  3880. @item lum(x, y)
  3881. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  3882. plane.
  3883. @item cb(x, y)
  3884. Return the value of the pixel at location (@var{x},@var{y}) of the
  3885. blue-difference chroma plane. Return 0 if there is no such plane.
  3886. @item cr(x, y)
  3887. Return the value of the pixel at location (@var{x},@var{y}) of the
  3888. red-difference chroma plane. Return 0 if there is no such plane.
  3889. @item r(x, y)
  3890. @item g(x, y)
  3891. @item b(x, y)
  3892. Return the value of the pixel at location (@var{x},@var{y}) of the
  3893. red/green/blue component. Return 0 if there is no such component.
  3894. @item alpha(x, y)
  3895. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  3896. plane. Return 0 if there is no such plane.
  3897. @end table
  3898. For functions, if @var{x} and @var{y} are outside the area, the value will be
  3899. automatically clipped to the closer edge.
  3900. @subsection Examples
  3901. @itemize
  3902. @item
  3903. Flip the image horizontally:
  3904. @example
  3905. geq=p(W-X\,Y)
  3906. @end example
  3907. @item
  3908. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  3909. wavelength of 100 pixels:
  3910. @example
  3911. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  3912. @end example
  3913. @item
  3914. Generate a fancy enigmatic moving light:
  3915. @example
  3916. nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
  3917. @end example
  3918. @item
  3919. Generate a quick emboss effect:
  3920. @example
  3921. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  3922. @end example
  3923. @item
  3924. Modify RGB components depending on pixel position:
  3925. @example
  3926. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  3927. @end example
  3928. @end itemize
  3929. @section gradfun
  3930. Fix the banding artifacts that are sometimes introduced into nearly flat
  3931. regions by truncation to 8bit color depth.
  3932. Interpolate the gradients that should go where the bands are, and
  3933. dither them.
  3934. It is designed for playback only. Do not use it prior to
  3935. lossy compression, because compression tends to lose the dither and
  3936. bring back the bands.
  3937. It accepts the following parameters:
  3938. @table @option
  3939. @item strength
  3940. The maximum amount by which the filter will change any one pixel. This is also
  3941. the threshold for detecting nearly flat regions. Acceptable values range from
  3942. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  3943. valid range.
  3944. @item radius
  3945. The neighborhood to fit the gradient to. A larger radius makes for smoother
  3946. gradients, but also prevents the filter from modifying the pixels near detailed
  3947. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  3948. values will be clipped to the valid range.
  3949. @end table
  3950. Alternatively, the options can be specified as a flat string:
  3951. @var{strength}[:@var{radius}]
  3952. @subsection Examples
  3953. @itemize
  3954. @item
  3955. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  3956. @example
  3957. gradfun=3.5:8
  3958. @end example
  3959. @item
  3960. Specify radius, omitting the strength (which will fall-back to the default
  3961. value):
  3962. @example
  3963. gradfun=radius=8
  3964. @end example
  3965. @end itemize
  3966. @anchor{haldclut}
  3967. @section haldclut
  3968. Apply a Hald CLUT to a video stream.
  3969. First input is the video stream to process, and second one is the Hald CLUT.
  3970. The Hald CLUT input can be a simple picture or a complete video stream.
  3971. The filter accepts the following options:
  3972. @table @option
  3973. @item shortest
  3974. Force termination when the shortest input terminates. Default is @code{0}.
  3975. @item repeatlast
  3976. Continue applying the last CLUT after the end of the stream. A value of
  3977. @code{0} disable the filter after the last frame of the CLUT is reached.
  3978. Default is @code{1}.
  3979. @end table
  3980. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  3981. filters share the same internals).
  3982. More information about the Hald CLUT can be found on Eskil Steenberg's website
  3983. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  3984. @subsection Workflow examples
  3985. @subsubsection Hald CLUT video stream
  3986. Generate an identity Hald CLUT stream altered with various effects:
  3987. @example
  3988. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
  3989. @end example
  3990. Note: make sure you use a lossless codec.
  3991. Then use it with @code{haldclut} to apply it on some random stream:
  3992. @example
  3993. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  3994. @end example
  3995. The Hald CLUT will be applied to the 10 first seconds (duration of
  3996. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  3997. to the remaining frames of the @code{mandelbrot} stream.
  3998. @subsubsection Hald CLUT with preview
  3999. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  4000. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  4001. biggest possible square starting at the top left of the picture. The remaining
  4002. padding pixels (bottom or right) will be ignored. This area can be used to add
  4003. a preview of the Hald CLUT.
  4004. Typically, the following generated Hald CLUT will be supported by the
  4005. @code{haldclut} filter:
  4006. @example
  4007. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  4008. pad=iw+320 [padded_clut];
  4009. smptebars=s=320x256, split [a][b];
  4010. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  4011. [main][b] overlay=W-320" -frames:v 1 clut.png
  4012. @end example
  4013. It contains the original and a preview of the effect of the CLUT: SMPTE color
  4014. bars are displayed on the right-top, and below the same color bars processed by
  4015. the color changes.
  4016. Then, the effect of this Hald CLUT can be visualized with:
  4017. @example
  4018. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  4019. @end example
  4020. @section hflip
  4021. Flip the input video horizontally.
  4022. For example, to horizontally flip the input video with @command{ffmpeg}:
  4023. @example
  4024. ffmpeg -i in.avi -vf "hflip" out.avi
  4025. @end example
  4026. @section histeq
  4027. This filter applies a global color histogram equalization on a
  4028. per-frame basis.
  4029. It can be used to correct video that has a compressed range of pixel
  4030. intensities. The filter redistributes the pixel intensities to
  4031. equalize their distribution across the intensity range. It may be
  4032. viewed as an "automatically adjusting contrast filter". This filter is
  4033. useful only for correcting degraded or poorly captured source
  4034. video.
  4035. The filter accepts the following options:
  4036. @table @option
  4037. @item strength
  4038. Determine the amount of equalization to be applied. As the strength
  4039. is reduced, the distribution of pixel intensities more-and-more
  4040. approaches that of the input frame. The value must be a float number
  4041. in the range [0,1] and defaults to 0.200.
  4042. @item intensity
  4043. Set the maximum intensity that can generated and scale the output
  4044. values appropriately. The strength should be set as desired and then
  4045. the intensity can be limited if needed to avoid washing-out. The value
  4046. must be a float number in the range [0,1] and defaults to 0.210.
  4047. @item antibanding
  4048. Set the antibanding level. If enabled the filter will randomly vary
  4049. the luminance of output pixels by a small amount to avoid banding of
  4050. the histogram. Possible values are @code{none}, @code{weak} or
  4051. @code{strong}. It defaults to @code{none}.
  4052. @end table
  4053. @section histogram
  4054. Compute and draw a color distribution histogram for the input video.
  4055. The computed histogram is a representation of the color component
  4056. distribution in an image.
  4057. The filter accepts the following options:
  4058. @table @option
  4059. @item mode
  4060. Set histogram mode.
  4061. It accepts the following values:
  4062. @table @samp
  4063. @item levels
  4064. Standard histogram that displays the color components distribution in an
  4065. image. Displays color graph for each color component. Shows distribution of
  4066. the Y, U, V, A or R, G, B components, depending on input format, in the
  4067. current frame. Below each graph a color component scale meter is shown.
  4068. @item color
  4069. Displays chroma values (U/V color placement) in a two dimensional
  4070. graph (which is called a vectorscope). The brighter a pixel in the
  4071. vectorscope, the more pixels of the input frame correspond to that pixel
  4072. (i.e., more pixels have this chroma value). The V component is displayed on
  4073. the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost
  4074. side being V = 255. The U component is displayed on the vertical (Y) axis,
  4075. with the top representing U = 0 and the bottom representing U = 255.
  4076. The position of a white pixel in the graph corresponds to the chroma value of
  4077. a pixel of the input clip. The graph can therefore be used to read the hue
  4078. (color flavor) and the saturation (the dominance of the hue in the color). As
  4079. the hue of a color changes, it moves around the square. At the center of the
  4080. square the saturation is zero, which means that the corresponding pixel has no
  4081. color. If the amount of a specific color is increased (while leaving the other
  4082. colors unchanged) the saturation increases, and the indicator moves towards
  4083. the edge of the square.
  4084. @item color2
  4085. Chroma values in vectorscope, similar as @code{color} but actual chroma values
  4086. are displayed.
  4087. @item waveform
  4088. Per row/column color component graph. In row mode, the graph on the left side
  4089. represents color component value 0 and the right side represents value = 255.
  4090. In column mode, the top side represents color component value = 0 and bottom
  4091. side represents value = 255.
  4092. @end table
  4093. Default value is @code{levels}.
  4094. @item level_height
  4095. Set height of level in @code{levels}. Default value is @code{200}.
  4096. Allowed range is [50, 2048].
  4097. @item scale_height
  4098. Set height of color scale in @code{levels}. Default value is @code{12}.
  4099. Allowed range is [0, 40].
  4100. @item step
  4101. Set step for @code{waveform} mode. Smaller values are useful to find out how
  4102. many values of the same luminance are distributed across input rows/columns.
  4103. Default value is @code{10}. Allowed range is [1, 255].
  4104. @item waveform_mode
  4105. Set mode for @code{waveform}. Can be either @code{row}, or @code{column}.
  4106. Default is @code{row}.
  4107. @item waveform_mirror
  4108. Set mirroring mode for @code{waveform}. @code{0} means unmirrored, @code{1}
  4109. means mirrored. In mirrored mode, higher values will be represented on the left
  4110. side for @code{row} mode and at the top for @code{column} mode. Default is
  4111. @code{0} (unmirrored).
  4112. @item display_mode
  4113. Set display mode for @code{waveform} and @code{levels}.
  4114. It accepts the following values:
  4115. @table @samp
  4116. @item parade
  4117. Display separate graph for the color components side by side in
  4118. @code{row} waveform mode or one below the other in @code{column} waveform mode
  4119. for @code{waveform} histogram mode. For @code{levels} histogram mode,
  4120. per color component graphs are placed below each other.
  4121. Using this display mode in @code{waveform} histogram mode makes it easy to
  4122. spot color casts in the highlights and shadows of an image, by comparing the
  4123. contours of the top and the bottom graphs of each waveform. Since whites,
  4124. grays, and blacks are characterized by exactly equal amounts of red, green,
  4125. and blue, neutral areas of the picture should display three waveforms of
  4126. roughly equal width/height. If not, the correction is easy to perform by
  4127. making level adjustments the three waveforms.
  4128. @item overlay
  4129. Presents information identical to that in the @code{parade}, except
  4130. that the graphs representing color components are superimposed directly
  4131. over one another.
  4132. This display mode in @code{waveform} histogram mode makes it easier to spot
  4133. relative differences or similarities in overlapping areas of the color
  4134. components that are supposed to be identical, such as neutral whites, grays,
  4135. or blacks.
  4136. @end table
  4137. Default is @code{parade}.
  4138. @item levels_mode
  4139. Set mode for @code{levels}. Can be either @code{linear}, or @code{logarithmic}.
  4140. Default is @code{linear}.
  4141. @end table
  4142. @subsection Examples
  4143. @itemize
  4144. @item
  4145. Calculate and draw histogram:
  4146. @example
  4147. ffplay -i input -vf histogram
  4148. @end example
  4149. @end itemize
  4150. @anchor{hqdn3d}
  4151. @section hqdn3d
  4152. This is a high precision/quality 3d denoise filter. It aims to reduce
  4153. image noise, producing smooth images and making still images really
  4154. still. It should enhance compressibility.
  4155. It accepts the following optional parameters:
  4156. @table @option
  4157. @item luma_spatial
  4158. A non-negative floating point number which specifies spatial luma strength.
  4159. It defaults to 4.0.
  4160. @item chroma_spatial
  4161. A non-negative floating point number which specifies spatial chroma strength.
  4162. It defaults to 3.0*@var{luma_spatial}/4.0.
  4163. @item luma_tmp
  4164. A floating point number which specifies luma temporal strength. It defaults to
  4165. 6.0*@var{luma_spatial}/4.0.
  4166. @item chroma_tmp
  4167. A floating point number which specifies chroma temporal strength. It defaults to
  4168. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  4169. @end table
  4170. @section hqx
  4171. Apply a high-quality magnification filter designed for pixel art. This filter
  4172. was originally created by Maxim Stepin.
  4173. It accepts the following option:
  4174. @table @option
  4175. @item n
  4176. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  4177. @code{hq3x} and @code{4} for @code{hq4x}.
  4178. Default is @code{3}.
  4179. @end table
  4180. @section hue
  4181. Modify the hue and/or the saturation of the input.
  4182. It accepts the following parameters:
  4183. @table @option
  4184. @item h
  4185. Specify the hue angle as a number of degrees. It accepts an expression,
  4186. and defaults to "0".
  4187. @item s
  4188. Specify the saturation in the [-10,10] range. It accepts an expression and
  4189. defaults to "1".
  4190. @item H
  4191. Specify the hue angle as a number of radians. It accepts an
  4192. expression, and defaults to "0".
  4193. @item b
  4194. Specify the brightness in the [-10,10] range. It accepts an expression and
  4195. defaults to "0".
  4196. @end table
  4197. @option{h} and @option{H} are mutually exclusive, and can't be
  4198. specified at the same time.
  4199. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  4200. expressions containing the following constants:
  4201. @table @option
  4202. @item n
  4203. frame count of the input frame starting from 0
  4204. @item pts
  4205. presentation timestamp of the input frame expressed in time base units
  4206. @item r
  4207. frame rate of the input video, NAN if the input frame rate is unknown
  4208. @item t
  4209. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4210. @item tb
  4211. time base of the input video
  4212. @end table
  4213. @subsection Examples
  4214. @itemize
  4215. @item
  4216. Set the hue to 90 degrees and the saturation to 1.0:
  4217. @example
  4218. hue=h=90:s=1
  4219. @end example
  4220. @item
  4221. Same command but expressing the hue in radians:
  4222. @example
  4223. hue=H=PI/2:s=1
  4224. @end example
  4225. @item
  4226. Rotate hue and make the saturation swing between 0
  4227. and 2 over a period of 1 second:
  4228. @example
  4229. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  4230. @end example
  4231. @item
  4232. Apply a 3 seconds saturation fade-in effect starting at 0:
  4233. @example
  4234. hue="s=min(t/3\,1)"
  4235. @end example
  4236. The general fade-in expression can be written as:
  4237. @example
  4238. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  4239. @end example
  4240. @item
  4241. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  4242. @example
  4243. hue="s=max(0\, min(1\, (8-t)/3))"
  4244. @end example
  4245. The general fade-out expression can be written as:
  4246. @example
  4247. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  4248. @end example
  4249. @end itemize
  4250. @subsection Commands
  4251. This filter supports the following commands:
  4252. @table @option
  4253. @item b
  4254. @item s
  4255. @item h
  4256. @item H
  4257. Modify the hue and/or the saturation and/or brightness of the input video.
  4258. The command accepts the same syntax of the corresponding option.
  4259. If the specified expression is not valid, it is kept at its current
  4260. value.
  4261. @end table
  4262. @section idet
  4263. Detect video interlacing type.
  4264. This filter tries to detect if the input is interlaced or progressive,
  4265. top or bottom field first.
  4266. The filter accepts the following options:
  4267. @table @option
  4268. @item intl_thres
  4269. Set interlacing threshold.
  4270. @item prog_thres
  4271. Set progressive threshold.
  4272. @end table
  4273. @section il
  4274. Deinterleave or interleave fields.
  4275. This filter allows one to process interlaced images fields without
  4276. deinterlacing them. Deinterleaving splits the input frame into 2
  4277. fields (so called half pictures). Odd lines are moved to the top
  4278. half of the output image, even lines to the bottom half.
  4279. You can process (filter) them independently and then re-interleave them.
  4280. The filter accepts the following options:
  4281. @table @option
  4282. @item luma_mode, l
  4283. @item chroma_mode, c
  4284. @item alpha_mode, a
  4285. Available values for @var{luma_mode}, @var{chroma_mode} and
  4286. @var{alpha_mode} are:
  4287. @table @samp
  4288. @item none
  4289. Do nothing.
  4290. @item deinterleave, d
  4291. Deinterleave fields, placing one above the other.
  4292. @item interleave, i
  4293. Interleave fields. Reverse the effect of deinterleaving.
  4294. @end table
  4295. Default value is @code{none}.
  4296. @item luma_swap, ls
  4297. @item chroma_swap, cs
  4298. @item alpha_swap, as
  4299. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  4300. @end table
  4301. @section interlace
  4302. Simple interlacing filter from progressive contents. This interleaves upper (or
  4303. lower) lines from odd frames with lower (or upper) lines from even frames,
  4304. halving the frame rate and preserving image height.
  4305. @example
  4306. Original Original New Frame
  4307. Frame 'j' Frame 'j+1' (tff)
  4308. ========== =========== ==================
  4309. Line 0 --------------------> Frame 'j' Line 0
  4310. Line 1 Line 1 ----> Frame 'j+1' Line 1
  4311. Line 2 ---------------------> Frame 'j' Line 2
  4312. Line 3 Line 3 ----> Frame 'j+1' Line 3
  4313. ... ... ...
  4314. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  4315. @end example
  4316. It accepts the following optional parameters:
  4317. @table @option
  4318. @item scan
  4319. This determines whether the interlaced frame is taken from the even
  4320. (tff - default) or odd (bff) lines of the progressive frame.
  4321. @item lowpass
  4322. Enable (default) or disable the vertical lowpass filter to avoid twitter
  4323. interlacing and reduce moire patterns.
  4324. @end table
  4325. @section kerndeint
  4326. Deinterlace input video by applying Donald Graft's adaptive kernel
  4327. deinterling. Work on interlaced parts of a video to produce
  4328. progressive frames.
  4329. The description of the accepted parameters follows.
  4330. @table @option
  4331. @item thresh
  4332. Set the threshold which affects the filter's tolerance when
  4333. determining if a pixel line must be processed. It must be an integer
  4334. in the range [0,255] and defaults to 10. A value of 0 will result in
  4335. applying the process on every pixels.
  4336. @item map
  4337. Paint pixels exceeding the threshold value to white if set to 1.
  4338. Default is 0.
  4339. @item order
  4340. Set the fields order. Swap fields if set to 1, leave fields alone if
  4341. 0. Default is 0.
  4342. @item sharp
  4343. Enable additional sharpening if set to 1. Default is 0.
  4344. @item twoway
  4345. Enable twoway sharpening if set to 1. Default is 0.
  4346. @end table
  4347. @subsection Examples
  4348. @itemize
  4349. @item
  4350. Apply default values:
  4351. @example
  4352. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  4353. @end example
  4354. @item
  4355. Enable additional sharpening:
  4356. @example
  4357. kerndeint=sharp=1
  4358. @end example
  4359. @item
  4360. Paint processed pixels in white:
  4361. @example
  4362. kerndeint=map=1
  4363. @end example
  4364. @end itemize
  4365. @section lenscorrection
  4366. Correct radial lens distortion
  4367. This filter can be used to correct for radial distortion as can result from the use
  4368. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  4369. one can use tools available for example as part of opencv or simply trial-and-error.
  4370. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  4371. and extract the k1 and k2 coefficients from the resulting matrix.
  4372. Note that effectively the same filter is available in the open-source tools Krita and
  4373. Digikam from the KDE project.
  4374. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  4375. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  4376. brightness distribution, so you may want to use both filters together in certain
  4377. cases, though you will have to take care of ordering, i.e. whether vignetting should
  4378. be applied before or after lens correction.
  4379. @subsection Options
  4380. The filter accepts the following options:
  4381. @table @option
  4382. @item cx
  4383. Relative x-coordinate of the focal point of the image, and thereby the center of the
  4384. distrortion. This value has a range [0,1] and is expressed as fractions of the image
  4385. width.
  4386. @item cy
  4387. Relative y-coordinate of the focal point of the image, and thereby the center of the
  4388. distrortion. This value has a range [0,1] and is expressed as fractions of the image
  4389. height.
  4390. @item k1
  4391. Coefficient of the quadratic correction term. 0.5 means no correction.
  4392. @item k2
  4393. Coefficient of the double quadratic correction term. 0.5 means no correction.
  4394. @end table
  4395. The formula that generates the correction is:
  4396. @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
  4397. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  4398. distances from the focal point in the source and target images, respectively.
  4399. @anchor{lut3d}
  4400. @section lut3d
  4401. Apply a 3D LUT to an input video.
  4402. The filter accepts the following options:
  4403. @table @option
  4404. @item file
  4405. Set the 3D LUT file name.
  4406. Currently supported formats:
  4407. @table @samp
  4408. @item 3dl
  4409. AfterEffects
  4410. @item cube
  4411. Iridas
  4412. @item dat
  4413. DaVinci
  4414. @item m3d
  4415. Pandora
  4416. @end table
  4417. @item interp
  4418. Select interpolation mode.
  4419. Available values are:
  4420. @table @samp
  4421. @item nearest
  4422. Use values from the nearest defined point.
  4423. @item trilinear
  4424. Interpolate values using the 8 points defining a cube.
  4425. @item tetrahedral
  4426. Interpolate values using a tetrahedron.
  4427. @end table
  4428. @end table
  4429. @section lut, lutrgb, lutyuv
  4430. Compute a look-up table for binding each pixel component input value
  4431. to an output value, and apply it to the input video.
  4432. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  4433. to an RGB input video.
  4434. These filters accept the following parameters:
  4435. @table @option
  4436. @item c0
  4437. set first pixel component expression
  4438. @item c1
  4439. set second pixel component expression
  4440. @item c2
  4441. set third pixel component expression
  4442. @item c3
  4443. set fourth pixel component expression, corresponds to the alpha component
  4444. @item r
  4445. set red component expression
  4446. @item g
  4447. set green component expression
  4448. @item b
  4449. set blue component expression
  4450. @item a
  4451. alpha component expression
  4452. @item y
  4453. set Y/luminance component expression
  4454. @item u
  4455. set U/Cb component expression
  4456. @item v
  4457. set V/Cr component expression
  4458. @end table
  4459. Each of them specifies the expression to use for computing the lookup table for
  4460. the corresponding pixel component values.
  4461. The exact component associated to each of the @var{c*} options depends on the
  4462. format in input.
  4463. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  4464. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  4465. The expressions can contain the following constants and functions:
  4466. @table @option
  4467. @item w
  4468. @item h
  4469. The input width and height.
  4470. @item val
  4471. The input value for the pixel component.
  4472. @item clipval
  4473. The input value, clipped to the @var{minval}-@var{maxval} range.
  4474. @item maxval
  4475. The maximum value for the pixel component.
  4476. @item minval
  4477. The minimum value for the pixel component.
  4478. @item negval
  4479. The negated value for the pixel component value, clipped to the
  4480. @var{minval}-@var{maxval} range; it corresponds to the expression
  4481. "maxval-clipval+minval".
  4482. @item clip(val)
  4483. The computed value in @var{val}, clipped to the
  4484. @var{minval}-@var{maxval} range.
  4485. @item gammaval(gamma)
  4486. The computed gamma correction value of the pixel component value,
  4487. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  4488. expression
  4489. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  4490. @end table
  4491. All expressions default to "val".
  4492. @subsection Examples
  4493. @itemize
  4494. @item
  4495. Negate input video:
  4496. @example
  4497. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  4498. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  4499. @end example
  4500. The above is the same as:
  4501. @example
  4502. lutrgb="r=negval:g=negval:b=negval"
  4503. lutyuv="y=negval:u=negval:v=negval"
  4504. @end example
  4505. @item
  4506. Negate luminance:
  4507. @example
  4508. lutyuv=y=negval
  4509. @end example
  4510. @item
  4511. Remove chroma components, turning the video into a graytone image:
  4512. @example
  4513. lutyuv="u=128:v=128"
  4514. @end example
  4515. @item
  4516. Apply a luma burning effect:
  4517. @example
  4518. lutyuv="y=2*val"
  4519. @end example
  4520. @item
  4521. Remove green and blue components:
  4522. @example
  4523. lutrgb="g=0:b=0"
  4524. @end example
  4525. @item
  4526. Set a constant alpha channel value on input:
  4527. @example
  4528. format=rgba,lutrgb=a="maxval-minval/2"
  4529. @end example
  4530. @item
  4531. Correct luminance gamma by a factor of 0.5:
  4532. @example
  4533. lutyuv=y=gammaval(0.5)
  4534. @end example
  4535. @item
  4536. Discard least significant bits of luma:
  4537. @example
  4538. lutyuv=y='bitand(val, 128+64+32)'
  4539. @end example
  4540. @end itemize
  4541. @section mergeplanes
  4542. Merge color channel components from several video streams.
  4543. The filter accepts up to 4 input streams, and merge selected input
  4544. planes to the output video.
  4545. This filter accepts the following options:
  4546. @table @option
  4547. @item mapping
  4548. Set input to output plane mapping. Default is @code{0}.
  4549. The mappings is specified as a bitmap. It should be specified as a
  4550. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  4551. mapping for the first plane of the output stream. 'A' sets the number of
  4552. the input stream to use (from 0 to 3), and 'a' the plane number of the
  4553. corresponding input to use (from 0 to 3). The rest of the mappings is
  4554. similar, 'Bb' describes the mapping for the output stream second
  4555. plane, 'Cc' describes the mapping for the output stream third plane and
  4556. 'Dd' describes the mapping for the output stream fourth plane.
  4557. @item format
  4558. Set output pixel format. Default is @code{yuva444p}.
  4559. @end table
  4560. @subsection Examples
  4561. @itemize
  4562. @item
  4563. Merge three gray video streams of same width and height into single video stream:
  4564. @example
  4565. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  4566. @end example
  4567. @item
  4568. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  4569. @example
  4570. [a0][a1]mergeplanes=0x00010210:yuva444p
  4571. @end example
  4572. @item
  4573. Swap Y and A plane in yuva444p stream:
  4574. @example
  4575. format=yuva444p,mergeplanes=0x03010200:yuva444p
  4576. @end example
  4577. @item
  4578. Swap U and V plane in yuv420p stream:
  4579. @example
  4580. format=yuv420p,mergeplanes=0x000201:yuv420p
  4581. @end example
  4582. @item
  4583. Cast a rgb24 clip to yuv444p:
  4584. @example
  4585. format=rgb24,mergeplanes=0x000102:yuv444p
  4586. @end example
  4587. @end itemize
  4588. @section mcdeint
  4589. Apply motion-compensation deinterlacing.
  4590. It needs one field per frame as input and must thus be used together
  4591. with yadif=1/3 or equivalent.
  4592. This filter accepts the following options:
  4593. @table @option
  4594. @item mode
  4595. Set the deinterlacing mode.
  4596. It accepts one of the following values:
  4597. @table @samp
  4598. @item fast
  4599. @item medium
  4600. @item slow
  4601. use iterative motion estimation
  4602. @item extra_slow
  4603. like @samp{slow}, but use multiple reference frames.
  4604. @end table
  4605. Default value is @samp{fast}.
  4606. @item parity
  4607. Set the picture field parity assumed for the input video. It must be
  4608. one of the following values:
  4609. @table @samp
  4610. @item 0, tff
  4611. assume top field first
  4612. @item 1, bff
  4613. assume bottom field first
  4614. @end table
  4615. Default value is @samp{bff}.
  4616. @item qp
  4617. Set per-block quantization parameter (QP) used by the internal
  4618. encoder.
  4619. Higher values should result in a smoother motion vector field but less
  4620. optimal individual vectors. Default value is 1.
  4621. @end table
  4622. @section mp
  4623. Apply an MPlayer filter to the input video.
  4624. This filter provides a wrapper around some of the filters of
  4625. MPlayer/MEncoder.
  4626. This wrapper is considered experimental. Some of the wrapped filters
  4627. may not work properly and we may drop support for them, as they will
  4628. be implemented natively into FFmpeg. Thus you should avoid
  4629. depending on them when writing portable scripts.
  4630. The filter accepts the parameters:
  4631. @var{filter_name}[:=]@var{filter_params}
  4632. @var{filter_name} is the name of a supported MPlayer filter,
  4633. @var{filter_params} is a string containing the parameters accepted by
  4634. the named filter.
  4635. The list of the currently supported filters follows:
  4636. @table @var
  4637. @item eq2
  4638. @item eq
  4639. @item fspp
  4640. @item ilpack
  4641. @item pp7
  4642. @item softpulldown
  4643. @item uspp
  4644. @end table
  4645. The parameter syntax and behavior for the listed filters are the same
  4646. of the corresponding MPlayer filters. For detailed instructions check
  4647. the "VIDEO FILTERS" section in the MPlayer manual.
  4648. @subsection Examples
  4649. @itemize
  4650. @item
  4651. Adjust gamma, brightness, contrast:
  4652. @example
  4653. mp=eq2=1.0:2:0.5
  4654. @end example
  4655. @end itemize
  4656. See also mplayer(1), @url{http://www.mplayerhq.hu/}.
  4657. @section mpdecimate
  4658. Drop frames that do not differ greatly from the previous frame in
  4659. order to reduce frame rate.
  4660. The main use of this filter is for very-low-bitrate encoding
  4661. (e.g. streaming over dialup modem), but it could in theory be used for
  4662. fixing movies that were inverse-telecined incorrectly.
  4663. A description of the accepted options follows.
  4664. @table @option
  4665. @item max
  4666. Set the maximum number of consecutive frames which can be dropped (if
  4667. positive), or the minimum interval between dropped frames (if
  4668. negative). If the value is 0, the frame is dropped unregarding the
  4669. number of previous sequentially dropped frames.
  4670. Default value is 0.
  4671. @item hi
  4672. @item lo
  4673. @item frac
  4674. Set the dropping threshold values.
  4675. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  4676. represent actual pixel value differences, so a threshold of 64
  4677. corresponds to 1 unit of difference for each pixel, or the same spread
  4678. out differently over the block.
  4679. A frame is a candidate for dropping if no 8x8 blocks differ by more
  4680. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  4681. meaning the whole image) differ by more than a threshold of @option{lo}.
  4682. Default value for @option{hi} is 64*12, default value for @option{lo} is
  4683. 64*5, and default value for @option{frac} is 0.33.
  4684. @end table
  4685. @section negate
  4686. Negate input video.
  4687. It accepts an integer in input; if non-zero it negates the
  4688. alpha component (if available). The default value in input is 0.
  4689. @section noformat
  4690. Force libavfilter not to use any of the specified pixel formats for the
  4691. input to the next filter.
  4692. It accepts the following parameters:
  4693. @table @option
  4694. @item pix_fmts
  4695. A '|'-separated list of pixel format names, such as
  4696. apix_fmts=yuv420p|monow|rgb24".
  4697. @end table
  4698. @subsection Examples
  4699. @itemize
  4700. @item
  4701. Force libavfilter to use a format different from @var{yuv420p} for the
  4702. input to the vflip filter:
  4703. @example
  4704. noformat=pix_fmts=yuv420p,vflip
  4705. @end example
  4706. @item
  4707. Convert the input video to any of the formats not contained in the list:
  4708. @example
  4709. noformat=yuv420p|yuv444p|yuv410p
  4710. @end example
  4711. @end itemize
  4712. @section noise
  4713. Add noise on video input frame.
  4714. The filter accepts the following options:
  4715. @table @option
  4716. @item all_seed
  4717. @item c0_seed
  4718. @item c1_seed
  4719. @item c2_seed
  4720. @item c3_seed
  4721. Set noise seed for specific pixel component or all pixel components in case
  4722. of @var{all_seed}. Default value is @code{123457}.
  4723. @item all_strength, alls
  4724. @item c0_strength, c0s
  4725. @item c1_strength, c1s
  4726. @item c2_strength, c2s
  4727. @item c3_strength, c3s
  4728. Set noise strength for specific pixel component or all pixel components in case
  4729. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  4730. @item all_flags, allf
  4731. @item c0_flags, c0f
  4732. @item c1_flags, c1f
  4733. @item c2_flags, c2f
  4734. @item c3_flags, c3f
  4735. Set pixel component flags or set flags for all components if @var{all_flags}.
  4736. Available values for component flags are:
  4737. @table @samp
  4738. @item a
  4739. averaged temporal noise (smoother)
  4740. @item p
  4741. mix random noise with a (semi)regular pattern
  4742. @item t
  4743. temporal noise (noise pattern changes between frames)
  4744. @item u
  4745. uniform noise (gaussian otherwise)
  4746. @end table
  4747. @end table
  4748. @subsection Examples
  4749. Add temporal and uniform noise to input video:
  4750. @example
  4751. noise=alls=20:allf=t+u
  4752. @end example
  4753. @section null
  4754. Pass the video source unchanged to the output.
  4755. @section ocv
  4756. Apply a video transform using libopencv.
  4757. To enable this filter, install the libopencv library and headers and
  4758. configure FFmpeg with @code{--enable-libopencv}.
  4759. It accepts the following parameters:
  4760. @table @option
  4761. @item filter_name
  4762. The name of the libopencv filter to apply.
  4763. @item filter_params
  4764. The parameters to pass to the libopencv filter. If not specified, the default
  4765. values are assumed.
  4766. @end table
  4767. Refer to the official libopencv documentation for more precise
  4768. information:
  4769. @url{http://opencv.willowgarage.com/documentation/c/image_filtering.html}
  4770. Several libopencv filters are supported; see the following subsections.
  4771. @anchor{dilate}
  4772. @subsection dilate
  4773. Dilate an image by using a specific structuring element.
  4774. It corresponds to the libopencv function @code{cvDilate}.
  4775. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  4776. @var{struct_el} represents a structuring element, and has the syntax:
  4777. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  4778. @var{cols} and @var{rows} represent the number of columns and rows of
  4779. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  4780. point, and @var{shape} the shape for the structuring element. @var{shape}
  4781. must be "rect", "cross", "ellipse", or "custom".
  4782. If the value for @var{shape} is "custom", it must be followed by a
  4783. string of the form "=@var{filename}". The file with name
  4784. @var{filename} is assumed to represent a binary image, with each
  4785. printable character corresponding to a bright pixel. When a custom
  4786. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  4787. or columns and rows of the read file are assumed instead.
  4788. The default value for @var{struct_el} is "3x3+0x0/rect".
  4789. @var{nb_iterations} specifies the number of times the transform is
  4790. applied to the image, and defaults to 1.
  4791. Some examples:
  4792. @example
  4793. # Use the default values
  4794. ocv=dilate
  4795. # Dilate using a structuring element with a 5x5 cross, iterating two times
  4796. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  4797. # Read the shape from the file diamond.shape, iterating two times.
  4798. # The file diamond.shape may contain a pattern of characters like this
  4799. # *
  4800. # ***
  4801. # *****
  4802. # ***
  4803. # *
  4804. # The specified columns and rows are ignored
  4805. # but the anchor point coordinates are not
  4806. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  4807. @end example
  4808. @subsection erode
  4809. Erode an image by using a specific structuring element.
  4810. It corresponds to the libopencv function @code{cvErode}.
  4811. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  4812. with the same syntax and semantics as the @ref{dilate} filter.
  4813. @subsection smooth
  4814. Smooth the input video.
  4815. The filter takes the following parameters:
  4816. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  4817. @var{type} is the type of smooth filter to apply, and must be one of
  4818. the following values: "blur", "blur_no_scale", "median", "gaussian",
  4819. or "bilateral". The default value is "gaussian".
  4820. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  4821. depend on the smooth type. @var{param1} and
  4822. @var{param2} accept integer positive values or 0. @var{param3} and
  4823. @var{param4} accept floating point values.
  4824. The default value for @var{param1} is 3. The default value for the
  4825. other parameters is 0.
  4826. These parameters correspond to the parameters assigned to the
  4827. libopencv function @code{cvSmooth}.
  4828. @anchor{overlay}
  4829. @section overlay
  4830. Overlay one video on top of another.
  4831. It takes two inputs and has one output. The first input is the "main"
  4832. video on which the second input is overlayed.
  4833. It accepts the following parameters:
  4834. A description of the accepted options follows.
  4835. @table @option
  4836. @item x
  4837. @item y
  4838. Set the expression for the x and y coordinates of the overlayed video
  4839. on the main video. Default value is "0" for both expressions. In case
  4840. the expression is invalid, it is set to a huge value (meaning that the
  4841. overlay will not be displayed within the output visible area).
  4842. @item eof_action
  4843. The action to take when EOF is encountered on the secondary input; it accepts
  4844. one of the following values:
  4845. @table @option
  4846. @item repeat
  4847. Repeat the last frame (the default).
  4848. @item endall
  4849. End both streams.
  4850. @item pass
  4851. Pass the main input through.
  4852. @end table
  4853. @item eval
  4854. Set when the expressions for @option{x}, and @option{y} are evaluated.
  4855. It accepts the following values:
  4856. @table @samp
  4857. @item init
  4858. only evaluate expressions once during the filter initialization or
  4859. when a command is processed
  4860. @item frame
  4861. evaluate expressions for each incoming frame
  4862. @end table
  4863. Default value is @samp{frame}.
  4864. @item shortest
  4865. If set to 1, force the output to terminate when the shortest input
  4866. terminates. Default value is 0.
  4867. @item format
  4868. Set the format for the output video.
  4869. It accepts the following values:
  4870. @table @samp
  4871. @item yuv420
  4872. force YUV420 output
  4873. @item yuv422
  4874. force YUV422 output
  4875. @item yuv444
  4876. force YUV444 output
  4877. @item rgb
  4878. force RGB output
  4879. @end table
  4880. Default value is @samp{yuv420}.
  4881. @item rgb @emph{(deprecated)}
  4882. If set to 1, force the filter to accept inputs in the RGB
  4883. color space. Default value is 0. This option is deprecated, use
  4884. @option{format} instead.
  4885. @item repeatlast
  4886. If set to 1, force the filter to draw the last overlay frame over the
  4887. main input until the end of the stream. A value of 0 disables this
  4888. behavior. Default value is 1.
  4889. @end table
  4890. The @option{x}, and @option{y} expressions can contain the following
  4891. parameters.
  4892. @table @option
  4893. @item main_w, W
  4894. @item main_h, H
  4895. The main input width and height.
  4896. @item overlay_w, w
  4897. @item overlay_h, h
  4898. The overlay input width and height.
  4899. @item x
  4900. @item y
  4901. The computed values for @var{x} and @var{y}. They are evaluated for
  4902. each new frame.
  4903. @item hsub
  4904. @item vsub
  4905. horizontal and vertical chroma subsample values of the output
  4906. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  4907. @var{vsub} is 1.
  4908. @item n
  4909. the number of input frame, starting from 0
  4910. @item pos
  4911. the position in the file of the input frame, NAN if unknown
  4912. @item t
  4913. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  4914. @end table
  4915. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  4916. when evaluation is done @emph{per frame}, and will evaluate to NAN
  4917. when @option{eval} is set to @samp{init}.
  4918. Be aware that frames are taken from each input video in timestamp
  4919. order, hence, if their initial timestamps differ, it is a good idea
  4920. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  4921. have them begin in the same zero timestamp, as the example for
  4922. the @var{movie} filter does.
  4923. You can chain together more overlays but you should test the
  4924. efficiency of such approach.
  4925. @subsection Commands
  4926. This filter supports the following commands:
  4927. @table @option
  4928. @item x
  4929. @item y
  4930. Modify the x and y of the overlay input.
  4931. The command accepts the same syntax of the corresponding option.
  4932. If the specified expression is not valid, it is kept at its current
  4933. value.
  4934. @end table
  4935. @subsection Examples
  4936. @itemize
  4937. @item
  4938. Draw the overlay at 10 pixels from the bottom right corner of the main
  4939. video:
  4940. @example
  4941. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  4942. @end example
  4943. Using named options the example above becomes:
  4944. @example
  4945. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  4946. @end example
  4947. @item
  4948. Insert a transparent PNG logo in the bottom left corner of the input,
  4949. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  4950. @example
  4951. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  4952. @end example
  4953. @item
  4954. Insert 2 different transparent PNG logos (second logo on bottom
  4955. right corner) using the @command{ffmpeg} tool:
  4956. @example
  4957. ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
  4958. @end example
  4959. @item
  4960. Add a transparent color layer on top of the main video; @code{WxH}
  4961. must specify the size of the main input to the overlay filter:
  4962. @example
  4963. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  4964. @end example
  4965. @item
  4966. Play an original video and a filtered version (here with the deshake
  4967. filter) side by side using the @command{ffplay} tool:
  4968. @example
  4969. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  4970. @end example
  4971. The above command is the same as:
  4972. @example
  4973. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  4974. @end example
  4975. @item
  4976. Make a sliding overlay appearing from the left to the right top part of the
  4977. screen starting since time 2:
  4978. @example
  4979. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  4980. @end example
  4981. @item
  4982. Compose output by putting two input videos side to side:
  4983. @example
  4984. ffmpeg -i left.avi -i right.avi -filter_complex "
  4985. nullsrc=size=200x100 [background];
  4986. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  4987. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  4988. [background][left] overlay=shortest=1 [background+left];
  4989. [background+left][right] overlay=shortest=1:x=100 [left+right]
  4990. "
  4991. @end example
  4992. @item
  4993. Mask 10-20 seconds of a video by applying the delogo filter to a section
  4994. @example
  4995. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  4996. -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
  4997. masked.avi
  4998. @end example
  4999. @item
  5000. Chain several overlays in cascade:
  5001. @example
  5002. nullsrc=s=200x200 [bg];
  5003. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  5004. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  5005. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  5006. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  5007. [in3] null, [mid2] overlay=100:100 [out0]
  5008. @end example
  5009. @end itemize
  5010. @section owdenoise
  5011. Apply Overcomplete Wavelet denoiser.
  5012. The filter accepts the following options:
  5013. @table @option
  5014. @item depth
  5015. Set depth.
  5016. Larger depth values will denoise lower frequency components more, but
  5017. slow down filtering.
  5018. Must be an int in the range 8-16, default is @code{8}.
  5019. @item luma_strength, ls
  5020. Set luma strength.
  5021. Must be a double value in the range 0-1000, default is @code{1.0}.
  5022. @item chroma_strength, cs
  5023. Set chroma strength.
  5024. Must be a double value in the range 0-1000, default is @code{1.0}.
  5025. @end table
  5026. @section pad
  5027. Add paddings to the input image, and place the original input at the
  5028. provided @var{x}, @var{y} coordinates.
  5029. It accepts the following parameters:
  5030. @table @option
  5031. @item width, w
  5032. @item height, h
  5033. Specify an expression for the size of the output image with the
  5034. paddings added. If the value for @var{width} or @var{height} is 0, the
  5035. corresponding input size is used for the output.
  5036. The @var{width} expression can reference the value set by the
  5037. @var{height} expression, and vice versa.
  5038. The default value of @var{width} and @var{height} is 0.
  5039. @item x
  5040. @item y
  5041. Specify the offsets to place the input image at within the padded area,
  5042. with respect to the top/left border of the output image.
  5043. The @var{x} expression can reference the value set by the @var{y}
  5044. expression, and vice versa.
  5045. The default value of @var{x} and @var{y} is 0.
  5046. @item color
  5047. Specify the color of the padded area. For the syntax of this option,
  5048. check the "Color" section in the ffmpeg-utils manual.
  5049. The default value of @var{color} is "black".
  5050. @end table
  5051. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  5052. options are expressions containing the following constants:
  5053. @table @option
  5054. @item in_w
  5055. @item in_h
  5056. The input video width and height.
  5057. @item iw
  5058. @item ih
  5059. These are the same as @var{in_w} and @var{in_h}.
  5060. @item out_w
  5061. @item out_h
  5062. The output width and height (the size of the padded area), as
  5063. specified by the @var{width} and @var{height} expressions.
  5064. @item ow
  5065. @item oh
  5066. These are the same as @var{out_w} and @var{out_h}.
  5067. @item x
  5068. @item y
  5069. The x and y offsets as specified by the @var{x} and @var{y}
  5070. expressions, or NAN if not yet specified.
  5071. @item a
  5072. same as @var{iw} / @var{ih}
  5073. @item sar
  5074. input sample aspect ratio
  5075. @item dar
  5076. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5077. @item hsub
  5078. @item vsub
  5079. The horizontal and vertical chroma subsample values. For example for the
  5080. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5081. @end table
  5082. @subsection Examples
  5083. @itemize
  5084. @item
  5085. Add paddings with the color "violet" to the input video. The output video
  5086. size is 640x480, and the top-left corner of the input video is placed at
  5087. column 0, row 40
  5088. @example
  5089. pad=640:480:0:40:violet
  5090. @end example
  5091. The example above is equivalent to the following command:
  5092. @example
  5093. pad=width=640:height=480:x=0:y=40:color=violet
  5094. @end example
  5095. @item
  5096. Pad the input to get an output with dimensions increased by 3/2,
  5097. and put the input video at the center of the padded area:
  5098. @example
  5099. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  5100. @end example
  5101. @item
  5102. Pad the input to get a squared output with size equal to the maximum
  5103. value between the input width and height, and put the input video at
  5104. the center of the padded area:
  5105. @example
  5106. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  5107. @end example
  5108. @item
  5109. Pad the input to get a final w/h ratio of 16:9:
  5110. @example
  5111. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  5112. @end example
  5113. @item
  5114. In case of anamorphic video, in order to set the output display aspect
  5115. correctly, it is necessary to use @var{sar} in the expression,
  5116. according to the relation:
  5117. @example
  5118. (ih * X / ih) * sar = output_dar
  5119. X = output_dar / sar
  5120. @end example
  5121. Thus the previous example needs to be modified to:
  5122. @example
  5123. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  5124. @end example
  5125. @item
  5126. Double the output size and put the input video in the bottom-right
  5127. corner of the output padded area:
  5128. @example
  5129. pad="2*iw:2*ih:ow-iw:oh-ih"
  5130. @end example
  5131. @end itemize
  5132. @section perspective
  5133. Correct perspective of video not recorded perpendicular to the screen.
  5134. A description of the accepted parameters follows.
  5135. @table @option
  5136. @item x0
  5137. @item y0
  5138. @item x1
  5139. @item y1
  5140. @item x2
  5141. @item y2
  5142. @item x3
  5143. @item y3
  5144. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  5145. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  5146. The expressions can use the following variables:
  5147. @table @option
  5148. @item W
  5149. @item H
  5150. the width and height of video frame.
  5151. @end table
  5152. @item interpolation
  5153. Set interpolation for perspective correction.
  5154. It accepts the following values:
  5155. @table @samp
  5156. @item linear
  5157. @item cubic
  5158. @end table
  5159. Default value is @samp{linear}.
  5160. @end table
  5161. @section phase
  5162. Delay interlaced video by one field time so that the field order changes.
  5163. The intended use is to fix PAL movies that have been captured with the
  5164. opposite field order to the film-to-video transfer.
  5165. A description of the accepted parameters follows.
  5166. @table @option
  5167. @item mode
  5168. Set phase mode.
  5169. It accepts the following values:
  5170. @table @samp
  5171. @item t
  5172. Capture field order top-first, transfer bottom-first.
  5173. Filter will delay the bottom field.
  5174. @item b
  5175. Capture field order bottom-first, transfer top-first.
  5176. Filter will delay the top field.
  5177. @item p
  5178. Capture and transfer with the same field order. This mode only exists
  5179. for the documentation of the other options to refer to, but if you
  5180. actually select it, the filter will faithfully do nothing.
  5181. @item a
  5182. Capture field order determined automatically by field flags, transfer
  5183. opposite.
  5184. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  5185. basis using field flags. If no field information is available,
  5186. then this works just like @samp{u}.
  5187. @item u
  5188. Capture unknown or varying, transfer opposite.
  5189. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  5190. analyzing the images and selecting the alternative that produces best
  5191. match between the fields.
  5192. @item T
  5193. Capture top-first, transfer unknown or varying.
  5194. Filter selects among @samp{t} and @samp{p} using image analysis.
  5195. @item B
  5196. Capture bottom-first, transfer unknown or varying.
  5197. Filter selects among @samp{b} and @samp{p} using image analysis.
  5198. @item A
  5199. Capture determined by field flags, transfer unknown or varying.
  5200. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  5201. image analysis. If no field information is available, then this works just
  5202. like @samp{U}. This is the default mode.
  5203. @item U
  5204. Both capture and transfer unknown or varying.
  5205. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  5206. @end table
  5207. @end table
  5208. @section pixdesctest
  5209. Pixel format descriptor test filter, mainly useful for internal
  5210. testing. The output video should be equal to the input video.
  5211. For example:
  5212. @example
  5213. format=monow, pixdesctest
  5214. @end example
  5215. can be used to test the monowhite pixel format descriptor definition.
  5216. @section pp
  5217. Enable the specified chain of postprocessing subfilters using libpostproc. This
  5218. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  5219. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  5220. Each subfilter and some options have a short and a long name that can be used
  5221. interchangeably, i.e. dr/dering are the same.
  5222. The filters accept the following options:
  5223. @table @option
  5224. @item subfilters
  5225. Set postprocessing subfilters string.
  5226. @end table
  5227. All subfilters share common options to determine their scope:
  5228. @table @option
  5229. @item a/autoq
  5230. Honor the quality commands for this subfilter.
  5231. @item c/chrom
  5232. Do chrominance filtering, too (default).
  5233. @item y/nochrom
  5234. Do luminance filtering only (no chrominance).
  5235. @item n/noluma
  5236. Do chrominance filtering only (no luminance).
  5237. @end table
  5238. These options can be appended after the subfilter name, separated by a '|'.
  5239. Available subfilters are:
  5240. @table @option
  5241. @item hb/hdeblock[|difference[|flatness]]
  5242. Horizontal deblocking filter
  5243. @table @option
  5244. @item difference
  5245. Difference factor where higher values mean more deblocking (default: @code{32}).
  5246. @item flatness
  5247. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  5248. @end table
  5249. @item vb/vdeblock[|difference[|flatness]]
  5250. Vertical deblocking filter
  5251. @table @option
  5252. @item difference
  5253. Difference factor where higher values mean more deblocking (default: @code{32}).
  5254. @item flatness
  5255. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  5256. @end table
  5257. @item ha/hadeblock[|difference[|flatness]]
  5258. Accurate horizontal deblocking filter
  5259. @table @option
  5260. @item difference
  5261. Difference factor where higher values mean more deblocking (default: @code{32}).
  5262. @item flatness
  5263. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  5264. @end table
  5265. @item va/vadeblock[|difference[|flatness]]
  5266. Accurate vertical deblocking filter
  5267. @table @option
  5268. @item difference
  5269. Difference factor where higher values mean more deblocking (default: @code{32}).
  5270. @item flatness
  5271. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  5272. @end table
  5273. @end table
  5274. The horizontal and vertical deblocking filters share the difference and
  5275. flatness values so you cannot set different horizontal and vertical
  5276. thresholds.
  5277. @table @option
  5278. @item h1/x1hdeblock
  5279. Experimental horizontal deblocking filter
  5280. @item v1/x1vdeblock
  5281. Experimental vertical deblocking filter
  5282. @item dr/dering
  5283. Deringing filter
  5284. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  5285. @table @option
  5286. @item threshold1
  5287. larger -> stronger filtering
  5288. @item threshold2
  5289. larger -> stronger filtering
  5290. @item threshold3
  5291. larger -> stronger filtering
  5292. @end table
  5293. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  5294. @table @option
  5295. @item f/fullyrange
  5296. Stretch luminance to @code{0-255}.
  5297. @end table
  5298. @item lb/linblenddeint
  5299. Linear blend deinterlacing filter that deinterlaces the given block by
  5300. filtering all lines with a @code{(1 2 1)} filter.
  5301. @item li/linipoldeint
  5302. Linear interpolating deinterlacing filter that deinterlaces the given block by
  5303. linearly interpolating every second line.
  5304. @item ci/cubicipoldeint
  5305. Cubic interpolating deinterlacing filter deinterlaces the given block by
  5306. cubically interpolating every second line.
  5307. @item md/mediandeint
  5308. Median deinterlacing filter that deinterlaces the given block by applying a
  5309. median filter to every second line.
  5310. @item fd/ffmpegdeint
  5311. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  5312. second line with a @code{(-1 4 2 4 -1)} filter.
  5313. @item l5/lowpass5
  5314. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  5315. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  5316. @item fq/forceQuant[|quantizer]
  5317. Overrides the quantizer table from the input with the constant quantizer you
  5318. specify.
  5319. @table @option
  5320. @item quantizer
  5321. Quantizer to use
  5322. @end table
  5323. @item de/default
  5324. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  5325. @item fa/fast
  5326. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  5327. @item ac
  5328. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  5329. @end table
  5330. @subsection Examples
  5331. @itemize
  5332. @item
  5333. Apply horizontal and vertical deblocking, deringing and automatic
  5334. brightness/contrast:
  5335. @example
  5336. pp=hb/vb/dr/al
  5337. @end example
  5338. @item
  5339. Apply default filters without brightness/contrast correction:
  5340. @example
  5341. pp=de/-al
  5342. @end example
  5343. @item
  5344. Apply default filters and temporal denoiser:
  5345. @example
  5346. pp=default/tmpnoise|1|2|3
  5347. @end example
  5348. @item
  5349. Apply deblocking on luminance only, and switch vertical deblocking on or off
  5350. automatically depending on available CPU time:
  5351. @example
  5352. pp=hb|y/vb|a
  5353. @end example
  5354. @end itemize
  5355. @section psnr
  5356. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  5357. Ratio) between two input videos.
  5358. This filter takes in input two input videos, the first input is
  5359. considered the "main" source and is passed unchanged to the
  5360. output. The second input is used as a "reference" video for computing
  5361. the PSNR.
  5362. Both video inputs must have the same resolution and pixel format for
  5363. this filter to work correctly. Also it assumes that both inputs
  5364. have the same number of frames, which are compared one by one.
  5365. The obtained average PSNR is printed through the logging system.
  5366. The filter stores the accumulated MSE (mean squared error) of each
  5367. frame, and at the end of the processing it is averaged across all frames
  5368. equally, and the following formula is applied to obtain the PSNR:
  5369. @example
  5370. PSNR = 10*log10(MAX^2/MSE)
  5371. @end example
  5372. Where MAX is the average of the maximum values of each component of the
  5373. image.
  5374. The description of the accepted parameters follows.
  5375. @table @option
  5376. @item stats_file, f
  5377. If specified the filter will use the named file to save the PSNR of
  5378. each individual frame.
  5379. @end table
  5380. The file printed if @var{stats_file} is selected, contains a sequence of
  5381. key/value pairs of the form @var{key}:@var{value} for each compared
  5382. couple of frames.
  5383. A description of each shown parameter follows:
  5384. @table @option
  5385. @item n
  5386. sequential number of the input frame, starting from 1
  5387. @item mse_avg
  5388. Mean Square Error pixel-by-pixel average difference of the compared
  5389. frames, averaged over all the image components.
  5390. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  5391. Mean Square Error pixel-by-pixel average difference of the compared
  5392. frames for the component specified by the suffix.
  5393. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  5394. Peak Signal to Noise ratio of the compared frames for the component
  5395. specified by the suffix.
  5396. @end table
  5397. For example:
  5398. @example
  5399. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  5400. [main][ref] psnr="stats_file=stats.log" [out]
  5401. @end example
  5402. On this example the input file being processed is compared with the
  5403. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  5404. is stored in @file{stats.log}.
  5405. @anchor{pullup}
  5406. @section pullup
  5407. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  5408. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  5409. content.
  5410. The pullup filter is designed to take advantage of future context in making
  5411. its decisions. This filter is stateless in the sense that it does not lock
  5412. onto a pattern to follow, but it instead looks forward to the following
  5413. fields in order to identify matches and rebuild progressive frames.
  5414. To produce content with an even framerate, insert the fps filter after
  5415. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  5416. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  5417. The filter accepts the following options:
  5418. @table @option
  5419. @item jl
  5420. @item jr
  5421. @item jt
  5422. @item jb
  5423. These options set the amount of "junk" to ignore at the left, right, top, and
  5424. bottom of the image, respectively. Left and right are in units of 8 pixels,
  5425. while top and bottom are in units of 2 lines.
  5426. The default is 8 pixels on each side.
  5427. @item sb
  5428. Set the strict breaks. Setting this option to 1 will reduce the chances of
  5429. filter generating an occasional mismatched frame, but it may also cause an
  5430. excessive number of frames to be dropped during high motion sequences.
  5431. Conversely, setting it to -1 will make filter match fields more easily.
  5432. This may help processing of video where there is slight blurring between
  5433. the fields, but may also cause there to be interlaced frames in the output.
  5434. Default value is @code{0}.
  5435. @item mp
  5436. Set the metric plane to use. It accepts the following values:
  5437. @table @samp
  5438. @item l
  5439. Use luma plane.
  5440. @item u
  5441. Use chroma blue plane.
  5442. @item v
  5443. Use chroma red plane.
  5444. @end table
  5445. This option may be set to use chroma plane instead of the default luma plane
  5446. for doing filter's computations. This may improve accuracy on very clean
  5447. source material, but more likely will decrease accuracy, especially if there
  5448. is chroma noise (rainbow effect) or any grayscale video.
  5449. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  5450. load and make pullup usable in realtime on slow machines.
  5451. @end table
  5452. For best results (without duplicated frames in the output file) it is
  5453. necessary to change the output frame rate. For example, to inverse
  5454. telecine NTSC input:
  5455. @example
  5456. ffmpeg -i input -vf pullup -r 24000/1001 ...
  5457. @end example
  5458. @section removelogo
  5459. Suppress a TV station logo, using an image file to determine which
  5460. pixels comprise the logo. It works by filling in the pixels that
  5461. comprise the logo with neighboring pixels.
  5462. The filter accepts the following options:
  5463. @table @option
  5464. @item filename, f
  5465. Set the filter bitmap file, which can be any image format supported by
  5466. libavformat. The width and height of the image file must match those of the
  5467. video stream being processed.
  5468. @end table
  5469. Pixels in the provided bitmap image with a value of zero are not
  5470. considered part of the logo, non-zero pixels are considered part of
  5471. the logo. If you use white (255) for the logo and black (0) for the
  5472. rest, you will be safe. For making the filter bitmap, it is
  5473. recommended to take a screen capture of a black frame with the logo
  5474. visible, and then using a threshold filter followed by the erode
  5475. filter once or twice.
  5476. If needed, little splotches can be fixed manually. Remember that if
  5477. logo pixels are not covered, the filter quality will be much
  5478. reduced. Marking too many pixels as part of the logo does not hurt as
  5479. much, but it will increase the amount of blurring needed to cover over
  5480. the image and will destroy more information than necessary, and extra
  5481. pixels will slow things down on a large logo.
  5482. @section rotate
  5483. Rotate video by an arbitrary angle expressed in radians.
  5484. The filter accepts the following options:
  5485. A description of the optional parameters follows.
  5486. @table @option
  5487. @item angle, a
  5488. Set an expression for the angle by which to rotate the input video
  5489. clockwise, expressed as a number of radians. A negative value will
  5490. result in a counter-clockwise rotation. By default it is set to "0".
  5491. This expression is evaluated for each frame.
  5492. @item out_w, ow
  5493. Set the output width expression, default value is "iw".
  5494. This expression is evaluated just once during configuration.
  5495. @item out_h, oh
  5496. Set the output height expression, default value is "ih".
  5497. This expression is evaluated just once during configuration.
  5498. @item bilinear
  5499. Enable bilinear interpolation if set to 1, a value of 0 disables
  5500. it. Default value is 1.
  5501. @item fillcolor, c
  5502. Set the color used to fill the output area not covered by the rotated
  5503. image. For the generalsyntax of this option, check the "Color" section in the
  5504. ffmpeg-utils manual. If the special value "none" is selected then no
  5505. background is printed (useful for example if the background is never shown).
  5506. Default value is "black".
  5507. @end table
  5508. The expressions for the angle and the output size can contain the
  5509. following constants and functions:
  5510. @table @option
  5511. @item n
  5512. sequential number of the input frame, starting from 0. It is always NAN
  5513. before the first frame is filtered.
  5514. @item t
  5515. time in seconds of the input frame, it is set to 0 when the filter is
  5516. configured. It is always NAN before the first frame is filtered.
  5517. @item hsub
  5518. @item vsub
  5519. horizontal and vertical chroma subsample values. For example for the
  5520. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5521. @item in_w, iw
  5522. @item in_h, ih
  5523. the input video width and height
  5524. @item out_w, ow
  5525. @item out_h, oh
  5526. the output width and height, that is the size of the padded area as
  5527. specified by the @var{width} and @var{height} expressions
  5528. @item rotw(a)
  5529. @item roth(a)
  5530. the minimal width/height required for completely containing the input
  5531. video rotated by @var{a} radians.
  5532. These are only available when computing the @option{out_w} and
  5533. @option{out_h} expressions.
  5534. @end table
  5535. @subsection Examples
  5536. @itemize
  5537. @item
  5538. Rotate the input by PI/6 radians clockwise:
  5539. @example
  5540. rotate=PI/6
  5541. @end example
  5542. @item
  5543. Rotate the input by PI/6 radians counter-clockwise:
  5544. @example
  5545. rotate=-PI/6
  5546. @end example
  5547. @item
  5548. Rotate the input by 45 degrees clockwise:
  5549. @example
  5550. rotate=45*PI/180
  5551. @end example
  5552. @item
  5553. Apply a constant rotation with period T, starting from an angle of PI/3:
  5554. @example
  5555. rotate=PI/3+2*PI*t/T
  5556. @end example
  5557. @item
  5558. Make the input video rotation oscillating with a period of T
  5559. seconds and an amplitude of A radians:
  5560. @example
  5561. rotate=A*sin(2*PI/T*t)
  5562. @end example
  5563. @item
  5564. Rotate the video, output size is chosen so that the whole rotating
  5565. input video is always completely contained in the output:
  5566. @example
  5567. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  5568. @end example
  5569. @item
  5570. Rotate the video, reduce the output size so that no background is ever
  5571. shown:
  5572. @example
  5573. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  5574. @end example
  5575. @end itemize
  5576. @subsection Commands
  5577. The filter supports the following commands:
  5578. @table @option
  5579. @item a, angle
  5580. Set the angle expression.
  5581. The command accepts the same syntax of the corresponding option.
  5582. If the specified expression is not valid, it is kept at its current
  5583. value.
  5584. @end table
  5585. @section sab
  5586. Apply Shape Adaptive Blur.
  5587. The filter accepts the following options:
  5588. @table @option
  5589. @item luma_radius, lr
  5590. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  5591. value is 1.0. A greater value will result in a more blurred image, and
  5592. in slower processing.
  5593. @item luma_pre_filter_radius, lpfr
  5594. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  5595. value is 1.0.
  5596. @item luma_strength, ls
  5597. Set luma maximum difference between pixels to still be considered, must
  5598. be a value in the 0.1-100.0 range, default value is 1.0.
  5599. @item chroma_radius, cr
  5600. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  5601. greater value will result in a more blurred image, and in slower
  5602. processing.
  5603. @item chroma_pre_filter_radius, cpfr
  5604. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  5605. @item chroma_strength, cs
  5606. Set chroma maximum difference between pixels to still be considered,
  5607. must be a value in the 0.1-100.0 range.
  5608. @end table
  5609. Each chroma option value, if not explicitly specified, is set to the
  5610. corresponding luma option value.
  5611. @anchor{scale}
  5612. @section scale
  5613. Scale (resize) the input video, using the libswscale library.
  5614. The scale filter forces the output display aspect ratio to be the same
  5615. of the input, by changing the output sample aspect ratio.
  5616. If the input image format is different from the format requested by
  5617. the next filter, the scale filter will convert the input to the
  5618. requested format.
  5619. @subsection Options
  5620. The filter accepts the following options, or any of the options
  5621. supported by the libswscale scaler.
  5622. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  5623. the complete list of scaler options.
  5624. @table @option
  5625. @item width, w
  5626. @item height, h
  5627. Set the output video dimension expression. Default value is the input
  5628. dimension.
  5629. If the value is 0, the input width is used for the output.
  5630. If one of the values is -1, the scale filter will use a value that
  5631. maintains the aspect ratio of the input image, calculated from the
  5632. other specified dimension. If both of them are -1, the input size is
  5633. used
  5634. If one of the values is -n with n > 1, the scale filter will also use a value
  5635. that maintains the aspect ratio of the input image, calculated from the other
  5636. specified dimension. After that it will, however, make sure that the calculated
  5637. dimension is divisible by n and adjust the value if necessary.
  5638. See below for the list of accepted constants for use in the dimension
  5639. expression.
  5640. @item interl
  5641. Set the interlacing mode. It accepts the following values:
  5642. @table @samp
  5643. @item 1
  5644. Force interlaced aware scaling.
  5645. @item 0
  5646. Do not apply interlaced scaling.
  5647. @item -1
  5648. Select interlaced aware scaling depending on whether the source frames
  5649. are flagged as interlaced or not.
  5650. @end table
  5651. Default value is @samp{0}.
  5652. @item flags
  5653. Set libswscale scaling flags. See
  5654. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  5655. complete list of values. If not explicitly specified the filter applies
  5656. the default flags.
  5657. @item size, s
  5658. Set the video size. For the syntax of this option, check the "Video size"
  5659. section in the ffmpeg-utils manual.
  5660. @item in_color_matrix
  5661. @item out_color_matrix
  5662. Set in/output YCbCr color space type.
  5663. This allows the autodetected value to be overridden as well as allows forcing
  5664. a specific value used for the output and encoder.
  5665. If not specified, the color space type depends on the pixel format.
  5666. Possible values:
  5667. @table @samp
  5668. @item auto
  5669. Choose automatically.
  5670. @item bt709
  5671. Format conforming to International Telecommunication Union (ITU)
  5672. Recommendation BT.709.
  5673. @item fcc
  5674. Set color space conforming to the United States Federal Communications
  5675. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  5676. @item bt601
  5677. Set color space conforming to:
  5678. @itemize
  5679. @item
  5680. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  5681. @item
  5682. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  5683. @item
  5684. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  5685. @end itemize
  5686. @item smpte240m
  5687. Set color space conforming to SMPTE ST 240:1999.
  5688. @end table
  5689. @item in_range
  5690. @item out_range
  5691. Set in/output YCbCr sample range.
  5692. This allows the autodetected value to be overridden as well as allows forcing
  5693. a specific value used for the output and encoder. If not specified, the
  5694. range depends on the pixel format. Possible values:
  5695. @table @samp
  5696. @item auto
  5697. Choose automatically.
  5698. @item jpeg/full/pc
  5699. Set full range (0-255 in case of 8-bit luma).
  5700. @item mpeg/tv
  5701. Set "MPEG" range (16-235 in case of 8-bit luma).
  5702. @end table
  5703. @item force_original_aspect_ratio
  5704. Enable decreasing or increasing output video width or height if necessary to
  5705. keep the original aspect ratio. Possible values:
  5706. @table @samp
  5707. @item disable
  5708. Scale the video as specified and disable this feature.
  5709. @item decrease
  5710. The output video dimensions will automatically be decreased if needed.
  5711. @item increase
  5712. The output video dimensions will automatically be increased if needed.
  5713. @end table
  5714. One useful instance of this option is that when you know a specific device's
  5715. maximum allowed resolution, you can use this to limit the output video to
  5716. that, while retaining the aspect ratio. For example, device A allows
  5717. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  5718. decrease) and specifying 1280x720 to the command line makes the output
  5719. 1280x533.
  5720. Please note that this is a different thing than specifying -1 for @option{w}
  5721. or @option{h}, you still need to specify the output resolution for this option
  5722. to work.
  5723. @end table
  5724. The values of the @option{w} and @option{h} options are expressions
  5725. containing the following constants:
  5726. @table @var
  5727. @item in_w
  5728. @item in_h
  5729. The input width and height
  5730. @item iw
  5731. @item ih
  5732. These are the same as @var{in_w} and @var{in_h}.
  5733. @item out_w
  5734. @item out_h
  5735. The output (scaled) width and height
  5736. @item ow
  5737. @item oh
  5738. These are the same as @var{out_w} and @var{out_h}
  5739. @item a
  5740. The same as @var{iw} / @var{ih}
  5741. @item sar
  5742. input sample aspect ratio
  5743. @item dar
  5744. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  5745. @item hsub
  5746. @item vsub
  5747. horizontal and vertical input chroma subsample values. For example for the
  5748. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5749. @item ohsub
  5750. @item ovsub
  5751. horizontal and vertical output chroma subsample values. For example for the
  5752. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5753. @end table
  5754. @subsection Examples
  5755. @itemize
  5756. @item
  5757. Scale the input video to a size of 200x100
  5758. @example
  5759. scale=w=200:h=100
  5760. @end example
  5761. This is equivalent to:
  5762. @example
  5763. scale=200:100
  5764. @end example
  5765. or:
  5766. @example
  5767. scale=200x100
  5768. @end example
  5769. @item
  5770. Specify a size abbreviation for the output size:
  5771. @example
  5772. scale=qcif
  5773. @end example
  5774. which can also be written as:
  5775. @example
  5776. scale=size=qcif
  5777. @end example
  5778. @item
  5779. Scale the input to 2x:
  5780. @example
  5781. scale=w=2*iw:h=2*ih
  5782. @end example
  5783. @item
  5784. The above is the same as:
  5785. @example
  5786. scale=2*in_w:2*in_h
  5787. @end example
  5788. @item
  5789. Scale the input to 2x with forced interlaced scaling:
  5790. @example
  5791. scale=2*iw:2*ih:interl=1
  5792. @end example
  5793. @item
  5794. Scale the input to half size:
  5795. @example
  5796. scale=w=iw/2:h=ih/2
  5797. @end example
  5798. @item
  5799. Increase the width, and set the height to the same size:
  5800. @example
  5801. scale=3/2*iw:ow
  5802. @end example
  5803. @item
  5804. Seek Greek harmony:
  5805. @example
  5806. scale=iw:1/PHI*iw
  5807. scale=ih*PHI:ih
  5808. @end example
  5809. @item
  5810. Increase the height, and set the width to 3/2 of the height:
  5811. @example
  5812. scale=w=3/2*oh:h=3/5*ih
  5813. @end example
  5814. @item
  5815. Increase the size, making the size a multiple of the chroma
  5816. subsample values:
  5817. @example
  5818. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  5819. @end example
  5820. @item
  5821. Increase the width to a maximum of 500 pixels,
  5822. keeping the same aspect ratio as the input:
  5823. @example
  5824. scale=w='min(500\, iw*3/2):h=-1'
  5825. @end example
  5826. @end itemize
  5827. @section separatefields
  5828. The @code{separatefields} takes a frame-based video input and splits
  5829. each frame into its components fields, producing a new half height clip
  5830. with twice the frame rate and twice the frame count.
  5831. This filter use field-dominance information in frame to decide which
  5832. of each pair of fields to place first in the output.
  5833. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  5834. @section setdar, setsar
  5835. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  5836. output video.
  5837. This is done by changing the specified Sample (aka Pixel) Aspect
  5838. Ratio, according to the following equation:
  5839. @example
  5840. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  5841. @end example
  5842. Keep in mind that the @code{setdar} filter does not modify the pixel
  5843. dimensions of the video frame. Also, the display aspect ratio set by
  5844. this filter may be changed by later filters in the filterchain,
  5845. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  5846. applied.
  5847. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  5848. the filter output video.
  5849. Note that as a consequence of the application of this filter, the
  5850. output display aspect ratio will change according to the equation
  5851. above.
  5852. Keep in mind that the sample aspect ratio set by the @code{setsar}
  5853. filter may be changed by later filters in the filterchain, e.g. if
  5854. another "setsar" or a "setdar" filter is applied.
  5855. It accepts the following parameters:
  5856. @table @option
  5857. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  5858. Set the aspect ratio used by the filter.
  5859. The parameter can be a floating point number string, an expression, or
  5860. a string of the form @var{num}:@var{den}, where @var{num} and
  5861. @var{den} are the numerator and denominator of the aspect ratio. If
  5862. the parameter is not specified, it is assumed the value "0".
  5863. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  5864. should be escaped.
  5865. @item max
  5866. Set the maximum integer value to use for expressing numerator and
  5867. denominator when reducing the expressed aspect ratio to a rational.
  5868. Default value is @code{100}.
  5869. @end table
  5870. The parameter @var{sar} is an expression containing
  5871. the following constants:
  5872. @table @option
  5873. @item E, PI, PHI
  5874. These are approximated values for the mathematical constants e
  5875. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  5876. @item w, h
  5877. The input width and height.
  5878. @item a
  5879. These are the same as @var{w} / @var{h}.
  5880. @item sar
  5881. The input sample aspect ratio.
  5882. @item dar
  5883. The input display aspect ratio. It is the same as
  5884. (@var{w} / @var{h}) * @var{sar}.
  5885. @item hsub, vsub
  5886. Horizontal and vertical chroma subsample values. For example, for the
  5887. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5888. @end table
  5889. @subsection Examples
  5890. @itemize
  5891. @item
  5892. To change the display aspect ratio to 16:9, specify one of the following:
  5893. @example
  5894. setdar=dar=1.77777
  5895. setdar=dar=16/9
  5896. setdar=dar=1.77777
  5897. @end example
  5898. @item
  5899. To change the sample aspect ratio to 10:11, specify:
  5900. @example
  5901. setsar=sar=10/11
  5902. @end example
  5903. @item
  5904. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  5905. 1000 in the aspect ratio reduction, use the command:
  5906. @example
  5907. setdar=ratio=16/9:max=1000
  5908. @end example
  5909. @end itemize
  5910. @anchor{setfield}
  5911. @section setfield
  5912. Force field for the output video frame.
  5913. The @code{setfield} filter marks the interlace type field for the
  5914. output frames. It does not change the input frame, but only sets the
  5915. corresponding property, which affects how the frame is treated by
  5916. following filters (e.g. @code{fieldorder} or @code{yadif}).
  5917. The filter accepts the following options:
  5918. @table @option
  5919. @item mode
  5920. Available values are:
  5921. @table @samp
  5922. @item auto
  5923. Keep the same field property.
  5924. @item bff
  5925. Mark the frame as bottom-field-first.
  5926. @item tff
  5927. Mark the frame as top-field-first.
  5928. @item prog
  5929. Mark the frame as progressive.
  5930. @end table
  5931. @end table
  5932. @section showinfo
  5933. Show a line containing various information for each input video frame.
  5934. The input video is not modified.
  5935. The shown line contains a sequence of key/value pairs of the form
  5936. @var{key}:@var{value}.
  5937. The following values are shown in the output:
  5938. @table @option
  5939. @item n
  5940. The (sequential) number of the input frame, starting from 0.
  5941. @item pts
  5942. The Presentation TimeStamp of the input frame, expressed as a number of
  5943. time base units. The time base unit depends on the filter input pad.
  5944. @item pts_time
  5945. The Presentation TimeStamp of the input frame, expressed as a number of
  5946. seconds.
  5947. @item pos
  5948. The position of the frame in the input stream, or -1 if this information is
  5949. unavailable and/or meaningless (for example in case of synthetic video).
  5950. @item fmt
  5951. The pixel format name.
  5952. @item sar
  5953. The sample aspect ratio of the input frame, expressed in the form
  5954. @var{num}/@var{den}.
  5955. @item s
  5956. The size of the input frame. For the syntax of this option, check the "Video size"
  5957. section in the ffmpeg-utils manual.
  5958. @item i
  5959. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  5960. for bottom field first).
  5961. @item iskey
  5962. This is 1 if the frame is a key frame, 0 otherwise.
  5963. @item type
  5964. The picture type of the input frame ("I" for an I-frame, "P" for a
  5965. P-frame, "B" for a B-frame, or "?" for an unknown type).
  5966. Also refer to the documentation of the @code{AVPictureType} enum and of
  5967. the @code{av_get_picture_type_char} function defined in
  5968. @file{libavutil/avutil.h}.
  5969. @item checksum
  5970. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  5971. @item plane_checksum
  5972. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  5973. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  5974. @end table
  5975. @section shuffleplanes
  5976. Reorder and/or duplicate video planes.
  5977. It accepts the following parameters:
  5978. @table @option
  5979. @item map0
  5980. The index of the input plane to be used as the first output plane.
  5981. @item map1
  5982. The index of the input plane to be used as the second output plane.
  5983. @item map2
  5984. The index of the input plane to be used as the third output plane.
  5985. @item map3
  5986. The index of the input plane to be used as the fourth output plane.
  5987. @end table
  5988. The first plane has the index 0. The default is to keep the input unchanged.
  5989. Swap the second and third planes of the input:
  5990. @example
  5991. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  5992. @end example
  5993. @section signalstats
  5994. Evaluate various visual metrics that assist in determining issues associated
  5995. with the digitization of analog video media.
  5996. By default the filter will log these metadata values:
  5997. @table @option
  5998. @item YMIN
  5999. Display the minimal Y value contained within the input frame. Expressed in
  6000. range of [0-255].
  6001. @item YLOW
  6002. Display the Y value at the 10% percentile within the input frame. Expressed in
  6003. range of [0-255].
  6004. @item YAVG
  6005. Display the average Y value within the input frame. Expressed in range of
  6006. [0-255].
  6007. @item YHIGH
  6008. Display the Y value at the 90% percentile within the input frame. Expressed in
  6009. range of [0-255].
  6010. @item YMAX
  6011. Display the maximum Y value contained within the input frame. Expressed in
  6012. range of [0-255].
  6013. @item UMIN
  6014. Display the minimal U value contained within the input frame. Expressed in
  6015. range of [0-255].
  6016. @item ULOW
  6017. Display the U value at the 10% percentile within the input frame. Expressed in
  6018. range of [0-255].
  6019. @item UAVG
  6020. Display the average U value within the input frame. Expressed in range of
  6021. [0-255].
  6022. @item UHIGH
  6023. Display the U value at the 90% percentile within the input frame. Expressed in
  6024. range of [0-255].
  6025. @item UMAX
  6026. Display the maximum U value contained within the input frame. Expressed in
  6027. range of [0-255].
  6028. @item VMIN
  6029. Display the minimal V value contained within the input frame. Expressed in
  6030. range of [0-255].
  6031. @item VLOW
  6032. Display the V value at the 10% percentile within the input frame. Expressed in
  6033. range of [0-255].
  6034. @item VAVG
  6035. Display the average V value within the input frame. Expressed in range of
  6036. [0-255].
  6037. @item VHIGH
  6038. Display the V value at the 90% percentile within the input frame. Expressed in
  6039. range of [0-255].
  6040. @item VMAX
  6041. Display the maximum V value contained within the input frame. Expressed in
  6042. range of [0-255].
  6043. @item SATMIN
  6044. Display the minimal saturation value contained within the input frame.
  6045. Expressed in range of [0-~181.02].
  6046. @item SATLOW
  6047. Display the saturation value at the 10% percentile within the input frame.
  6048. Expressed in range of [0-~181.02].
  6049. @item SATAVG
  6050. Display the average saturation value within the input frame. Expressed in range
  6051. of [0-~181.02].
  6052. @item SATHIGH
  6053. Display the saturation value at the 90% percentile within the input frame.
  6054. Expressed in range of [0-~181.02].
  6055. @item SATMAX
  6056. Display the maximum saturation value contained within the input frame.
  6057. Expressed in range of [0-~181.02].
  6058. @item HUEMED
  6059. Display the median value for hue within the input frame. Expressed in range of
  6060. [0-360].
  6061. @item HUEAVG
  6062. Display the average value for hue within the input frame. Expressed in range of
  6063. [0-360].
  6064. @item YDIF
  6065. Display the average of sample value difference between all values of the Y
  6066. plane in the current frame and corresponding values of the previous input frame.
  6067. Expressed in range of [0-255].
  6068. @item UDIF
  6069. Display the average of sample value difference between all values of the U
  6070. plane in the current frame and corresponding values of the previous input frame.
  6071. Expressed in range of [0-255].
  6072. @item VDIF
  6073. Display the average of sample value difference between all values of the V
  6074. plane in the current frame and corresponding values of the previous input frame.
  6075. Expressed in range of [0-255].
  6076. @end table
  6077. The filter accepts the following options:
  6078. @table @option
  6079. @item stat
  6080. @item out
  6081. @option{stat} specify an additional form of image analysis.
  6082. @option{out} output video with the specified type of pixel highlighted.
  6083. Both options accept the following values:
  6084. @table @samp
  6085. @item tout
  6086. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  6087. unlike the neighboring pixels of the same field. Examples of temporal outliers
  6088. include the results of video dropouts, head clogs, or tape tracking issues.
  6089. @item vrep
  6090. Identify @var{vertical line repetition}. Vertical line repetition includes
  6091. similar rows of pixels within a frame. In born-digital video vertical line
  6092. repetition is common, but this pattern is uncommon in video digitized from an
  6093. analog source. When it occurs in video that results from the digitization of an
  6094. analog source it can indicate concealment from a dropout compensator.
  6095. @item brng
  6096. Identify pixels that fall outside of legal broadcast range.
  6097. @end table
  6098. @item color, c
  6099. Set the highlight color for the @option{out} option. The default color is
  6100. yellow.
  6101. @end table
  6102. @subsection Examples
  6103. @itemize
  6104. @item
  6105. Output data of various video metrics:
  6106. @example
  6107. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  6108. @end example
  6109. @item
  6110. Output specific data about the minimum and maximum values of the Y plane per frame:
  6111. @example
  6112. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  6113. @end example
  6114. @item
  6115. Playback video while highlighting pixels that are outside of broadcast range in red.
  6116. @example
  6117. ffplay example.mov -vf signalstats="out=brng:color=red"
  6118. @end example
  6119. @item
  6120. Playback video with signalstats metadata drawn over the frame.
  6121. @example
  6122. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  6123. @end example
  6124. The contents of signalstat_drawtext.txt used in the command are:
  6125. @example
  6126. time %@{pts:hms@}
  6127. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  6128. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  6129. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  6130. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  6131. @end example
  6132. @end itemize
  6133. @anchor{smartblur}
  6134. @section smartblur
  6135. Blur the input video without impacting the outlines.
  6136. It accepts the following options:
  6137. @table @option
  6138. @item luma_radius, lr
  6139. Set the luma radius. The option value must be a float number in
  6140. the range [0.1,5.0] that specifies the variance of the gaussian filter
  6141. used to blur the image (slower if larger). Default value is 1.0.
  6142. @item luma_strength, ls
  6143. Set the luma strength. The option value must be a float number
  6144. in the range [-1.0,1.0] that configures the blurring. A value included
  6145. in [0.0,1.0] will blur the image whereas a value included in
  6146. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  6147. @item luma_threshold, lt
  6148. Set the luma threshold used as a coefficient to determine
  6149. whether a pixel should be blurred or not. The option value must be an
  6150. integer in the range [-30,30]. A value of 0 will filter all the image,
  6151. a value included in [0,30] will filter flat areas and a value included
  6152. in [-30,0] will filter edges. Default value is 0.
  6153. @item chroma_radius, cr
  6154. Set the chroma radius. The option value must be a float number in
  6155. the range [0.1,5.0] that specifies the variance of the gaussian filter
  6156. used to blur the image (slower if larger). Default value is 1.0.
  6157. @item chroma_strength, cs
  6158. Set the chroma strength. The option value must be a float number
  6159. in the range [-1.0,1.0] that configures the blurring. A value included
  6160. in [0.0,1.0] will blur the image whereas a value included in
  6161. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  6162. @item chroma_threshold, ct
  6163. Set the chroma threshold used as a coefficient to determine
  6164. whether a pixel should be blurred or not. The option value must be an
  6165. integer in the range [-30,30]. A value of 0 will filter all the image,
  6166. a value included in [0,30] will filter flat areas and a value included
  6167. in [-30,0] will filter edges. Default value is 0.
  6168. @end table
  6169. If a chroma option is not explicitly set, the corresponding luma value
  6170. is set.
  6171. @section stereo3d
  6172. Convert between different stereoscopic image formats.
  6173. The filters accept the following options:
  6174. @table @option
  6175. @item in
  6176. Set stereoscopic image format of input.
  6177. Available values for input image formats are:
  6178. @table @samp
  6179. @item sbsl
  6180. side by side parallel (left eye left, right eye right)
  6181. @item sbsr
  6182. side by side crosseye (right eye left, left eye right)
  6183. @item sbs2l
  6184. side by side parallel with half width resolution
  6185. (left eye left, right eye right)
  6186. @item sbs2r
  6187. side by side crosseye with half width resolution
  6188. (right eye left, left eye right)
  6189. @item abl
  6190. above-below (left eye above, right eye below)
  6191. @item abr
  6192. above-below (right eye above, left eye below)
  6193. @item ab2l
  6194. above-below with half height resolution
  6195. (left eye above, right eye below)
  6196. @item ab2r
  6197. above-below with half height resolution
  6198. (right eye above, left eye below)
  6199. @item al
  6200. alternating frames (left eye first, right eye second)
  6201. @item ar
  6202. alternating frames (right eye first, left eye second)
  6203. Default value is @samp{sbsl}.
  6204. @end table
  6205. @item out
  6206. Set stereoscopic image format of output.
  6207. Available values for output image formats are all the input formats as well as:
  6208. @table @samp
  6209. @item arbg
  6210. anaglyph red/blue gray
  6211. (red filter on left eye, blue filter on right eye)
  6212. @item argg
  6213. anaglyph red/green gray
  6214. (red filter on left eye, green filter on right eye)
  6215. @item arcg
  6216. anaglyph red/cyan gray
  6217. (red filter on left eye, cyan filter on right eye)
  6218. @item arch
  6219. anaglyph red/cyan half colored
  6220. (red filter on left eye, cyan filter on right eye)
  6221. @item arcc
  6222. anaglyph red/cyan color
  6223. (red filter on left eye, cyan filter on right eye)
  6224. @item arcd
  6225. anaglyph red/cyan color optimized with the least squares projection of dubois
  6226. (red filter on left eye, cyan filter on right eye)
  6227. @item agmg
  6228. anaglyph green/magenta gray
  6229. (green filter on left eye, magenta filter on right eye)
  6230. @item agmh
  6231. anaglyph green/magenta half colored
  6232. (green filter on left eye, magenta filter on right eye)
  6233. @item agmc
  6234. anaglyph green/magenta colored
  6235. (green filter on left eye, magenta filter on right eye)
  6236. @item agmd
  6237. anaglyph green/magenta color optimized with the least squares projection of dubois
  6238. (green filter on left eye, magenta filter on right eye)
  6239. @item aybg
  6240. anaglyph yellow/blue gray
  6241. (yellow filter on left eye, blue filter on right eye)
  6242. @item aybh
  6243. anaglyph yellow/blue half colored
  6244. (yellow filter on left eye, blue filter on right eye)
  6245. @item aybc
  6246. anaglyph yellow/blue colored
  6247. (yellow filter on left eye, blue filter on right eye)
  6248. @item aybd
  6249. anaglyph yellow/blue color optimized with the least squares projection of dubois
  6250. (yellow filter on left eye, blue filter on right eye)
  6251. @item irl
  6252. interleaved rows (left eye has top row, right eye starts on next row)
  6253. @item irr
  6254. interleaved rows (right eye has top row, left eye starts on next row)
  6255. @item ml
  6256. mono output (left eye only)
  6257. @item mr
  6258. mono output (right eye only)
  6259. @end table
  6260. Default value is @samp{arcd}.
  6261. @end table
  6262. @subsection Examples
  6263. @itemize
  6264. @item
  6265. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  6266. @example
  6267. stereo3d=sbsl:aybd
  6268. @end example
  6269. @item
  6270. Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
  6271. @example
  6272. stereo3d=abl:sbsr
  6273. @end example
  6274. @end itemize
  6275. @section spp
  6276. Apply a simple postprocessing filter that compresses and decompresses the image
  6277. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  6278. and average the results.
  6279. The filter accepts the following options:
  6280. @table @option
  6281. @item quality
  6282. Set quality. This option defines the number of levels for averaging. It accepts
  6283. an integer in the range 0-6. If set to @code{0}, the filter will have no
  6284. effect. A value of @code{6} means the higher quality. For each increment of
  6285. that value the speed drops by a factor of approximately 2. Default value is
  6286. @code{3}.
  6287. @item qp
  6288. Force a constant quantization parameter. If not set, the filter will use the QP
  6289. from the video stream (if available).
  6290. @item mode
  6291. Set thresholding mode. Available modes are:
  6292. @table @samp
  6293. @item hard
  6294. Set hard thresholding (default).
  6295. @item soft
  6296. Set soft thresholding (better de-ringing effect, but likely blurrier).
  6297. @end table
  6298. @item use_bframe_qp
  6299. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6300. option may cause flicker since the B-Frames have often larger QP. Default is
  6301. @code{0} (not enabled).
  6302. @end table
  6303. @anchor{subtitles}
  6304. @section subtitles
  6305. Draw subtitles on top of input video using the libass library.
  6306. To enable compilation of this filter you need to configure FFmpeg with
  6307. @code{--enable-libass}. This filter also requires a build with libavcodec and
  6308. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  6309. Alpha) subtitles format.
  6310. The filter accepts the following options:
  6311. @table @option
  6312. @item filename, f
  6313. Set the filename of the subtitle file to read. It must be specified.
  6314. @item original_size
  6315. Specify the size of the original video, the video for which the ASS file
  6316. was composed. For the syntax of this option, check the "Video size" section in
  6317. the ffmpeg-utils manual. Due to a misdesign in ASS aspect ratio arithmetic,
  6318. this is necessary to correctly scale the fonts if the aspect ratio has been
  6319. changed.
  6320. @item charenc
  6321. Set subtitles input character encoding. @code{subtitles} filter only. Only
  6322. useful if not UTF-8.
  6323. @item stream_index, si
  6324. Set subtitles stream index. @code{subtitles} filter only.
  6325. @end table
  6326. If the first key is not specified, it is assumed that the first value
  6327. specifies the @option{filename}.
  6328. For example, to render the file @file{sub.srt} on top of the input
  6329. video, use the command:
  6330. @example
  6331. subtitles=sub.srt
  6332. @end example
  6333. which is equivalent to:
  6334. @example
  6335. subtitles=filename=sub.srt
  6336. @end example
  6337. To render the default subtitles stream from file @file{video.mkv}, use:
  6338. @example
  6339. subtitles=video.mkv
  6340. @end example
  6341. To render the second subtitles stream from that file, use:
  6342. @example
  6343. subtitles=video.mkv:si=1
  6344. @end example
  6345. @section super2xsai
  6346. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  6347. Interpolate) pixel art scaling algorithm.
  6348. Useful for enlarging pixel art images without reducing sharpness.
  6349. @section swapuv
  6350. Swap U & V plane.
  6351. @section telecine
  6352. Apply telecine process to the video.
  6353. This filter accepts the following options:
  6354. @table @option
  6355. @item first_field
  6356. @table @samp
  6357. @item top, t
  6358. top field first
  6359. @item bottom, b
  6360. bottom field first
  6361. The default value is @code{top}.
  6362. @end table
  6363. @item pattern
  6364. A string of numbers representing the pulldown pattern you wish to apply.
  6365. The default value is @code{23}.
  6366. @end table
  6367. @example
  6368. Some typical patterns:
  6369. NTSC output (30i):
  6370. 27.5p: 32222
  6371. 24p: 23 (classic)
  6372. 24p: 2332 (preferred)
  6373. 20p: 33
  6374. 18p: 334
  6375. 16p: 3444
  6376. PAL output (25i):
  6377. 27.5p: 12222
  6378. 24p: 222222222223 ("Euro pulldown")
  6379. 16.67p: 33
  6380. 16p: 33333334
  6381. @end example
  6382. @section thumbnail
  6383. Select the most representative frame in a given sequence of consecutive frames.
  6384. The filter accepts the following options:
  6385. @table @option
  6386. @item n
  6387. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  6388. will pick one of them, and then handle the next batch of @var{n} frames until
  6389. the end. Default is @code{100}.
  6390. @end table
  6391. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  6392. value will result in a higher memory usage, so a high value is not recommended.
  6393. @subsection Examples
  6394. @itemize
  6395. @item
  6396. Extract one picture each 50 frames:
  6397. @example
  6398. thumbnail=50
  6399. @end example
  6400. @item
  6401. Complete example of a thumbnail creation with @command{ffmpeg}:
  6402. @example
  6403. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  6404. @end example
  6405. @end itemize
  6406. @section tile
  6407. Tile several successive frames together.
  6408. The filter accepts the following options:
  6409. @table @option
  6410. @item layout
  6411. Set the grid size (i.e. the number of lines and columns). For the syntax of
  6412. this option, check the "Video size" section in the ffmpeg-utils manual.
  6413. @item nb_frames
  6414. Set the maximum number of frames to render in the given area. It must be less
  6415. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  6416. the area will be used.
  6417. @item margin
  6418. Set the outer border margin in pixels.
  6419. @item padding
  6420. Set the inner border thickness (i.e. the number of pixels between frames). For
  6421. more advanced padding options (such as having different values for the edges),
  6422. refer to the pad video filter.
  6423. @item color
  6424. Specify the color of the unused areaFor the syntax of this option, check the
  6425. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  6426. is "black".
  6427. @end table
  6428. @subsection Examples
  6429. @itemize
  6430. @item
  6431. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  6432. @example
  6433. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  6434. @end example
  6435. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  6436. duplicating each output frame to accommodate the originally detected frame
  6437. rate.
  6438. @item
  6439. Display @code{5} pictures in an area of @code{3x2} frames,
  6440. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  6441. mixed flat and named options:
  6442. @example
  6443. tile=3x2:nb_frames=5:padding=7:margin=2
  6444. @end example
  6445. @end itemize
  6446. @section tinterlace
  6447. Perform various types of temporal field interlacing.
  6448. Frames are counted starting from 1, so the first input frame is
  6449. considered odd.
  6450. The filter accepts the following options:
  6451. @table @option
  6452. @item mode
  6453. Specify the mode of the interlacing. This option can also be specified
  6454. as a value alone. See below for a list of values for this option.
  6455. Available values are:
  6456. @table @samp
  6457. @item merge, 0
  6458. Move odd frames into the upper field, even into the lower field,
  6459. generating a double height frame at half frame rate.
  6460. @item drop_odd, 1
  6461. Only output even frames, odd frames are dropped, generating a frame with
  6462. unchanged height at half frame rate.
  6463. @item drop_even, 2
  6464. Only output odd frames, even frames are dropped, generating a frame with
  6465. unchanged height at half frame rate.
  6466. @item pad, 3
  6467. Expand each frame to full height, but pad alternate lines with black,
  6468. generating a frame with double height at the same input frame rate.
  6469. @item interleave_top, 4
  6470. Interleave the upper field from odd frames with the lower field from
  6471. even frames, generating a frame with unchanged height at half frame rate.
  6472. @item interleave_bottom, 5
  6473. Interleave the lower field from odd frames with the upper field from
  6474. even frames, generating a frame with unchanged height at half frame rate.
  6475. @item interlacex2, 6
  6476. Double frame rate with unchanged height. Frames are inserted each
  6477. containing the second temporal field from the previous input frame and
  6478. the first temporal field from the next input frame. This mode relies on
  6479. the top_field_first flag. Useful for interlaced video displays with no
  6480. field synchronisation.
  6481. @end table
  6482. Numeric values are deprecated but are accepted for backward
  6483. compatibility reasons.
  6484. Default mode is @code{merge}.
  6485. @item flags
  6486. Specify flags influencing the filter process.
  6487. Available value for @var{flags} is:
  6488. @table @option
  6489. @item low_pass_filter, vlfp
  6490. Enable vertical low-pass filtering in the filter.
  6491. Vertical low-pass filtering is required when creating an interlaced
  6492. destination from a progressive source which contains high-frequency
  6493. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  6494. patterning.
  6495. Vertical low-pass filtering can only be enabled for @option{mode}
  6496. @var{interleave_top} and @var{interleave_bottom}.
  6497. @end table
  6498. @end table
  6499. @section transpose
  6500. Transpose rows with columns in the input video and optionally flip it.
  6501. It accepts the following parameters:
  6502. @table @option
  6503. @item dir
  6504. Specify the transposition direction.
  6505. Can assume the following values:
  6506. @table @samp
  6507. @item 0, 4, cclock_flip
  6508. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  6509. @example
  6510. L.R L.l
  6511. . . -> . .
  6512. l.r R.r
  6513. @end example
  6514. @item 1, 5, clock
  6515. Rotate by 90 degrees clockwise, that is:
  6516. @example
  6517. L.R l.L
  6518. . . -> . .
  6519. l.r r.R
  6520. @end example
  6521. @item 2, 6, cclock
  6522. Rotate by 90 degrees counterclockwise, that is:
  6523. @example
  6524. L.R R.r
  6525. . . -> . .
  6526. l.r L.l
  6527. @end example
  6528. @item 3, 7, clock_flip
  6529. Rotate by 90 degrees clockwise and vertically flip, that is:
  6530. @example
  6531. L.R r.R
  6532. . . -> . .
  6533. l.r l.L
  6534. @end example
  6535. @end table
  6536. For values between 4-7, the transposition is only done if the input
  6537. video geometry is portrait and not landscape. These values are
  6538. deprecated, the @code{passthrough} option should be used instead.
  6539. Numerical values are deprecated, and should be dropped in favor of
  6540. symbolic constants.
  6541. @item passthrough
  6542. Do not apply the transposition if the input geometry matches the one
  6543. specified by the specified value. It accepts the following values:
  6544. @table @samp
  6545. @item none
  6546. Always apply transposition.
  6547. @item portrait
  6548. Preserve portrait geometry (when @var{height} >= @var{width}).
  6549. @item landscape
  6550. Preserve landscape geometry (when @var{width} >= @var{height}).
  6551. @end table
  6552. Default value is @code{none}.
  6553. @end table
  6554. For example to rotate by 90 degrees clockwise and preserve portrait
  6555. layout:
  6556. @example
  6557. transpose=dir=1:passthrough=portrait
  6558. @end example
  6559. The command above can also be specified as:
  6560. @example
  6561. transpose=1:portrait
  6562. @end example
  6563. @section trim
  6564. Trim the input so that the output contains one continuous subpart of the input.
  6565. It accepts the following parameters:
  6566. @table @option
  6567. @item start
  6568. Specify the time of the start of the kept section, i.e. the frame with the
  6569. timestamp @var{start} will be the first frame in the output.
  6570. @item end
  6571. Specify the time of the first frame that will be dropped, i.e. the frame
  6572. immediately preceding the one with the timestamp @var{end} will be the last
  6573. frame in the output.
  6574. @item start_pts
  6575. This is the same as @var{start}, except this option sets the start timestamp
  6576. in timebase units instead of seconds.
  6577. @item end_pts
  6578. This is the same as @var{end}, except this option sets the end timestamp
  6579. in timebase units instead of seconds.
  6580. @item duration
  6581. The maximum duration of the output in seconds.
  6582. @item start_frame
  6583. The number of the first frame that should be passed to the output.
  6584. @item end_frame
  6585. The number of the first frame that should be dropped.
  6586. @end table
  6587. @option{start}, @option{end}, and @option{duration} are expressed as time
  6588. duration specifications; see
  6589. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6590. for the accepted syntax.
  6591. Note that the first two sets of the start/end options and the @option{duration}
  6592. option look at the frame timestamp, while the _frame variants simply count the
  6593. frames that pass through the filter. Also note that this filter does not modify
  6594. the timestamps. If you wish for the output timestamps to start at zero, insert a
  6595. setpts filter after the trim filter.
  6596. If multiple start or end options are set, this filter tries to be greedy and
  6597. keep all the frames that match at least one of the specified constraints. To keep
  6598. only the part that matches all the constraints at once, chain multiple trim
  6599. filters.
  6600. The defaults are such that all the input is kept. So it is possible to set e.g.
  6601. just the end values to keep everything before the specified time.
  6602. Examples:
  6603. @itemize
  6604. @item
  6605. Drop everything except the second minute of input:
  6606. @example
  6607. ffmpeg -i INPUT -vf trim=60:120
  6608. @end example
  6609. @item
  6610. Keep only the first second:
  6611. @example
  6612. ffmpeg -i INPUT -vf trim=duration=1
  6613. @end example
  6614. @end itemize
  6615. @section unsharp
  6616. Sharpen or blur the input video.
  6617. It accepts the following parameters:
  6618. @table @option
  6619. @item luma_msize_x, lx
  6620. Set the luma matrix horizontal size. It must be an odd integer between
  6621. 3 and 63. The default value is 5.
  6622. @item luma_msize_y, ly
  6623. Set the luma matrix vertical size. It must be an odd integer between 3
  6624. and 63. The default value is 5.
  6625. @item luma_amount, la
  6626. Set the luma effect strength. It must be a floating point number, reasonable
  6627. values lay between -1.5 and 1.5.
  6628. Negative values will blur the input video, while positive values will
  6629. sharpen it, a value of zero will disable the effect.
  6630. Default value is 1.0.
  6631. @item chroma_msize_x, cx
  6632. Set the chroma matrix horizontal size. It must be an odd integer
  6633. between 3 and 63. The default value is 5.
  6634. @item chroma_msize_y, cy
  6635. Set the chroma matrix vertical size. It must be an odd integer
  6636. between 3 and 63. The default value is 5.
  6637. @item chroma_amount, ca
  6638. Set the chroma effect strength. It must be a floating point number, reasonable
  6639. values lay between -1.5 and 1.5.
  6640. Negative values will blur the input video, while positive values will
  6641. sharpen it, a value of zero will disable the effect.
  6642. Default value is 0.0.
  6643. @item opencl
  6644. If set to 1, specify using OpenCL capabilities, only available if
  6645. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  6646. @end table
  6647. All parameters are optional and default to the equivalent of the
  6648. string '5:5:1.0:5:5:0.0'.
  6649. @subsection Examples
  6650. @itemize
  6651. @item
  6652. Apply strong luma sharpen effect:
  6653. @example
  6654. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  6655. @end example
  6656. @item
  6657. Apply a strong blur of both luma and chroma parameters:
  6658. @example
  6659. unsharp=7:7:-2:7:7:-2
  6660. @end example
  6661. @end itemize
  6662. @anchor{vidstabdetect}
  6663. @section vidstabdetect
  6664. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  6665. @ref{vidstabtransform} for pass 2.
  6666. This filter generates a file with relative translation and rotation
  6667. transform information about subsequent frames, which is then used by
  6668. the @ref{vidstabtransform} filter.
  6669. To enable compilation of this filter you need to configure FFmpeg with
  6670. @code{--enable-libvidstab}.
  6671. This filter accepts the following options:
  6672. @table @option
  6673. @item result
  6674. Set the path to the file used to write the transforms information.
  6675. Default value is @file{transforms.trf}.
  6676. @item shakiness
  6677. Set how shaky the video is and how quick the camera is. It accepts an
  6678. integer in the range 1-10, a value of 1 means little shakiness, a
  6679. value of 10 means strong shakiness. Default value is 5.
  6680. @item accuracy
  6681. Set the accuracy of the detection process. It must be a value in the
  6682. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  6683. accuracy. Default value is 15.
  6684. @item stepsize
  6685. Set stepsize of the search process. The region around minimum is
  6686. scanned with 1 pixel resolution. Default value is 6.
  6687. @item mincontrast
  6688. Set minimum contrast. Below this value a local measurement field is
  6689. discarded. Must be a floating point value in the range 0-1. Default
  6690. value is 0.3.
  6691. @item tripod
  6692. Set reference frame number for tripod mode.
  6693. If enabled, the motion of the frames is compared to a reference frame
  6694. in the filtered stream, identified by the specified number. The idea
  6695. is to compensate all movements in a more-or-less static scene and keep
  6696. the camera view absolutely still.
  6697. If set to 0, it is disabled. The frames are counted starting from 1.
  6698. @item show
  6699. Show fields and transforms in the resulting frames. It accepts an
  6700. integer in the range 0-2. Default value is 0, which disables any
  6701. visualization.
  6702. @end table
  6703. @subsection Examples
  6704. @itemize
  6705. @item
  6706. Use default values:
  6707. @example
  6708. vidstabdetect
  6709. @end example
  6710. @item
  6711. Analyze strongly shaky movie and put the results in file
  6712. @file{mytransforms.trf}:
  6713. @example
  6714. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  6715. @end example
  6716. @item
  6717. Visualize the result of internal transformations in the resulting
  6718. video:
  6719. @example
  6720. vidstabdetect=show=1
  6721. @end example
  6722. @item
  6723. Analyze a video with medium shakiness using @command{ffmpeg}:
  6724. @example
  6725. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  6726. @end example
  6727. @end itemize
  6728. @anchor{vidstabtransform}
  6729. @section vidstabtransform
  6730. Video stabilization/deshaking: pass 2 of 2,
  6731. see @ref{vidstabdetect} for pass 1.
  6732. Read a file with transform information for each frame and
  6733. apply/compensate them. Together with the @ref{vidstabdetect}
  6734. filter this can be used to deshake videos. See also
  6735. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  6736. the unsharp filter, see below.
  6737. To enable compilation of this filter you need to configure FFmpeg with
  6738. @code{--enable-libvidstab}.
  6739. @subsection Options
  6740. @table @option
  6741. @item input
  6742. Set path to the file used to read the transforms. Default value is
  6743. @file{transforms.trf}).
  6744. @item smoothing
  6745. Set the number of frames (value*2 + 1) used for lowpass filtering the
  6746. camera movements. Default value is 10.
  6747. For example a number of 10 means that 21 frames are used (10 in the
  6748. past and 10 in the future) to smoothen the motion in the video. A
  6749. larger values leads to a smoother video, but limits the acceleration
  6750. of the camera (pan/tilt movements). 0 is a special case where a
  6751. static camera is simulated.
  6752. @item optalgo
  6753. Set the camera path optimization algorithm.
  6754. Accepted values are:
  6755. @table @samp
  6756. @item gauss
  6757. gaussian kernel low-pass filter on camera motion (default)
  6758. @item avg
  6759. averaging on transformations
  6760. @end table
  6761. @item maxshift
  6762. Set maximal number of pixels to translate frames. Default value is -1,
  6763. meaning no limit.
  6764. @item maxangle
  6765. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  6766. value is -1, meaning no limit.
  6767. @item crop
  6768. Specify how to deal with borders that may be visible due to movement
  6769. compensation.
  6770. Available values are:
  6771. @table @samp
  6772. @item keep
  6773. keep image information from previous frame (default)
  6774. @item black
  6775. fill the border black
  6776. @end table
  6777. @item invert
  6778. Invert transforms if set to 1. Default value is 0.
  6779. @item relative
  6780. Consider transforms as relative to previsou frame if set to 1,
  6781. absolute if set to 0. Default value is 0.
  6782. @item zoom
  6783. Set percentage to zoom. A positive value will result in a zoom-in
  6784. effect, a negative value in a zoom-out effect. Default value is 0 (no
  6785. zoom).
  6786. @item optzoom
  6787. Set optimal zooming to avoid borders.
  6788. Accepted values are:
  6789. @table @samp
  6790. @item 0
  6791. disabled
  6792. @item 1
  6793. optimal static zoom value is determined (only very strong movements
  6794. will lead to visible borders) (default)
  6795. @item 2
  6796. optimal adaptive zoom value is determined (no borders will be
  6797. visible), see @option{zoomspeed}
  6798. @end table
  6799. Note that the value given at zoom is added to the one calculated here.
  6800. @item zoomspeed
  6801. Set percent to zoom maximally each frame (enabled when
  6802. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  6803. 0.25.
  6804. @item interpol
  6805. Specify type of interpolation.
  6806. Available values are:
  6807. @table @samp
  6808. @item no
  6809. no interpolation
  6810. @item linear
  6811. linear only horizontal
  6812. @item bilinear
  6813. linear in both directions (default)
  6814. @item bicubic
  6815. cubic in both directions (slow)
  6816. @end table
  6817. @item tripod
  6818. Enable virtual tripod mode if set to 1, which is equivalent to
  6819. @code{relative=0:smoothing=0}. Default value is 0.
  6820. Use also @code{tripod} option of @ref{vidstabdetect}.
  6821. @item debug
  6822. Increase log verbosity if set to 1. Also the detected global motions
  6823. are written to the temporary file @file{global_motions.trf}. Default
  6824. value is 0.
  6825. @end table
  6826. @subsection Examples
  6827. @itemize
  6828. @item
  6829. Use @command{ffmpeg} for a typical stabilization with default values:
  6830. @example
  6831. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  6832. @end example
  6833. Note the use of the unsharp filter which is always recommended.
  6834. @item
  6835. Zoom in a bit more and load transform data from a given file:
  6836. @example
  6837. vidstabtransform=zoom=5:input="mytransforms.trf"
  6838. @end example
  6839. @item
  6840. Smoothen the video even more:
  6841. @example
  6842. vidstabtransform=smoothing=30
  6843. @end example
  6844. @end itemize
  6845. @section vflip
  6846. Flip the input video vertically.
  6847. For example, to vertically flip a video with @command{ffmpeg}:
  6848. @example
  6849. ffmpeg -i in.avi -vf "vflip" out.avi
  6850. @end example
  6851. @anchor{vignette}
  6852. @section vignette
  6853. Make or reverse a natural vignetting effect.
  6854. The filter accepts the following options:
  6855. @table @option
  6856. @item angle, a
  6857. Set lens angle expression as a number of radians.
  6858. The value is clipped in the @code{[0,PI/2]} range.
  6859. Default value: @code{"PI/5"}
  6860. @item x0
  6861. @item y0
  6862. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  6863. by default.
  6864. @item mode
  6865. Set forward/backward mode.
  6866. Available modes are:
  6867. @table @samp
  6868. @item forward
  6869. The larger the distance from the central point, the darker the image becomes.
  6870. @item backward
  6871. The larger the distance from the central point, the brighter the image becomes.
  6872. This can be used to reverse a vignette effect, though there is no automatic
  6873. detection to extract the lens @option{angle} and other settings (yet). It can
  6874. also be used to create a burning effect.
  6875. @end table
  6876. Default value is @samp{forward}.
  6877. @item eval
  6878. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  6879. It accepts the following values:
  6880. @table @samp
  6881. @item init
  6882. Evaluate expressions only once during the filter initialization.
  6883. @item frame
  6884. Evaluate expressions for each incoming frame. This is way slower than the
  6885. @samp{init} mode since it requires all the scalers to be re-computed, but it
  6886. allows advanced dynamic expressions.
  6887. @end table
  6888. Default value is @samp{init}.
  6889. @item dither
  6890. Set dithering to reduce the circular banding effects. Default is @code{1}
  6891. (enabled).
  6892. @item aspect
  6893. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  6894. Setting this value to the SAR of the input will make a rectangular vignetting
  6895. following the dimensions of the video.
  6896. Default is @code{1/1}.
  6897. @end table
  6898. @subsection Expressions
  6899. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  6900. following parameters.
  6901. @table @option
  6902. @item w
  6903. @item h
  6904. input width and height
  6905. @item n
  6906. the number of input frame, starting from 0
  6907. @item pts
  6908. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  6909. @var{TB} units, NAN if undefined
  6910. @item r
  6911. frame rate of the input video, NAN if the input frame rate is unknown
  6912. @item t
  6913. the PTS (Presentation TimeStamp) of the filtered video frame,
  6914. expressed in seconds, NAN if undefined
  6915. @item tb
  6916. time base of the input video
  6917. @end table
  6918. @subsection Examples
  6919. @itemize
  6920. @item
  6921. Apply simple strong vignetting effect:
  6922. @example
  6923. vignette=PI/4
  6924. @end example
  6925. @item
  6926. Make a flickering vignetting:
  6927. @example
  6928. vignette='PI/4+random(1)*PI/50':eval=frame
  6929. @end example
  6930. @end itemize
  6931. @section w3fdif
  6932. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  6933. Deinterlacing Filter").
  6934. Based on the process described by Martin Weston for BBC R&D, and
  6935. implemented based on the de-interlace algorithm written by Jim
  6936. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  6937. uses filter coefficients calculated by BBC R&D.
  6938. There are two sets of filter coefficients, so called "simple":
  6939. and "complex". Which set of filter coefficients is used can
  6940. be set by passing an optional parameter:
  6941. @table @option
  6942. @item filter
  6943. Set the interlacing filter coefficients. Accepts one of the following values:
  6944. @table @samp
  6945. @item simple
  6946. Simple filter coefficient set.
  6947. @item complex
  6948. More-complex filter coefficient set.
  6949. @end table
  6950. Default value is @samp{complex}.
  6951. @item deint
  6952. Specify which frames to deinterlace. Accept one of the following values:
  6953. @table @samp
  6954. @item all
  6955. Deinterlace all frames,
  6956. @item interlaced
  6957. Only deinterlace frames marked as interlaced.
  6958. @end table
  6959. Default value is @samp{all}.
  6960. @end table
  6961. @anchor{yadif}
  6962. @section yadif
  6963. Deinterlace the input video ("yadif" means "yet another deinterlacing
  6964. filter").
  6965. It accepts the following parameters:
  6966. @table @option
  6967. @item mode
  6968. The interlacing mode to adopt. It accepts one of the following values:
  6969. @table @option
  6970. @item 0, send_frame
  6971. Output one frame for each frame.
  6972. @item 1, send_field
  6973. Output one frame for each field.
  6974. @item 2, send_frame_nospatial
  6975. Like @code{send_frame}, but it skips the spatial interlacing check.
  6976. @item 3, send_field_nospatial
  6977. Like @code{send_field}, but it skips the spatial interlacing check.
  6978. @end table
  6979. The default value is @code{send_frame}.
  6980. @item parity
  6981. The picture field parity assumed for the input interlaced video. It accepts one
  6982. of the following values:
  6983. @table @option
  6984. @item 0, tff
  6985. Assume the top field is first.
  6986. @item 1, bff
  6987. Assume the bottom field is first.
  6988. @item -1, auto
  6989. Enable automatic detection of field parity.
  6990. @end table
  6991. The default value is @code{auto}.
  6992. If the interlacing is unknown or the decoder does not export this information,
  6993. top field first will be assumed.
  6994. @item deint
  6995. Specify which frames to deinterlace. Accept one of the following
  6996. values:
  6997. @table @option
  6998. @item 0, all
  6999. Deinterlace all frames.
  7000. @item 1, interlaced
  7001. Only deinterlace frames marked as interlaced.
  7002. @end table
  7003. The default value is @code{all}.
  7004. @end table
  7005. @section zoompan
  7006. Apply Zoom & Pan effect.
  7007. This filter accepts the following options:
  7008. @table @option
  7009. @item zoom, z
  7010. Set the zoom expression. Default is 1.
  7011. @item x
  7012. @item y
  7013. Set the x and y expression. Default is 0.
  7014. @item d
  7015. Set the duration expression in number of frames.
  7016. This sets for how many number of frames effect will last for
  7017. single input image.
  7018. @item s
  7019. Set the output image size, default is 'hd720'.
  7020. @end table
  7021. Each expression can contain the following constants:
  7022. @table @option
  7023. @item in_w, iw
  7024. Input width.
  7025. @item in_h, ih
  7026. Input height.
  7027. @item out_w, ow
  7028. Output width.
  7029. @item out_h, oh
  7030. Output height.
  7031. @item in
  7032. Input frame count.
  7033. @item on
  7034. Output frame count.
  7035. @item x
  7036. @item y
  7037. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  7038. for current input frame.
  7039. @item px
  7040. @item py
  7041. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  7042. not yet such frame (first input frame).
  7043. @item zoom
  7044. Last calculated zoom from 'z' expression for current input frame.
  7045. @item pzoom
  7046. Last calculated zoom of last output frame of previous input frame.
  7047. @item duration
  7048. Number of output frames for current input frame. Calculated from 'd' expression
  7049. for each input frame.
  7050. @item pduration
  7051. number of output frames created for previous input frame
  7052. @item a
  7053. Rational number: input width / input height
  7054. @item sar
  7055. sample aspect ratio
  7056. @item dar
  7057. display aspect ratio
  7058. @end table
  7059. @subsection Examples
  7060. @itemize
  7061. @item
  7062. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  7063. @example
  7064. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360
  7065. @end example
  7066. @end itemize
  7067. @c man end VIDEO FILTERS
  7068. @chapter Video Sources
  7069. @c man begin VIDEO SOURCES
  7070. Below is a description of the currently available video sources.
  7071. @section buffer
  7072. Buffer video frames, and make them available to the filter chain.
  7073. This source is mainly intended for a programmatic use, in particular
  7074. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  7075. It accepts the following parameters:
  7076. @table @option
  7077. @item video_size
  7078. Specify the size (width and height) of the buffered video frames. For the
  7079. syntax of this option, check the "Video size" section in the ffmpeg-utils
  7080. manual.
  7081. @item width
  7082. The input video width.
  7083. @item height
  7084. The input video height.
  7085. @item pix_fmt
  7086. A string representing the pixel format of the buffered video frames.
  7087. It may be a number corresponding to a pixel format, or a pixel format
  7088. name.
  7089. @item time_base
  7090. Specify the timebase assumed by the timestamps of the buffered frames.
  7091. @item frame_rate
  7092. Specify the frame rate expected for the video stream.
  7093. @item pixel_aspect, sar
  7094. The sample (pixel) aspect ratio of the input video.
  7095. @item sws_param
  7096. Specify the optional parameters to be used for the scale filter which
  7097. is automatically inserted when an input change is detected in the
  7098. input size or format.
  7099. @end table
  7100. For example:
  7101. @example
  7102. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  7103. @end example
  7104. will instruct the source to accept video frames with size 320x240 and
  7105. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  7106. square pixels (1:1 sample aspect ratio).
  7107. Since the pixel format with name "yuv410p" corresponds to the number 6
  7108. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  7109. this example corresponds to:
  7110. @example
  7111. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  7112. @end example
  7113. Alternatively, the options can be specified as a flat string, but this
  7114. syntax is deprecated:
  7115. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}[:@var{sws_param}]
  7116. @section cellauto
  7117. Create a pattern generated by an elementary cellular automaton.
  7118. The initial state of the cellular automaton can be defined through the
  7119. @option{filename}, and @option{pattern} options. If such options are
  7120. not specified an initial state is created randomly.
  7121. At each new frame a new row in the video is filled with the result of
  7122. the cellular automaton next generation. The behavior when the whole
  7123. frame is filled is defined by the @option{scroll} option.
  7124. This source accepts the following options:
  7125. @table @option
  7126. @item filename, f
  7127. Read the initial cellular automaton state, i.e. the starting row, from
  7128. the specified file.
  7129. In the file, each non-whitespace character is considered an alive
  7130. cell, a newline will terminate the row, and further characters in the
  7131. file will be ignored.
  7132. @item pattern, p
  7133. Read the initial cellular automaton state, i.e. the starting row, from
  7134. the specified string.
  7135. Each non-whitespace character in the string is considered an alive
  7136. cell, a newline will terminate the row, and further characters in the
  7137. string will be ignored.
  7138. @item rate, r
  7139. Set the video rate, that is the number of frames generated per second.
  7140. Default is 25.
  7141. @item random_fill_ratio, ratio
  7142. Set the random fill ratio for the initial cellular automaton row. It
  7143. is a floating point number value ranging from 0 to 1, defaults to
  7144. 1/PHI.
  7145. This option is ignored when a file or a pattern is specified.
  7146. @item random_seed, seed
  7147. Set the seed for filling randomly the initial row, must be an integer
  7148. included between 0 and UINT32_MAX. If not specified, or if explicitly
  7149. set to -1, the filter will try to use a good random seed on a best
  7150. effort basis.
  7151. @item rule
  7152. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  7153. Default value is 110.
  7154. @item size, s
  7155. Set the size of the output video. For the syntax of this option, check
  7156. the "Video size" section in the ffmpeg-utils manual.
  7157. If @option{filename} or @option{pattern} is specified, the size is set
  7158. by default to the width of the specified initial state row, and the
  7159. height is set to @var{width} * PHI.
  7160. If @option{size} is set, it must contain the width of the specified
  7161. pattern string, and the specified pattern will be centered in the
  7162. larger row.
  7163. If a filename or a pattern string is not specified, the size value
  7164. defaults to "320x518" (used for a randomly generated initial state).
  7165. @item scroll
  7166. If set to 1, scroll the output upward when all the rows in the output
  7167. have been already filled. If set to 0, the new generated row will be
  7168. written over the top row just after the bottom row is filled.
  7169. Defaults to 1.
  7170. @item start_full, full
  7171. If set to 1, completely fill the output with generated rows before
  7172. outputting the first frame.
  7173. This is the default behavior, for disabling set the value to 0.
  7174. @item stitch
  7175. If set to 1, stitch the left and right row edges together.
  7176. This is the default behavior, for disabling set the value to 0.
  7177. @end table
  7178. @subsection Examples
  7179. @itemize
  7180. @item
  7181. Read the initial state from @file{pattern}, and specify an output of
  7182. size 200x400.
  7183. @example
  7184. cellauto=f=pattern:s=200x400
  7185. @end example
  7186. @item
  7187. Generate a random initial row with a width of 200 cells, with a fill
  7188. ratio of 2/3:
  7189. @example
  7190. cellauto=ratio=2/3:s=200x200
  7191. @end example
  7192. @item
  7193. Create a pattern generated by rule 18 starting by a single alive cell
  7194. centered on an initial row with width 100:
  7195. @example
  7196. cellauto=p=@@:s=100x400:full=0:rule=18
  7197. @end example
  7198. @item
  7199. Specify a more elaborated initial pattern:
  7200. @example
  7201. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  7202. @end example
  7203. @end itemize
  7204. @section mandelbrot
  7205. Generate a Mandelbrot set fractal, and progressively zoom towards the
  7206. point specified with @var{start_x} and @var{start_y}.
  7207. This source accepts the following options:
  7208. @table @option
  7209. @item end_pts
  7210. Set the terminal pts value. Default value is 400.
  7211. @item end_scale
  7212. Set the terminal scale value.
  7213. Must be a floating point value. Default value is 0.3.
  7214. @item inner
  7215. Set the inner coloring mode, that is the algorithm used to draw the
  7216. Mandelbrot fractal internal region.
  7217. It shall assume one of the following values:
  7218. @table @option
  7219. @item black
  7220. Set black mode.
  7221. @item convergence
  7222. Show time until convergence.
  7223. @item mincol
  7224. Set color based on point closest to the origin of the iterations.
  7225. @item period
  7226. Set period mode.
  7227. @end table
  7228. Default value is @var{mincol}.
  7229. @item bailout
  7230. Set the bailout value. Default value is 10.0.
  7231. @item maxiter
  7232. Set the maximum of iterations performed by the rendering
  7233. algorithm. Default value is 7189.
  7234. @item outer
  7235. Set outer coloring mode.
  7236. It shall assume one of following values:
  7237. @table @option
  7238. @item iteration_count
  7239. Set iteration cound mode.
  7240. @item normalized_iteration_count
  7241. set normalized iteration count mode.
  7242. @end table
  7243. Default value is @var{normalized_iteration_count}.
  7244. @item rate, r
  7245. Set frame rate, expressed as number of frames per second. Default
  7246. value is "25".
  7247. @item size, s
  7248. Set frame size. For the syntax of this option, check the "Video
  7249. size" section in the ffmpeg-utils manual. Default value is "640x480".
  7250. @item start_scale
  7251. Set the initial scale value. Default value is 3.0.
  7252. @item start_x
  7253. Set the initial x position. Must be a floating point value between
  7254. -100 and 100. Default value is -0.743643887037158704752191506114774.
  7255. @item start_y
  7256. Set the initial y position. Must be a floating point value between
  7257. -100 and 100. Default value is -0.131825904205311970493132056385139.
  7258. @end table
  7259. @section mptestsrc
  7260. Generate various test patterns, as generated by the MPlayer test filter.
  7261. The size of the generated video is fixed, and is 256x256.
  7262. This source is useful in particular for testing encoding features.
  7263. This source accepts the following options:
  7264. @table @option
  7265. @item rate, r
  7266. Specify the frame rate of the sourced video, as the number of frames
  7267. generated per second. It has to be a string in the format
  7268. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  7269. number or a valid video frame rate abbreviation. The default value is
  7270. "25".
  7271. @item duration, d
  7272. Set the duration of the sourced video. See
  7273. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  7274. for the accepted syntax.
  7275. If not specified, or the expressed duration is negative, the video is
  7276. supposed to be generated forever.
  7277. @item test, t
  7278. Set the number or the name of the test to perform. Supported tests are:
  7279. @table @option
  7280. @item dc_luma
  7281. @item dc_chroma
  7282. @item freq_luma
  7283. @item freq_chroma
  7284. @item amp_luma
  7285. @item amp_chroma
  7286. @item cbp
  7287. @item mv
  7288. @item ring1
  7289. @item ring2
  7290. @item all
  7291. @end table
  7292. Default value is "all", which will cycle through the list of all tests.
  7293. @end table
  7294. Some examples:
  7295. @example
  7296. mptestsrc=t=dc_luma
  7297. @end example
  7298. will generate a "dc_luma" test pattern.
  7299. @section frei0r_src
  7300. Provide a frei0r source.
  7301. To enable compilation of this filter you need to install the frei0r
  7302. header and configure FFmpeg with @code{--enable-frei0r}.
  7303. This source accepts the following parameters:
  7304. @table @option
  7305. @item size
  7306. The size of the video to generate. For the syntax of this option, check the
  7307. "Video size" section in the ffmpeg-utils manual.
  7308. @item framerate
  7309. The framerate of the generated video. It may be a string of the form
  7310. @var{num}/@var{den} or a frame rate abbreviation.
  7311. @item filter_name
  7312. The name to the frei0r source to load. For more information regarding frei0r and
  7313. how to set the parameters, read the @ref{frei0r} section in the video filters
  7314. documentation.
  7315. @item filter_params
  7316. A '|'-separated list of parameters to pass to the frei0r source.
  7317. @end table
  7318. For example, to generate a frei0r partik0l source with size 200x200
  7319. and frame rate 10 which is overlayed on the overlay filter main input:
  7320. @example
  7321. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  7322. @end example
  7323. @section life
  7324. Generate a life pattern.
  7325. This source is based on a generalization of John Conway's life game.
  7326. The sourced input represents a life grid, each pixel represents a cell
  7327. which can be in one of two possible states, alive or dead. Every cell
  7328. interacts with its eight neighbours, which are the cells that are
  7329. horizontally, vertically, or diagonally adjacent.
  7330. At each interaction the grid evolves according to the adopted rule,
  7331. which specifies the number of neighbor alive cells which will make a
  7332. cell stay alive or born. The @option{rule} option allows one to specify
  7333. the rule to adopt.
  7334. This source accepts the following options:
  7335. @table @option
  7336. @item filename, f
  7337. Set the file from which to read the initial grid state. In the file,
  7338. each non-whitespace character is considered an alive cell, and newline
  7339. is used to delimit the end of each row.
  7340. If this option is not specified, the initial grid is generated
  7341. randomly.
  7342. @item rate, r
  7343. Set the video rate, that is the number of frames generated per second.
  7344. Default is 25.
  7345. @item random_fill_ratio, ratio
  7346. Set the random fill ratio for the initial random grid. It is a
  7347. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  7348. It is ignored when a file is specified.
  7349. @item random_seed, seed
  7350. Set the seed for filling the initial random grid, must be an integer
  7351. included between 0 and UINT32_MAX. If not specified, or if explicitly
  7352. set to -1, the filter will try to use a good random seed on a best
  7353. effort basis.
  7354. @item rule
  7355. Set the life rule.
  7356. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  7357. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  7358. @var{NS} specifies the number of alive neighbor cells which make a
  7359. live cell stay alive, and @var{NB} the number of alive neighbor cells
  7360. which make a dead cell to become alive (i.e. to "born").
  7361. "s" and "b" can be used in place of "S" and "B", respectively.
  7362. Alternatively a rule can be specified by an 18-bits integer. The 9
  7363. high order bits are used to encode the next cell state if it is alive
  7364. for each number of neighbor alive cells, the low order bits specify
  7365. the rule for "borning" new cells. Higher order bits encode for an
  7366. higher number of neighbor cells.
  7367. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  7368. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  7369. Default value is "S23/B3", which is the original Conway's game of life
  7370. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  7371. cells, and will born a new cell if there are three alive cells around
  7372. a dead cell.
  7373. @item size, s
  7374. Set the size of the output video. For the syntax of this option, check the
  7375. "Video size" section in the ffmpeg-utils manual.
  7376. If @option{filename} is specified, the size is set by default to the
  7377. same size of the input file. If @option{size} is set, it must contain
  7378. the size specified in the input file, and the initial grid defined in
  7379. that file is centered in the larger resulting area.
  7380. If a filename is not specified, the size value defaults to "320x240"
  7381. (used for a randomly generated initial grid).
  7382. @item stitch
  7383. If set to 1, stitch the left and right grid edges together, and the
  7384. top and bottom edges also. Defaults to 1.
  7385. @item mold
  7386. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  7387. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  7388. value from 0 to 255.
  7389. @item life_color
  7390. Set the color of living (or new born) cells.
  7391. @item death_color
  7392. Set the color of dead cells. If @option{mold} is set, this is the first color
  7393. used to represent a dead cell.
  7394. @item mold_color
  7395. Set mold color, for definitely dead and moldy cells.
  7396. For the syntax of these 3 color options, check the "Color" section in the
  7397. ffmpeg-utils manual.
  7398. @end table
  7399. @subsection Examples
  7400. @itemize
  7401. @item
  7402. Read a grid from @file{pattern}, and center it on a grid of size
  7403. 300x300 pixels:
  7404. @example
  7405. life=f=pattern:s=300x300
  7406. @end example
  7407. @item
  7408. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  7409. @example
  7410. life=ratio=2/3:s=200x200
  7411. @end example
  7412. @item
  7413. Specify a custom rule for evolving a randomly generated grid:
  7414. @example
  7415. life=rule=S14/B34
  7416. @end example
  7417. @item
  7418. Full example with slow death effect (mold) using @command{ffplay}:
  7419. @example
  7420. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  7421. @end example
  7422. @end itemize
  7423. @anchor{color}
  7424. @anchor{haldclutsrc}
  7425. @anchor{nullsrc}
  7426. @anchor{rgbtestsrc}
  7427. @anchor{smptebars}
  7428. @anchor{smptehdbars}
  7429. @anchor{testsrc}
  7430. @section color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  7431. The @code{color} source provides an uniformly colored input.
  7432. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  7433. @ref{haldclut} filter.
  7434. The @code{nullsrc} source returns unprocessed video frames. It is
  7435. mainly useful to be employed in analysis / debugging tools, or as the
  7436. source for filters which ignore the input data.
  7437. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  7438. detecting RGB vs BGR issues. You should see a red, green and blue
  7439. stripe from top to bottom.
  7440. The @code{smptebars} source generates a color bars pattern, based on
  7441. the SMPTE Engineering Guideline EG 1-1990.
  7442. The @code{smptehdbars} source generates a color bars pattern, based on
  7443. the SMPTE RP 219-2002.
  7444. The @code{testsrc} source generates a test video pattern, showing a
  7445. color pattern, a scrolling gradient and a timestamp. This is mainly
  7446. intended for testing purposes.
  7447. The sources accept the following parameters:
  7448. @table @option
  7449. @item color, c
  7450. Specify the color of the source, only available in the @code{color}
  7451. source. For the syntax of this option, check the "Color" section in the
  7452. ffmpeg-utils manual.
  7453. @item level
  7454. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  7455. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  7456. pixels to be used as identity matrix for 3D lookup tables. Each component is
  7457. coded on a @code{1/(N*N)} scale.
  7458. @item size, s
  7459. Specify the size of the sourced video. For the syntax of this option, check the
  7460. "Video size" section in the ffmpeg-utils manual. The default value is
  7461. "320x240".
  7462. This option is not available with the @code{haldclutsrc} filter.
  7463. @item rate, r
  7464. Specify the frame rate of the sourced video, as the number of frames
  7465. generated per second. It has to be a string in the format
  7466. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  7467. number or a valid video frame rate abbreviation. The default value is
  7468. "25".
  7469. @item sar
  7470. Set the sample aspect ratio of the sourced video.
  7471. @item duration, d
  7472. Set the duration of the sourced video. See
  7473. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  7474. for the accepted syntax.
  7475. If not specified, or the expressed duration is negative, the video is
  7476. supposed to be generated forever.
  7477. @item decimals, n
  7478. Set the number of decimals to show in the timestamp, only available in the
  7479. @code{testsrc} source.
  7480. The displayed timestamp value will correspond to the original
  7481. timestamp value multiplied by the power of 10 of the specified
  7482. value. Default value is 0.
  7483. @end table
  7484. For example the following:
  7485. @example
  7486. testsrc=duration=5.3:size=qcif:rate=10
  7487. @end example
  7488. will generate a video with a duration of 5.3 seconds, with size
  7489. 176x144 and a frame rate of 10 frames per second.
  7490. The following graph description will generate a red source
  7491. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  7492. frames per second.
  7493. @example
  7494. color=c=red@@0.2:s=qcif:r=10
  7495. @end example
  7496. If the input content is to be ignored, @code{nullsrc} can be used. The
  7497. following command generates noise in the luminance plane by employing
  7498. the @code{geq} filter:
  7499. @example
  7500. nullsrc=s=256x256, geq=random(1)*255:128:128
  7501. @end example
  7502. @subsection Commands
  7503. The @code{color} source supports the following commands:
  7504. @table @option
  7505. @item c, color
  7506. Set the color of the created image. Accepts the same syntax of the
  7507. corresponding @option{color} option.
  7508. @end table
  7509. @c man end VIDEO SOURCES
  7510. @chapter Video Sinks
  7511. @c man begin VIDEO SINKS
  7512. Below is a description of the currently available video sinks.
  7513. @section buffersink
  7514. Buffer video frames, and make them available to the end of the filter
  7515. graph.
  7516. This sink is mainly intended for programmatic use, in particular
  7517. through the interface defined in @file{libavfilter/buffersink.h}
  7518. or the options system.
  7519. It accepts a pointer to an AVBufferSinkContext structure, which
  7520. defines the incoming buffers' formats, to be passed as the opaque
  7521. parameter to @code{avfilter_init_filter} for initialization.
  7522. @section nullsink
  7523. Null video sink: do absolutely nothing with the input video. It is
  7524. mainly useful as a template and for use in analysis / debugging
  7525. tools.
  7526. @c man end VIDEO SINKS
  7527. @chapter Multimedia Filters
  7528. @c man begin MULTIMEDIA FILTERS
  7529. Below is a description of the currently available multimedia filters.
  7530. @section avectorscope
  7531. Convert input audio to a video output, representing the audio vector
  7532. scope.
  7533. The filter is used to measure the difference between channels of stereo
  7534. audio stream. A monoaural signal, consisting of identical left and right
  7535. signal, results in straight vertical line. Any stereo separation is visible
  7536. as a deviation from this line, creating a Lissajous figure.
  7537. If the straight (or deviation from it) but horizontal line appears this
  7538. indicates that the left and right channels are out of phase.
  7539. The filter accepts the following options:
  7540. @table @option
  7541. @item mode, m
  7542. Set the vectorscope mode.
  7543. Available values are:
  7544. @table @samp
  7545. @item lissajous
  7546. Lissajous rotated by 45 degrees.
  7547. @item lissajous_xy
  7548. Same as above but not rotated.
  7549. @end table
  7550. Default value is @samp{lissajous}.
  7551. @item size, s
  7552. Set the video size for the output. For the syntax of this option, check the "Video size"
  7553. section in the ffmpeg-utils manual. Default value is @code{400x400}.
  7554. @item rate, r
  7555. Set the output frame rate. Default value is @code{25}.
  7556. @item rc
  7557. @item gc
  7558. @item bc
  7559. Specify the red, green and blue contrast. Default values are @code{40}, @code{160} and @code{80}.
  7560. Allowed range is @code{[0, 255]}.
  7561. @item rf
  7562. @item gf
  7563. @item bf
  7564. Specify the red, green and blue fade. Default values are @code{15}, @code{10} and @code{5}.
  7565. Allowed range is @code{[0, 255]}.
  7566. @item zoom
  7567. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  7568. @end table
  7569. @subsection Examples
  7570. @itemize
  7571. @item
  7572. Complete example using @command{ffplay}:
  7573. @example
  7574. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  7575. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  7576. @end example
  7577. @end itemize
  7578. @section concat
  7579. Concatenate audio and video streams, joining them together one after the
  7580. other.
  7581. The filter works on segments of synchronized video and audio streams. All
  7582. segments must have the same number of streams of each type, and that will
  7583. also be the number of streams at output.
  7584. The filter accepts the following options:
  7585. @table @option
  7586. @item n
  7587. Set the number of segments. Default is 2.
  7588. @item v
  7589. Set the number of output video streams, that is also the number of video
  7590. streams in each segment. Default is 1.
  7591. @item a
  7592. Set the number of output audio streams, that is also the number of audio
  7593. streams in each segment. Default is 0.
  7594. @item unsafe
  7595. Activate unsafe mode: do not fail if segments have a different format.
  7596. @end table
  7597. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  7598. @var{a} audio outputs.
  7599. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  7600. segment, in the same order as the outputs, then the inputs for the second
  7601. segment, etc.
  7602. Related streams do not always have exactly the same duration, for various
  7603. reasons including codec frame size or sloppy authoring. For that reason,
  7604. related synchronized streams (e.g. a video and its audio track) should be
  7605. concatenated at once. The concat filter will use the duration of the longest
  7606. stream in each segment (except the last one), and if necessary pad shorter
  7607. audio streams with silence.
  7608. For this filter to work correctly, all segments must start at timestamp 0.
  7609. All corresponding streams must have the same parameters in all segments; the
  7610. filtering system will automatically select a common pixel format for video
  7611. streams, and a common sample format, sample rate and channel layout for
  7612. audio streams, but other settings, such as resolution, must be converted
  7613. explicitly by the user.
  7614. Different frame rates are acceptable but will result in variable frame rate
  7615. at output; be sure to configure the output file to handle it.
  7616. @subsection Examples
  7617. @itemize
  7618. @item
  7619. Concatenate an opening, an episode and an ending, all in bilingual version
  7620. (video in stream 0, audio in streams 1 and 2):
  7621. @example
  7622. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  7623. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  7624. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  7625. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  7626. @end example
  7627. @item
  7628. Concatenate two parts, handling audio and video separately, using the
  7629. (a)movie sources, and adjusting the resolution:
  7630. @example
  7631. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  7632. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  7633. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  7634. @end example
  7635. Note that a desync will happen at the stitch if the audio and video streams
  7636. do not have exactly the same duration in the first file.
  7637. @end itemize
  7638. @section ebur128
  7639. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  7640. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  7641. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  7642. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  7643. The filter also has a video output (see the @var{video} option) with a real
  7644. time graph to observe the loudness evolution. The graphic contains the logged
  7645. message mentioned above, so it is not printed anymore when this option is set,
  7646. unless the verbose logging is set. The main graphing area contains the
  7647. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  7648. the momentary loudness (400 milliseconds).
  7649. More information about the Loudness Recommendation EBU R128 on
  7650. @url{http://tech.ebu.ch/loudness}.
  7651. The filter accepts the following options:
  7652. @table @option
  7653. @item video
  7654. Activate the video output. The audio stream is passed unchanged whether this
  7655. option is set or no. The video stream will be the first output stream if
  7656. activated. Default is @code{0}.
  7657. @item size
  7658. Set the video size. This option is for video only. For the syntax of this
  7659. option, check the "Video size" section in the ffmpeg-utils manual. Default
  7660. and minimum resolution is @code{640x480}.
  7661. @item meter
  7662. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  7663. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  7664. other integer value between this range is allowed.
  7665. @item metadata
  7666. Set metadata injection. If set to @code{1}, the audio input will be segmented
  7667. into 100ms output frames, each of them containing various loudness information
  7668. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  7669. Default is @code{0}.
  7670. @item framelog
  7671. Force the frame logging level.
  7672. Available values are:
  7673. @table @samp
  7674. @item info
  7675. information logging level
  7676. @item verbose
  7677. verbose logging level
  7678. @end table
  7679. By default, the logging level is set to @var{info}. If the @option{video} or
  7680. the @option{metadata} options are set, it switches to @var{verbose}.
  7681. @item peak
  7682. Set peak mode(s).
  7683. Available modes can be cumulated (the option is a @code{flag} type). Possible
  7684. values are:
  7685. @table @samp
  7686. @item none
  7687. Disable any peak mode (default).
  7688. @item sample
  7689. Enable sample-peak mode.
  7690. Simple peak mode looking for the higher sample value. It logs a message
  7691. for sample-peak (identified by @code{SPK}).
  7692. @item true
  7693. Enable true-peak mode.
  7694. If enabled, the peak lookup is done on an over-sampled version of the input
  7695. stream for better peak accuracy. It logs a message for true-peak.
  7696. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  7697. This mode requires a build with @code{libswresample}.
  7698. @end table
  7699. @end table
  7700. @subsection Examples
  7701. @itemize
  7702. @item
  7703. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  7704. @example
  7705. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  7706. @end example
  7707. @item
  7708. Run an analysis with @command{ffmpeg}:
  7709. @example
  7710. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  7711. @end example
  7712. @end itemize
  7713. @section interleave, ainterleave
  7714. Temporally interleave frames from several inputs.
  7715. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  7716. These filters read frames from several inputs and send the oldest
  7717. queued frame to the output.
  7718. Input streams must have a well defined, monotonically increasing frame
  7719. timestamp values.
  7720. In order to submit one frame to output, these filters need to enqueue
  7721. at least one frame for each input, so they cannot work in case one
  7722. input is not yet terminated and will not receive incoming frames.
  7723. For example consider the case when one input is a @code{select} filter
  7724. which always drop input frames. The @code{interleave} filter will keep
  7725. reading from that input, but it will never be able to send new frames
  7726. to output until the input will send an end-of-stream signal.
  7727. Also, depending on inputs synchronization, the filters will drop
  7728. frames in case one input receives more frames than the other ones, and
  7729. the queue is already filled.
  7730. These filters accept the following options:
  7731. @table @option
  7732. @item nb_inputs, n
  7733. Set the number of different inputs, it is 2 by default.
  7734. @end table
  7735. @subsection Examples
  7736. @itemize
  7737. @item
  7738. Interleave frames belonging to different streams using @command{ffmpeg}:
  7739. @example
  7740. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  7741. @end example
  7742. @item
  7743. Add flickering blur effect:
  7744. @example
  7745. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  7746. @end example
  7747. @end itemize
  7748. @section perms, aperms
  7749. Set read/write permissions for the output frames.
  7750. These filters are mainly aimed at developers to test direct path in the
  7751. following filter in the filtergraph.
  7752. The filters accept the following options:
  7753. @table @option
  7754. @item mode
  7755. Select the permissions mode.
  7756. It accepts the following values:
  7757. @table @samp
  7758. @item none
  7759. Do nothing. This is the default.
  7760. @item ro
  7761. Set all the output frames read-only.
  7762. @item rw
  7763. Set all the output frames directly writable.
  7764. @item toggle
  7765. Make the frame read-only if writable, and writable if read-only.
  7766. @item random
  7767. Set each output frame read-only or writable randomly.
  7768. @end table
  7769. @item seed
  7770. Set the seed for the @var{random} mode, must be an integer included between
  7771. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7772. @code{-1}, the filter will try to use a good random seed on a best effort
  7773. basis.
  7774. @end table
  7775. Note: in case of auto-inserted filter between the permission filter and the
  7776. following one, the permission might not be received as expected in that
  7777. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  7778. perms/aperms filter can avoid this problem.
  7779. @section select, aselect
  7780. Select frames to pass in output.
  7781. This filter accepts the following options:
  7782. @table @option
  7783. @item expr, e
  7784. Set expression, which is evaluated for each input frame.
  7785. If the expression is evaluated to zero, the frame is discarded.
  7786. If the evaluation result is negative or NaN, the frame is sent to the
  7787. first output; otherwise it is sent to the output with index
  7788. @code{ceil(val)-1}, assuming that the input index starts from 0.
  7789. For example a value of @code{1.2} corresponds to the output with index
  7790. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  7791. @item outputs, n
  7792. Set the number of outputs. The output to which to send the selected
  7793. frame is based on the result of the evaluation. Default value is 1.
  7794. @end table
  7795. The expression can contain the following constants:
  7796. @table @option
  7797. @item n
  7798. The (sequential) number of the filtered frame, starting from 0.
  7799. @item selected_n
  7800. The (sequential) number of the selected frame, starting from 0.
  7801. @item prev_selected_n
  7802. The sequential number of the last selected frame. It's NAN if undefined.
  7803. @item TB
  7804. The timebase of the input timestamps.
  7805. @item pts
  7806. The PTS (Presentation TimeStamp) of the filtered video frame,
  7807. expressed in @var{TB} units. It's NAN if undefined.
  7808. @item t
  7809. The PTS of the filtered video frame,
  7810. expressed in seconds. It's NAN if undefined.
  7811. @item prev_pts
  7812. The PTS of the previously filtered video frame. It's NAN if undefined.
  7813. @item prev_selected_pts
  7814. The PTS of the last previously filtered video frame. It's NAN if undefined.
  7815. @item prev_selected_t
  7816. The PTS of the last previously selected video frame. It's NAN if undefined.
  7817. @item start_pts
  7818. The PTS of the first video frame in the video. It's NAN if undefined.
  7819. @item start_t
  7820. The time of the first video frame in the video. It's NAN if undefined.
  7821. @item pict_type @emph{(video only)}
  7822. The type of the filtered frame. It can assume one of the following
  7823. values:
  7824. @table @option
  7825. @item I
  7826. @item P
  7827. @item B
  7828. @item S
  7829. @item SI
  7830. @item SP
  7831. @item BI
  7832. @end table
  7833. @item interlace_type @emph{(video only)}
  7834. The frame interlace type. It can assume one of the following values:
  7835. @table @option
  7836. @item PROGRESSIVE
  7837. The frame is progressive (not interlaced).
  7838. @item TOPFIRST
  7839. The frame is top-field-first.
  7840. @item BOTTOMFIRST
  7841. The frame is bottom-field-first.
  7842. @end table
  7843. @item consumed_sample_n @emph{(audio only)}
  7844. the number of selected samples before the current frame
  7845. @item samples_n @emph{(audio only)}
  7846. the number of samples in the current frame
  7847. @item sample_rate @emph{(audio only)}
  7848. the input sample rate
  7849. @item key
  7850. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  7851. @item pos
  7852. the position in the file of the filtered frame, -1 if the information
  7853. is not available (e.g. for synthetic video)
  7854. @item scene @emph{(video only)}
  7855. value between 0 and 1 to indicate a new scene; a low value reflects a low
  7856. probability for the current frame to introduce a new scene, while a higher
  7857. value means the current frame is more likely to be one (see the example below)
  7858. @end table
  7859. The default value of the select expression is "1".
  7860. @subsection Examples
  7861. @itemize
  7862. @item
  7863. Select all frames in input:
  7864. @example
  7865. select
  7866. @end example
  7867. The example above is the same as:
  7868. @example
  7869. select=1
  7870. @end example
  7871. @item
  7872. Skip all frames:
  7873. @example
  7874. select=0
  7875. @end example
  7876. @item
  7877. Select only I-frames:
  7878. @example
  7879. select='eq(pict_type\,I)'
  7880. @end example
  7881. @item
  7882. Select one frame every 100:
  7883. @example
  7884. select='not(mod(n\,100))'
  7885. @end example
  7886. @item
  7887. Select only frames contained in the 10-20 time interval:
  7888. @example
  7889. select=between(t\,10\,20)
  7890. @end example
  7891. @item
  7892. Select only I frames contained in the 10-20 time interval:
  7893. @example
  7894. select=between(t\,10\,20)*eq(pict_type\,I)
  7895. @end example
  7896. @item
  7897. Select frames with a minimum distance of 10 seconds:
  7898. @example
  7899. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  7900. @end example
  7901. @item
  7902. Use aselect to select only audio frames with samples number > 100:
  7903. @example
  7904. aselect='gt(samples_n\,100)'
  7905. @end example
  7906. @item
  7907. Create a mosaic of the first scenes:
  7908. @example
  7909. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  7910. @end example
  7911. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  7912. choice.
  7913. @item
  7914. Send even and odd frames to separate outputs, and compose them:
  7915. @example
  7916. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  7917. @end example
  7918. @end itemize
  7919. @section sendcmd, asendcmd
  7920. Send commands to filters in the filtergraph.
  7921. These filters read commands to be sent to other filters in the
  7922. filtergraph.
  7923. @code{sendcmd} must be inserted between two video filters,
  7924. @code{asendcmd} must be inserted between two audio filters, but apart
  7925. from that they act the same way.
  7926. The specification of commands can be provided in the filter arguments
  7927. with the @var{commands} option, or in a file specified by the
  7928. @var{filename} option.
  7929. These filters accept the following options:
  7930. @table @option
  7931. @item commands, c
  7932. Set the commands to be read and sent to the other filters.
  7933. @item filename, f
  7934. Set the filename of the commands to be read and sent to the other
  7935. filters.
  7936. @end table
  7937. @subsection Commands syntax
  7938. A commands description consists of a sequence of interval
  7939. specifications, comprising a list of commands to be executed when a
  7940. particular event related to that interval occurs. The occurring event
  7941. is typically the current frame time entering or leaving a given time
  7942. interval.
  7943. An interval is specified by the following syntax:
  7944. @example
  7945. @var{START}[-@var{END}] @var{COMMANDS};
  7946. @end example
  7947. The time interval is specified by the @var{START} and @var{END} times.
  7948. @var{END} is optional and defaults to the maximum time.
  7949. The current frame time is considered within the specified interval if
  7950. it is included in the interval [@var{START}, @var{END}), that is when
  7951. the time is greater or equal to @var{START} and is lesser than
  7952. @var{END}.
  7953. @var{COMMANDS} consists of a sequence of one or more command
  7954. specifications, separated by ",", relating to that interval. The
  7955. syntax of a command specification is given by:
  7956. @example
  7957. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  7958. @end example
  7959. @var{FLAGS} is optional and specifies the type of events relating to
  7960. the time interval which enable sending the specified command, and must
  7961. be a non-null sequence of identifier flags separated by "+" or "|" and
  7962. enclosed between "[" and "]".
  7963. The following flags are recognized:
  7964. @table @option
  7965. @item enter
  7966. The command is sent when the current frame timestamp enters the
  7967. specified interval. In other words, the command is sent when the
  7968. previous frame timestamp was not in the given interval, and the
  7969. current is.
  7970. @item leave
  7971. The command is sent when the current frame timestamp leaves the
  7972. specified interval. In other words, the command is sent when the
  7973. previous frame timestamp was in the given interval, and the
  7974. current is not.
  7975. @end table
  7976. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  7977. assumed.
  7978. @var{TARGET} specifies the target of the command, usually the name of
  7979. the filter class or a specific filter instance name.
  7980. @var{COMMAND} specifies the name of the command for the target filter.
  7981. @var{ARG} is optional and specifies the optional list of argument for
  7982. the given @var{COMMAND}.
  7983. Between one interval specification and another, whitespaces, or
  7984. sequences of characters starting with @code{#} until the end of line,
  7985. are ignored and can be used to annotate comments.
  7986. A simplified BNF description of the commands specification syntax
  7987. follows:
  7988. @example
  7989. @var{COMMAND_FLAG} ::= "enter" | "leave"
  7990. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  7991. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  7992. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  7993. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  7994. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  7995. @end example
  7996. @subsection Examples
  7997. @itemize
  7998. @item
  7999. Specify audio tempo change at second 4:
  8000. @example
  8001. asendcmd=c='4.0 atempo tempo 1.5',atempo
  8002. @end example
  8003. @item
  8004. Specify a list of drawtext and hue commands in a file.
  8005. @example
  8006. # show text in the interval 5-10
  8007. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  8008. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  8009. # desaturate the image in the interval 15-20
  8010. 15.0-20.0 [enter] hue s 0,
  8011. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  8012. [leave] hue s 1,
  8013. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  8014. # apply an exponential saturation fade-out effect, starting from time 25
  8015. 25 [enter] hue s exp(25-t)
  8016. @end example
  8017. A filtergraph allowing to read and process the above command list
  8018. stored in a file @file{test.cmd}, can be specified with:
  8019. @example
  8020. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  8021. @end example
  8022. @end itemize
  8023. @anchor{setpts}
  8024. @section setpts, asetpts
  8025. Change the PTS (presentation timestamp) of the input frames.
  8026. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  8027. This filter accepts the following options:
  8028. @table @option
  8029. @item expr
  8030. The expression which is evaluated for each frame to construct its timestamp.
  8031. @end table
  8032. The expression is evaluated through the eval API and can contain the following
  8033. constants:
  8034. @table @option
  8035. @item FRAME_RATE
  8036. frame rate, only defined for constant frame-rate video
  8037. @item PTS
  8038. The presentation timestamp in input
  8039. @item N
  8040. The count of the input frame for video or the number of consumed samples,
  8041. not including the current frame for audio, starting from 0.
  8042. @item NB_CONSUMED_SAMPLES
  8043. The number of consumed samples, not including the current frame (only
  8044. audio)
  8045. @item NB_SAMPLES, S
  8046. The number of samples in the current frame (only audio)
  8047. @item SAMPLE_RATE, SR
  8048. The audio sample rate.
  8049. @item STARTPTS
  8050. The PTS of the first frame.
  8051. @item STARTT
  8052. the time in seconds of the first frame
  8053. @item INTERLACED
  8054. State whether the current frame is interlaced.
  8055. @item T
  8056. the time in seconds of the current frame
  8057. @item POS
  8058. original position in the file of the frame, or undefined if undefined
  8059. for the current frame
  8060. @item PREV_INPTS
  8061. The previous input PTS.
  8062. @item PREV_INT
  8063. previous input time in seconds
  8064. @item PREV_OUTPTS
  8065. The previous output PTS.
  8066. @item PREV_OUTT
  8067. previous output time in seconds
  8068. @item RTCTIME
  8069. The wallclock (RTC) time in microseconds.. This is deprecated, use time(0)
  8070. instead.
  8071. @item RTCSTART
  8072. The wallclock (RTC) time at the start of the movie in microseconds.
  8073. @item TB
  8074. The timebase of the input timestamps.
  8075. @end table
  8076. @subsection Examples
  8077. @itemize
  8078. @item
  8079. Start counting PTS from zero
  8080. @example
  8081. setpts=PTS-STARTPTS
  8082. @end example
  8083. @item
  8084. Apply fast motion effect:
  8085. @example
  8086. setpts=0.5*PTS
  8087. @end example
  8088. @item
  8089. Apply slow motion effect:
  8090. @example
  8091. setpts=2.0*PTS
  8092. @end example
  8093. @item
  8094. Set fixed rate of 25 frames per second:
  8095. @example
  8096. setpts=N/(25*TB)
  8097. @end example
  8098. @item
  8099. Set fixed rate 25 fps with some jitter:
  8100. @example
  8101. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  8102. @end example
  8103. @item
  8104. Apply an offset of 10 seconds to the input PTS:
  8105. @example
  8106. setpts=PTS+10/TB
  8107. @end example
  8108. @item
  8109. Generate timestamps from a "live source" and rebase onto the current timebase:
  8110. @example
  8111. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  8112. @end example
  8113. @item
  8114. Generate timestamps by counting samples:
  8115. @example
  8116. asetpts=N/SR/TB
  8117. @end example
  8118. @end itemize
  8119. @section settb, asettb
  8120. Set the timebase to use for the output frames timestamps.
  8121. It is mainly useful for testing timebase configuration.
  8122. It accepts the following parameters:
  8123. @table @option
  8124. @item expr, tb
  8125. The expression which is evaluated into the output timebase.
  8126. @end table
  8127. The value for @option{tb} is an arithmetic expression representing a
  8128. rational. The expression can contain the constants "AVTB" (the default
  8129. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  8130. audio only). Default value is "intb".
  8131. @subsection Examples
  8132. @itemize
  8133. @item
  8134. Set the timebase to 1/25:
  8135. @example
  8136. settb=expr=1/25
  8137. @end example
  8138. @item
  8139. Set the timebase to 1/10:
  8140. @example
  8141. settb=expr=0.1
  8142. @end example
  8143. @item
  8144. Set the timebase to 1001/1000:
  8145. @example
  8146. settb=1+0.001
  8147. @end example
  8148. @item
  8149. Set the timebase to 2*intb:
  8150. @example
  8151. settb=2*intb
  8152. @end example
  8153. @item
  8154. Set the default timebase value:
  8155. @example
  8156. settb=AVTB
  8157. @end example
  8158. @end itemize
  8159. @section showcqt
  8160. Convert input audio to a video output representing
  8161. frequency spectrum logarithmically (using constant Q transform with
  8162. Brown-Puckette algorithm), with musical tone scale, from E0 to D#10 (10 octaves).
  8163. The filter accepts the following options:
  8164. @table @option
  8165. @item volume
  8166. Specify transform volume (multiplier) expression. The expression can contain
  8167. variables:
  8168. @table @option
  8169. @item frequency, freq, f
  8170. the frequency where transform is evaluated
  8171. @item timeclamp, tc
  8172. value of timeclamp option
  8173. @end table
  8174. and functions:
  8175. @table @option
  8176. @item a_weighting(f)
  8177. A-weighting of equal loudness
  8178. @item b_weighting(f)
  8179. B-weighting of equal loudness
  8180. @item c_weighting(f)
  8181. C-weighting of equal loudness
  8182. @end table
  8183. Default value is @code{16}.
  8184. @item tlength
  8185. Specify transform length expression. The expression can contain variables:
  8186. @table @option
  8187. @item frequency, freq, f
  8188. the frequency where transform is evaluated
  8189. @item timeclamp, tc
  8190. value of timeclamp option
  8191. @end table
  8192. Default value is @code{384/f*tc/(384/f+tc)}.
  8193. @item timeclamp
  8194. Specify the transform timeclamp. At low frequency, there is trade-off between
  8195. accuracy in time domain and frequency domain. If timeclamp is lower,
  8196. event in time domain is represented more accurately (such as fast bass drum),
  8197. otherwise event in frequency domain is represented more accurately
  8198. (such as bass guitar). Acceptable value is [0.1, 1.0]. Default value is @code{0.17}.
  8199. @item coeffclamp
  8200. Specify the transform coeffclamp. If coeffclamp is lower, transform is
  8201. more accurate, otherwise transform is faster. Acceptable value is [0.1, 10.0].
  8202. Default value is @code{1.0}.
  8203. @item gamma
  8204. Specify gamma. Lower gamma makes the spectrum more contrast, higher gamma
  8205. makes the spectrum having more range. Acceptable value is [1.0, 7.0].
  8206. Default value is @code{3.0}.
  8207. @item fontfile
  8208. Specify font file for use with freetype. If not specified, use embedded font.
  8209. @item fontcolor
  8210. Specify font color expression. This is arithmetic expression that should return
  8211. integer value 0xRRGGBB. The expression can contain variables:
  8212. @table @option
  8213. @item frequency, freq, f
  8214. the frequency where transform is evaluated
  8215. @item timeclamp, tc
  8216. value of timeclamp option
  8217. @end table
  8218. and functions:
  8219. @table @option
  8220. @item midi(f)
  8221. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  8222. @item r(x), g(x), b(x)
  8223. red, green, and blue value of intensity x
  8224. @end table
  8225. Default value is @code{st(0, (midi(f)-59.5)/12);
  8226. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  8227. r(1-ld(1)) + b(ld(1))}
  8228. @item fullhd
  8229. If set to 1 (the default), the video size is 1920x1080 (full HD),
  8230. if set to 0, the video size is 960x540. Use this option to make CPU usage lower.
  8231. @item fps
  8232. Specify video fps. Default value is @code{25}.
  8233. @item count
  8234. Specify number of transform per frame, so there are fps*count transforms
  8235. per second. Note that audio data rate must be divisible by fps*count.
  8236. Default value is @code{6}.
  8237. @end table
  8238. @subsection Examples
  8239. @itemize
  8240. @item
  8241. Playing audio while showing the spectrum:
  8242. @example
  8243. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  8244. @end example
  8245. @item
  8246. Same as above, but with frame rate 30 fps:
  8247. @example
  8248. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  8249. @end example
  8250. @item
  8251. Playing at 960x540 and lower CPU usage:
  8252. @example
  8253. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fullhd=0:count=3 [out0]'
  8254. @end example
  8255. @item
  8256. A1 and its harmonics: A1, A2, (near)E3, A3:
  8257. @example
  8258. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  8259. asplit[a][out1]; [a] showcqt [out0]'
  8260. @end example
  8261. @item
  8262. Same as above, but with more accuracy in frequency domain (and slower):
  8263. @example
  8264. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  8265. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  8266. @end example
  8267. @item
  8268. B-weighting of equal loudness
  8269. @example
  8270. volume=16*b_weighting(f)
  8271. @end example
  8272. @item
  8273. Lower Q factor
  8274. @example
  8275. tlength=100/f*tc/(100/f+tc)
  8276. @end example
  8277. @item
  8278. Custom fontcolor, C-note is colored green, others are colored blue
  8279. @example
  8280. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))'
  8281. @end example
  8282. @end itemize
  8283. @section showspectrum
  8284. Convert input audio to a video output, representing the audio frequency
  8285. spectrum.
  8286. The filter accepts the following options:
  8287. @table @option
  8288. @item size, s
  8289. Specify the video size for the output. For the syntax of this option, check
  8290. the "Video size" section in the ffmpeg-utils manual. Default value is
  8291. @code{640x512}.
  8292. @item slide
  8293. Specify how the spectrum should slide along the window.
  8294. It accepts the following values:
  8295. @table @samp
  8296. @item replace
  8297. the samples start again on the left when they reach the right
  8298. @item scroll
  8299. the samples scroll from right to left
  8300. @item fullframe
  8301. frames are only produced when the samples reach the right
  8302. @end table
  8303. Default value is @code{replace}.
  8304. @item mode
  8305. Specify display mode.
  8306. It accepts the following values:
  8307. @table @samp
  8308. @item combined
  8309. all channels are displayed in the same row
  8310. @item separate
  8311. all channels are displayed in separate rows
  8312. @end table
  8313. Default value is @samp{combined}.
  8314. @item color
  8315. Specify display color mode.
  8316. It accepts the following values:
  8317. @table @samp
  8318. @item channel
  8319. each channel is displayed in a separate color
  8320. @item intensity
  8321. each channel is is displayed using the same color scheme
  8322. @end table
  8323. Default value is @samp{channel}.
  8324. @item scale
  8325. Specify scale used for calculating intensity color values.
  8326. It accepts the following values:
  8327. @table @samp
  8328. @item lin
  8329. linear
  8330. @item sqrt
  8331. square root, default
  8332. @item cbrt
  8333. cubic root
  8334. @item log
  8335. logarithmic
  8336. @end table
  8337. Default value is @samp{sqrt}.
  8338. @item saturation
  8339. Set saturation modifier for displayed colors. Negative values provide
  8340. alternative color scheme. @code{0} is no saturation at all.
  8341. Saturation must be in [-10.0, 10.0] range.
  8342. Default value is @code{1}.
  8343. @item win_func
  8344. Set window function.
  8345. It accepts the following values:
  8346. @table @samp
  8347. @item none
  8348. No samples pre-processing (do not expect this to be faster)
  8349. @item hann
  8350. Hann window
  8351. @item hamming
  8352. Hamming window
  8353. @item blackman
  8354. Blackman window
  8355. @end table
  8356. Default value is @code{hann}.
  8357. @end table
  8358. The usage is very similar to the showwaves filter; see the examples in that
  8359. section.
  8360. @subsection Examples
  8361. @itemize
  8362. @item
  8363. Large window with logarithmic color scaling:
  8364. @example
  8365. showspectrum=s=1280x480:scale=log
  8366. @end example
  8367. @item
  8368. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  8369. @example
  8370. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  8371. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  8372. @end example
  8373. @end itemize
  8374. @section showwaves
  8375. Convert input audio to a video output, representing the samples waves.
  8376. The filter accepts the following options:
  8377. @table @option
  8378. @item size, s
  8379. Specify the video size for the output. For the syntax of this option, check
  8380. the "Video size" section in the ffmpeg-utils manual. Default value
  8381. is "600x240".
  8382. @item mode
  8383. Set display mode.
  8384. Available values are:
  8385. @table @samp
  8386. @item point
  8387. Draw a point for each sample.
  8388. @item line
  8389. Draw a vertical line for each sample.
  8390. @item p2p
  8391. Draw a point for each sample and a line between them.
  8392. @item cline
  8393. Draw a centered vertical line for each sample.
  8394. @end table
  8395. Default value is @code{point}.
  8396. @item n
  8397. Set the number of samples which are printed on the same column. A
  8398. larger value will decrease the frame rate. Must be a positive
  8399. integer. This option can be set only if the value for @var{rate}
  8400. is not explicitly specified.
  8401. @item rate, r
  8402. Set the (approximate) output frame rate. This is done by setting the
  8403. option @var{n}. Default value is "25".
  8404. @item split_channels
  8405. Set if channels should be drawn separately or overlap. Default value is 0.
  8406. @end table
  8407. @subsection Examples
  8408. @itemize
  8409. @item
  8410. Output the input file audio and the corresponding video representation
  8411. at the same time:
  8412. @example
  8413. amovie=a.mp3,asplit[out0],showwaves[out1]
  8414. @end example
  8415. @item
  8416. Create a synthetic signal and show it with showwaves, forcing a
  8417. frame rate of 30 frames per second:
  8418. @example
  8419. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  8420. @end example
  8421. @end itemize
  8422. @section split, asplit
  8423. Split input into several identical outputs.
  8424. @code{asplit} works with audio input, @code{split} with video.
  8425. The filter accepts a single parameter which specifies the number of outputs. If
  8426. unspecified, it defaults to 2.
  8427. @subsection Examples
  8428. @itemize
  8429. @item
  8430. Create two separate outputs from the same input:
  8431. @example
  8432. [in] split [out0][out1]
  8433. @end example
  8434. @item
  8435. To create 3 or more outputs, you need to specify the number of
  8436. outputs, like in:
  8437. @example
  8438. [in] asplit=3 [out0][out1][out2]
  8439. @end example
  8440. @item
  8441. Create two separate outputs from the same input, one cropped and
  8442. one padded:
  8443. @example
  8444. [in] split [splitout1][splitout2];
  8445. [splitout1] crop=100:100:0:0 [cropout];
  8446. [splitout2] pad=200:200:100:100 [padout];
  8447. @end example
  8448. @item
  8449. Create 5 copies of the input audio with @command{ffmpeg}:
  8450. @example
  8451. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  8452. @end example
  8453. @end itemize
  8454. @section zmq, azmq
  8455. Receive commands sent through a libzmq client, and forward them to
  8456. filters in the filtergraph.
  8457. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  8458. must be inserted between two video filters, @code{azmq} between two
  8459. audio filters.
  8460. To enable these filters you need to install the libzmq library and
  8461. headers and configure FFmpeg with @code{--enable-libzmq}.
  8462. For more information about libzmq see:
  8463. @url{http://www.zeromq.org/}
  8464. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  8465. receives messages sent through a network interface defined by the
  8466. @option{bind_address} option.
  8467. The received message must be in the form:
  8468. @example
  8469. @var{TARGET} @var{COMMAND} [@var{ARG}]
  8470. @end example
  8471. @var{TARGET} specifies the target of the command, usually the name of
  8472. the filter class or a specific filter instance name.
  8473. @var{COMMAND} specifies the name of the command for the target filter.
  8474. @var{ARG} is optional and specifies the optional argument list for the
  8475. given @var{COMMAND}.
  8476. Upon reception, the message is processed and the corresponding command
  8477. is injected into the filtergraph. Depending on the result, the filter
  8478. will send a reply to the client, adopting the format:
  8479. @example
  8480. @var{ERROR_CODE} @var{ERROR_REASON}
  8481. @var{MESSAGE}
  8482. @end example
  8483. @var{MESSAGE} is optional.
  8484. @subsection Examples
  8485. Look at @file{tools/zmqsend} for an example of a zmq client which can
  8486. be used to send commands processed by these filters.
  8487. Consider the following filtergraph generated by @command{ffplay}
  8488. @example
  8489. ffplay -dumpgraph 1 -f lavfi "
  8490. color=s=100x100:c=red [l];
  8491. color=s=100x100:c=blue [r];
  8492. nullsrc=s=200x100, zmq [bg];
  8493. [bg][l] overlay [bg+l];
  8494. [bg+l][r] overlay=x=100 "
  8495. @end example
  8496. To change the color of the left side of the video, the following
  8497. command can be used:
  8498. @example
  8499. echo Parsed_color_0 c yellow | tools/zmqsend
  8500. @end example
  8501. To change the right side:
  8502. @example
  8503. echo Parsed_color_1 c pink | tools/zmqsend
  8504. @end example
  8505. @c man end MULTIMEDIA FILTERS
  8506. @chapter Multimedia Sources
  8507. @c man begin MULTIMEDIA SOURCES
  8508. Below is a description of the currently available multimedia sources.
  8509. @section amovie
  8510. This is the same as @ref{movie} source, except it selects an audio
  8511. stream by default.
  8512. @anchor{movie}
  8513. @section movie
  8514. Read audio and/or video stream(s) from a movie container.
  8515. It accepts the following parameters:
  8516. @table @option
  8517. @item filename
  8518. The name of the resource to read (not necessarily a file; it can also be a
  8519. device or a stream accessed through some protocol).
  8520. @item format_name, f
  8521. Specifies the format assumed for the movie to read, and can be either
  8522. the name of a container or an input device. If not specified, the
  8523. format is guessed from @var{movie_name} or by probing.
  8524. @item seek_point, sp
  8525. Specifies the seek point in seconds. The frames will be output
  8526. starting from this seek point. The parameter is evaluated with
  8527. @code{av_strtod}, so the numerical value may be suffixed by an IS
  8528. postfix. The default value is "0".
  8529. @item streams, s
  8530. Specifies the streams to read. Several streams can be specified,
  8531. separated by "+". The source will then have as many outputs, in the
  8532. same order. The syntax is explained in the ``Stream specifiers''
  8533. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  8534. respectively the default (best suited) video and audio stream. Default
  8535. is "dv", or "da" if the filter is called as "amovie".
  8536. @item stream_index, si
  8537. Specifies the index of the video stream to read. If the value is -1,
  8538. the most suitable video stream will be automatically selected. The default
  8539. value is "-1". Deprecated. If the filter is called "amovie", it will select
  8540. audio instead of video.
  8541. @item loop
  8542. Specifies how many times to read the stream in sequence.
  8543. If the value is less than 1, the stream will be read again and again.
  8544. Default value is "1".
  8545. Note that when the movie is looped the source timestamps are not
  8546. changed, so it will generate non monotonically increasing timestamps.
  8547. @end table
  8548. It allows overlaying a second video on top of the main input of
  8549. a filtergraph, as shown in this graph:
  8550. @example
  8551. input -----------> deltapts0 --> overlay --> output
  8552. ^
  8553. |
  8554. movie --> scale--> deltapts1 -------+
  8555. @end example
  8556. @subsection Examples
  8557. @itemize
  8558. @item
  8559. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  8560. on top of the input labelled "in":
  8561. @example
  8562. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  8563. [in] setpts=PTS-STARTPTS [main];
  8564. [main][over] overlay=16:16 [out]
  8565. @end example
  8566. @item
  8567. Read from a video4linux2 device, and overlay it on top of the input
  8568. labelled "in":
  8569. @example
  8570. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  8571. [in] setpts=PTS-STARTPTS [main];
  8572. [main][over] overlay=16:16 [out]
  8573. @end example
  8574. @item
  8575. Read the first video stream and the audio stream with id 0x81 from
  8576. dvd.vob; the video is connected to the pad named "video" and the audio is
  8577. connected to the pad named "audio":
  8578. @example
  8579. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  8580. @end example
  8581. @end itemize
  8582. @c man end MULTIMEDIA SOURCES