filters.texi 249 KB

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