filters.texi 893 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249
  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. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. A special syntax implemented in the @command{ffmpeg} CLI tool allows loading
  138. option values from files. This is done be prepending a slash '/' to the option
  139. name, then the supplied value is interpreted as a path from which the actual
  140. value is loaded. E.g.
  141. @example
  142. ffmpeg -i <INPUT> -vf drawtext=/text=/tmp/some_text <OUTPUT>
  143. @end example
  144. will load the text to be drawn from @file{/tmp/some_text}. API users wishing to
  145. implement a similar feature should use the @code{avfilter_graph_segment_*()}
  146. functions together with custom IO code.
  147. The name and arguments of the filter are optionally preceded and
  148. followed by a list of link labels.
  149. A link label allows one to name a link and associate it to a filter output
  150. or input pad. The preceding labels @var{in_link_1}
  151. ... @var{in_link_N}, are associated to the filter input pads,
  152. the following labels @var{out_link_1} ... @var{out_link_M}, are
  153. associated to the output pads.
  154. When two link labels with the same name are found in the
  155. filtergraph, a link between the corresponding input and output pad is
  156. created.
  157. If an output pad is not labelled, it is linked by default to the first
  158. unlabelled input pad of the next filter in the filterchain.
  159. For example in the filterchain
  160. @example
  161. nullsrc, split[L1], [L2]overlay, nullsink
  162. @end example
  163. the split filter instance has two output pads, and the overlay filter
  164. instance two input pads. The first output pad of split is labelled
  165. "L1", the first input pad of overlay is labelled "L2", and the second
  166. output pad of split is linked to the second input pad of overlay,
  167. which are both unlabelled.
  168. In a filter description, if the input label of the first filter is not
  169. specified, "in" is assumed; if the output label of the last filter is not
  170. specified, "out" is assumed.
  171. In a complete filterchain all the unlabelled filter input and output
  172. pads must be connected. A filtergraph is considered valid if all the
  173. filter input and output pads of all the filterchains are connected.
  174. Leading and trailing whitespaces (space, tabs, or line feeds) separating tokens
  175. in the filtergraph specification are ignored. This means that the filtergraph
  176. can be expressed using empty lines and spaces to improve redability.
  177. For example, the filtergraph:
  178. @example
  179. testsrc,split[L1],hflip[L2];[L1][L2] hstack
  180. @end example
  181. can be represented as:
  182. @example
  183. testsrc,
  184. split [L1], hflip [L2];
  185. [L1][L2] hstack
  186. @end example
  187. Libavfilter will automatically insert @ref{scale} filters where format
  188. conversion is required. It is possible to specify swscale flags
  189. for those automatically inserted scalers by prepending
  190. @code{sws_flags=@var{flags};}
  191. to the filtergraph description.
  192. Here is a BNF description of the filtergraph syntax:
  193. @example
  194. @var{NAME} ::= sequence of alphanumeric characters and '_'
  195. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  196. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  197. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  198. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  199. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  200. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  201. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  202. @end example
  203. @anchor{filtergraph escaping}
  204. @section Notes on filtergraph escaping
  205. Filtergraph description composition entails several levels of
  206. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  207. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  208. information about the employed escaping procedure.
  209. A first level escaping affects the content of each filter option
  210. value, which may contain the special character @code{:} used to
  211. separate values, or one of the escaping characters @code{\'}.
  212. A second level escaping affects the whole filter description, which
  213. may contain the escaping characters @code{\'} or the special
  214. characters @code{[],;} used by the filtergraph description.
  215. Finally, when you specify a filtergraph on a shell commandline, you
  216. need to perform a third level escaping for the shell special
  217. characters contained within it.
  218. For example, consider the following string to be embedded in
  219. the @ref{drawtext} filter description @option{text} value:
  220. @example
  221. this is a 'string': may contain one, or more, special characters
  222. @end example
  223. This string contains the @code{'} special escaping character, and the
  224. @code{:} special character, so it needs to be escaped in this way:
  225. @example
  226. text=this is a \'string\'\: may contain one, or more, special characters
  227. @end example
  228. A second level of escaping is required when embedding the filter
  229. description in a filtergraph description, in order to escape all the
  230. filtergraph special characters. Thus the example above becomes:
  231. @example
  232. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  233. @end example
  234. (note that in addition to the @code{\'} escaping special characters,
  235. also @code{,} needs to be escaped).
  236. Finally an additional level of escaping is needed when writing the
  237. filtergraph description in a shell command, which depends on the
  238. escaping rules of the adopted shell. For example, assuming that
  239. @code{\} is special and needs to be escaped with another @code{\}, the
  240. previous string will finally result in:
  241. @example
  242. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  243. @end example
  244. In order to avoid cumbersome escaping when using a commandline tool accepting a
  245. filter specification as input, it is advisable to avoid direct inclusion of the
  246. filter or options specification in the shell.
  247. For example, in case of the @ref{drawtext,,drawtext filter}, you might prefer to
  248. use the @option{textfile} option in place of @option{text} to specify the text
  249. to render.
  250. @chapter Timeline editing
  251. Some filters support a generic @option{enable} option. For the filters
  252. supporting timeline editing, this option can be set to an expression which is
  253. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  254. the filter will be enabled, otherwise the frame will be sent unchanged to the
  255. next filter in the filtergraph.
  256. The expression accepts the following values:
  257. @table @samp
  258. @item t
  259. timestamp expressed in seconds, NAN if the input timestamp is unknown
  260. @item n
  261. sequential number of the input frame, starting from 0
  262. @item pos
  263. the position in the file of the input frame, NAN if unknown; deprecated, do
  264. not use
  265. @item w
  266. @item h
  267. width and height of the input frame if video
  268. @end table
  269. Additionally, these filters support an @option{enable} command that can be used
  270. to re-define the expression.
  271. Like any other filtering option, the @option{enable} option follows the same
  272. rules.
  273. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  274. minutes, and a @ref{curves} filter starting at 3 seconds:
  275. @example
  276. smartblur = enable='between(t,10,3*60)',
  277. curves = enable='gte(t,3)' : preset=cross_process
  278. @end example
  279. See @code{ffmpeg -filters} to view which filters have timeline support.
  280. @c man end FILTERGRAPH DESCRIPTION
  281. @anchor{commands}
  282. @chapter Changing options at runtime with a command
  283. Some options can be changed during the operation of the filter using
  284. a command. These options are marked 'T' on the output of
  285. @command{ffmpeg} @option{-h filter=<name of filter>}.
  286. The name of the command is the name of the option and the argument is
  287. the new value.
  288. @anchor{framesync}
  289. @chapter Options for filters with several inputs (framesync)
  290. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  291. Some filters with several inputs support a common set of options.
  292. These options can only be set by name, not with the short notation.
  293. @table @option
  294. @item eof_action
  295. The action to take when EOF is encountered on the secondary input; it accepts
  296. one of the following values:
  297. @table @option
  298. @item repeat
  299. Repeat the last frame (the default).
  300. @item endall
  301. End both streams.
  302. @item pass
  303. Pass the main input through.
  304. @end table
  305. @item shortest
  306. If set to 1, force the output to terminate when the shortest input
  307. terminates. Default value is 0.
  308. @item repeatlast
  309. If set to 1, force the filter to extend the last frame of secondary streams
  310. until the end of the primary stream. A value of 0 disables this behavior.
  311. Default value is 1.
  312. @item ts_sync_mode
  313. How strictly to sync streams based on secondary input timestamps; it accepts
  314. one of the following values:
  315. @table @option
  316. @item default
  317. Frame from secondary input with the nearest lower or equal timestamp to the
  318. primary input frame.
  319. @item nearest
  320. Frame from secondary input with the absolute nearest timestamp to the primary
  321. input frame.
  322. @end table
  323. @end table
  324. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  325. @chapter Audio Filters
  326. @c man begin AUDIO FILTERS
  327. When you configure your FFmpeg build, you can disable any of the
  328. existing filters using @code{--disable-filters}.
  329. The configure output will show the audio filters included in your
  330. build.
  331. Below is a description of the currently available audio filters.
  332. @section aap
  333. Apply Affine Projection algorithm to the first audio stream using the second audio stream.
  334. This adaptive filter is used to estimate unknown audio based on multiple input audio samples.
  335. Affine projection algorithm can make trade-offs between computation complexity with convergence speed.
  336. A description of the accepted options follows.
  337. @table @option
  338. @item order
  339. Set the filter order.
  340. @item projection
  341. Set the projection order.
  342. @item mu
  343. Set the filter mu.
  344. @item delta
  345. Set the coefficient to initialize internal covariance matrix.
  346. @item out_mode
  347. Set the filter output samples. It accepts the following values:
  348. @table @option
  349. @item i
  350. Pass the 1st input.
  351. @item d
  352. Pass the 2nd input.
  353. @item o
  354. Pass difference between desired, 2nd input and error signal estimate.
  355. @item n
  356. Pass difference between input, 1st input and error signal estimate.
  357. @item e
  358. Pass error signal estimated samples.
  359. Default value is @var{o}.
  360. @end table
  361. @item precision
  362. Set which precision to use when processing samples.
  363. @table @option
  364. @item auto
  365. Auto pick internal sample format depending on other filters.
  366. @item float
  367. Always use single-floating point precision sample format.
  368. @item double
  369. Always use double-floating point precision sample format.
  370. @end table
  371. @end table
  372. @section acompressor
  373. A compressor is mainly used to reduce the dynamic range of a signal.
  374. Especially modern music is mostly compressed at a high ratio to
  375. improve the overall loudness. It's done to get the highest attention
  376. of a listener, "fatten" the sound and bring more "power" to the track.
  377. If a signal is compressed too much it may sound dull or "dead"
  378. afterwards or it may start to "pump" (which could be a powerful effect
  379. but can also destroy a track completely).
  380. The right compression is the key to reach a professional sound and is
  381. the high art of mixing and mastering. Because of its complex settings
  382. it may take a long time to get the right feeling for this kind of effect.
  383. Compression is done by detecting the volume above a chosen level
  384. @code{threshold} and dividing it by the factor set with @code{ratio}.
  385. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  386. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  387. the signal would cause distortion of the waveform the reduction can be
  388. levelled over the time. This is done by setting "Attack" and "Release".
  389. @code{attack} determines how long the signal has to rise above the threshold
  390. before any reduction will occur and @code{release} sets the time the signal
  391. has to fall below the threshold to reduce the reduction again. Shorter signals
  392. than the chosen attack time will be left untouched.
  393. The overall reduction of the signal can be made up afterwards with the
  394. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  395. raising the makeup to this level results in a signal twice as loud than the
  396. source. To gain a softer entry in the compression the @code{knee} flattens the
  397. hard edge at the threshold in the range of the chosen decibels.
  398. The filter accepts the following options:
  399. @table @option
  400. @item level_in
  401. Set input gain. Default is 1. Range is between 0.015625 and 64.
  402. @item mode
  403. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  404. Default is @code{downward}.
  405. @item threshold
  406. If a signal of stream rises above this level it will affect the gain
  407. reduction.
  408. By default it is 0.125. Range is between 0.00097563 and 1.
  409. @item ratio
  410. Set a ratio by which the signal is reduced. 1:2 means that if the level
  411. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  412. Default is 2. Range is between 1 and 20.
  413. @item attack
  414. Amount of milliseconds the signal has to rise above the threshold before gain
  415. reduction starts. Default is 20. Range is between 0.01 and 2000.
  416. @item release
  417. Amount of milliseconds the signal has to fall below the threshold before
  418. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  419. @item makeup
  420. Set the amount by how much signal will be amplified after processing.
  421. Default is 1. Range is from 1 to 64.
  422. @item knee
  423. Curve the sharp knee around the threshold to enter gain reduction more softly.
  424. Default is 2.82843. Range is between 1 and 8.
  425. @item link
  426. Choose if the @code{average} level between all channels of input stream
  427. or the louder(@code{maximum}) channel of input stream affects the
  428. reduction. Default is @code{average}.
  429. @item detection
  430. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  431. of @code{rms}. Default is @code{rms} which is mostly smoother.
  432. @item mix
  433. How much to use compressed signal in output. Default is 1.
  434. Range is between 0 and 1.
  435. @end table
  436. @subsection Commands
  437. This filter supports the all above options as @ref{commands}.
  438. @section acontrast
  439. Simple audio dynamic range compression/expansion filter.
  440. The filter accepts the following options:
  441. @table @option
  442. @item contrast
  443. Set contrast. Default is 33. Allowed range is between 0 and 100.
  444. @end table
  445. @section acopy
  446. Copy the input audio source unchanged to the output. This is mainly useful for
  447. testing purposes.
  448. @section acrossfade
  449. Apply cross fade from one input audio stream to another input audio stream.
  450. The cross fade is applied for specified duration near the end of first stream.
  451. The filter accepts the following options:
  452. @table @option
  453. @item nb_samples, ns
  454. Specify the number of samples for which the cross fade effect has to last.
  455. At the end of the cross fade effect the first input audio will be completely
  456. silent. Default is 44100.
  457. @item duration, d
  458. Specify the duration of the cross fade effect. See
  459. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  460. for the accepted syntax.
  461. By default the duration is determined by @var{nb_samples}.
  462. If set this option is used instead of @var{nb_samples}.
  463. @item overlap, o
  464. Should first stream end overlap with second stream start. Default is enabled.
  465. @item curve1
  466. Set curve for cross fade transition for first stream.
  467. @item curve2
  468. Set curve for cross fade transition for second stream.
  469. For description of available curve types see @ref{afade} filter description.
  470. @end table
  471. @subsection Examples
  472. @itemize
  473. @item
  474. Cross fade from one input to another:
  475. @example
  476. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  477. @end example
  478. @item
  479. Cross fade from one input to another but without overlapping:
  480. @example
  481. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  482. @end example
  483. @end itemize
  484. @section acrossover
  485. Split audio stream into several bands.
  486. This filter splits audio stream into two or more frequency ranges.
  487. Summing all streams back will give flat output.
  488. The filter accepts the following options:
  489. @table @option
  490. @item split
  491. Set split frequencies. Those must be positive and increasing.
  492. @item order
  493. Set filter order for each band split. This controls filter roll-off or steepness
  494. of filter transfer function.
  495. Available values are:
  496. @table @samp
  497. @item 2nd
  498. 12 dB per octave.
  499. @item 4th
  500. 24 dB per octave.
  501. @item 6th
  502. 36 dB per octave.
  503. @item 8th
  504. 48 dB per octave.
  505. @item 10th
  506. 60 dB per octave.
  507. @item 12th
  508. 72 dB per octave.
  509. @item 14th
  510. 84 dB per octave.
  511. @item 16th
  512. 96 dB per octave.
  513. @item 18th
  514. 108 dB per octave.
  515. @item 20th
  516. 120 dB per octave.
  517. @end table
  518. Default is @var{4th}.
  519. @item level
  520. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  521. @item gains
  522. Set output gain for each band. Default value is 1 for all bands.
  523. @item precision
  524. Set which precision to use when processing samples.
  525. @table @option
  526. @item auto
  527. Auto pick internal sample format depending on other filters.
  528. @item float
  529. Always use single-floating point precision sample format.
  530. @item double
  531. Always use double-floating point precision sample format.
  532. @end table
  533. Default value is @code{auto}.
  534. @end table
  535. @subsection Examples
  536. @itemize
  537. @item
  538. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  539. each band will be in separate stream:
  540. @example
  541. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  542. @end example
  543. @item
  544. Same as above, but with higher filter order:
  545. @example
  546. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  547. @end example
  548. @item
  549. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  550. @example
  551. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  552. @end example
  553. @end itemize
  554. @section acrusher
  555. Reduce audio bit resolution.
  556. This filter is bit crusher with enhanced functionality. A bit crusher
  557. is used to audibly reduce number of bits an audio signal is sampled
  558. with. This doesn't change the bit depth at all, it just produces the
  559. effect. Material reduced in bit depth sounds more harsh and "digital".
  560. This filter is able to even round to continuous values instead of discrete
  561. bit depths.
  562. Additionally it has a D/C offset which results in different crushing of
  563. the lower and the upper half of the signal.
  564. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  565. Another feature of this filter is the logarithmic mode.
  566. This setting switches from linear distances between bits to logarithmic ones.
  567. The result is a much more "natural" sounding crusher which doesn't gate low
  568. signals for example. The human ear has a logarithmic perception,
  569. so this kind of crushing is much more pleasant.
  570. Logarithmic crushing is also able to get anti-aliased.
  571. The filter accepts the following options:
  572. @table @option
  573. @item level_in
  574. Set level in.
  575. @item level_out
  576. Set level out.
  577. @item bits
  578. Set bit reduction.
  579. @item mix
  580. Set mixing amount.
  581. @item mode
  582. Can be linear: @code{lin} or logarithmic: @code{log}.
  583. @item dc
  584. Set DC.
  585. @item aa
  586. Set anti-aliasing.
  587. @item samples
  588. Set sample reduction.
  589. @item lfo
  590. Enable LFO. By default disabled.
  591. @item lforange
  592. Set LFO range.
  593. @item lforate
  594. Set LFO rate.
  595. @end table
  596. @subsection Commands
  597. This filter supports the all above options as @ref{commands}.
  598. @section acue
  599. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  600. filter.
  601. @section adeclick
  602. Remove impulsive noise from input audio.
  603. Samples detected as impulsive noise are replaced by interpolated samples using
  604. autoregressive modelling.
  605. @table @option
  606. @item window, w
  607. Set window size, in milliseconds. Allowed range is from @code{10} to
  608. @code{100}. Default value is @code{55} milliseconds.
  609. This sets size of window which will be processed at once.
  610. @item overlap, o
  611. Set window overlap, in percentage of window size. Allowed range is from
  612. @code{50} to @code{95}. Default value is @code{75} percent.
  613. Setting this to a very high value increases impulsive noise removal but makes
  614. whole process much slower.
  615. @item arorder, a
  616. Set autoregression order, in percentage of window size. Allowed range is from
  617. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  618. controls quality of interpolated samples using neighbour good samples.
  619. @item threshold, t
  620. Set threshold value. Allowed range is from @code{1} to @code{100}.
  621. Default value is @code{2}.
  622. This controls the strength of impulsive noise which is going to be removed.
  623. The lower value, the more samples will be detected as impulsive noise.
  624. @item burst, b
  625. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  626. @code{10}. Default value is @code{2}.
  627. If any two samples detected as noise are spaced less than this value then any
  628. sample between those two samples will be also detected as noise.
  629. @item method, m
  630. Set overlap method.
  631. It accepts the following values:
  632. @table @option
  633. @item add, a
  634. Select overlap-add method. Even not interpolated samples are slightly
  635. changed with this method.
  636. @item save, s
  637. Select overlap-save method. Not interpolated samples remain unchanged.
  638. @end table
  639. Default value is @code{a}.
  640. @end table
  641. @section adeclip
  642. Remove clipped samples from input audio.
  643. Samples detected as clipped are replaced by interpolated samples using
  644. autoregressive modelling.
  645. @table @option
  646. @item window, w
  647. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  648. Default value is @code{55} milliseconds.
  649. This sets size of window which will be processed at once.
  650. @item overlap, o
  651. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  652. to @code{95}. Default value is @code{75} percent.
  653. @item arorder, a
  654. Set autoregression order, in percentage of window size. Allowed range is from
  655. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  656. quality of interpolated samples using neighbour good samples.
  657. @item threshold, t
  658. Set threshold value. Allowed range is from @code{1} to @code{100}.
  659. Default value is @code{10}. Higher values make clip detection less aggressive.
  660. @item hsize, n
  661. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  662. Default value is @code{1000}. Higher values make clip detection less aggressive.
  663. @item method, m
  664. Set overlap method.
  665. It accepts the following values:
  666. @table @option
  667. @item add, a
  668. Select overlap-add method. Even not interpolated samples are slightly changed
  669. with this method.
  670. @item save, s
  671. Select overlap-save method. Not interpolated samples remain unchanged.
  672. @end table
  673. Default value is @code{a}.
  674. @end table
  675. @section adecorrelate
  676. Apply decorrelation to input audio stream.
  677. The filter accepts the following options:
  678. @table @option
  679. @item stages
  680. Set decorrelation stages of filtering. Allowed
  681. range is from 1 to 16. Default value is 6.
  682. @item seed
  683. Set random seed used for setting delay in samples across channels.
  684. @end table
  685. @section adelay
  686. Delay one or more audio channels.
  687. Samples in delayed channel are filled with silence.
  688. The filter accepts the following option:
  689. @table @option
  690. @item delays
  691. Set list of delays in milliseconds for each channel separated by '|'.
  692. Unused delays will be silently ignored. If number of given delays is
  693. smaller than number of channels all remaining channels will not be delayed.
  694. If you want to delay exact number of samples, append 'S' to number.
  695. If you want instead to delay in seconds, append 's' to number.
  696. @item all
  697. Use last set delay for all remaining channels. By default is disabled.
  698. This option if enabled changes how option @code{delays} is interpreted.
  699. @end table
  700. @subsection Examples
  701. @itemize
  702. @item
  703. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  704. the second channel (and any other channels that may be present) unchanged.
  705. @example
  706. adelay=1500|0|500
  707. @end example
  708. @item
  709. Delay second channel by 500 samples, the third channel by 700 samples and leave
  710. the first channel (and any other channels that may be present) unchanged.
  711. @example
  712. adelay=0|500S|700S
  713. @end example
  714. @item
  715. Delay all channels by same number of samples:
  716. @example
  717. adelay=delays=64S:all=1
  718. @end example
  719. @end itemize
  720. @section adenorm
  721. Remedy denormals in audio by adding extremely low-level noise.
  722. This filter shall be placed before any filter that can produce denormals.
  723. A description of the accepted parameters follows.
  724. @table @option
  725. @item level
  726. Set level of added noise in dB. Default is @code{-351}.
  727. Allowed range is from -451 to -90.
  728. @item type
  729. Set type of added noise.
  730. @table @option
  731. @item dc
  732. Add DC signal.
  733. @item ac
  734. Add AC signal.
  735. @item square
  736. Add square signal.
  737. @item pulse
  738. Add pulse signal.
  739. @end table
  740. Default is @code{dc}.
  741. @end table
  742. @subsection Commands
  743. This filter supports the all above options as @ref{commands}.
  744. @section aderivative, aintegral
  745. Compute derivative/integral of audio stream.
  746. Applying both filters one after another produces original audio.
  747. @section adrc
  748. Apply spectral dynamic range controller filter to input audio stream.
  749. A description of the accepted options follows.
  750. @table @option
  751. @item transfer
  752. Set the transfer expression.
  753. The expression can contain the following constants:
  754. @table @option
  755. @item ch
  756. current channel number
  757. @item sn
  758. current sample number
  759. @item nb_channels
  760. number of channels
  761. @item t
  762. timestamp expressed in seconds
  763. @item sr
  764. sample rate
  765. @item p
  766. current frequency power value, in dB
  767. @item f
  768. current frequency in Hz
  769. @end table
  770. Default value is @code{p}.
  771. @item attack
  772. Set the attack in milliseconds. Default is @code{50} milliseconds.
  773. Allowed range is from 1 to 1000 milliseconds.
  774. @item release
  775. Set the release in milliseconds. Default is @code{100} milliseconds.
  776. Allowed range is from 5 to 2000 milliseconds.
  777. @item channels
  778. Set which channels to filter, by default @code{all} channels in audio stream are filtered.
  779. @end table
  780. @subsection Commands
  781. This filter supports the all above options as @ref{commands}.
  782. @subsection Examples
  783. @itemize
  784. @item
  785. Apply spectral compression to all frequencies with threshold of -50 dB and 1:6 ratio:
  786. @example
  787. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/6,p)':attack=50:release=100
  788. @end example
  789. @item
  790. Similar to above but with 1:2 ratio and filtering only front center channel:
  791. @example
  792. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/2,p)':attack=50:release=100:channels=FC
  793. @end example
  794. @item
  795. Apply spectral noise gate to all frequencies with threshold of -85 dB and with short attack time and short release time:
  796. @example
  797. adrc=transfer='if(lte(p,-85),p-800,p)':attack=1:release=5
  798. @end example
  799. @item
  800. Apply spectral expansion to all frequencies with threshold of -10 dB and 1:2 ratio:
  801. @example
  802. adrc=transfer='if(lt(p,-10),-10+(p-(-10))*2,p)':attack=50:release=100
  803. @end example
  804. @item
  805. Apply limiter to max -60 dB to all frequencies, with attack of 2 ms and release of 10 ms:
  806. @example
  807. adrc=transfer='min(p,-60)':attack=2:release=10
  808. @end example
  809. @end itemize
  810. @section adynamicequalizer
  811. Apply dynamic equalization to input audio stream.
  812. A description of the accepted options follows.
  813. @table @option
  814. @item threshold
  815. Set the detection threshold used to trigger equalization.
  816. Threshold detection is using detection filter.
  817. Default value is 0. Allowed range is from 0 to 100.
  818. @item dfrequency
  819. Set the detection frequency in Hz used for detection filter used to trigger equalization.
  820. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  821. @item dqfactor
  822. Set the detection resonance factor for detection filter used to trigger equalization.
  823. Default value is 1. Allowed range is from 0.001 to 1000.
  824. @item tfrequency
  825. Set the target frequency of equalization filter.
  826. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  827. @item tqfactor
  828. Set the target resonance factor for target equalization filter.
  829. Default value is 1. Allowed range is from 0.001 to 1000.
  830. @item attack
  831. Set the amount of milliseconds the signal from detection has to rise above
  832. the detection threshold before equalization starts.
  833. Default is 20. Allowed range is between 1 and 2000.
  834. @item release
  835. Set the amount of milliseconds the signal from detection has to fall below the
  836. detection threshold before equalization ends.
  837. Default is 200. Allowed range is between 1 and 2000.
  838. @item ratio
  839. Set the ratio by which the equalization gain is raised.
  840. Default is 1. Allowed range is between 0 and 30.
  841. @item makeup
  842. Set the makeup offset by which the equalization gain is raised.
  843. Default is 0. Allowed range is between 0 and 100.
  844. @item range
  845. Set the max allowed cut/boost amount. Default is 50.
  846. Allowed range is from 1 to 200.
  847. @item mode
  848. Set the mode of filter operation, can be one of the following:
  849. @table @samp
  850. @item listen
  851. Output only isolated detection signal.
  852. @item cutbelow
  853. Cut frequencies below detection threshold.
  854. @item cutabove
  855. Cut frequencies above detection threshold.
  856. @item boostbelow
  857. Boost frequencies below detection threshold.
  858. @item boostabove
  859. Boost frequencies above detection threshold.
  860. @end table
  861. Default mode is @samp{cutbelow}.
  862. @item dftype
  863. Set the type of detection filter, can be one of the following:
  864. @table @samp
  865. @item bandpass
  866. @item lowpass
  867. @item highpass
  868. @item peak
  869. @end table
  870. Default type is @samp{bandpass}.
  871. @item tftype
  872. Set the type of target filter, can be one of the following:
  873. @table @samp
  874. @item bell
  875. @item lowshelf
  876. @item highshelf
  877. @end table
  878. Default type is @samp{bell}.
  879. @item auto
  880. Automatically gather threshold from detection filter. By default
  881. is @samp{disabled}.
  882. This option is useful to detect threshold in certain time frame of
  883. input audio stream, in such case option value is changed at runtime.
  884. Available values are:
  885. @table @samp
  886. @item disabled
  887. Disable using automatically gathered threshold value.
  888. @item off
  889. Stop picking threshold value.
  890. @item on
  891. Start picking threshold value.
  892. @item adaptive
  893. Adaptively pick threshold value, by calculating sliding window entropy.
  894. @end table
  895. @item precision
  896. Set which precision to use when processing samples.
  897. @table @option
  898. @item auto
  899. Auto pick internal sample format depending on other filters.
  900. @item float
  901. Always use single-floating point precision sample format.
  902. @item double
  903. Always use double-floating point precision sample format.
  904. @end table
  905. @end table
  906. @subsection Commands
  907. This filter supports the all above options as @ref{commands}.
  908. @section adynamicsmooth
  909. Apply dynamic smoothing to input audio stream.
  910. A description of the accepted options follows.
  911. @table @option
  912. @item sensitivity
  913. Set an amount of sensitivity to frequency fluctations. Default is 2.
  914. Allowed range is from 0 to 1e+06.
  915. @item basefreq
  916. Set a base frequency for smoothing. Default value is 22050.
  917. Allowed range is from 2 to 1e+06.
  918. @end table
  919. @subsection Commands
  920. This filter supports the all above options as @ref{commands}.
  921. @section aecho
  922. Apply echoing to the input audio.
  923. Echoes are reflected sound and can occur naturally amongst mountains
  924. (and sometimes large buildings) when talking or shouting; digital echo
  925. effects emulate this behaviour and are often used to help fill out the
  926. sound of a single instrument or vocal. The time difference between the
  927. original signal and the reflection is the @code{delay}, and the
  928. loudness of the reflected signal is the @code{decay}.
  929. Multiple echoes can have different delays and decays.
  930. A description of the accepted parameters follows.
  931. @table @option
  932. @item in_gain
  933. Set input gain of reflected signal. Default is @code{0.6}.
  934. @item out_gain
  935. Set output gain of reflected signal. Default is @code{0.3}.
  936. @item delays
  937. Set list of time intervals in milliseconds between original signal and reflections
  938. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  939. Default is @code{1000}.
  940. @item decays
  941. Set list of loudness of reflected signals separated by '|'.
  942. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  943. Default is @code{0.5}.
  944. @end table
  945. @subsection Examples
  946. @itemize
  947. @item
  948. Make it sound as if there are twice as many instruments as are actually playing:
  949. @example
  950. aecho=0.8:0.88:60:0.4
  951. @end example
  952. @item
  953. If delay is very short, then it sounds like a (metallic) robot playing music:
  954. @example
  955. aecho=0.8:0.88:6:0.4
  956. @end example
  957. @item
  958. A longer delay will sound like an open air concert in the mountains:
  959. @example
  960. aecho=0.8:0.9:1000:0.3
  961. @end example
  962. @item
  963. Same as above but with one more mountain:
  964. @example
  965. aecho=0.8:0.9:1000|1800:0.3|0.25
  966. @end example
  967. @end itemize
  968. @section aemphasis
  969. Audio emphasis filter creates or restores material directly taken from LPs or
  970. emphased CDs with different filter curves. E.g. to store music on vinyl the
  971. signal has to be altered by a filter first to even out the disadvantages of
  972. this recording medium.
  973. Once the material is played back the inverse filter has to be applied to
  974. restore the distortion of the frequency response.
  975. The filter accepts the following options:
  976. @table @option
  977. @item level_in
  978. Set input gain.
  979. @item level_out
  980. Set output gain.
  981. @item mode
  982. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  983. use @code{production} mode. Default is @code{reproduction} mode.
  984. @item type
  985. Set filter type. Selects medium. Can be one of the following:
  986. @table @option
  987. @item col
  988. select Columbia.
  989. @item emi
  990. select EMI.
  991. @item bsi
  992. select BSI (78RPM).
  993. @item riaa
  994. select RIAA.
  995. @item cd
  996. select Compact Disc (CD).
  997. @item 50fm
  998. select 50µs (FM).
  999. @item 75fm
  1000. select 75µs (FM).
  1001. @item 50kf
  1002. select 50µs (FM-KF).
  1003. @item 75kf
  1004. select 75µs (FM-KF).
  1005. @end table
  1006. @end table
  1007. @subsection Commands
  1008. This filter supports the all above options as @ref{commands}.
  1009. @section aeval
  1010. Modify an audio signal according to the specified expressions.
  1011. This filter accepts one or more expressions (one for each channel),
  1012. which are evaluated and used to modify a corresponding audio signal.
  1013. It accepts the following parameters:
  1014. @table @option
  1015. @item exprs
  1016. Set the '|'-separated expressions list for each separate channel. If
  1017. the number of input channels is greater than the number of
  1018. expressions, the last specified expression is used for the remaining
  1019. output channels.
  1020. @item channel_layout, c
  1021. Set output channel layout. If not specified, the channel layout is
  1022. specified by the number of expressions. If set to @samp{same}, it will
  1023. use by default the same input channel layout.
  1024. @end table
  1025. Each expression in @var{exprs} can contain the following constants and functions:
  1026. @table @option
  1027. @item ch
  1028. channel number of the current expression
  1029. @item n
  1030. number of the evaluated sample, starting from 0
  1031. @item s
  1032. sample rate
  1033. @item t
  1034. time of the evaluated sample expressed in seconds
  1035. @item nb_in_channels
  1036. @item nb_out_channels
  1037. input and output number of channels
  1038. @item val(CH)
  1039. the value of input channel with number @var{CH}
  1040. @end table
  1041. Note: this filter is slow. For faster processing you should use a
  1042. dedicated filter.
  1043. @subsection Examples
  1044. @itemize
  1045. @item
  1046. Half volume:
  1047. @example
  1048. aeval=val(ch)/2:c=same
  1049. @end example
  1050. @item
  1051. Invert phase of the second channel:
  1052. @example
  1053. aeval=val(0)|-val(1)
  1054. @end example
  1055. @end itemize
  1056. @section aexciter
  1057. An exciter is used to produce high sound that is not present in the
  1058. original signal. This is done by creating harmonic distortions of the
  1059. signal which are restricted in range and added to the original signal.
  1060. An Exciter raises the upper end of an audio signal without simply raising
  1061. the higher frequencies like an equalizer would do to create a more
  1062. "crisp" or "brilliant" sound.
  1063. The filter accepts the following options:
  1064. @table @option
  1065. @item level_in
  1066. Set input level prior processing of signal.
  1067. Allowed range is from 0 to 64.
  1068. Default value is 1.
  1069. @item level_out
  1070. Set output level after processing of signal.
  1071. Allowed range is from 0 to 64.
  1072. Default value is 1.
  1073. @item amount
  1074. Set the amount of harmonics added to original signal.
  1075. Allowed range is from 0 to 64.
  1076. Default value is 1.
  1077. @item drive
  1078. Set the amount of newly created harmonics.
  1079. Allowed range is from 0.1 to 10.
  1080. Default value is 8.5.
  1081. @item blend
  1082. Set the octave of newly created harmonics.
  1083. Allowed range is from -10 to 10.
  1084. Default value is 0.
  1085. @item freq
  1086. Set the lower frequency limit of producing harmonics in Hz.
  1087. Allowed range is from 2000 to 12000 Hz.
  1088. Default is 7500 Hz.
  1089. @item ceil
  1090. Set the upper frequency limit of producing harmonics.
  1091. Allowed range is from 9999 to 20000 Hz.
  1092. If value is lower than 10000 Hz no limit is applied.
  1093. @item listen
  1094. Mute the original signal and output only added harmonics.
  1095. By default is disabled.
  1096. @end table
  1097. @subsection Commands
  1098. This filter supports the all above options as @ref{commands}.
  1099. @anchor{afade}
  1100. @section afade
  1101. Apply fade-in/out effect to input audio.
  1102. A description of the accepted parameters follows.
  1103. @table @option
  1104. @item type, t
  1105. Specify the effect type, can be either @code{in} for fade-in, or
  1106. @code{out} for a fade-out effect. Default is @code{in}.
  1107. @item start_sample, ss
  1108. Specify the number of the start sample for starting to apply the fade
  1109. effect. Default is 0.
  1110. @item nb_samples, ns
  1111. Specify the number of samples for which the fade effect has to last. At
  1112. the end of the fade-in effect the output audio will have the same
  1113. volume as the input audio, at the end of the fade-out transition
  1114. the output audio will be silence. Default is 44100.
  1115. @item start_time, st
  1116. Specify the start time of the fade effect. Default is 0.
  1117. The value must be specified as a time duration; see
  1118. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1119. for the accepted syntax.
  1120. If set this option is used instead of @var{start_sample}.
  1121. @item duration, d
  1122. Specify the duration of the fade effect. See
  1123. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1124. for the accepted syntax.
  1125. At the end of the fade-in effect the output audio will have the same
  1126. volume as the input audio, at the end of the fade-out transition
  1127. the output audio will be silence.
  1128. By default the duration is determined by @var{nb_samples}.
  1129. If set this option is used instead of @var{nb_samples}.
  1130. @item curve
  1131. Set curve for fade transition.
  1132. It accepts the following values:
  1133. @table @option
  1134. @item tri
  1135. select triangular, linear slope (default)
  1136. @item qsin
  1137. select quarter of sine wave
  1138. @item hsin
  1139. select half of sine wave
  1140. @item esin
  1141. select exponential sine wave
  1142. @item log
  1143. select logarithmic
  1144. @item ipar
  1145. select inverted parabola
  1146. @item qua
  1147. select quadratic
  1148. @item cub
  1149. select cubic
  1150. @item squ
  1151. select square root
  1152. @item cbr
  1153. select cubic root
  1154. @item par
  1155. select parabola
  1156. @item exp
  1157. select exponential
  1158. @item iqsin
  1159. select inverted quarter of sine wave
  1160. @item ihsin
  1161. select inverted half of sine wave
  1162. @item dese
  1163. select double-exponential seat
  1164. @item desi
  1165. select double-exponential sigmoid
  1166. @item losi
  1167. select logistic sigmoid
  1168. @item sinc
  1169. select sine cardinal function
  1170. @item isinc
  1171. select inverted sine cardinal function
  1172. @item quat
  1173. select quartic
  1174. @item quatr
  1175. select quartic root
  1176. @item qsin2
  1177. select squared quarter of sine wave
  1178. @item hsin2
  1179. select squared half of sine wave
  1180. @item nofade
  1181. no fade applied
  1182. @end table
  1183. @item silence
  1184. Set the initial gain for fade-in or final gain for fade-out.
  1185. Default value is @code{0.0}.
  1186. @item unity
  1187. Set the initial gain for fade-out or final gain for fade-in.
  1188. Default value is @code{1.0}.
  1189. @end table
  1190. @subsection Commands
  1191. This filter supports the all above options as @ref{commands}.
  1192. @subsection Examples
  1193. @itemize
  1194. @item
  1195. Fade in first 15 seconds of audio:
  1196. @example
  1197. afade=t=in:ss=0:d=15
  1198. @end example
  1199. @item
  1200. Fade out last 25 seconds of a 900 seconds audio:
  1201. @example
  1202. afade=t=out:st=875:d=25
  1203. @end example
  1204. @end itemize
  1205. @section afftdn
  1206. Denoise audio samples with FFT.
  1207. A description of the accepted parameters follows.
  1208. @table @option
  1209. @item noise_reduction, nr
  1210. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1211. Default value is 12 dB.
  1212. @item noise_floor, nf
  1213. Set the noise floor in dB, allowed range is -80 to -20.
  1214. Default value is -50 dB.
  1215. @item noise_type, nt
  1216. Set the noise type.
  1217. It accepts the following values:
  1218. @table @option
  1219. @item white, w
  1220. Select white noise.
  1221. @item vinyl, v
  1222. Select vinyl noise.
  1223. @item shellac, s
  1224. Select shellac noise.
  1225. @item custom, c
  1226. Select custom noise, defined in @code{bn} option.
  1227. Default value is white noise.
  1228. @end table
  1229. @item band_noise, bn
  1230. Set custom band noise profile for every one of 15 bands.
  1231. Bands are separated by ' ' or '|'.
  1232. @item residual_floor, rf
  1233. Set the residual floor in dB, allowed range is -80 to -20.
  1234. Default value is -38 dB.
  1235. @item track_noise, tn
  1236. Enable noise floor tracking. By default is disabled.
  1237. With this enabled, noise floor is automatically adjusted.
  1238. @item track_residual, tr
  1239. Enable residual tracking. By default is disabled.
  1240. @item output_mode, om
  1241. Set the output mode.
  1242. It accepts the following values:
  1243. @table @option
  1244. @item input, i
  1245. Pass input unchanged.
  1246. @item output, o
  1247. Pass noise filtered out.
  1248. @item noise, n
  1249. Pass only noise.
  1250. Default value is @var{output}.
  1251. @end table
  1252. @item adaptivity, ad
  1253. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1254. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1255. react much slower.
  1256. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1257. @item floor_offset, fo
  1258. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1259. noise floor. It is only effective when noise floor tracking is enabled.
  1260. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1261. @item noise_link, nl
  1262. Set the noise link used for multichannel audio.
  1263. It accepts the following values:
  1264. @table @option
  1265. @item none
  1266. Use unchanged channel's noise floor.
  1267. @item min
  1268. Use measured min noise floor of all channels.
  1269. @item max
  1270. Use measured max noise floor of all channels.
  1271. @item average
  1272. Use measured average noise floor of all channels.
  1273. Default value is @var{min}.
  1274. @end table
  1275. @item band_multiplier, bm
  1276. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1277. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1278. @item sample_noise, sn
  1279. Toggle capturing and measurement of noise profile from input audio.
  1280. It accepts the following values:
  1281. @table @option
  1282. @item start, begin
  1283. Start sample noise capture.
  1284. @item stop, end
  1285. Stop sample noise capture and measure new noise band profile.
  1286. Default value is @code{none}.
  1287. @end table
  1288. @item gain_smooth, gs
  1289. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1290. Useful to reduce random music noise artefacts.
  1291. Higher values increases smoothing of gains.
  1292. Allowed range is from @code{0} to @code{50}.
  1293. Default value is @code{0}.
  1294. @end table
  1295. @subsection Commands
  1296. This filter supports the some above mentioned options as @ref{commands}.
  1297. @subsection Examples
  1298. @itemize
  1299. @item
  1300. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1301. @example
  1302. afftdn=nr=10:nf=-40
  1303. @end example
  1304. @item
  1305. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1306. tracking of noise floor so noise floor will gradually change during processing:
  1307. @example
  1308. afftdn=nr=10:nf=-80:tn=1
  1309. @end example
  1310. @item
  1311. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1312. of first 0.4 seconds of input audio:
  1313. @example
  1314. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1315. @end example
  1316. @end itemize
  1317. @section afftfilt
  1318. Apply arbitrary expressions to samples in frequency domain.
  1319. @table @option
  1320. @item real
  1321. Set frequency domain real expression for each separate channel separated
  1322. by '|'. Default is "re".
  1323. If the number of input channels is greater than the number of
  1324. expressions, the last specified expression is used for the remaining
  1325. output channels.
  1326. @item imag
  1327. Set frequency domain imaginary expression for each separate channel
  1328. separated by '|'. Default is "im".
  1329. Each expression in @var{real} and @var{imag} can contain the following
  1330. constants and functions:
  1331. @table @option
  1332. @item sr
  1333. sample rate
  1334. @item b
  1335. current frequency bin number
  1336. @item nb
  1337. number of available bins
  1338. @item ch
  1339. channel number of the current expression
  1340. @item chs
  1341. number of channels
  1342. @item pts
  1343. current frame pts
  1344. @item re
  1345. current real part of frequency bin of current channel
  1346. @item im
  1347. current imaginary part of frequency bin of current channel
  1348. @item real(b, ch)
  1349. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1350. @item imag(b, ch)
  1351. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1352. @end table
  1353. @item win_size
  1354. Set window size. Allowed range is from 16 to 131072.
  1355. Default is @code{4096}
  1356. @item win_func
  1357. Set window function.
  1358. It accepts the following values:
  1359. @table @samp
  1360. @item rect
  1361. @item bartlett
  1362. @item hann, hanning
  1363. @item hamming
  1364. @item blackman
  1365. @item welch
  1366. @item flattop
  1367. @item bharris
  1368. @item bnuttall
  1369. @item bhann
  1370. @item sine
  1371. @item nuttall
  1372. @item lanczos
  1373. @item gauss
  1374. @item tukey
  1375. @item dolph
  1376. @item cauchy
  1377. @item parzen
  1378. @item poisson
  1379. @item bohman
  1380. @item kaiser
  1381. @end table
  1382. Default is @code{hann}.
  1383. @item overlap
  1384. Set window overlap. If set to 1, the recommended overlap for selected
  1385. window function will be picked. Default is @code{0.75}.
  1386. @end table
  1387. @subsection Examples
  1388. @itemize
  1389. @item
  1390. Leave almost only low frequencies in audio:
  1391. @example
  1392. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1393. @end example
  1394. @item
  1395. Apply robotize effect:
  1396. @example
  1397. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1398. @end example
  1399. @item
  1400. Apply whisper effect:
  1401. @example
  1402. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  1403. @end example
  1404. @item
  1405. Apply phase shift:
  1406. @example
  1407. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1408. @end example
  1409. @end itemize
  1410. @anchor{afir}
  1411. @section afir
  1412. Apply an arbitrary Finite Impulse Response filter.
  1413. This filter is designed for applying long FIR filters,
  1414. up to 60 seconds long.
  1415. It can be used as component for digital crossover filters,
  1416. room equalization, cross talk cancellation, wavefield synthesis,
  1417. auralization, ambiophonics, ambisonics and spatialization.
  1418. This filter uses the streams higher than first one as FIR coefficients.
  1419. If the non-first stream holds a single channel, it will be used
  1420. for all input channels in the first stream, otherwise
  1421. the number of channels in the non-first stream must be same as
  1422. the number of channels in the first stream.
  1423. It accepts the following parameters:
  1424. @table @option
  1425. @item dry
  1426. Set dry gain. This sets input gain.
  1427. @item wet
  1428. Set wet gain. This sets final output gain.
  1429. @item length
  1430. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1431. @item gtype
  1432. This option is deprecated, and does nothing.
  1433. @item irnorm
  1434. Set norm to be applied to IR coefficients before filtering.
  1435. Allowed range is from @var{-1} to @var{2}.
  1436. IR coefficients are normalized with calculated vector norm set by this option.
  1437. For negative values, no norm is calculated, and IR coefficients are not modified at all.
  1438. Default is @var{1}.
  1439. @item irlink
  1440. For multichannel IR if this option is set to @var{true}, all IR channels will be
  1441. normalized with maximal measured gain of all IR channels coefficients as set by @code{irnorm} option.
  1442. When disabled, all IR coefficients in each IR channel will be normalized independently.
  1443. Default is @var{true}.
  1444. @item irgain
  1445. Set gain to be applied to IR coefficients before filtering.
  1446. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{irnorm} option.
  1447. @item irfmt
  1448. Set format of IR stream. Can be @code{mono} or @code{input}.
  1449. Default is @code{input}.
  1450. @item maxir
  1451. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1452. Allowed range is 0.1 to 60 seconds.
  1453. @item response
  1454. This option is deprecated, and does nothing.
  1455. @item channel
  1456. This option is deprecated, and does nothing.
  1457. @item size
  1458. This option is deprecated, and does nothing.
  1459. @item rate
  1460. This option is deprecated, and does nothing.
  1461. @item minp
  1462. Set minimal partition size used for convolution. Default is @var{8192}.
  1463. Allowed range is from @var{1} to @var{65536}.
  1464. Lower values decreases latency at cost of higher CPU usage.
  1465. @item maxp
  1466. Set maximal partition size used for convolution. Default is @var{8192}.
  1467. Allowed range is from @var{8} to @var{65536}.
  1468. Lower values may increase CPU usage.
  1469. @item nbirs
  1470. Set number of input impulse responses streams which will be switchable at runtime.
  1471. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1472. @item ir
  1473. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1474. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1475. This option can be changed at runtime via @ref{commands}.
  1476. @item precision
  1477. Set which precision to use when processing samples.
  1478. @table @option
  1479. @item auto
  1480. Auto pick internal sample format depending on other filters.
  1481. @item float
  1482. Always use single-floating point precision sample format.
  1483. @item double
  1484. Always use double-floating point precision sample format.
  1485. @end table
  1486. Default value is auto.
  1487. @item irload
  1488. Set when to load IR stream. Can be @code{init} or @code{access}.
  1489. First one load and prepares all IRs on initialization, second one
  1490. once on first access of specific IR.
  1491. Default is @code{init}.
  1492. @end table
  1493. @subsection Examples
  1494. @itemize
  1495. @item
  1496. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1497. @example
  1498. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1499. @end example
  1500. @item
  1501. Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel,
  1502. the impulse response files are files with names l_ir.wav and r_ir.wav, and setting irnorm option value:
  1503. @example
  1504. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:irnorm=1.2,pan=stereo|FL<c0+c2|FR<c1+c3"
  1505. @end example
  1506. @item
  1507. Similar to above example, but with @code{irgain} explicitly set to estimated value and with @code{irnorm} disabled:
  1508. @example
  1509. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:irgain=-5dB:irnom=-1,pan=stereo|FL<c0+c2|FR<c1+c3"
  1510. @end example
  1511. @end itemize
  1512. @anchor{aformat}
  1513. @section aformat
  1514. Set output format constraints for the input audio. The framework will
  1515. negotiate the most appropriate format to minimize conversions.
  1516. It accepts the following parameters:
  1517. @table @option
  1518. @item sample_fmts, f
  1519. A '|'-separated list of requested sample formats.
  1520. @item sample_rates, r
  1521. A '|'-separated list of requested sample rates.
  1522. @item channel_layouts, cl
  1523. A '|'-separated list of requested channel layouts.
  1524. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1525. for the required syntax.
  1526. @end table
  1527. If a parameter is omitted, all values are allowed.
  1528. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1529. @example
  1530. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1531. @end example
  1532. @section afreqshift
  1533. Apply frequency shift to input audio samples.
  1534. The filter accepts the following options:
  1535. @table @option
  1536. @item shift
  1537. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1538. Default value is 0.0.
  1539. @item level
  1540. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1541. Default value is 1.0.
  1542. @item order
  1543. Set filter order used for filtering. Allowed range is from 1 to 16.
  1544. Default value is 8.
  1545. @end table
  1546. @subsection Commands
  1547. This filter supports the all above options as @ref{commands}.
  1548. @section afwtdn
  1549. Reduce broadband noise from input samples using Wavelets.
  1550. A description of the accepted options follows.
  1551. @table @option
  1552. @item sigma
  1553. Set the noise sigma, allowed range is from 0 to 1.
  1554. Default value is 0.
  1555. This option controls strength of denoising applied to input samples.
  1556. Most useful way to set this option is via decibels, eg. -45dB.
  1557. @item levels
  1558. Set the number of wavelet levels of decomposition.
  1559. Allowed range is from 1 to 12.
  1560. Default value is 10.
  1561. Setting this too low make denoising performance very poor.
  1562. @item wavet
  1563. Set wavelet type for decomposition of input frame.
  1564. They are sorted by number of coefficients, from lowest to highest.
  1565. More coefficients means worse filtering speed, but overall better quality.
  1566. Available wavelets are:
  1567. @table @samp
  1568. @item sym2
  1569. @item sym4
  1570. @item rbior68
  1571. @item deb10
  1572. @item sym10
  1573. @item coif5
  1574. @item bl3
  1575. @end table
  1576. @item percent
  1577. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1578. Default value is 85 percent or partial denoising.
  1579. @item profile
  1580. If enabled, first input frame will be used as noise profile.
  1581. If first frame samples contain non-noise performance will be very poor.
  1582. @item adaptive
  1583. If enabled, input frames are analyzed for presence of noise.
  1584. If noise is detected with high possibility then input frame profile will be
  1585. used for processing following frames, until new noise frame is detected.
  1586. @item samples
  1587. Set size of single frame in number of samples. Allowed range is from 512 to
  1588. 65536. Default frame size is 8192 samples.
  1589. @item softness
  1590. Set softness applied inside thresholding function. Allowed range is from 0 to
  1591. 10. Default softness is 1.
  1592. @end table
  1593. @subsection Commands
  1594. This filter supports the all above options as @ref{commands}.
  1595. @section agate
  1596. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1597. processing reduces disturbing noise between useful signals.
  1598. Gating is done by detecting the volume below a chosen level @var{threshold}
  1599. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1600. floor is set via @var{range}. Because an exact manipulation of the signal
  1601. would cause distortion of the waveform the reduction can be levelled over
  1602. time. This is done by setting @var{attack} and @var{release}.
  1603. @var{attack} determines how long the signal has to fall below the threshold
  1604. before any reduction will occur and @var{release} sets the time the signal
  1605. has to rise above the threshold to reduce the reduction again.
  1606. Shorter signals than the chosen attack time will be left untouched.
  1607. @table @option
  1608. @item level_in
  1609. Set input level before filtering.
  1610. Default is 1. Allowed range is from 0.015625 to 64.
  1611. @item mode
  1612. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1613. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1614. will be amplified, expanding dynamic range in upward direction.
  1615. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1616. @item range
  1617. Set the level of gain reduction when the signal is below the threshold.
  1618. Default is 0.06125. Allowed range is from 0 to 1.
  1619. Setting this to 0 disables reduction and then filter behaves like expander.
  1620. @item threshold
  1621. If a signal rises above this level the gain reduction is released.
  1622. Default is 0.125. Allowed range is from 0 to 1.
  1623. @item ratio
  1624. Set a ratio by which the signal is reduced.
  1625. Default is 2. Allowed range is from 1 to 9000.
  1626. @item attack
  1627. Amount of milliseconds the signal has to rise above the threshold before gain
  1628. reduction stops.
  1629. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1630. @item release
  1631. Amount of milliseconds the signal has to fall below the threshold before the
  1632. reduction is increased again. Default is 250 milliseconds.
  1633. Allowed range is from 0.01 to 9000.
  1634. @item makeup
  1635. Set amount of amplification of signal after processing.
  1636. Default is 1. Allowed range is from 1 to 64.
  1637. @item knee
  1638. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1639. Default is 2.828427125. Allowed range is from 1 to 8.
  1640. @item detection
  1641. Choose if exact signal should be taken for detection or an RMS like one.
  1642. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1643. @item link
  1644. Choose if the average level between all channels or the louder channel affects
  1645. the reduction.
  1646. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1647. @end table
  1648. @subsection Commands
  1649. This filter supports the all above options as @ref{commands}.
  1650. @section aiir
  1651. Apply an arbitrary Infinite Impulse Response filter.
  1652. It accepts the following parameters:
  1653. @table @option
  1654. @item zeros, z
  1655. Set B/numerator/zeros/reflection coefficients.
  1656. @item poles, p
  1657. Set A/denominator/poles/ladder coefficients.
  1658. @item gains, k
  1659. Set channels gains.
  1660. @item dry_gain
  1661. Set input gain.
  1662. @item wet_gain
  1663. Set output gain.
  1664. @item format, f
  1665. Set coefficients format.
  1666. @table @samp
  1667. @item ll
  1668. lattice-ladder function
  1669. @item sf
  1670. analog transfer function
  1671. @item tf
  1672. digital transfer function
  1673. @item zp
  1674. Z-plane zeros/poles, cartesian (default)
  1675. @item pr
  1676. Z-plane zeros/poles, polar radians
  1677. @item pd
  1678. Z-plane zeros/poles, polar degrees
  1679. @item sp
  1680. S-plane zeros/poles
  1681. @end table
  1682. @item process, r
  1683. Set type of processing.
  1684. @table @samp
  1685. @item d
  1686. direct processing
  1687. @item s
  1688. serial processing
  1689. @item p
  1690. parallel processing
  1691. @end table
  1692. @item precision, e
  1693. Set filtering precision.
  1694. @table @samp
  1695. @item dbl
  1696. double-precision floating-point (default)
  1697. @item flt
  1698. single-precision floating-point
  1699. @item i32
  1700. 32-bit integers
  1701. @item i16
  1702. 16-bit integers
  1703. @end table
  1704. @item normalize, n
  1705. Normalize filter coefficients, by default is enabled.
  1706. Enabling it will normalize magnitude response at DC to 0dB.
  1707. @item mix
  1708. How much to use filtered signal in output. Default is 1.
  1709. Range is between 0 and 1.
  1710. @item response
  1711. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1712. By default it is disabled.
  1713. @item channel
  1714. Set for which IR channel to display frequency response. By default is first channel
  1715. displayed. This option is used only when @var{response} is enabled.
  1716. @item size
  1717. Set video stream size. This option is used only when @var{response} is enabled.
  1718. @end table
  1719. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1720. order.
  1721. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1722. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1723. imaginary unit.
  1724. Different coefficients and gains can be provided for every channel, in such case
  1725. use '|' to separate coefficients or gains. Last provided coefficients will be
  1726. used for all remaining channels.
  1727. @subsection Examples
  1728. @itemize
  1729. @item
  1730. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1731. @example
  1732. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1733. @end example
  1734. @item
  1735. Same as above but in @code{zp} format:
  1736. @example
  1737. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1738. @end example
  1739. @item
  1740. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1741. @example
  1742. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1743. @end example
  1744. @end itemize
  1745. @section alimiter
  1746. The limiter prevents an input signal from rising over a desired threshold.
  1747. This limiter uses lookahead technology to prevent your signal from distorting.
  1748. It means that there is a small delay after the signal is processed. Keep in mind
  1749. that the delay it produces is the attack time you set.
  1750. The filter accepts the following options:
  1751. @table @option
  1752. @item level_in
  1753. Set input gain. Default is 1.
  1754. @item level_out
  1755. Set output gain. Default is 1.
  1756. @item limit
  1757. Don't let signals above this level pass the limiter. Default is 1.
  1758. @item attack
  1759. The limiter will reach its attenuation level in this amount of time in
  1760. milliseconds. Default is 5 milliseconds.
  1761. @item release
  1762. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1763. Default is 50 milliseconds.
  1764. @item asc
  1765. When gain reduction is always needed ASC takes care of releasing to an
  1766. average reduction level rather than reaching a reduction of 0 in the release
  1767. time.
  1768. @item asc_level
  1769. Select how much the release time is affected by ASC, 0 means nearly no changes
  1770. in release time while 1 produces higher release times.
  1771. @item level
  1772. Auto level output signal. Default is enabled.
  1773. This normalizes audio back to 0dB if enabled.
  1774. @item latency
  1775. Compensate the delay introduced by using the lookahead buffer set with attack
  1776. parameter. Also flush the valid audio data in the lookahead buffer when the
  1777. stream hits EOF.
  1778. @end table
  1779. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1780. with @ref{aresample} before applying this filter.
  1781. @section allpass
  1782. Apply a two-pole all-pass filter with central frequency (in Hz)
  1783. @var{frequency}, and filter-width @var{width}.
  1784. An all-pass filter changes the audio's frequency to phase relationship
  1785. without changing its frequency to amplitude relationship.
  1786. The filter accepts the following options:
  1787. @table @option
  1788. @item frequency, f
  1789. Set frequency in Hz.
  1790. @item width_type, t
  1791. Set method to specify band-width of filter.
  1792. @table @option
  1793. @item h
  1794. Hz
  1795. @item q
  1796. Q-Factor
  1797. @item o
  1798. octave
  1799. @item s
  1800. slope
  1801. @item k
  1802. kHz
  1803. @end table
  1804. @item width, w
  1805. Specify the band-width of a filter in width_type units.
  1806. @item mix, m
  1807. How much to use filtered signal in output. Default is 1.
  1808. Range is between 0 and 1.
  1809. @item channels, c
  1810. Specify which channels to filter, by default all available are filtered.
  1811. @item normalize, n
  1812. Normalize biquad coefficients, by default is disabled.
  1813. Enabling it will normalize magnitude response at DC to 0dB.
  1814. @item order, o
  1815. Set the filter order, can be 1 or 2. Default is 2.
  1816. @item transform, a
  1817. Set transform type of IIR filter.
  1818. @table @option
  1819. @item di
  1820. @item dii
  1821. @item tdi
  1822. @item tdii
  1823. @item latt
  1824. @item svf
  1825. @item zdf
  1826. @end table
  1827. @item precision, r
  1828. Set precision of filtering.
  1829. @table @option
  1830. @item auto
  1831. Pick automatic sample format depending on surround filters.
  1832. @item s16
  1833. Always use signed 16-bit.
  1834. @item s32
  1835. Always use signed 32-bit.
  1836. @item f32
  1837. Always use float 32-bit.
  1838. @item f64
  1839. Always use float 64-bit.
  1840. @end table
  1841. @end table
  1842. @subsection Commands
  1843. This filter supports the following commands:
  1844. @table @option
  1845. @item frequency, f
  1846. Change allpass frequency.
  1847. Syntax for the command is : "@var{frequency}"
  1848. @item width_type, t
  1849. Change allpass width_type.
  1850. Syntax for the command is : "@var{width_type}"
  1851. @item width, w
  1852. Change allpass width.
  1853. Syntax for the command is : "@var{width}"
  1854. @item mix, m
  1855. Change allpass mix.
  1856. Syntax for the command is : "@var{mix}"
  1857. @end table
  1858. @section aloop
  1859. Loop audio samples.
  1860. The filter accepts the following options:
  1861. @table @option
  1862. @item loop
  1863. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1864. Default is 0.
  1865. @item size
  1866. Set maximal number of samples. Default is 0.
  1867. @item start
  1868. Set first sample of loop. Default is 0.
  1869. @item time
  1870. Set the time of loop start in seconds.
  1871. Only used if option named @var{start} is set to @code{-1}.
  1872. @end table
  1873. @anchor{amerge}
  1874. @section amerge
  1875. Merge two or more audio streams into a single multi-channel stream.
  1876. The filter accepts the following options:
  1877. @table @option
  1878. @item inputs
  1879. Set the number of inputs. Default is 2.
  1880. @end table
  1881. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1882. the channel layout of the output will be set accordingly and the channels
  1883. will be reordered as necessary. If the channel layouts of the inputs are not
  1884. disjoint, the output will have all the channels of the first input then all
  1885. the channels of the second input, in that order, and the channel layout of
  1886. the output will be the default value corresponding to the total number of
  1887. channels.
  1888. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1889. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1890. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1891. first input, b1 is the first channel of the second input).
  1892. On the other hand, if both input are in stereo, the output channels will be
  1893. in the default order: a1, a2, b1, b2, and the channel layout will be
  1894. arbitrarily set to 4.0, which may or may not be the expected value.
  1895. All inputs must have the same sample rate, and format.
  1896. If inputs do not have the same duration, the output will stop with the
  1897. shortest.
  1898. @subsection Examples
  1899. @itemize
  1900. @item
  1901. Merge two mono files into a stereo stream:
  1902. @example
  1903. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1904. @end example
  1905. @item
  1906. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1907. @example
  1908. 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
  1909. @end example
  1910. @end itemize
  1911. @section amix
  1912. Mixes multiple audio inputs into a single output.
  1913. Note that this filter only supports float samples (the @var{amerge}
  1914. and @var{pan} audio filters support many formats). If the @var{amix}
  1915. input has integer samples then @ref{aresample} will be automatically
  1916. inserted to perform the conversion to float samples.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item inputs
  1920. The number of inputs. If unspecified, it defaults to 2.
  1921. @item duration
  1922. How to determine the end-of-stream.
  1923. @table @option
  1924. @item longest
  1925. The duration of the longest input. (default)
  1926. @item shortest
  1927. The duration of the shortest input.
  1928. @item first
  1929. The duration of the first input.
  1930. @end table
  1931. @item dropout_transition
  1932. The transition time, in seconds, for volume renormalization when an input
  1933. stream ends. The default value is 2 seconds.
  1934. @item weights
  1935. Specify weight of each input audio stream as a sequence of numbers separated
  1936. by a space. If fewer weights are specified compared to number of inputs, the
  1937. last weight is assigned to the remaining inputs.
  1938. Default weight for each input is 1.
  1939. @item normalize
  1940. Always scale inputs instead of only doing summation of samples.
  1941. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1942. by this filter if this option is disabled. By default is enabled.
  1943. @end table
  1944. @subsection Examples
  1945. @itemize
  1946. @item
  1947. This will mix 3 input audio streams to a single output with the same duration as the
  1948. first input and a dropout transition time of 3 seconds:
  1949. @example
  1950. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1951. @end example
  1952. @item
  1953. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1954. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1955. @example
  1956. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1957. @end example
  1958. @end itemize
  1959. @subsection Commands
  1960. This filter supports the following commands:
  1961. @table @option
  1962. @item weights
  1963. @item normalize
  1964. Syntax is same as option with same name.
  1965. @end table
  1966. @section amultiply
  1967. Multiply first audio stream with second audio stream and store result
  1968. in output audio stream. Multiplication is done by multiplying each
  1969. sample from first stream with sample at same position from second stream.
  1970. With this element-wise multiplication one can create amplitude fades and
  1971. amplitude modulations.
  1972. @section anequalizer
  1973. High-order parametric multiband equalizer for each channel.
  1974. It accepts the following parameters:
  1975. @table @option
  1976. @item params
  1977. This option string is in format:
  1978. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1979. Each equalizer band is separated by '|'.
  1980. @table @option
  1981. @item chn
  1982. Set channel number to which equalization will be applied.
  1983. If input doesn't have that channel the entry is ignored.
  1984. @item f
  1985. Set central frequency for band.
  1986. If input doesn't have that frequency the entry is ignored.
  1987. @item w
  1988. Set band width in Hertz.
  1989. @item g
  1990. Set band gain in dB.
  1991. @item t
  1992. Set filter type for band, optional, can be:
  1993. @table @samp
  1994. @item 0
  1995. Butterworth, this is default.
  1996. @item 1
  1997. Chebyshev type 1.
  1998. @item 2
  1999. Chebyshev type 2.
  2000. @end table
  2001. @end table
  2002. @item curves
  2003. With this option activated frequency response of anequalizer is displayed
  2004. in video stream.
  2005. @item size
  2006. Set video stream size. Only useful if curves option is activated.
  2007. @item mgain
  2008. Set max gain that will be displayed. Only useful if curves option is activated.
  2009. Setting this to a reasonable value makes it possible to display gain which is derived from
  2010. neighbour bands which are too close to each other and thus produce higher gain
  2011. when both are activated.
  2012. @item fscale
  2013. Set frequency scale used to draw frequency response in video output.
  2014. Can be linear or logarithmic. Default is logarithmic.
  2015. @item colors
  2016. Set color for each channel curve which is going to be displayed in video stream.
  2017. This is list of color names separated by space or by '|'.
  2018. Unrecognised or missing colors will be replaced by white color.
  2019. @end table
  2020. @subsection Examples
  2021. @itemize
  2022. @item
  2023. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  2024. for first 2 channels using Chebyshev type 1 filter:
  2025. @example
  2026. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  2027. @end example
  2028. @end itemize
  2029. @subsection Commands
  2030. This filter supports the following commands:
  2031. @table @option
  2032. @item change
  2033. Alter existing filter parameters.
  2034. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  2035. @var{fN} is existing filter number, starting from 0, if no such filter is available
  2036. error is returned.
  2037. @var{freq} set new frequency parameter.
  2038. @var{width} set new width parameter in Hertz.
  2039. @var{gain} set new gain parameter in dB.
  2040. Full filter invocation with asendcmd may look like this:
  2041. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  2042. @end table
  2043. @section anlmdn
  2044. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  2045. Each sample is adjusted by looking for other samples with similar contexts. This
  2046. context similarity is defined by comparing their surrounding patches of size
  2047. @option{p}. Patches are searched in an area of @option{r} around the sample.
  2048. The filter accepts the following options:
  2049. @table @option
  2050. @item strength, s
  2051. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  2052. @item patch, p
  2053. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  2054. Default value is 2 milliseconds.
  2055. @item research, r
  2056. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  2057. Default value is 6 milliseconds.
  2058. @item output, o
  2059. Set the output mode.
  2060. It accepts the following values:
  2061. @table @option
  2062. @item i
  2063. Pass input unchanged.
  2064. @item o
  2065. Pass noise filtered out.
  2066. @item n
  2067. Pass only noise.
  2068. Default value is @var{o}.
  2069. @end table
  2070. @item smooth, m
  2071. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  2072. @end table
  2073. @subsection Commands
  2074. This filter supports the all above options as @ref{commands}.
  2075. @section anlmf, anlms
  2076. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  2077. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  2078. relate to producing the least mean square of the error signal (difference between the desired,
  2079. 2nd input audio stream and the actual signal, the 1st input audio stream).
  2080. A description of the accepted options follows.
  2081. @table @option
  2082. @item order
  2083. Set filter order.
  2084. @item mu
  2085. Set filter mu.
  2086. @item eps
  2087. Set the filter eps.
  2088. @item leakage
  2089. Set the filter leakage.
  2090. @item out_mode
  2091. It accepts the following values:
  2092. @table @option
  2093. @item i
  2094. Pass the 1st input.
  2095. @item d
  2096. Pass the 2nd input.
  2097. @item o
  2098. Pass difference between desired, 2nd input and error signal estimate.
  2099. @item n
  2100. Pass difference between input, 1st input and error signal estimate.
  2101. @item e
  2102. Pass error signal estimated samples.
  2103. Default value is @var{o}.
  2104. @end table
  2105. @item precision
  2106. Set which precision to use when processing samples.
  2107. @table @option
  2108. @item auto
  2109. Auto pick internal sample format depending on other filters.
  2110. @item float
  2111. Always use single-floating point precision sample format.
  2112. @item double
  2113. Always use double-floating point precision sample format.
  2114. @end table
  2115. @end table
  2116. @subsection Examples
  2117. @itemize
  2118. @item
  2119. One of many usages of this filter is noise reduction, input audio is filtered
  2120. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  2121. @example
  2122. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  2123. @end example
  2124. @end itemize
  2125. @subsection Commands
  2126. This filter supports the same commands as options, excluding option @code{order}.
  2127. @section anull
  2128. Pass the audio source unchanged to the output.
  2129. @section apad
  2130. Pad the end of an audio stream with silence.
  2131. This can be used together with @command{ffmpeg} @option{-shortest} to
  2132. extend audio streams to the same length as the video stream.
  2133. A description of the accepted options follows.
  2134. @table @option
  2135. @item packet_size
  2136. Set silence packet size. Default value is 4096.
  2137. @item pad_len
  2138. Set the number of samples of silence to add to the end. After the
  2139. value is reached, the stream is terminated. This option is mutually
  2140. exclusive with @option{whole_len}.
  2141. @item whole_len
  2142. Set the minimum total number of samples in the output audio stream. If
  2143. the value is longer than the input audio length, silence is added to
  2144. the end, until the value is reached. This option is mutually exclusive
  2145. with @option{pad_len}.
  2146. @item pad_dur
  2147. Specify the duration of samples of silence to add. See
  2148. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2149. for the accepted syntax. Used only if set to non-negative value.
  2150. @item whole_dur
  2151. Specify the minimum total duration in the output audio stream. See
  2152. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2153. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  2154. the input audio length, silence is added to the end, until the value is reached.
  2155. This option is mutually exclusive with @option{pad_dur}
  2156. @end table
  2157. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  2158. nor @option{whole_dur} option is set, the filter will add silence to the end of
  2159. the input stream indefinitely.
  2160. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  2161. @option{whole_dur} also caused the filter to add silence indefinitely.
  2162. @subsection Examples
  2163. @itemize
  2164. @item
  2165. Add 1024 samples of silence to the end of the input:
  2166. @example
  2167. apad=pad_len=1024
  2168. @end example
  2169. @item
  2170. Make sure the audio output will contain at least 10000 samples, pad
  2171. the input with silence if required:
  2172. @example
  2173. apad=whole_len=10000
  2174. @end example
  2175. @item
  2176. Use @command{ffmpeg} to pad the audio input with silence, so that the
  2177. video stream will always result the shortest and will be converted
  2178. until the end in the output file when using the @option{shortest}
  2179. option:
  2180. @example
  2181. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2182. @end example
  2183. @end itemize
  2184. @section aphaser
  2185. Add a phasing effect to the input audio.
  2186. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  2187. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  2188. A description of the accepted parameters follows.
  2189. @table @option
  2190. @item in_gain
  2191. Set input gain. Default is 0.4.
  2192. @item out_gain
  2193. Set output gain. Default is 0.74
  2194. @item delay
  2195. Set delay in milliseconds. Default is 3.0.
  2196. @item decay
  2197. Set decay. Default is 0.4.
  2198. @item speed
  2199. Set modulation speed in Hz. Default is 0.5.
  2200. @item type
  2201. Set modulation type. Default is triangular.
  2202. It accepts the following values:
  2203. @table @samp
  2204. @item triangular, t
  2205. @item sinusoidal, s
  2206. @end table
  2207. @end table
  2208. @section aphaseshift
  2209. Apply phase shift to input audio samples.
  2210. The filter accepts the following options:
  2211. @table @option
  2212. @item shift
  2213. Specify phase shift. Allowed range is from -1.0 to 1.0.
  2214. Default value is 0.0.
  2215. @item level
  2216. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2217. Default value is 1.0.
  2218. @item order
  2219. Set filter order used for filtering. Allowed range is from 1 to 16.
  2220. Default value is 8.
  2221. @end table
  2222. @subsection Commands
  2223. This filter supports the all above options as @ref{commands}.
  2224. @section apsnr
  2225. Measure Audio Peak Signal-to-Noise Ratio.
  2226. This filter takes two audio streams for input, and outputs first
  2227. audio stream.
  2228. Results are in dB per channel at end of either input.
  2229. @section apsyclip
  2230. Apply Psychoacoustic clipper to input audio stream.
  2231. The filter accepts the following options:
  2232. @table @option
  2233. @item level_in
  2234. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2235. @item level_out
  2236. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2237. @item clip
  2238. Set the clipping start value. Default value is 0dBFS or 1.
  2239. @item diff
  2240. Output only difference samples, useful to hear introduced distortions.
  2241. By default is disabled.
  2242. @item adaptive
  2243. Set strength of adaptive distortion applied. Default value is 0.5.
  2244. Allowed range is from 0 to 1.
  2245. @item iterations
  2246. Set number of iterations of psychoacoustic clipper.
  2247. Allowed range is from 1 to 20. Default value is 10.
  2248. @item level
  2249. Auto level output signal. Default is disabled.
  2250. This normalizes audio back to 0dBFS if enabled.
  2251. @end table
  2252. @subsection Commands
  2253. This filter supports the all above options as @ref{commands}.
  2254. @section apulsator
  2255. Audio pulsator is something between an autopanner and a tremolo.
  2256. But it can produce funny stereo effects as well. Pulsator changes the volume
  2257. of the left and right channel based on a LFO (low frequency oscillator) with
  2258. different waveforms and shifted phases.
  2259. This filter have the ability to define an offset between left and right
  2260. channel. An offset of 0 means that both LFO shapes match each other.
  2261. The left and right channel are altered equally - a conventional tremolo.
  2262. An offset of 50% means that the shape of the right channel is exactly shifted
  2263. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2264. an autopanner. At 1 both curves match again. Every setting in between moves the
  2265. phase shift gapless between all stages and produces some "bypassing" sounds with
  2266. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2267. the 0.5) the faster the signal passes from the left to the right speaker.
  2268. The filter accepts the following options:
  2269. @table @option
  2270. @item level_in
  2271. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2272. @item level_out
  2273. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2274. @item mode
  2275. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2276. sawup or sawdown. Default is sine.
  2277. @item amount
  2278. Set modulation. Define how much of original signal is affected by the LFO.
  2279. @item offset_l
  2280. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2281. @item offset_r
  2282. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2283. @item width
  2284. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2285. @item timing
  2286. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2287. @item bpm
  2288. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2289. is set to bpm.
  2290. @item ms
  2291. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2292. is set to ms.
  2293. @item hz
  2294. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2295. if timing is set to hz.
  2296. @end table
  2297. @anchor{aresample}
  2298. @section aresample
  2299. Resample the input audio to the specified parameters, using the
  2300. libswresample library. If none are specified then the filter will
  2301. automatically convert between its input and output.
  2302. This filter is also able to stretch/squeeze the audio data to make it match
  2303. the timestamps or to inject silence / cut out audio to make it match the
  2304. timestamps, do a combination of both or do neither.
  2305. The filter accepts the syntax
  2306. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2307. expresses a sample rate and @var{resampler_options} is a list of
  2308. @var{key}=@var{value} pairs, separated by ":". See the
  2309. @ref{Resampler Options,,"Resampler Options" section in the
  2310. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2311. for the complete list of supported options.
  2312. @subsection Examples
  2313. @itemize
  2314. @item
  2315. Resample the input audio to 44100Hz:
  2316. @example
  2317. aresample=44100
  2318. @end example
  2319. @item
  2320. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2321. samples per second compensation:
  2322. @example
  2323. aresample=async=1000
  2324. @end example
  2325. @end itemize
  2326. @section areverse
  2327. Reverse an audio clip.
  2328. Warning: This filter requires memory to buffer the entire clip, so trimming
  2329. is suggested.
  2330. @subsection Examples
  2331. @itemize
  2332. @item
  2333. Take the first 5 seconds of a clip, and reverse it.
  2334. @example
  2335. atrim=end=5,areverse
  2336. @end example
  2337. @end itemize
  2338. @section arls
  2339. Apply Recursive Least Squares algorithm to the first audio stream using the second audio stream.
  2340. This adaptive filter is used to mimic a desired filter by recursively finding the filter coefficients that
  2341. relate to producing the minimal weighted linear least squares cost function of the error signal (difference
  2342. between the desired, 2nd input audio stream and the actual signal, the 1st input audio stream).
  2343. A description of the accepted options follows.
  2344. @table @option
  2345. @item order
  2346. Set the filter order.
  2347. @item lambda
  2348. Set the forgetting factor.
  2349. @item delta
  2350. Set the coefficient to initialize internal covariance matrix.
  2351. @item out_mode
  2352. Set the filter output samples. It accepts the following values:
  2353. @table @option
  2354. @item i
  2355. Pass the 1st input.
  2356. @item d
  2357. Pass the 2nd input.
  2358. @item o
  2359. Pass difference between desired, 2nd input and error signal estimate.
  2360. @item n
  2361. Pass difference between input, 1st input and error signal estimate.
  2362. @item e
  2363. Pass error signal estimated samples.
  2364. Default value is @var{o}.
  2365. @end table
  2366. @item precision
  2367. Set which precision to use when processing samples.
  2368. @table @option
  2369. @item auto
  2370. Auto pick internal sample format depending on other filters.
  2371. @item float
  2372. Always use single-floating point precision sample format.
  2373. @item double
  2374. Always use double-floating point precision sample format.
  2375. @end table
  2376. @end table
  2377. @section arnndn
  2378. Reduce noise from speech using Recurrent Neural Networks.
  2379. This filter accepts the following options:
  2380. @table @option
  2381. @item model, m
  2382. Set train model file to load. This option is always required.
  2383. @item mix
  2384. Set how much to mix filtered samples into final output.
  2385. Allowed range is from -1 to 1. Default value is 1.
  2386. Negative values are special, they set how much to keep filtered noise
  2387. in the final filter output. Set this option to -1 to hear actual
  2388. noise removed from input signal.
  2389. @end table
  2390. @subsection Commands
  2391. This filter supports the all above options as @ref{commands}.
  2392. @section asdr
  2393. Measure Audio Signal-to-Distortion Ratio.
  2394. This filter takes two audio streams for input, and outputs first
  2395. audio stream.
  2396. Results are in dB per channel at end of either input.
  2397. @section asetnsamples
  2398. Set the number of samples per each output audio frame.
  2399. The last output packet may contain a different number of samples, as
  2400. the filter will flush all the remaining samples when the input audio
  2401. signals its end.
  2402. The filter accepts the following options:
  2403. @table @option
  2404. @item nb_out_samples, n
  2405. Set the number of frames per each output audio frame. The number is
  2406. intended as the number of samples @emph{per each channel}.
  2407. Default value is 1024.
  2408. @item pad, p
  2409. If set to 1, the filter will pad the last audio frame with zeroes, so
  2410. that the last frame will contain the same number of samples as the
  2411. previous ones. Default value is 1.
  2412. @end table
  2413. For example, to set the number of per-frame samples to 1234 and
  2414. disable padding for the last frame, use:
  2415. @example
  2416. asetnsamples=n=1234:p=0
  2417. @end example
  2418. @section asetrate
  2419. Set the sample rate without altering the PCM data.
  2420. This will result in a change of speed and pitch.
  2421. The filter accepts the following options:
  2422. @table @option
  2423. @item sample_rate, r
  2424. Set the output sample rate. Default is 44100 Hz.
  2425. @end table
  2426. @section ashowinfo
  2427. Show a line containing various information for each input audio frame.
  2428. The input audio is not modified.
  2429. The shown line contains a sequence of key/value pairs of the form
  2430. @var{key}:@var{value}.
  2431. The following values are shown in the output:
  2432. @table @option
  2433. @item n
  2434. The (sequential) number of the input frame, starting from 0.
  2435. @item pts
  2436. The presentation timestamp of the input frame, in time base units; the time base
  2437. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2438. @item pts_time
  2439. The presentation timestamp of the input frame in seconds.
  2440. @item fmt
  2441. The sample format.
  2442. @item chlayout
  2443. The channel layout.
  2444. @item rate
  2445. The sample rate for the audio frame.
  2446. @item nb_samples
  2447. The number of samples (per channel) in the frame.
  2448. @item checksum
  2449. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2450. audio, the data is treated as if all the planes were concatenated.
  2451. @item plane_checksums
  2452. A list of Adler-32 checksums for each data plane.
  2453. @end table
  2454. @section asisdr
  2455. Measure Audio Scaled-Invariant Signal-to-Distortion Ratio.
  2456. This filter takes two audio streams for input, and outputs first
  2457. audio stream.
  2458. Results are in dB per channel at end of either input.
  2459. @section asoftclip
  2460. Apply audio soft clipping.
  2461. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2462. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2463. This filter accepts the following options:
  2464. @table @option
  2465. @item type
  2466. Set type of soft-clipping.
  2467. It accepts the following values:
  2468. @table @option
  2469. @item hard
  2470. @item tanh
  2471. @item atan
  2472. @item cubic
  2473. @item exp
  2474. @item alg
  2475. @item quintic
  2476. @item sin
  2477. @item erf
  2478. @end table
  2479. @item threshold
  2480. Set threshold from where to start clipping. Default value is 0dB or 1.
  2481. @item output
  2482. Set gain applied to output. Default value is 0dB or 1.
  2483. @item param
  2484. Set additional parameter which controls sigmoid function.
  2485. @item oversample
  2486. Set oversampling factor.
  2487. @end table
  2488. @subsection Commands
  2489. This filter supports the all above options as @ref{commands}.
  2490. @section aspectralstats
  2491. Display frequency domain statistical information about the audio channels.
  2492. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2493. It accepts the following option:
  2494. @table @option
  2495. @item win_size
  2496. Set the window length in samples. Default value is 2048.
  2497. Allowed range is from 32 to 65536.
  2498. @item win_func
  2499. Set window function.
  2500. It accepts the following values:
  2501. @table @samp
  2502. @item rect
  2503. @item bartlett
  2504. @item hann, hanning
  2505. @item hamming
  2506. @item blackman
  2507. @item welch
  2508. @item flattop
  2509. @item bharris
  2510. @item bnuttall
  2511. @item bhann
  2512. @item sine
  2513. @item nuttall
  2514. @item lanczos
  2515. @item gauss
  2516. @item tukey
  2517. @item dolph
  2518. @item cauchy
  2519. @item parzen
  2520. @item poisson
  2521. @item bohman
  2522. @item kaiser
  2523. @end table
  2524. Default is @code{hann}.
  2525. @item overlap
  2526. Set window overlap. Allowed range is from @code{0}
  2527. to @code{1}. Default value is @code{0.5}.
  2528. @item measure
  2529. Select the parameters which are measured. The metadata keys can
  2530. be used as flags, default is @option{all} which measures everything.
  2531. @option{none} disables all measurement.
  2532. @end table
  2533. A list of each metadata key follows:
  2534. @table @option
  2535. @item mean
  2536. @item variance
  2537. @item centroid
  2538. @item spread
  2539. @item skewness
  2540. @item kurtosis
  2541. @item entropy
  2542. @item flatness
  2543. @item crest
  2544. @item flux
  2545. @item slope
  2546. @item decrease
  2547. @item rolloff
  2548. @end table
  2549. @section asr
  2550. Automatic Speech Recognition
  2551. This filter uses PocketSphinx for speech recognition. To enable
  2552. compilation of this filter, you need to configure FFmpeg with
  2553. @code{--enable-pocketsphinx}.
  2554. It accepts the following options:
  2555. @table @option
  2556. @item rate
  2557. Set sampling rate of input audio. Defaults is @code{16000}.
  2558. This need to match speech models, otherwise one will get poor results.
  2559. @item hmm
  2560. Set dictionary containing acoustic model files.
  2561. @item dict
  2562. Set pronunciation dictionary.
  2563. @item lm
  2564. Set language model file.
  2565. @item lmctl
  2566. Set language model set.
  2567. @item lmname
  2568. Set which language model to use.
  2569. @item logfn
  2570. Set output for log messages.
  2571. @end table
  2572. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2573. @anchor{astats}
  2574. @section astats
  2575. Display time domain statistical information about the audio channels.
  2576. Statistics are calculated and displayed for each audio channel and,
  2577. where applicable, an overall figure is also given.
  2578. It accepts the following option:
  2579. @table @option
  2580. @item length
  2581. Short window length in seconds, used for peak and trough RMS measurement.
  2582. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2583. @item metadata
  2584. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2585. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2586. disabled.
  2587. Available keys for each channel are:
  2588. @var{Bit_depth}
  2589. @var{Crest_factor}
  2590. @var{DC_offset}
  2591. @var{Dynamic_range}
  2592. @var{Entropy}
  2593. @var{Flat_factor}
  2594. @var{Max_difference}
  2595. @var{Max_level}
  2596. @var{Mean_difference}
  2597. @var{Min_difference}
  2598. @var{Min_level}
  2599. @var{Noise_floor}
  2600. @var{Noise_floor_count}
  2601. @var{Number_of_Infs}
  2602. @var{Number_of_NaNs}
  2603. @var{Number_of_denormals}
  2604. @var{Peak_count}
  2605. @var{Abs_Peak_count}
  2606. @var{Peak_level}
  2607. @var{RMS_difference}
  2608. @var{RMS_peak}
  2609. @var{RMS_trough}
  2610. @var{Zero_crossings}
  2611. @var{Zero_crossings_rate}
  2612. and for @code{Overall}:
  2613. @var{Bit_depth}
  2614. @var{DC_offset}
  2615. @var{Entropy}
  2616. @var{Flat_factor}
  2617. @var{Max_difference}
  2618. @var{Max_level}
  2619. @var{Mean_difference}
  2620. @var{Min_difference}
  2621. @var{Min_level}
  2622. @var{Noise_floor}
  2623. @var{Noise_floor_count}
  2624. @var{Number_of_Infs}
  2625. @var{Number_of_NaNs}
  2626. @var{Number_of_denormals}
  2627. @var{Number_of_samples}
  2628. @var{Peak_count}
  2629. @var{Abs_Peak_count}
  2630. @var{Peak_level}
  2631. @var{RMS_difference}
  2632. @var{RMS_level}
  2633. @var{RMS_peak}
  2634. @var{RMS_trough}
  2635. For example, a full key looks like @code{lavfi.astats.1.DC_offset} or
  2636. @code{lavfi.astats.Overall.Peak_count}.
  2637. Read below for the description of the keys.
  2638. @item reset
  2639. Set the number of frames over which cumulative stats are calculated before
  2640. being reset. Default is disabled.
  2641. @item measure_perchannel
  2642. Select the parameters which are measured per channel. The metadata keys can
  2643. be used as flags, default is @option{all} which measures everything.
  2644. @option{none} disables all per channel measurement.
  2645. @item measure_overall
  2646. Select the parameters which are measured overall. The metadata keys can
  2647. be used as flags, default is @option{all} which measures everything.
  2648. @option{none} disables all overall measurement.
  2649. @end table
  2650. A description of the measure keys follow:
  2651. @table @option
  2652. @item none
  2653. no measures
  2654. @item all
  2655. all measures
  2656. @item Bit_depth
  2657. overall bit depth of audio, i.e. number of bits used for each sample
  2658. @item Crest_factor
  2659. standard ratio of peak to RMS level (note: not in dB)
  2660. @item DC_offset
  2661. mean amplitude displacement from zero
  2662. @item Dynamic_range
  2663. measured dynamic range of audio in dB
  2664. @item Entropy
  2665. entropy measured across whole audio, entropy of value near 1.0 is typically measured for white noise
  2666. @item Flat_factor
  2667. flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2668. (i.e. either @var{Min_level} or @var{Max_level})
  2669. @item Max_difference
  2670. maximal difference between two consecutive samples
  2671. @item Max_level
  2672. maximal sample level
  2673. @item Mean_difference
  2674. mean difference between two consecutive samples, i.e. the average of each difference between two consecutive samples
  2675. @item Min_difference
  2676. minimal difference between two consecutive samples
  2677. @item Min_level
  2678. minimal sample level
  2679. @item Noise_floor
  2680. minimum local peak measured in dBFS over a short window
  2681. @item Noise_floor_count
  2682. number of occasions (not the number of samples) that the signal attained
  2683. @var{Noise floor}
  2684. @item Number_of_Infs
  2685. number of samples with an infinite value
  2686. @item Number_of_NaNs
  2687. number of samples with a NaN (not a number) value
  2688. @item Number_of_denormals
  2689. number of samples with a subnormal value
  2690. @item Number_of_samples
  2691. number of samples
  2692. @item Peak_count
  2693. number of occasions (not the number of samples) that the signal attained either
  2694. @var{Min_level} or @var{Max_level}
  2695. @item Abs_Peak_count
  2696. number of occasions that the absolute samples taken from the signal attained
  2697. max absolute value of @var{Min_level} and @var{Max_level}
  2698. @item Peak_level
  2699. standard peak level measured in dBFS
  2700. @item RMS_difference
  2701. Root Mean Square difference between two consecutive samples
  2702. @item RMS_level
  2703. standard RMS level measured in dBFS
  2704. @item RMS_peak
  2705. @item RMS_trough
  2706. peak and trough values for RMS level measured over a short window,
  2707. measured in dBFS.
  2708. @item Zero crossings
  2709. number of points where the waveform crosses the zero level axis
  2710. @item Zero crossings rate
  2711. rate of Zero crossings and number of audio samples
  2712. @end table
  2713. @section asubboost
  2714. Boost subwoofer frequencies.
  2715. The filter accepts the following options:
  2716. @table @option
  2717. @item dry
  2718. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2719. Default value is 1.0.
  2720. @item wet
  2721. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2722. Default value is 1.0.
  2723. @item boost
  2724. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2725. @item decay
  2726. Set delay line decay gain value. Allowed range is from 0 to 1.
  2727. Default value is 0.0.
  2728. @item feedback
  2729. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2730. Default value is 0.9.
  2731. @item cutoff
  2732. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2733. Default value is 100.
  2734. @item slope
  2735. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2736. Default value is 0.5.
  2737. @item delay
  2738. Set delay. Allowed range is from 1 to 100.
  2739. Default value is 20.
  2740. @item channels
  2741. Set the channels to process. Default value is all available.
  2742. @end table
  2743. @subsection Commands
  2744. This filter supports the all above options as @ref{commands}.
  2745. @section asubcut
  2746. Cut subwoofer frequencies.
  2747. This filter allows to set custom, steeper
  2748. roll off than highpass filter, and thus is able to more attenuate
  2749. frequency content in stop-band.
  2750. The filter accepts the following options:
  2751. @table @option
  2752. @item cutoff
  2753. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2754. Default value is 20.
  2755. @item order
  2756. Set filter order. Available values are from 3 to 20.
  2757. Default value is 10.
  2758. @item level
  2759. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2760. @end table
  2761. @subsection Commands
  2762. This filter supports the all above options as @ref{commands}.
  2763. @section asupercut
  2764. Cut super frequencies.
  2765. The filter accepts the following options:
  2766. @table @option
  2767. @item cutoff
  2768. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2769. Default value is 20000.
  2770. @item order
  2771. Set filter order. Available values are from 3 to 20.
  2772. Default value is 10.
  2773. @item level
  2774. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2775. @end table
  2776. @subsection Commands
  2777. This filter supports the all above options as @ref{commands}.
  2778. @section asuperpass
  2779. Apply high order Butterworth band-pass filter.
  2780. The filter accepts the following options:
  2781. @table @option
  2782. @item centerf
  2783. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2784. Default value is 1000.
  2785. @item order
  2786. Set filter order. Available values are from 4 to 20.
  2787. Default value is 4.
  2788. @item qfactor
  2789. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2790. @item level
  2791. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2792. @end table
  2793. @subsection Commands
  2794. This filter supports the all above options as @ref{commands}.
  2795. @section asuperstop
  2796. Apply high order Butterworth band-stop filter.
  2797. The filter accepts the following options:
  2798. @table @option
  2799. @item centerf
  2800. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2801. Default value is 1000.
  2802. @item order
  2803. Set filter order. Available values are from 4 to 20.
  2804. Default value is 4.
  2805. @item qfactor
  2806. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2807. @item level
  2808. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2809. @end table
  2810. @subsection Commands
  2811. This filter supports the all above options as @ref{commands}.
  2812. @section atempo
  2813. Adjust audio tempo.
  2814. The filter accepts exactly one parameter, the audio tempo. If not
  2815. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2816. be in the [0.5, 100.0] range.
  2817. Note that tempo greater than 2 will skip some samples rather than
  2818. blend them in. If for any reason this is a concern it is always
  2819. possible to daisy-chain several instances of atempo to achieve the
  2820. desired product tempo.
  2821. @subsection Examples
  2822. @itemize
  2823. @item
  2824. Slow down audio to 80% tempo:
  2825. @example
  2826. atempo=0.8
  2827. @end example
  2828. @item
  2829. To speed up audio to 300% tempo:
  2830. @example
  2831. atempo=3
  2832. @end example
  2833. @item
  2834. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2835. @example
  2836. atempo=sqrt(3),atempo=sqrt(3)
  2837. @end example
  2838. @end itemize
  2839. @subsection Commands
  2840. This filter supports the following commands:
  2841. @table @option
  2842. @item tempo
  2843. Change filter tempo scale factor.
  2844. Syntax for the command is : "@var{tempo}"
  2845. @end table
  2846. @section atilt
  2847. Apply spectral tilt filter to audio stream.
  2848. This filter apply any spectral roll-off slope over any specified frequency band.
  2849. The filter accepts the following options:
  2850. @table @option
  2851. @item freq
  2852. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2853. @item slope
  2854. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2855. @item width
  2856. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2857. @item order
  2858. Set order of tilt filter.
  2859. @item level
  2860. Set input volume level. Allowed range is from 0 to 4.
  2861. Default is 1.
  2862. @end table
  2863. @subsection Commands
  2864. This filter supports the all above options as @ref{commands}.
  2865. @section atrim
  2866. Trim the input so that the output contains one continuous subpart of the input.
  2867. It accepts the following parameters:
  2868. @table @option
  2869. @item start
  2870. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2871. sample with the timestamp @var{start} will be the first sample in the output.
  2872. @item end
  2873. Specify time of the first audio sample that will be dropped, i.e. the
  2874. audio sample immediately preceding the one with the timestamp @var{end} will be
  2875. the last sample in the output.
  2876. @item start_pts
  2877. Same as @var{start}, except this option sets the start timestamp in samples
  2878. instead of seconds.
  2879. @item end_pts
  2880. Same as @var{end}, except this option sets the end timestamp in samples instead
  2881. of seconds.
  2882. @item duration
  2883. The maximum duration of the output in seconds.
  2884. @item start_sample
  2885. The number of the first sample that should be output.
  2886. @item end_sample
  2887. The number of the first sample that should be dropped.
  2888. @end table
  2889. @option{start}, @option{end}, and @option{duration} are expressed as time
  2890. duration specifications; see
  2891. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2892. Note that the first two sets of the start/end options and the @option{duration}
  2893. option look at the frame timestamp, while the _sample options simply count the
  2894. samples that pass through the filter. So start/end_pts and start/end_sample will
  2895. give different results when the timestamps are wrong, inexact or do not start at
  2896. zero. Also note that this filter does not modify the timestamps. If you wish
  2897. to have the output timestamps start at zero, insert the asetpts filter after the
  2898. atrim filter.
  2899. If multiple start or end options are set, this filter tries to be greedy and
  2900. keep all samples that match at least one of the specified constraints. To keep
  2901. only the part that matches all the constraints at once, chain multiple atrim
  2902. filters.
  2903. The defaults are such that all the input is kept. So it is possible to set e.g.
  2904. just the end values to keep everything before the specified time.
  2905. Examples:
  2906. @itemize
  2907. @item
  2908. Drop everything except the second minute of input:
  2909. @example
  2910. ffmpeg -i INPUT -af atrim=60:120
  2911. @end example
  2912. @item
  2913. Keep only the first 1000 samples:
  2914. @example
  2915. ffmpeg -i INPUT -af atrim=end_sample=1000
  2916. @end example
  2917. @end itemize
  2918. @section axcorrelate
  2919. Calculate normalized windowed cross-correlation between two input audio streams.
  2920. Resulted samples are always between -1 and 1 inclusive.
  2921. If result is 1 it means two input samples are highly correlated in that selected segment.
  2922. Result 0 means they are not correlated at all.
  2923. If result is -1 it means two input samples are out of phase, which means they cancel each
  2924. other.
  2925. The filter accepts the following options:
  2926. @table @option
  2927. @item size
  2928. Set size of segment over which cross-correlation is calculated.
  2929. Default is 256. Allowed range is from 2 to 131072.
  2930. @item algo
  2931. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast} or @code{best}.
  2932. Default is @code{best}. Fast algorithm assumes mean values over any given segment
  2933. are always zero and thus need much less calculations to make.
  2934. This is generally not true, but is valid for typical audio streams.
  2935. @end table
  2936. @subsection Examples
  2937. @itemize
  2938. @item
  2939. Calculate correlation between channels in stereo audio stream:
  2940. @example
  2941. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2942. @end example
  2943. @end itemize
  2944. @section bandpass
  2945. Apply a two-pole Butterworth band-pass filter with central
  2946. frequency @var{frequency}, and (3dB-point) band-width width.
  2947. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2948. instead of the default: constant 0dB peak gain.
  2949. The filter roll off at 6dB per octave (20dB per decade).
  2950. The filter accepts the following options:
  2951. @table @option
  2952. @item frequency, f
  2953. Set the filter's central frequency. Default is @code{3000}.
  2954. @item csg
  2955. Constant skirt gain if set to 1. Defaults to 0.
  2956. @item width_type, t
  2957. Set method to specify band-width of filter.
  2958. @table @option
  2959. @item h
  2960. Hz
  2961. @item q
  2962. Q-Factor
  2963. @item o
  2964. octave
  2965. @item s
  2966. slope
  2967. @item k
  2968. kHz
  2969. @end table
  2970. @item width, w
  2971. Specify the band-width of a filter in width_type units.
  2972. @item mix, m
  2973. How much to use filtered signal in output. Default is 1.
  2974. Range is between 0 and 1.
  2975. @item channels, c
  2976. Specify which channels to filter, by default all available are filtered.
  2977. @item normalize, n
  2978. Normalize biquad coefficients, by default is disabled.
  2979. Enabling it will normalize magnitude response at DC to 0dB.
  2980. @item transform, a
  2981. Set transform type of IIR filter.
  2982. @table @option
  2983. @item di
  2984. @item dii
  2985. @item tdi
  2986. @item tdii
  2987. @item latt
  2988. @item svf
  2989. @item zdf
  2990. @end table
  2991. @item precision, r
  2992. Set precision of filtering.
  2993. @table @option
  2994. @item auto
  2995. Pick automatic sample format depending on surround filters.
  2996. @item s16
  2997. Always use signed 16-bit.
  2998. @item s32
  2999. Always use signed 32-bit.
  3000. @item f32
  3001. Always use float 32-bit.
  3002. @item f64
  3003. Always use float 64-bit.
  3004. @end table
  3005. @item block_size, b
  3006. Set block size used for reverse IIR processing. If this value is set to high enough
  3007. value (higher than impulse response length truncated when reaches near zero values) filtering
  3008. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3009. Note that filter delay will be exactly this many samples when set to non-zero value.
  3010. @end table
  3011. @subsection Commands
  3012. This filter supports the following commands:
  3013. @table @option
  3014. @item frequency, f
  3015. Change bandpass frequency.
  3016. Syntax for the command is : "@var{frequency}"
  3017. @item width_type, t
  3018. Change bandpass width_type.
  3019. Syntax for the command is : "@var{width_type}"
  3020. @item width, w
  3021. Change bandpass width.
  3022. Syntax for the command is : "@var{width}"
  3023. @item mix, m
  3024. Change bandpass mix.
  3025. Syntax for the command is : "@var{mix}"
  3026. @end table
  3027. @section bandreject
  3028. Apply a two-pole Butterworth band-reject filter with central
  3029. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  3030. The filter roll off at 6dB per octave (20dB per decade).
  3031. The filter accepts the following options:
  3032. @table @option
  3033. @item frequency, f
  3034. Set the filter's central frequency. Default is @code{3000}.
  3035. @item width_type, t
  3036. Set method to specify band-width of filter.
  3037. @table @option
  3038. @item h
  3039. Hz
  3040. @item q
  3041. Q-Factor
  3042. @item o
  3043. octave
  3044. @item s
  3045. slope
  3046. @item k
  3047. kHz
  3048. @end table
  3049. @item width, w
  3050. Specify the band-width of a filter in width_type units.
  3051. @item mix, m
  3052. How much to use filtered signal in output. Default is 1.
  3053. Range is between 0 and 1.
  3054. @item channels, c
  3055. Specify which channels to filter, by default all available are filtered.
  3056. @item normalize, n
  3057. Normalize biquad coefficients, by default is disabled.
  3058. Enabling it will normalize magnitude response at DC to 0dB.
  3059. @item transform, a
  3060. Set transform type of IIR filter.
  3061. @table @option
  3062. @item di
  3063. @item dii
  3064. @item tdi
  3065. @item tdii
  3066. @item latt
  3067. @item svf
  3068. @item zdf
  3069. @end table
  3070. @item precision, r
  3071. Set precision of filtering.
  3072. @table @option
  3073. @item auto
  3074. Pick automatic sample format depending on surround filters.
  3075. @item s16
  3076. Always use signed 16-bit.
  3077. @item s32
  3078. Always use signed 32-bit.
  3079. @item f32
  3080. Always use float 32-bit.
  3081. @item f64
  3082. Always use float 64-bit.
  3083. @end table
  3084. @item block_size, b
  3085. Set block size used for reverse IIR processing. If this value is set to high enough
  3086. value (higher than impulse response length truncated when reaches near zero values) filtering
  3087. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3088. Note that filter delay will be exactly this many samples when set to non-zero value.
  3089. @end table
  3090. @subsection Commands
  3091. This filter supports the following commands:
  3092. @table @option
  3093. @item frequency, f
  3094. Change bandreject frequency.
  3095. Syntax for the command is : "@var{frequency}"
  3096. @item width_type, t
  3097. Change bandreject width_type.
  3098. Syntax for the command is : "@var{width_type}"
  3099. @item width, w
  3100. Change bandreject width.
  3101. Syntax for the command is : "@var{width}"
  3102. @item mix, m
  3103. Change bandreject mix.
  3104. Syntax for the command is : "@var{mix}"
  3105. @end table
  3106. @section bass, lowshelf
  3107. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  3108. shelving filter with a response similar to that of a standard
  3109. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3110. The filter accepts the following options:
  3111. @table @option
  3112. @item gain, g
  3113. Give the gain at 0 Hz. Its useful range is about -20
  3114. (for a large cut) to +20 (for a large boost).
  3115. Beware of clipping when using a positive gain.
  3116. @item frequency, f
  3117. Set the filter's central frequency and so can be used
  3118. to extend or reduce the frequency range to be boosted or cut.
  3119. The default value is @code{100} Hz.
  3120. @item width_type, t
  3121. Set method to specify band-width of filter.
  3122. @table @option
  3123. @item h
  3124. Hz
  3125. @item q
  3126. Q-Factor
  3127. @item o
  3128. octave
  3129. @item s
  3130. slope
  3131. @item k
  3132. kHz
  3133. @end table
  3134. @item width, w
  3135. Determine how steep is the filter's shelf transition.
  3136. @item poles, p
  3137. Set number of poles. Default is 2.
  3138. @item mix, m
  3139. How much to use filtered signal in output. Default is 1.
  3140. Range is between 0 and 1.
  3141. @item channels, c
  3142. Specify which channels to filter, by default all available are filtered.
  3143. @item normalize, n
  3144. Normalize biquad coefficients, by default is disabled.
  3145. Enabling it will normalize magnitude response at DC to 0dB.
  3146. @item transform, a
  3147. Set transform type of IIR filter.
  3148. @table @option
  3149. @item di
  3150. @item dii
  3151. @item tdi
  3152. @item tdii
  3153. @item latt
  3154. @item svf
  3155. @item zdf
  3156. @end table
  3157. @item precision, r
  3158. Set precision of filtering.
  3159. @table @option
  3160. @item auto
  3161. Pick automatic sample format depending on surround filters.
  3162. @item s16
  3163. Always use signed 16-bit.
  3164. @item s32
  3165. Always use signed 32-bit.
  3166. @item f32
  3167. Always use float 32-bit.
  3168. @item f64
  3169. Always use float 64-bit.
  3170. @end table
  3171. @item block_size, b
  3172. Set block size used for reverse IIR processing. If this value is set to high enough
  3173. value (higher than impulse response length truncated when reaches near zero values) filtering
  3174. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3175. Note that filter delay will be exactly this many samples when set to non-zero value.
  3176. @end table
  3177. @subsection Commands
  3178. This filter supports the following commands:
  3179. @table @option
  3180. @item frequency, f
  3181. Change bass frequency.
  3182. Syntax for the command is : "@var{frequency}"
  3183. @item width_type, t
  3184. Change bass width_type.
  3185. Syntax for the command is : "@var{width_type}"
  3186. @item width, w
  3187. Change bass width.
  3188. Syntax for the command is : "@var{width}"
  3189. @item gain, g
  3190. Change bass gain.
  3191. Syntax for the command is : "@var{gain}"
  3192. @item mix, m
  3193. Change bass mix.
  3194. Syntax for the command is : "@var{mix}"
  3195. @end table
  3196. @section biquad
  3197. Apply a biquad IIR filter with the given coefficients.
  3198. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  3199. are the numerator and denominator coefficients respectively.
  3200. and @var{channels}, @var{c} specify which channels to filter, by default all
  3201. available are filtered.
  3202. @subsection Commands
  3203. This filter supports the following commands:
  3204. @table @option
  3205. @item a0
  3206. @item a1
  3207. @item a2
  3208. @item b0
  3209. @item b1
  3210. @item b2
  3211. Change biquad parameter.
  3212. Syntax for the command is : "@var{value}"
  3213. @item mix, m
  3214. How much to use filtered signal in output. Default is 1.
  3215. Range is between 0 and 1.
  3216. @item channels, c
  3217. Specify which channels to filter, by default all available are filtered.
  3218. @item normalize, n
  3219. Normalize biquad coefficients, by default is disabled.
  3220. Enabling it will normalize magnitude response at DC to 0dB.
  3221. @item transform, a
  3222. Set transform type of IIR filter.
  3223. @table @option
  3224. @item di
  3225. @item dii
  3226. @item tdi
  3227. @item tdii
  3228. @item latt
  3229. @item svf
  3230. @item zdf
  3231. @end table
  3232. @item precision, r
  3233. Set precision of filtering.
  3234. @table @option
  3235. @item auto
  3236. Pick automatic sample format depending on surround filters.
  3237. @item s16
  3238. Always use signed 16-bit.
  3239. @item s32
  3240. Always use signed 32-bit.
  3241. @item f32
  3242. Always use float 32-bit.
  3243. @item f64
  3244. Always use float 64-bit.
  3245. @end table
  3246. @item block_size, b
  3247. Set block size used for reverse IIR processing. If this value is set to high enough
  3248. value (higher than impulse response length truncated when reaches near zero values) filtering
  3249. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3250. Note that filter delay will be exactly this many samples when set to non-zero value.
  3251. @end table
  3252. @section bs2b
  3253. Bauer stereo to binaural transformation, which improves headphone listening of
  3254. stereo audio records.
  3255. To enable compilation of this filter you need to configure FFmpeg with
  3256. @code{--enable-libbs2b}.
  3257. It accepts the following parameters:
  3258. @table @option
  3259. @item profile
  3260. Pre-defined crossfeed level.
  3261. @table @option
  3262. @item default
  3263. Default level (fcut=700, feed=50).
  3264. @item cmoy
  3265. Chu Moy circuit (fcut=700, feed=60).
  3266. @item jmeier
  3267. Jan Meier circuit (fcut=650, feed=95).
  3268. @end table
  3269. @item fcut
  3270. Cut frequency (in Hz).
  3271. @item feed
  3272. Feed level (in Hz).
  3273. @end table
  3274. @section channelmap
  3275. Remap input channels to new locations.
  3276. It accepts the following parameters:
  3277. @table @option
  3278. @item map
  3279. Map channels from input to output. The argument is a '|'-separated list of
  3280. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3281. @code{@var{in_channel}} form. @var{in_channel} can be either the name of the
  3282. input channel (e.g. FL for front left) or its index in the input channel
  3283. layout. @var{out_channel} is the name of the output channel or its index in the
  3284. output channel layout. If @var{out_channel} is not given then it is implicitly
  3285. an index, starting with zero and increasing by one for each mapping. Mixing
  3286. different types of mappings is not allowed and will result in a parse error.
  3287. @item channel_layout
  3288. The channel layout of the output stream. If not specified, then filter will
  3289. guess it based on the @var{out_channel} names or the number of mappings.
  3290. Guessed layouts will not necessarily contain channels in the order of the
  3291. mappings.
  3292. @end table
  3293. If no mapping is present, the filter will implicitly map input channels to
  3294. output channels, preserving indices.
  3295. @subsection Examples
  3296. @itemize
  3297. @item
  3298. For example, assuming a 5.1+downmix input MOV file,
  3299. @example
  3300. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3301. @end example
  3302. will create an output WAV file tagged as stereo from the downmix channels of
  3303. the input.
  3304. @item
  3305. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3306. @example
  3307. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3308. @end example
  3309. @end itemize
  3310. @section channelsplit
  3311. Split each channel from an input audio stream into a separate output stream.
  3312. It accepts the following parameters:
  3313. @table @option
  3314. @item channel_layout
  3315. The channel layout of the input stream. The default is "stereo".
  3316. @item channels
  3317. A channel layout describing the channels to be extracted as separate output streams
  3318. or "all" to extract each input channel as a separate stream. The default is "all".
  3319. Choosing channels not present in channel layout in the input will result in an error.
  3320. @end table
  3321. @subsection Examples
  3322. @itemize
  3323. @item
  3324. For example, assuming a stereo input MP3 file,
  3325. @example
  3326. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3327. @end example
  3328. will create an output Matroska file with two audio streams, one containing only
  3329. the left channel and the other the right channel.
  3330. @item
  3331. Split a 5.1 WAV file into per-channel files:
  3332. @example
  3333. ffmpeg -i in.wav -filter_complex
  3334. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3335. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3336. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3337. side_right.wav
  3338. @end example
  3339. @item
  3340. Extract only LFE from a 5.1 WAV file:
  3341. @example
  3342. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3343. -map '[LFE]' lfe.wav
  3344. @end example
  3345. @end itemize
  3346. @section chorus
  3347. Add a chorus effect to the audio.
  3348. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3349. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3350. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3351. The modulation depth defines the range the modulated delay is played before or after
  3352. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3353. sound tuned around the original one, like in a chorus where some vocals are slightly
  3354. off key.
  3355. It accepts the following parameters:
  3356. @table @option
  3357. @item in_gain
  3358. Set input gain. Default is 0.4.
  3359. @item out_gain
  3360. Set output gain. Default is 0.4.
  3361. @item delays
  3362. Set delays. A typical delay is around 40ms to 60ms.
  3363. @item decays
  3364. Set decays.
  3365. @item speeds
  3366. Set speeds.
  3367. @item depths
  3368. Set depths.
  3369. @end table
  3370. @subsection Examples
  3371. @itemize
  3372. @item
  3373. A single delay:
  3374. @example
  3375. chorus=0.7:0.9:55:0.4:0.25:2
  3376. @end example
  3377. @item
  3378. Two delays:
  3379. @example
  3380. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3381. @end example
  3382. @item
  3383. Fuller sounding chorus with three delays:
  3384. @example
  3385. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  3386. @end example
  3387. @end itemize
  3388. @section compand
  3389. Compress or expand the audio's dynamic range.
  3390. It accepts the following parameters:
  3391. @table @option
  3392. @item attacks
  3393. @item decays
  3394. A list of times in seconds for each channel over which the instantaneous level
  3395. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3396. increase of volume and @var{decays} refers to decrease of volume. For most
  3397. situations, the attack time (response to the audio getting louder) should be
  3398. shorter than the decay time, because the human ear is more sensitive to sudden
  3399. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3400. a typical value for decay is 0.8 seconds.
  3401. If specified number of attacks & decays is lower than number of channels, the last
  3402. set attack/decay will be used for all remaining channels.
  3403. @item points
  3404. A list of points for the transfer function, specified in dB relative to the
  3405. maximum possible signal amplitude. Each key points list must be defined using
  3406. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3407. @code{x0/y0 x1/y1 x2/y2 ....}
  3408. The input values must be in strictly increasing order but the transfer function
  3409. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3410. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3411. function are @code{-70/-70|-60/-20|1/0}.
  3412. @item soft-knee
  3413. Set the curve radius in dB for all joints. It defaults to 0.01.
  3414. @item gain
  3415. Set the additional gain in dB to be applied at all points on the transfer
  3416. function. This allows for easy adjustment of the overall gain.
  3417. It defaults to 0.
  3418. @item volume
  3419. Set an initial volume, in dB, to be assumed for each channel when filtering
  3420. starts. This permits the user to supply a nominal level initially, so that, for
  3421. example, a very large gain is not applied to initial signal levels before the
  3422. companding has begun to operate. A typical value for audio which is initially
  3423. quiet is -90 dB. It defaults to 0.
  3424. @item delay
  3425. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3426. delayed before being fed to the volume adjuster. Specifying a delay
  3427. approximately equal to the attack/decay times allows the filter to effectively
  3428. operate in predictive rather than reactive mode. It defaults to 0.
  3429. @end table
  3430. @subsection Examples
  3431. @itemize
  3432. @item
  3433. Make music with both quiet and loud passages suitable for listening to in a
  3434. noisy environment:
  3435. @example
  3436. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3437. @end example
  3438. Another example for audio with whisper and explosion parts:
  3439. @example
  3440. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3441. @end example
  3442. @item
  3443. A noise gate for when the noise is at a lower level than the signal:
  3444. @example
  3445. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3446. @end example
  3447. @item
  3448. Here is another noise gate, this time for when the noise is at a higher level
  3449. than the signal (making it, in some ways, similar to squelch):
  3450. @example
  3451. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3452. @end example
  3453. @item
  3454. 2:1 compression starting at -6dB:
  3455. @example
  3456. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3457. @end example
  3458. @item
  3459. 2:1 compression starting at -9dB:
  3460. @example
  3461. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3462. @end example
  3463. @item
  3464. 2:1 compression starting at -12dB:
  3465. @example
  3466. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3467. @end example
  3468. @item
  3469. 2:1 compression starting at -18dB:
  3470. @example
  3471. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3472. @end example
  3473. @item
  3474. 3:1 compression starting at -15dB:
  3475. @example
  3476. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3477. @end example
  3478. @item
  3479. Compressor/Gate:
  3480. @example
  3481. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3482. @end example
  3483. @item
  3484. Expander:
  3485. @example
  3486. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  3487. @end example
  3488. @item
  3489. Hard limiter at -6dB:
  3490. @example
  3491. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3492. @end example
  3493. @item
  3494. Hard limiter at -12dB:
  3495. @example
  3496. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3497. @end example
  3498. @item
  3499. Hard noise gate at -35 dB:
  3500. @example
  3501. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3502. @end example
  3503. @item
  3504. Soft limiter:
  3505. @example
  3506. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3507. @end example
  3508. @end itemize
  3509. @section compensationdelay
  3510. Compensation Delay Line is a metric based delay to compensate differing
  3511. positions of microphones or speakers.
  3512. For example, you have recorded guitar with two microphones placed in
  3513. different locations. Because the front of sound wave has fixed speed in
  3514. normal conditions, the phasing of microphones can vary and depends on
  3515. their location and interposition. The best sound mix can be achieved when
  3516. these microphones are in phase (synchronized). Note that a distance of
  3517. ~30 cm between microphones makes one microphone capture the signal in
  3518. antiphase to the other microphone. That makes the final mix sound moody.
  3519. This filter helps to solve phasing problems by adding different delays
  3520. to each microphone track and make them synchronized.
  3521. The best result can be reached when you take one track as base and
  3522. synchronize other tracks one by one with it.
  3523. Remember that synchronization/delay tolerance depends on sample rate, too.
  3524. Higher sample rates will give more tolerance.
  3525. The filter accepts the following parameters:
  3526. @table @option
  3527. @item mm
  3528. Set millimeters distance. This is compensation distance for fine tuning.
  3529. Default is 0.
  3530. @item cm
  3531. Set cm distance. This is compensation distance for tightening distance setup.
  3532. Default is 0.
  3533. @item m
  3534. Set meters distance. This is compensation distance for hard distance setup.
  3535. Default is 0.
  3536. @item dry
  3537. Set dry amount. Amount of unprocessed (dry) signal.
  3538. Default is 0.
  3539. @item wet
  3540. Set wet amount. Amount of processed (wet) signal.
  3541. Default is 1.
  3542. @item temp
  3543. Set temperature in degrees Celsius. This is the temperature of the environment.
  3544. Default is 20.
  3545. @end table
  3546. @subsection Commands
  3547. This filter supports the all above options as @ref{commands}.
  3548. @section crossfeed
  3549. Apply headphone crossfeed filter.
  3550. Crossfeed is the process of blending the left and right channels of stereo
  3551. audio recording.
  3552. It is mainly used to reduce extreme stereo separation of low frequencies.
  3553. The intent is to produce more speaker like sound to the listener.
  3554. The filter accepts the following options:
  3555. @table @option
  3556. @item strength
  3557. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3558. This sets gain of low shelf filter for side part of stereo image.
  3559. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3560. @item range
  3561. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3562. This sets cut off frequency of low shelf filter. Default is cut off near
  3563. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3564. @item slope
  3565. Set curve slope of low shelf filter. Default is 0.5.
  3566. Allowed range is from 0.01 to 1.
  3567. @item level_in
  3568. Set input gain. Default is 0.9.
  3569. @item level_out
  3570. Set output gain. Default is 1.
  3571. @item block_size
  3572. Set block size used for reverse IIR processing. If this value is set to high enough
  3573. value (higher than impulse response length truncated when reaches near zero values) filtering
  3574. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3575. Note that filter delay will be exactly this many samples when set to non-zero value.
  3576. @end table
  3577. @subsection Commands
  3578. This filter supports the all above options as @ref{commands}.
  3579. @section crystalizer
  3580. Simple algorithm for audio noise sharpening.
  3581. This filter linearly increases differences between each audio sample.
  3582. The filter accepts the following options:
  3583. @table @option
  3584. @item i
  3585. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3586. (unchanged sound) to 10.0 (maximum effect).
  3587. To inverse filtering use negative value.
  3588. @item c
  3589. Enable clipping. By default is enabled.
  3590. @end table
  3591. @subsection Commands
  3592. This filter supports the all above options as @ref{commands}.
  3593. @section dcshift
  3594. Apply a DC shift to the audio.
  3595. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3596. in the recording chain) from the audio. The effect of a DC offset is reduced
  3597. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3598. a signal has a DC offset.
  3599. @table @option
  3600. @item shift
  3601. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3602. the audio.
  3603. @item limitergain
  3604. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3605. used to prevent clipping.
  3606. @end table
  3607. @section deesser
  3608. Apply de-essing to the audio samples.
  3609. @table @option
  3610. @item i
  3611. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3612. Default is 0.
  3613. @item m
  3614. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3615. Default is 0.5.
  3616. @item f
  3617. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3618. Default is 0.5.
  3619. @item s
  3620. Set the output mode.
  3621. It accepts the following values:
  3622. @table @option
  3623. @item i
  3624. Pass input unchanged.
  3625. @item o
  3626. Pass ess filtered out.
  3627. @item e
  3628. Pass only ess.
  3629. Default value is @var{o}.
  3630. @end table
  3631. @end table
  3632. @section dialoguenhance
  3633. Enhance dialogue in stereo audio.
  3634. This filter accepts stereo input and produce surround (3.0) channels output.
  3635. The newly produced front center channel have enhanced speech dialogue originally
  3636. available in both stereo channels.
  3637. This filter outputs front left and front right channels same as available in stereo input.
  3638. The filter accepts the following options:
  3639. @table @option
  3640. @item original
  3641. Set the original center factor to keep in front center channel output.
  3642. Allowed range is from 0 to 1. Default value is 1.
  3643. @item enhance
  3644. Set the dialogue enhance factor to put in front center channel output.
  3645. Allowed range is from 0 to 3. Default value is 1.
  3646. @item voice
  3647. Set the voice detection factor.
  3648. Allowed range is from 2 to 32. Default value is 2.
  3649. @end table
  3650. @subsection Commands
  3651. This filter supports the all above options as @ref{commands}.
  3652. @section drmeter
  3653. Measure audio dynamic range.
  3654. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3655. is found in transition material. And anything less that 8 have very poor dynamics
  3656. and is very compressed.
  3657. The filter accepts the following options:
  3658. @table @option
  3659. @item length
  3660. Set window length in seconds used to split audio into segments of equal length.
  3661. Default is 3 seconds.
  3662. @end table
  3663. @section dynaudnorm
  3664. Dynamic Audio Normalizer.
  3665. This filter applies a certain amount of gain to the input audio in order
  3666. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3667. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3668. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3669. This allows for applying extra gain to the "quiet" sections of the audio
  3670. while avoiding distortions or clipping the "loud" sections. In other words:
  3671. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3672. sections, in the sense that the volume of each section is brought to the
  3673. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3674. this goal *without* applying "dynamic range compressing". It will retain 100%
  3675. of the dynamic range *within* each section of the audio file.
  3676. @table @option
  3677. @item framelen, f
  3678. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3679. Default is 500 milliseconds.
  3680. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3681. referred to as frames. This is required, because a peak magnitude has no
  3682. meaning for just a single sample value. Instead, we need to determine the
  3683. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3684. normalizer would simply use the peak magnitude of the complete file, the
  3685. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3686. frame. The length of a frame is specified in milliseconds. By default, the
  3687. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3688. been found to give good results with most files.
  3689. Note that the exact frame length, in number of samples, will be determined
  3690. automatically, based on the sampling rate of the individual input audio file.
  3691. @item gausssize, g
  3692. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3693. number. Default is 31.
  3694. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3695. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3696. is specified in frames, centered around the current frame. For the sake of
  3697. simplicity, this must be an odd number. Consequently, the default value of 31
  3698. takes into account the current frame, as well as the 15 preceding frames and
  3699. the 15 subsequent frames. Using a larger window results in a stronger
  3700. smoothing effect and thus in less gain variation, i.e. slower gain
  3701. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3702. effect and thus in more gain variation, i.e. faster gain adaptation.
  3703. In other words, the more you increase this value, the more the Dynamic Audio
  3704. Normalizer will behave like a "traditional" normalization filter. On the
  3705. contrary, the more you decrease this value, the more the Dynamic Audio
  3706. Normalizer will behave like a dynamic range compressor.
  3707. @item peak, p
  3708. Set the target peak value. This specifies the highest permissible magnitude
  3709. level for the normalized audio input. This filter will try to approach the
  3710. target peak magnitude as closely as possible, but at the same time it also
  3711. makes sure that the normalized signal will never exceed the peak magnitude.
  3712. A frame's maximum local gain factor is imposed directly by the target peak
  3713. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3714. It is not recommended to go above this value.
  3715. @item maxgain, m
  3716. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3717. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3718. factor for each input frame, i.e. the maximum gain factor that does not
  3719. result in clipping or distortion. The maximum gain factor is determined by
  3720. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3721. additionally bounds the frame's maximum gain factor by a predetermined
  3722. (global) maximum gain factor. This is done in order to avoid excessive gain
  3723. factors in "silent" or almost silent frames. By default, the maximum gain
  3724. factor is 10.0, For most inputs the default value should be sufficient and
  3725. it usually is not recommended to increase this value. Though, for input
  3726. with an extremely low overall volume level, it may be necessary to allow even
  3727. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3728. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3729. Instead, a "sigmoid" threshold function will be applied. This way, the
  3730. gain factors will smoothly approach the threshold value, but never exceed that
  3731. value.
  3732. @item targetrms, r
  3733. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3734. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3735. This means that the maximum local gain factor for each frame is defined
  3736. (only) by the frame's highest magnitude sample. This way, the samples can
  3737. be amplified as much as possible without exceeding the maximum signal
  3738. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3739. Normalizer can also take into account the frame's root mean square,
  3740. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3741. determine the power of a time-varying signal. It is therefore considered
  3742. that the RMS is a better approximation of the "perceived loudness" than
  3743. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3744. frames to a constant RMS value, a uniform "perceived loudness" can be
  3745. established. If a target RMS value has been specified, a frame's local gain
  3746. factor is defined as the factor that would result in exactly that RMS value.
  3747. Note, however, that the maximum local gain factor is still restricted by the
  3748. frame's highest magnitude sample, in order to prevent clipping.
  3749. @item coupling, n
  3750. Enable channels coupling. By default is enabled.
  3751. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3752. amount. This means the same gain factor will be applied to all channels, i.e.
  3753. the maximum possible gain factor is determined by the "loudest" channel.
  3754. However, in some recordings, it may happen that the volume of the different
  3755. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3756. In this case, this option can be used to disable the channel coupling. This way,
  3757. the gain factor will be determined independently for each channel, depending
  3758. only on the individual channel's highest magnitude sample. This allows for
  3759. harmonizing the volume of the different channels.
  3760. @item correctdc, c
  3761. Enable DC bias correction. By default is disabled.
  3762. An audio signal (in the time domain) is a sequence of sample values.
  3763. In the Dynamic Audio Normalizer these sample values are represented in the
  3764. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3765. audio signal, or "waveform", should be centered around the zero point.
  3766. That means if we calculate the mean value of all samples in a file, or in a
  3767. single frame, then the result should be 0.0 or at least very close to that
  3768. value. If, however, there is a significant deviation of the mean value from
  3769. 0.0, in either positive or negative direction, this is referred to as a
  3770. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3771. Audio Normalizer provides optional DC bias correction.
  3772. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3773. the mean value, or "DC correction" offset, of each input frame and subtract
  3774. that value from all of the frame's sample values which ensures those samples
  3775. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3776. boundaries, the DC correction offset values will be interpolated smoothly
  3777. between neighbouring frames.
  3778. @item altboundary, b
  3779. Enable alternative boundary mode. By default is disabled.
  3780. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3781. around each frame. This includes the preceding frames as well as the
  3782. subsequent frames. However, for the "boundary" frames, located at the very
  3783. beginning and at the very end of the audio file, not all neighbouring
  3784. frames are available. In particular, for the first few frames in the audio
  3785. file, the preceding frames are not known. And, similarly, for the last few
  3786. frames in the audio file, the subsequent frames are not known. Thus, the
  3787. question arises which gain factors should be assumed for the missing frames
  3788. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3789. to deal with this situation. The default boundary mode assumes a gain factor
  3790. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3791. "fade out" at the beginning and at the end of the input, respectively.
  3792. @item compress, s
  3793. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3794. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3795. compression. This means that signal peaks will not be pruned and thus the
  3796. full dynamic range will be retained within each local neighbourhood. However,
  3797. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3798. normalization algorithm with a more "traditional" compression.
  3799. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3800. (thresholding) function. If (and only if) the compression feature is enabled,
  3801. all input frames will be processed by a soft knee thresholding function prior
  3802. to the actual normalization process. Put simply, the thresholding function is
  3803. going to prune all samples whose magnitude exceeds a certain threshold value.
  3804. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3805. value. Instead, the threshold value will be adjusted for each individual
  3806. frame.
  3807. In general, smaller parameters result in stronger compression, and vice versa.
  3808. Values below 3.0 are not recommended, because audible distortion may appear.
  3809. @item threshold, t
  3810. Set the target threshold value. This specifies the lowest permissible
  3811. magnitude level for the audio input which will be normalized.
  3812. If input frame volume is above this value frame will be normalized.
  3813. Otherwise frame may not be normalized at all. The default value is set
  3814. to 0, which means all input frames will be normalized.
  3815. This option is mostly useful if digital noise is not wanted to be amplified.
  3816. @item channels, h
  3817. Specify which channels to filter, by default all available channels are filtered.
  3818. @item overlap, o
  3819. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3820. Using >0 and <1 values will make less conservative gain adjustments, like
  3821. when framelen option is set to smaller value, if framelen option value is
  3822. compensated for non-zero overlap then gain adjustments will be smoother across time
  3823. compared to zero overlap case.
  3824. @item curve, v
  3825. Specify the peak mapping curve expression which is going to be used when calculating
  3826. gain applied to frames. The max output frame gain will still be limited by other
  3827. options mentioned previously for this filter.
  3828. The expression can contain the following constants:
  3829. @table @option
  3830. @item ch
  3831. current channel number
  3832. @item sn
  3833. current sample number
  3834. @item nb_channels
  3835. number of channels
  3836. @item t
  3837. timestamp expressed in seconds
  3838. @item sr
  3839. sample rate
  3840. @item p
  3841. current frame peak value
  3842. @end table
  3843. @end table
  3844. @subsection Commands
  3845. This filter supports the all above options as @ref{commands}.
  3846. @section earwax
  3847. Make audio easier to listen to on headphones.
  3848. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3849. so that when listened to on headphones the stereo image is moved from
  3850. inside your head (standard for headphones) to outside and in front of
  3851. the listener (standard for speakers).
  3852. Ported from SoX.
  3853. @section equalizer
  3854. Apply a two-pole peaking equalisation (EQ) filter. With this
  3855. filter, the signal-level at and around a selected frequency can
  3856. be increased or decreased, whilst (unlike bandpass and bandreject
  3857. filters) that at all other frequencies is unchanged.
  3858. In order to produce complex equalisation curves, this filter can
  3859. be given several times, each with a different central frequency.
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item frequency, f
  3863. Set the filter's central frequency in Hz.
  3864. @item width_type, t
  3865. Set method to specify band-width of filter.
  3866. @table @option
  3867. @item h
  3868. Hz
  3869. @item q
  3870. Q-Factor
  3871. @item o
  3872. octave
  3873. @item s
  3874. slope
  3875. @item k
  3876. kHz
  3877. @end table
  3878. @item width, w
  3879. Specify the band-width of a filter in width_type units.
  3880. @item gain, g
  3881. Set the required gain or attenuation in dB.
  3882. Beware of clipping when using a positive gain.
  3883. @item mix, m
  3884. How much to use filtered signal in output. Default is 1.
  3885. Range is between 0 and 1.
  3886. @item channels, c
  3887. Specify which channels to filter, by default all available are filtered.
  3888. @item normalize, n
  3889. Normalize biquad coefficients, by default is disabled.
  3890. Enabling it will normalize magnitude response at DC to 0dB.
  3891. @item transform, a
  3892. Set transform type of IIR filter.
  3893. @table @option
  3894. @item di
  3895. @item dii
  3896. @item tdi
  3897. @item tdii
  3898. @item latt
  3899. @item svf
  3900. @item zdf
  3901. @end table
  3902. @item precision, r
  3903. Set precision of filtering.
  3904. @table @option
  3905. @item auto
  3906. Pick automatic sample format depending on surround filters.
  3907. @item s16
  3908. Always use signed 16-bit.
  3909. @item s32
  3910. Always use signed 32-bit.
  3911. @item f32
  3912. Always use float 32-bit.
  3913. @item f64
  3914. Always use float 64-bit.
  3915. @end table
  3916. @item block_size, b
  3917. Set block size used for reverse IIR processing. If this value is set to high enough
  3918. value (higher than impulse response length truncated when reaches near zero values) filtering
  3919. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3920. Note that filter delay will be exactly this many samples when set to non-zero value.
  3921. @end table
  3922. @subsection Examples
  3923. @itemize
  3924. @item
  3925. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3926. @example
  3927. equalizer=f=1000:t=h:width=200:g=-10
  3928. @end example
  3929. @item
  3930. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3931. @example
  3932. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3933. @end example
  3934. @end itemize
  3935. @subsection Commands
  3936. This filter supports the following commands:
  3937. @table @option
  3938. @item frequency, f
  3939. Change equalizer frequency.
  3940. Syntax for the command is : "@var{frequency}"
  3941. @item width_type, t
  3942. Change equalizer width_type.
  3943. Syntax for the command is : "@var{width_type}"
  3944. @item width, w
  3945. Change equalizer width.
  3946. Syntax for the command is : "@var{width}"
  3947. @item gain, g
  3948. Change equalizer gain.
  3949. Syntax for the command is : "@var{gain}"
  3950. @item mix, m
  3951. Change equalizer mix.
  3952. Syntax for the command is : "@var{mix}"
  3953. @end table
  3954. @section extrastereo
  3955. Linearly increases the difference between left and right channels which
  3956. adds some sort of "live" effect to playback.
  3957. The filter accepts the following options:
  3958. @table @option
  3959. @item m
  3960. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3961. (average of both channels), with 1.0 sound will be unchanged, with
  3962. -1.0 left and right channels will be swapped.
  3963. @item c
  3964. Enable clipping. By default is enabled.
  3965. @end table
  3966. @subsection Commands
  3967. This filter supports the all above options as @ref{commands}.
  3968. @section firequalizer
  3969. Apply FIR Equalization using arbitrary frequency response.
  3970. The filter accepts the following option:
  3971. @table @option
  3972. @item gain
  3973. Set gain curve equation (in dB). The expression can contain variables:
  3974. @table @option
  3975. @item f
  3976. the evaluated frequency
  3977. @item sr
  3978. sample rate
  3979. @item ch
  3980. channel number, set to 0 when multichannels evaluation is disabled
  3981. @item chid
  3982. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3983. multichannels evaluation is disabled
  3984. @item chs
  3985. number of channels
  3986. @item chlayout
  3987. channel_layout, see libavutil/channel_layout.h
  3988. @end table
  3989. and functions:
  3990. @table @option
  3991. @item gain_interpolate(f)
  3992. interpolate gain on frequency f based on gain_entry
  3993. @item cubic_interpolate(f)
  3994. same as gain_interpolate, but smoother
  3995. @end table
  3996. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3997. @item gain_entry
  3998. Set gain entry for gain_interpolate function. The expression can
  3999. contain functions:
  4000. @table @option
  4001. @item entry(f, g)
  4002. store gain entry at frequency f with value g
  4003. @end table
  4004. This option is also available as command.
  4005. @item delay
  4006. Set filter delay in seconds. Higher value means more accurate.
  4007. Default is @code{0.01}.
  4008. @item accuracy
  4009. Set filter accuracy in Hz. Lower value means more accurate.
  4010. Default is @code{5}.
  4011. @item wfunc
  4012. Set window function. Acceptable values are:
  4013. @table @option
  4014. @item rectangular
  4015. rectangular window, useful when gain curve is already smooth
  4016. @item hann
  4017. hann window (default)
  4018. @item hamming
  4019. hamming window
  4020. @item blackman
  4021. blackman window
  4022. @item nuttall3
  4023. 3-terms continuous 1st derivative nuttall window
  4024. @item mnuttall3
  4025. minimum 3-terms discontinuous nuttall window
  4026. @item nuttall
  4027. 4-terms continuous 1st derivative nuttall window
  4028. @item bnuttall
  4029. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  4030. @item bharris
  4031. blackman-harris window
  4032. @item tukey
  4033. tukey window
  4034. @end table
  4035. @item fixed
  4036. If enabled, use fixed number of audio samples. This improves speed when
  4037. filtering with large delay. Default is disabled.
  4038. @item multi
  4039. Enable multichannels evaluation on gain. Default is disabled.
  4040. @item zero_phase
  4041. Enable zero phase mode by subtracting timestamp to compensate delay.
  4042. Default is disabled.
  4043. @item scale
  4044. Set scale used by gain. Acceptable values are:
  4045. @table @option
  4046. @item linlin
  4047. linear frequency, linear gain
  4048. @item linlog
  4049. linear frequency, logarithmic (in dB) gain (default)
  4050. @item loglin
  4051. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  4052. @item loglog
  4053. logarithmic frequency, logarithmic gain
  4054. @end table
  4055. @item dumpfile
  4056. Set file for dumping, suitable for gnuplot.
  4057. @item dumpscale
  4058. Set scale for dumpfile. Acceptable values are same with scale option.
  4059. Default is linlog.
  4060. @item fft2
  4061. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  4062. Default is disabled.
  4063. @item min_phase
  4064. Enable minimum phase impulse response. Default is disabled.
  4065. @end table
  4066. @subsection Examples
  4067. @itemize
  4068. @item
  4069. lowpass at 1000 Hz:
  4070. @example
  4071. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  4072. @end example
  4073. @item
  4074. lowpass at 1000 Hz with gain_entry:
  4075. @example
  4076. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  4077. @end example
  4078. @item
  4079. custom equalization:
  4080. @example
  4081. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  4082. @end example
  4083. @item
  4084. higher delay with zero phase to compensate delay:
  4085. @example
  4086. firequalizer=delay=0.1:fixed=on:zero_phase=on
  4087. @end example
  4088. @item
  4089. lowpass on left channel, highpass on right channel:
  4090. @example
  4091. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  4092. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  4093. @end example
  4094. @end itemize
  4095. @section flanger
  4096. Apply a flanging effect to the audio.
  4097. The filter accepts the following options:
  4098. @table @option
  4099. @item delay
  4100. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  4101. @item depth
  4102. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  4103. @item regen
  4104. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  4105. Default value is 0.
  4106. @item width
  4107. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  4108. Default value is 71.
  4109. @item speed
  4110. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  4111. @item shape
  4112. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  4113. Default value is @var{sinusoidal}.
  4114. @item phase
  4115. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  4116. Default value is 25.
  4117. @item interp
  4118. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  4119. Default is @var{linear}.
  4120. @end table
  4121. @section haas
  4122. Apply Haas effect to audio.
  4123. Note that this makes most sense to apply on mono signals.
  4124. With this filter applied to mono signals it give some directionality and
  4125. stretches its stereo image.
  4126. The filter accepts the following options:
  4127. @table @option
  4128. @item level_in
  4129. Set input level. By default is @var{1}, or 0dB
  4130. @item level_out
  4131. Set output level. By default is @var{1}, or 0dB.
  4132. @item side_gain
  4133. Set gain applied to side part of signal. By default is @var{1}.
  4134. @item middle_source
  4135. Set kind of middle source. Can be one of the following:
  4136. @table @samp
  4137. @item left
  4138. Pick left channel.
  4139. @item right
  4140. Pick right channel.
  4141. @item mid
  4142. Pick middle part signal of stereo image.
  4143. @item side
  4144. Pick side part signal of stereo image.
  4145. @end table
  4146. @item middle_phase
  4147. Change middle phase. By default is disabled.
  4148. @item left_delay
  4149. Set left channel delay. By default is @var{2.05} milliseconds.
  4150. @item left_balance
  4151. Set left channel balance. By default is @var{-1}.
  4152. @item left_gain
  4153. Set left channel gain. By default is @var{1}.
  4154. @item left_phase
  4155. Change left phase. By default is disabled.
  4156. @item right_delay
  4157. Set right channel delay. By defaults is @var{2.12} milliseconds.
  4158. @item right_balance
  4159. Set right channel balance. By default is @var{1}.
  4160. @item right_gain
  4161. Set right channel gain. By default is @var{1}.
  4162. @item right_phase
  4163. Change right phase. By default is enabled.
  4164. @end table
  4165. @section hdcd
  4166. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  4167. embedded HDCD codes is expanded into a 20-bit PCM stream.
  4168. The filter supports the Peak Extend and Low-level Gain Adjustment features
  4169. of HDCD, and detects the Transient Filter flag.
  4170. @example
  4171. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  4172. @end example
  4173. When using the filter with wav, note the default encoding for wav is 16-bit,
  4174. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  4175. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  4176. @example
  4177. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  4178. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  4179. @end example
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item disable_autoconvert
  4183. Disable any automatic format conversion or resampling in the filter graph.
  4184. @item process_stereo
  4185. Process the stereo channels together. If target_gain does not match between
  4186. channels, consider it invalid and use the last valid target_gain.
  4187. @item cdt_ms
  4188. Set the code detect timer period in ms.
  4189. @item force_pe
  4190. Always extend peaks above -3dBFS even if PE isn't signaled.
  4191. @item analyze_mode
  4192. Replace audio with a solid tone and adjust the amplitude to signal some
  4193. specific aspect of the decoding process. The output file can be loaded in
  4194. an audio editor alongside the original to aid analysis.
  4195. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  4196. Modes are:
  4197. @table @samp
  4198. @item 0, off
  4199. Disabled
  4200. @item 1, lle
  4201. Gain adjustment level at each sample
  4202. @item 2, pe
  4203. Samples where peak extend occurs
  4204. @item 3, cdt
  4205. Samples where the code detect timer is active
  4206. @item 4, tgm
  4207. Samples where the target gain does not match between channels
  4208. @end table
  4209. @end table
  4210. @section headphone
  4211. Apply head-related transfer functions (HRTFs) to create virtual
  4212. loudspeakers around the user for binaural listening via headphones.
  4213. The HRIRs are provided via additional streams, for each channel
  4214. one stereo input stream is needed.
  4215. The filter accepts the following options:
  4216. @table @option
  4217. @item map
  4218. Set mapping of input streams for convolution.
  4219. The argument is a '|'-separated list of channel names in order as they
  4220. are given as additional stream inputs for filter.
  4221. This also specify number of input streams. Number of input streams
  4222. must be not less than number of channels in first stream plus one.
  4223. @item gain
  4224. Set gain applied to audio. Value is in dB. Default is 0.
  4225. @item type
  4226. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4227. processing audio in time domain which is slow.
  4228. @var{freq} is processing audio in frequency domain which is fast.
  4229. Default is @var{freq}.
  4230. @item lfe
  4231. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4232. @item size
  4233. Set size of frame in number of samples which will be processed at once.
  4234. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  4235. @item hrir
  4236. Set format of hrir stream.
  4237. Default value is @var{stereo}. Alternative value is @var{multich}.
  4238. If value is set to @var{stereo}, number of additional streams should
  4239. be greater or equal to number of input channels in first input stream.
  4240. Also each additional stream should have stereo number of channels.
  4241. If value is set to @var{multich}, number of additional streams should
  4242. be exactly one. Also number of input channels of additional stream
  4243. should be equal or greater than twice number of channels of first input
  4244. stream.
  4245. @end table
  4246. @subsection Examples
  4247. @itemize
  4248. @item
  4249. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4250. each amovie filter use stereo file with IR coefficients as input.
  4251. The files give coefficients for each position of virtual loudspeaker:
  4252. @example
  4253. ffmpeg -i input.wav
  4254. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  4255. output.wav
  4256. @end example
  4257. @item
  4258. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4259. but now in @var{multich} @var{hrir} format.
  4260. @example
  4261. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  4262. output.wav
  4263. @end example
  4264. @end itemize
  4265. @section highpass
  4266. Apply a high-pass filter with 3dB point frequency.
  4267. The filter can be either single-pole, or double-pole (the default).
  4268. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item frequency, f
  4272. Set frequency in Hz. Default is 3000.
  4273. @item poles, p
  4274. Set number of poles. Default is 2.
  4275. @item width_type, t
  4276. Set method to specify band-width of filter.
  4277. @table @option
  4278. @item h
  4279. Hz
  4280. @item q
  4281. Q-Factor
  4282. @item o
  4283. octave
  4284. @item s
  4285. slope
  4286. @item k
  4287. kHz
  4288. @end table
  4289. @item width, w
  4290. Specify the band-width of a filter in width_type units.
  4291. Applies only to double-pole filter.
  4292. The default is 0.707q and gives a Butterworth response.
  4293. @item mix, m
  4294. How much to use filtered signal in output. Default is 1.
  4295. Range is between 0 and 1.
  4296. @item channels, c
  4297. Specify which channels to filter, by default all available are filtered.
  4298. @item normalize, n
  4299. Normalize biquad coefficients, by default is disabled.
  4300. Enabling it will normalize magnitude response at DC to 0dB.
  4301. @item transform, a
  4302. Set transform type of IIR filter.
  4303. @table @option
  4304. @item di
  4305. @item dii
  4306. @item tdi
  4307. @item tdii
  4308. @item latt
  4309. @item svf
  4310. @item zdf
  4311. @end table
  4312. @item precision, r
  4313. Set precision of filtering.
  4314. @table @option
  4315. @item auto
  4316. Pick automatic sample format depending on surround filters.
  4317. @item s16
  4318. Always use signed 16-bit.
  4319. @item s32
  4320. Always use signed 32-bit.
  4321. @item f32
  4322. Always use float 32-bit.
  4323. @item f64
  4324. Always use float 64-bit.
  4325. @end table
  4326. @item block_size, b
  4327. Set block size used for reverse IIR processing. If this value is set to high enough
  4328. value (higher than impulse response length truncated when reaches near zero values) filtering
  4329. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4330. Note that filter delay will be exactly this many samples when set to non-zero value.
  4331. @end table
  4332. @subsection Commands
  4333. This filter supports the following commands:
  4334. @table @option
  4335. @item frequency, f
  4336. Change highpass frequency.
  4337. Syntax for the command is : "@var{frequency}"
  4338. @item width_type, t
  4339. Change highpass width_type.
  4340. Syntax for the command is : "@var{width_type}"
  4341. @item width, w
  4342. Change highpass width.
  4343. Syntax for the command is : "@var{width}"
  4344. @item mix, m
  4345. Change highpass mix.
  4346. Syntax for the command is : "@var{mix}"
  4347. @end table
  4348. @section join
  4349. Join multiple input streams into one multi-channel stream.
  4350. It accepts the following parameters:
  4351. @table @option
  4352. @item inputs
  4353. The number of input streams. It defaults to 2.
  4354. @item channel_layout
  4355. The desired output channel layout. It defaults to stereo.
  4356. @item map
  4357. Map channels from inputs to output. The argument is a '|'-separated list of
  4358. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4359. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4360. can be either the name of the input channel (e.g. FL for front left) or its
  4361. index in the specified input stream. @var{out_channel} is the name of the output
  4362. channel.
  4363. @end table
  4364. The filter will attempt to guess the mappings when they are not specified
  4365. explicitly. It does so by first trying to find an unused matching input channel
  4366. and if that fails it picks the first unused input channel.
  4367. Join 3 inputs (with properly set channel layouts):
  4368. @example
  4369. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4370. @end example
  4371. Build a 5.1 output from 6 single-channel streams:
  4372. @example
  4373. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4374. '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'
  4375. out
  4376. @end example
  4377. @section ladspa
  4378. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4379. To enable compilation of this filter you need to configure FFmpeg with
  4380. @code{--enable-ladspa}.
  4381. @table @option
  4382. @item file, f
  4383. Specifies the name of LADSPA plugin library to load. If the environment
  4384. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4385. each one of the directories specified by the colon separated list in
  4386. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4387. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4388. @file{/usr/lib/ladspa/}.
  4389. @item plugin, p
  4390. Specifies the plugin within the library. Some libraries contain only
  4391. one plugin, but others contain many of them. If this is not set filter
  4392. will list all available plugins within the specified library.
  4393. @item controls, c
  4394. Set the '|' separated list of controls which are zero or more floating point
  4395. values that determine the behavior of the loaded plugin (for example delay,
  4396. threshold or gain).
  4397. Controls need to be defined using the following syntax:
  4398. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4399. @var{valuei} is the value set on the @var{i}-th control.
  4400. Alternatively they can be also defined using the following syntax:
  4401. @var{value0}|@var{value1}|@var{value2}|..., where
  4402. @var{valuei} is the value set on the @var{i}-th control.
  4403. If @option{controls} is set to @code{help}, all available controls and
  4404. their valid ranges are printed.
  4405. @item sample_rate, s
  4406. Specify the sample rate, default to 44100. Only used if plugin have
  4407. zero inputs.
  4408. @item nb_samples, n
  4409. Set the number of samples per channel per each output frame, default
  4410. is 1024. Only used if plugin have zero inputs.
  4411. @item duration, d
  4412. Set the minimum duration of the sourced audio. See
  4413. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4414. for the accepted syntax.
  4415. Note that the resulting duration may be greater than the specified duration,
  4416. as the generated audio is always cut at the end of a complete frame.
  4417. If not specified, or the expressed duration is negative, the audio is
  4418. supposed to be generated forever.
  4419. Only used if plugin have zero inputs.
  4420. @item latency, l
  4421. Enable latency compensation, by default is disabled.
  4422. Only used if plugin have inputs.
  4423. @end table
  4424. @subsection Examples
  4425. @itemize
  4426. @item
  4427. List all available plugins within amp (LADSPA example plugin) library:
  4428. @example
  4429. ladspa=file=amp
  4430. @end example
  4431. @item
  4432. List all available controls and their valid ranges for @code{vcf_notch}
  4433. plugin from @code{VCF} library:
  4434. @example
  4435. ladspa=f=vcf:p=vcf_notch:c=help
  4436. @end example
  4437. @item
  4438. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4439. plugin library:
  4440. @example
  4441. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4442. @end example
  4443. @item
  4444. Add reverberation to the audio using TAP-plugins
  4445. (Tom's Audio Processing plugins):
  4446. @example
  4447. ladspa=file=tap_reverb:tap_reverb
  4448. @end example
  4449. @item
  4450. Generate white noise, with 0.2 amplitude:
  4451. @example
  4452. ladspa=file=cmt:noise_source_white:c=c0=.2
  4453. @end example
  4454. @item
  4455. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4456. @code{C* Audio Plugin Suite} (CAPS) library:
  4457. @example
  4458. ladspa=file=caps:Click:c=c1=20'
  4459. @end example
  4460. @item
  4461. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4462. @example
  4463. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4464. @end example
  4465. @item
  4466. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4467. @code{SWH Plugins} collection:
  4468. @example
  4469. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4470. @end example
  4471. @item
  4472. Attenuate low frequencies using Multiband EQ from Steve Harris
  4473. @code{SWH Plugins} collection:
  4474. @example
  4475. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4476. @end example
  4477. @item
  4478. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4479. (CAPS) library:
  4480. @example
  4481. ladspa=caps:Narrower
  4482. @end example
  4483. @item
  4484. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4485. @example
  4486. ladspa=caps:White:.2
  4487. @end example
  4488. @item
  4489. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4490. @example
  4491. ladspa=caps:Fractal:c=c1=1
  4492. @end example
  4493. @item
  4494. Dynamic volume normalization using @code{VLevel} plugin:
  4495. @example
  4496. ladspa=vlevel-ladspa:vlevel_mono
  4497. @end example
  4498. @end itemize
  4499. @subsection Commands
  4500. This filter supports the following commands:
  4501. @table @option
  4502. @item cN
  4503. Modify the @var{N}-th control value.
  4504. If the specified value is not valid, it is ignored and prior one is kept.
  4505. @end table
  4506. @section loudnorm
  4507. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4508. Support for both single pass (livestreams, files) and double pass (files) modes.
  4509. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4510. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4511. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4512. The filter accepts the following options:
  4513. @table @option
  4514. @item I, i
  4515. Set integrated loudness target.
  4516. Range is -70.0 - -5.0. Default value is -24.0.
  4517. @item LRA, lra
  4518. Set loudness range target.
  4519. Range is 1.0 - 50.0. Default value is 7.0.
  4520. @item TP, tp
  4521. Set maximum true peak.
  4522. Range is -9.0 - +0.0. Default value is -2.0.
  4523. @item measured_I, measured_i
  4524. Measured IL of input file.
  4525. Range is -99.0 - +0.0.
  4526. @item measured_LRA, measured_lra
  4527. Measured LRA of input file.
  4528. Range is 0.0 - 99.0.
  4529. @item measured_TP, measured_tp
  4530. Measured true peak of input file.
  4531. Range is -99.0 - +99.0.
  4532. @item measured_thresh
  4533. Measured threshold of input file.
  4534. Range is -99.0 - +0.0.
  4535. @item offset
  4536. Set offset gain. Gain is applied before the true-peak limiter.
  4537. Range is -99.0 - +99.0. Default is +0.0.
  4538. @item linear
  4539. Normalize by linearly scaling the source audio.
  4540. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4541. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4542. be lower than source LRA and the change in integrated loudness shouldn't
  4543. result in a true peak which exceeds the target TP. If any of these
  4544. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4545. Options are @code{true} or @code{false}. Default is @code{true}.
  4546. @item dual_mono
  4547. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4548. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4549. If set to @code{true}, this option will compensate for this effect.
  4550. Multi-channel input files are not affected by this option.
  4551. Options are true or false. Default is false.
  4552. @item print_format
  4553. Set print format for stats. Options are summary, json, or none.
  4554. Default value is none.
  4555. @end table
  4556. @section lowpass
  4557. Apply a low-pass filter with 3dB point frequency.
  4558. The filter can be either single-pole or double-pole (the default).
  4559. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4560. The filter accepts the following options:
  4561. @table @option
  4562. @item frequency, f
  4563. Set frequency in Hz. Default is 500.
  4564. @item poles, p
  4565. Set number of poles. Default is 2.
  4566. @item width_type, t
  4567. Set method to specify band-width of filter.
  4568. @table @option
  4569. @item h
  4570. Hz
  4571. @item q
  4572. Q-Factor
  4573. @item o
  4574. octave
  4575. @item s
  4576. slope
  4577. @item k
  4578. kHz
  4579. @end table
  4580. @item width, w
  4581. Specify the band-width of a filter in width_type units.
  4582. Applies only to double-pole filter.
  4583. The default is 0.707q and gives a Butterworth response.
  4584. @item mix, m
  4585. How much to use filtered signal in output. Default is 1.
  4586. Range is between 0 and 1.
  4587. @item channels, c
  4588. Specify which channels to filter, by default all available are filtered.
  4589. @item normalize, n
  4590. Normalize biquad coefficients, by default is disabled.
  4591. Enabling it will normalize magnitude response at DC to 0dB.
  4592. @item transform, a
  4593. Set transform type of IIR filter.
  4594. @table @option
  4595. @item di
  4596. @item dii
  4597. @item tdi
  4598. @item tdii
  4599. @item latt
  4600. @item svf
  4601. @item zdf
  4602. @end table
  4603. @item precision, r
  4604. Set precision of filtering.
  4605. @table @option
  4606. @item auto
  4607. Pick automatic sample format depending on surround filters.
  4608. @item s16
  4609. Always use signed 16-bit.
  4610. @item s32
  4611. Always use signed 32-bit.
  4612. @item f32
  4613. Always use float 32-bit.
  4614. @item f64
  4615. Always use float 64-bit.
  4616. @end table
  4617. @item block_size, b
  4618. Set block size used for reverse IIR processing. If this value is set to high enough
  4619. value (higher than impulse response length truncated when reaches near zero values) filtering
  4620. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4621. Note that filter delay will be exactly this many samples when set to non-zero value.
  4622. @end table
  4623. @subsection Examples
  4624. @itemize
  4625. @item
  4626. Lowpass only LFE channel, it LFE is not present it does nothing:
  4627. @example
  4628. lowpass=c=LFE
  4629. @end example
  4630. @end itemize
  4631. @subsection Commands
  4632. This filter supports the following commands:
  4633. @table @option
  4634. @item frequency, f
  4635. Change lowpass frequency.
  4636. Syntax for the command is : "@var{frequency}"
  4637. @item width_type, t
  4638. Change lowpass width_type.
  4639. Syntax for the command is : "@var{width_type}"
  4640. @item width, w
  4641. Change lowpass width.
  4642. Syntax for the command is : "@var{width}"
  4643. @item mix, m
  4644. Change lowpass mix.
  4645. Syntax for the command is : "@var{mix}"
  4646. @end table
  4647. @section lv2
  4648. Load a LV2 (LADSPA Version 2) plugin.
  4649. To enable compilation of this filter you need to configure FFmpeg with
  4650. @code{--enable-lv2}.
  4651. @table @option
  4652. @item plugin, p
  4653. Specifies the plugin URI. You may need to escape ':'.
  4654. @item controls, c
  4655. Set the '|' separated list of controls which are zero or more floating point
  4656. values that determine the behavior of the loaded plugin (for example delay,
  4657. threshold or gain).
  4658. If @option{controls} is set to @code{help}, all available controls and
  4659. their valid ranges are printed.
  4660. @item sample_rate, s
  4661. Specify the sample rate, default to 44100. Only used if plugin have
  4662. zero inputs.
  4663. @item nb_samples, n
  4664. Set the number of samples per channel per each output frame, default
  4665. is 1024. Only used if plugin have zero inputs.
  4666. @item duration, d
  4667. Set the minimum duration of the sourced audio. See
  4668. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4669. for the accepted syntax.
  4670. Note that the resulting duration may be greater than the specified duration,
  4671. as the generated audio is always cut at the end of a complete frame.
  4672. If not specified, or the expressed duration is negative, the audio is
  4673. supposed to be generated forever.
  4674. Only used if plugin have zero inputs.
  4675. @end table
  4676. @subsection Examples
  4677. @itemize
  4678. @item
  4679. Apply bass enhancer plugin from Calf:
  4680. @example
  4681. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4682. @end example
  4683. @item
  4684. Apply vinyl plugin from Calf:
  4685. @example
  4686. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4687. @end example
  4688. @item
  4689. Apply bit crusher plugin from ArtyFX:
  4690. @example
  4691. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4692. @end example
  4693. @end itemize
  4694. @subsection Commands
  4695. This filter supports all options that are exported by plugin as commands.
  4696. @section mcompand
  4697. Multiband Compress or expand the audio's dynamic range.
  4698. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4699. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4700. response when absent compander action.
  4701. It accepts the following parameters:
  4702. @table @option
  4703. @item args
  4704. This option syntax is:
  4705. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4706. For explanation of each item refer to compand filter documentation.
  4707. @end table
  4708. @anchor{pan}
  4709. @section pan
  4710. Mix channels with specific gain levels. The filter accepts the output
  4711. channel layout followed by a set of channels definitions.
  4712. This filter is also designed to efficiently remap the channels of an audio
  4713. stream.
  4714. The filter accepts parameters of the form:
  4715. "@var{l}|@var{outdef}|@var{outdef}|..."
  4716. @table @option
  4717. @item l
  4718. output channel layout or number of channels
  4719. @item outdef
  4720. output channel specification, of the form:
  4721. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4722. @item out_name
  4723. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4724. number (c0, c1, etc.)
  4725. @item gain
  4726. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4727. @item in_name
  4728. input channel to use, see out_name for details; it is not possible to mix
  4729. named and numbered input channels
  4730. @end table
  4731. If the `=' in a channel specification is replaced by `<', then the gains for
  4732. that specification will be renormalized so that the total is 1, thus
  4733. avoiding clipping noise.
  4734. @subsection Mixing examples
  4735. For example, if you want to down-mix from stereo to mono, but with a bigger
  4736. factor for the left channel:
  4737. @example
  4738. pan=1c|c0=0.9*c0+0.1*c1
  4739. @end example
  4740. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4741. 7-channels surround:
  4742. @example
  4743. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4744. @end example
  4745. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4746. that should be preferred (see "-ac" option) unless you have very specific
  4747. needs.
  4748. @subsection Remapping examples
  4749. The channel remapping will be effective if, and only if:
  4750. @itemize
  4751. @item gain coefficients are zeroes or ones,
  4752. @item only one input per channel output,
  4753. @end itemize
  4754. If all these conditions are satisfied, the filter will notify the user ("Pure
  4755. channel mapping detected"), and use an optimized and lossless method to do the
  4756. remapping.
  4757. For example, if you have a 5.1 source and want a stereo audio stream by
  4758. dropping the extra channels:
  4759. @example
  4760. pan="stereo| c0=FL | c1=FR"
  4761. @end example
  4762. Given the same source, you can also switch front left and front right channels
  4763. and keep the input channel layout:
  4764. @example
  4765. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4766. @end example
  4767. If the input is a stereo audio stream, you can mute the front left channel (and
  4768. still keep the stereo channel layout) with:
  4769. @example
  4770. pan="stereo|c1=c1"
  4771. @end example
  4772. Still with a stereo audio stream input, you can copy the right channel in both
  4773. front left and right:
  4774. @example
  4775. pan="stereo| c0=FR | c1=FR"
  4776. @end example
  4777. @section replaygain
  4778. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4779. outputs it unchanged.
  4780. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4781. The filter accepts the following exported read-only options:
  4782. @table @option
  4783. @item track_gain
  4784. Exported track gain in dB at end of stream.
  4785. @item track_peak
  4786. Exported track peak at end of stream.
  4787. @end table
  4788. @section resample
  4789. Convert the audio sample format, sample rate and channel layout. It is
  4790. not meant to be used directly.
  4791. @section rubberband
  4792. Apply time-stretching and pitch-shifting with librubberband.
  4793. To enable compilation of this filter, you need to configure FFmpeg with
  4794. @code{--enable-librubberband}.
  4795. The filter accepts the following options:
  4796. @table @option
  4797. @item tempo
  4798. Set tempo scale factor.
  4799. @item pitch
  4800. Set pitch scale factor.
  4801. @item transients
  4802. Set transients detector.
  4803. Possible values are:
  4804. @table @var
  4805. @item crisp
  4806. @item mixed
  4807. @item smooth
  4808. @end table
  4809. @item detector
  4810. Set detector.
  4811. Possible values are:
  4812. @table @var
  4813. @item compound
  4814. @item percussive
  4815. @item soft
  4816. @end table
  4817. @item phase
  4818. Set phase.
  4819. Possible values are:
  4820. @table @var
  4821. @item laminar
  4822. @item independent
  4823. @end table
  4824. @item window
  4825. Set processing window size.
  4826. Possible values are:
  4827. @table @var
  4828. @item standard
  4829. @item short
  4830. @item long
  4831. @end table
  4832. @item smoothing
  4833. Set smoothing.
  4834. Possible values are:
  4835. @table @var
  4836. @item off
  4837. @item on
  4838. @end table
  4839. @item formant
  4840. Enable formant preservation when shift pitching.
  4841. Possible values are:
  4842. @table @var
  4843. @item shifted
  4844. @item preserved
  4845. @end table
  4846. @item pitchq
  4847. Set pitch quality.
  4848. Possible values are:
  4849. @table @var
  4850. @item quality
  4851. @item speed
  4852. @item consistency
  4853. @end table
  4854. @item channels
  4855. Set channels.
  4856. Possible values are:
  4857. @table @var
  4858. @item apart
  4859. @item together
  4860. @end table
  4861. @end table
  4862. @subsection Commands
  4863. This filter supports the following commands:
  4864. @table @option
  4865. @item tempo
  4866. Change filter tempo scale factor.
  4867. Syntax for the command is : "@var{tempo}"
  4868. @item pitch
  4869. Change filter pitch scale factor.
  4870. Syntax for the command is : "@var{pitch}"
  4871. @end table
  4872. @section sidechaincompress
  4873. This filter acts like normal compressor but has the ability to compress
  4874. detected signal using second input signal.
  4875. It needs two input streams and returns one output stream.
  4876. First input stream will be processed depending on second stream signal.
  4877. The filtered signal then can be filtered with other filters in later stages of
  4878. processing. See @ref{pan} and @ref{amerge} filter.
  4879. The filter accepts the following options:
  4880. @table @option
  4881. @item level_in
  4882. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4883. @item mode
  4884. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4885. Default is @code{downward}.
  4886. @item threshold
  4887. If a signal of second stream raises above this level it will affect the gain
  4888. reduction of first stream.
  4889. By default is 0.125. Range is between 0.00097563 and 1.
  4890. @item ratio
  4891. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4892. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4893. Default is 2. Range is between 1 and 20.
  4894. @item attack
  4895. Amount of milliseconds the signal has to rise above the threshold before gain
  4896. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4897. @item release
  4898. Amount of milliseconds the signal has to fall below the threshold before
  4899. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4900. @item makeup
  4901. Set the amount by how much signal will be amplified after processing.
  4902. Default is 1. Range is from 1 to 64.
  4903. @item knee
  4904. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4905. Default is 2.82843. Range is between 1 and 8.
  4906. @item link
  4907. Choose if the @code{average} level between all channels of side-chain stream
  4908. or the louder(@code{maximum}) channel of side-chain stream affects the
  4909. reduction. Default is @code{average}.
  4910. @item detection
  4911. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4912. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4913. @item level_sc
  4914. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4915. @item mix
  4916. How much to use compressed signal in output. Default is 1.
  4917. Range is between 0 and 1.
  4918. @end table
  4919. @subsection Commands
  4920. This filter supports the all above options as @ref{commands}.
  4921. @subsection Examples
  4922. @itemize
  4923. @item
  4924. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4925. depending on the signal of 2nd input and later compressed signal to be
  4926. merged with 2nd input:
  4927. @example
  4928. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4929. @end example
  4930. @end itemize
  4931. @section sidechaingate
  4932. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4933. filter the detected signal before sending it to the gain reduction stage.
  4934. Normally a gate uses the full range signal to detect a level above the
  4935. threshold.
  4936. For example: If you cut all lower frequencies from your sidechain signal
  4937. the gate will decrease the volume of your track only if not enough highs
  4938. appear. With this technique you are able to reduce the resonation of a
  4939. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4940. guitar.
  4941. It needs two input streams and returns one output stream.
  4942. First input stream will be processed depending on second stream signal.
  4943. The filter accepts the following options:
  4944. @table @option
  4945. @item level_in
  4946. Set input level before filtering.
  4947. Default is 1. Allowed range is from 0.015625 to 64.
  4948. @item mode
  4949. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4950. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4951. will be amplified, expanding dynamic range in upward direction.
  4952. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4953. @item range
  4954. Set the level of gain reduction when the signal is below the threshold.
  4955. Default is 0.06125. Allowed range is from 0 to 1.
  4956. Setting this to 0 disables reduction and then filter behaves like expander.
  4957. @item threshold
  4958. If a signal rises above this level the gain reduction is released.
  4959. Default is 0.125. Allowed range is from 0 to 1.
  4960. @item ratio
  4961. Set a ratio about which the signal is reduced.
  4962. Default is 2. Allowed range is from 1 to 9000.
  4963. @item attack
  4964. Amount of milliseconds the signal has to rise above the threshold before gain
  4965. reduction stops.
  4966. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4967. @item release
  4968. Amount of milliseconds the signal has to fall below the threshold before the
  4969. reduction is increased again. Default is 250 milliseconds.
  4970. Allowed range is from 0.01 to 9000.
  4971. @item makeup
  4972. Set amount of amplification of signal after processing.
  4973. Default is 1. Allowed range is from 1 to 64.
  4974. @item knee
  4975. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4976. Default is 2.828427125. Allowed range is from 1 to 8.
  4977. @item detection
  4978. Choose if exact signal should be taken for detection or an RMS like one.
  4979. Default is rms. Can be peak or rms.
  4980. @item link
  4981. Choose if the average level between all channels or the louder channel affects
  4982. the reduction.
  4983. Default is average. Can be average or maximum.
  4984. @item level_sc
  4985. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4986. @end table
  4987. @subsection Commands
  4988. This filter supports the all above options as @ref{commands}.
  4989. @section silencedetect
  4990. Detect silence in an audio stream.
  4991. This filter logs a message when it detects that the input audio volume is less
  4992. or equal to a noise tolerance value for a duration greater or equal to the
  4993. minimum detected noise duration.
  4994. The printed times and duration are expressed in seconds. The
  4995. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4996. is set on the first frame whose timestamp equals or exceeds the detection
  4997. duration and it contains the timestamp of the first frame of the silence.
  4998. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4999. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  5000. keys are set on the first frame after the silence. If @option{mono} is
  5001. enabled, and each channel is evaluated separately, the @code{.X}
  5002. suffixed keys are used, and @code{X} corresponds to the channel number.
  5003. The filter accepts the following options:
  5004. @table @option
  5005. @item noise, n
  5006. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  5007. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  5008. @item duration, d
  5009. Set silence duration until notification (default is 2 seconds). See
  5010. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5011. for the accepted syntax.
  5012. @item mono, m
  5013. Process each channel separately, instead of combined. By default is disabled.
  5014. @end table
  5015. @subsection Examples
  5016. @itemize
  5017. @item
  5018. Detect 5 seconds of silence with -50dB noise tolerance:
  5019. @example
  5020. silencedetect=n=-50dB:d=5
  5021. @end example
  5022. @item
  5023. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  5024. tolerance in @file{silence.mp3}:
  5025. @example
  5026. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  5027. @end example
  5028. @end itemize
  5029. @section silenceremove
  5030. Remove silence from the beginning, middle or end of the audio.
  5031. The filter accepts the following options:
  5032. @table @option
  5033. @item start_periods
  5034. This value is used to indicate if audio should be trimmed at beginning of
  5035. the audio. A value of zero indicates no silence should be trimmed from the
  5036. beginning. When specifying a non-zero value, it trims audio up until it
  5037. finds non-silence. Normally, when trimming silence from beginning of audio
  5038. the @var{start_periods} will be @code{1} but it can be increased to higher
  5039. values to trim all audio up to specific count of non-silence periods.
  5040. Default value is @code{0}.
  5041. @item start_duration
  5042. Specify the amount of time that non-silence must be detected before it stops
  5043. trimming audio. By increasing the duration, bursts of noises can be treated
  5044. as silence and trimmed off. Default value is @code{0}.
  5045. @item start_threshold
  5046. This indicates what sample value should be treated as silence. For digital
  5047. audio, a value of @code{0} may be fine but for audio recorded from analog,
  5048. you may wish to increase the value to account for background noise.
  5049. Can be specified in dB (in case "dB" is appended to the specified value)
  5050. or amplitude ratio. Default value is @code{0}.
  5051. @item start_silence
  5052. Specify max duration of silence at beginning that will be kept after
  5053. trimming. Default is 0, which is equal to trimming all samples detected
  5054. as silence.
  5055. @item start_mode
  5056. Specify mode of detection of silence end at start of multi-channel audio.
  5057. Can be @var{any} or @var{all}. Default is @var{any}.
  5058. With @var{any}, any sample from any channel that is detected as non-silence
  5059. will trigger end of silence trimming at start of audio stream.
  5060. With @var{all}, only if every sample from every channel is detected as non-silence
  5061. will trigger end of silence trimming at start of audio stream, limited usage.
  5062. @item stop_periods
  5063. Set the count for trimming silence from the end of audio. When specifying a
  5064. positive value, it trims audio after it finds specified silence period.
  5065. To remove silence from the middle of a file, specify a @var{stop_periods}
  5066. that is negative. This value is then treated as a positive value and is
  5067. used to indicate the effect should restart processing as specified by
  5068. @var{stop_periods}, making it suitable for removing periods of silence
  5069. in the middle of the audio.
  5070. Default value is @code{0}.
  5071. @item stop_duration
  5072. Specify a duration of silence that must exist before audio is not copied any
  5073. more. By specifying a higher duration, silence that is wanted can be left in
  5074. the audio.
  5075. Default value is @code{0}.
  5076. @item stop_threshold
  5077. This is the same as @option{start_threshold} but for trimming silence from
  5078. the end of audio.
  5079. Can be specified in dB (in case "dB" is appended to the specified value)
  5080. or amplitude ratio. Default value is @code{0}.
  5081. @item stop_silence
  5082. Specify max duration of silence at end that will be kept after
  5083. trimming. Default is 0, which is equal to trimming all samples detected
  5084. as silence.
  5085. @item stop_mode
  5086. Specify mode of detection of silence start after start of multi-channel audio.
  5087. Can be @var{any} or @var{all}. Default is @var{all}.
  5088. With @var{any}, any sample from any channel that is detected as silence
  5089. will trigger start of silence trimming after start of audio stream, limited usage.
  5090. With @var{all}, only if every sample from every channel is detected as silence
  5091. will trigger start of silence trimming after start of audio stream.
  5092. @item detection
  5093. Set how is silence detected.
  5094. @table @option
  5095. @item avg
  5096. Mean of absolute values of samples in moving window.
  5097. @item rms
  5098. Root squared mean of absolute values of samples in moving window.
  5099. @item peak
  5100. Maximum of absolute values of samples in moving window.
  5101. @item median
  5102. Median of absolute values of samples in moving window.
  5103. @item ptp
  5104. Absolute of max peak to min peak difference of samples in moving window.
  5105. @item dev
  5106. Standard deviation of values of samples in moving window.
  5107. @end table
  5108. Default value is @code{rms}.
  5109. @item window
  5110. Set duration in number of seconds used to calculate size of window in number
  5111. of samples for detecting silence. Using @code{0} will effectively disable
  5112. any windowing and use only single sample per channel for silence detection.
  5113. In that case it may be needed to also set @option{start_silence} and/or
  5114. @option{stop_silence} to nonzero values with also @option{start_duration} and/or
  5115. @option{stop_duration} to nonzero values.
  5116. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  5117. @item timestamp
  5118. Set processing mode of every audio frame output timestamp.
  5119. @table @option
  5120. @item write
  5121. Full timestamps rewrite, keep only the start time for the first output frame.
  5122. @item copy
  5123. Non-dropped frames are left with same timestamp as input audio frame.
  5124. @end table
  5125. Defaults value is @code{write}.
  5126. @end table
  5127. @subsection Examples
  5128. @itemize
  5129. @item
  5130. The following example shows how this filter can be used to start a recording
  5131. that does not contain the delay at the start which usually occurs between
  5132. pressing the record button and the start of the performance:
  5133. @example
  5134. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  5135. @end example
  5136. @item
  5137. Trim all silence encountered from beginning to end where there is more than 1
  5138. second of silence in audio:
  5139. @example
  5140. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  5141. @end example
  5142. @item
  5143. Trim all digital silence samples, using peak detection, from beginning to end
  5144. where there is more than 0 samples of digital silence in audio and digital
  5145. silence is detected in all channels at same positions in stream:
  5146. @example
  5147. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  5148. @end example
  5149. @item
  5150. Trim every 2nd encountered silence period from beginning to end where there is
  5151. more than 1 second of silence per silence period in audio:
  5152. @example
  5153. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB
  5154. @end example
  5155. @item
  5156. Similar as above, but keep maximum of 0.5 seconds of silence from each trimmed period:
  5157. @example
  5158. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5
  5159. @end example
  5160. @item
  5161. Similar as above, but keep maximum of 1.5 seconds of silence from start of audio:
  5162. @example
  5163. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5:start_periods=1:start_duration=1:start_silence=1.5:stop_threshold=-90dB
  5164. @end example
  5165. @end itemize
  5166. @subsection Commands
  5167. This filter supports some above options as @ref{commands}.
  5168. @section sofalizer
  5169. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  5170. loudspeakers around the user for binaural listening via headphones (audio
  5171. formats up to 9 channels supported).
  5172. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  5173. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  5174. Austrian Academy of Sciences.
  5175. To enable compilation of this filter you need to configure FFmpeg with
  5176. @code{--enable-libmysofa}.
  5177. The filter accepts the following options:
  5178. @table @option
  5179. @item sofa
  5180. Set the SOFA file used for rendering.
  5181. @item gain
  5182. Set gain applied to audio. Value is in dB. Default is 0.
  5183. @item rotation
  5184. Set rotation of virtual loudspeakers in deg. Default is 0.
  5185. @item elevation
  5186. Set elevation of virtual speakers in deg. Default is 0.
  5187. @item radius
  5188. Set distance in meters between loudspeakers and the listener with near-field
  5189. HRTFs. Default is 1.
  5190. @item type
  5191. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  5192. processing audio in time domain which is slow.
  5193. @var{freq} is processing audio in frequency domain which is fast.
  5194. Default is @var{freq}.
  5195. @item speakers
  5196. Set custom positions of virtual loudspeakers. Syntax for this option is:
  5197. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  5198. Each virtual loudspeaker is described with short channel name following with
  5199. azimuth and elevation in degrees.
  5200. Each virtual loudspeaker description is separated by '|'.
  5201. For example to override front left and front right channel positions use:
  5202. 'speakers=FL 45 15|FR 345 15'.
  5203. Descriptions with unrecognised channel names are ignored.
  5204. @item lfegain
  5205. Set custom gain for LFE channels. Value is in dB. Default is 0.
  5206. @item framesize
  5207. Set custom frame size in number of samples. Default is 1024.
  5208. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  5209. is set to @var{freq}.
  5210. @item normalize
  5211. Should all IRs be normalized upon importing SOFA file.
  5212. By default is enabled.
  5213. @item interpolate
  5214. Should nearest IRs be interpolated with neighbor IRs if exact position
  5215. does not match. By default is disabled.
  5216. @item minphase
  5217. Minphase all IRs upon loading of SOFA file. By default is disabled.
  5218. @item anglestep
  5219. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  5220. @item radstep
  5221. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  5222. @end table
  5223. @subsection Examples
  5224. @itemize
  5225. @item
  5226. Using ClubFritz6 sofa file:
  5227. @example
  5228. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  5229. @end example
  5230. @item
  5231. Using ClubFritz12 sofa file and bigger radius with small rotation:
  5232. @example
  5233. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  5234. @end example
  5235. @item
  5236. Similar as above but with custom speaker positions for front left, front right, back left and back right
  5237. and also with custom gain:
  5238. @example
  5239. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  5240. @end example
  5241. @end itemize
  5242. @section speechnorm
  5243. Speech Normalizer.
  5244. This filter expands or compresses each half-cycle of audio samples
  5245. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  5246. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  5247. The filter accepts the following options:
  5248. @table @option
  5249. @item peak, p
  5250. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  5251. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  5252. @item expansion, e
  5253. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5254. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  5255. would be such that local peak value reaches target peak value but never to surpass it and that
  5256. ratio between new and previous peak value does not surpass this option value.
  5257. @item compression, c
  5258. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5259. This option controls maximum local half-cycle of samples compression. This option is used
  5260. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  5261. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  5262. that peak's half-cycle will be compressed by current compression factor.
  5263. @item threshold, t
  5264. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  5265. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  5266. Any half-cycle samples with their local peak value below or same as this option value will be
  5267. compressed by current compression factor, otherwise, if greater than threshold value they will be
  5268. expanded with expansion factor so that it could reach peak target value but never surpass it.
  5269. @item raise, r
  5270. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  5271. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  5272. each new half-cycle until it reaches @option{expansion} value.
  5273. Setting this options too high may lead to distortions.
  5274. @item fall, f
  5275. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  5276. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  5277. each new half-cycle until it reaches @option{compression} value.
  5278. @item channels, h
  5279. Specify which channels to filter, by default all available channels are filtered.
  5280. @item invert, i
  5281. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  5282. option. When enabled any half-cycle of samples with their local peak value below or same as
  5283. @option{threshold} option will be expanded otherwise it will be compressed.
  5284. @item link, l
  5285. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  5286. When disabled each filtered channel gain calculation is independent, otherwise when this option
  5287. is enabled the minimum of all possible gains for each filtered channel is used.
  5288. @item rms, m
  5289. Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized
  5290. audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0.
  5291. @end table
  5292. @subsection Commands
  5293. This filter supports the all above options as @ref{commands}.
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Weak and slow amplification:
  5298. @example
  5299. speechnorm=e=3:r=0.00001:l=1
  5300. @end example
  5301. @item
  5302. Moderate and slow amplification:
  5303. @example
  5304. speechnorm=e=6.25:r=0.00001:l=1
  5305. @end example
  5306. @item
  5307. Strong and fast amplification:
  5308. @example
  5309. speechnorm=e=12.5:r=0.0001:l=1
  5310. @end example
  5311. @item
  5312. Very strong and fast amplification:
  5313. @example
  5314. speechnorm=e=25:r=0.0001:l=1
  5315. @end example
  5316. @item
  5317. Extreme and fast amplification:
  5318. @example
  5319. speechnorm=e=50:r=0.0001:l=1
  5320. @end example
  5321. @end itemize
  5322. @section stereotools
  5323. This filter has some handy utilities to manage stereo signals, for converting
  5324. M/S stereo recordings to L/R signal while having control over the parameters
  5325. or spreading the stereo image of master track.
  5326. The filter accepts the following options:
  5327. @table @option
  5328. @item level_in
  5329. Set input level before filtering for both channels. Defaults is 1.
  5330. Allowed range is from 0.015625 to 64.
  5331. @item level_out
  5332. Set output level after filtering for both channels. Defaults is 1.
  5333. Allowed range is from 0.015625 to 64.
  5334. @item balance_in
  5335. Set input balance between both channels. Default is 0.
  5336. Allowed range is from -1 to 1.
  5337. @item balance_out
  5338. Set output balance between both channels. Default is 0.
  5339. Allowed range is from -1 to 1.
  5340. @item softclip
  5341. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  5342. clipping. Disabled by default.
  5343. @item mutel
  5344. Mute the left channel. Disabled by default.
  5345. @item muter
  5346. Mute the right channel. Disabled by default.
  5347. @item phasel
  5348. Change the phase of the left channel. Disabled by default.
  5349. @item phaser
  5350. Change the phase of the right channel. Disabled by default.
  5351. @item mode
  5352. Set stereo mode. Available values are:
  5353. @table @samp
  5354. @item lr>lr
  5355. Left/Right to Left/Right, this is default.
  5356. @item lr>ms
  5357. Left/Right to Mid/Side.
  5358. @item ms>lr
  5359. Mid/Side to Left/Right.
  5360. @item lr>ll
  5361. Left/Right to Left/Left.
  5362. @item lr>rr
  5363. Left/Right to Right/Right.
  5364. @item lr>l+r
  5365. Left/Right to Left + Right.
  5366. @item lr>rl
  5367. Left/Right to Right/Left.
  5368. @item ms>ll
  5369. Mid/Side to Left/Left.
  5370. @item ms>rr
  5371. Mid/Side to Right/Right.
  5372. @item ms>rl
  5373. Mid/Side to Right/Left.
  5374. @item lr>l-r
  5375. Left/Right to Left - Right.
  5376. @end table
  5377. @item slev
  5378. Set level of side signal. Default is 1.
  5379. Allowed range is from 0.015625 to 64.
  5380. @item sbal
  5381. Set balance of side signal. Default is 0.
  5382. Allowed range is from -1 to 1.
  5383. @item mlev
  5384. Set level of the middle signal. Default is 1.
  5385. Allowed range is from 0.015625 to 64.
  5386. @item mpan
  5387. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5388. @item base
  5389. Set stereo base between mono and inversed channels. Default is 0.
  5390. Allowed range is from -1 to 1.
  5391. @item delay
  5392. Set delay in milliseconds how much to delay left from right channel and
  5393. vice versa. Default is 0. Allowed range is from -20 to 20.
  5394. @item sclevel
  5395. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5396. @item phase
  5397. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5398. @item bmode_in, bmode_out
  5399. Set balance mode for balance_in/balance_out option.
  5400. Can be one of the following:
  5401. @table @samp
  5402. @item balance
  5403. Classic balance mode. Attenuate one channel at time.
  5404. Gain is raised up to 1.
  5405. @item amplitude
  5406. Similar as classic mode above but gain is raised up to 2.
  5407. @item power
  5408. Equal power distribution, from -6dB to +6dB range.
  5409. @end table
  5410. @end table
  5411. @subsection Commands
  5412. This filter supports the all above options as @ref{commands}.
  5413. @subsection Examples
  5414. @itemize
  5415. @item
  5416. Apply karaoke like effect:
  5417. @example
  5418. stereotools=mlev=0.015625
  5419. @end example
  5420. @item
  5421. Convert M/S signal to L/R:
  5422. @example
  5423. "stereotools=mode=ms>lr"
  5424. @end example
  5425. @end itemize
  5426. @section stereowiden
  5427. This filter enhance the stereo effect by suppressing signal common to both
  5428. channels and by delaying the signal of left into right and vice versa,
  5429. thereby widening the stereo effect.
  5430. The filter accepts the following options:
  5431. @table @option
  5432. @item delay
  5433. Time in milliseconds of the delay of left signal into right and vice versa.
  5434. Default is 20 milliseconds.
  5435. @item feedback
  5436. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5437. effect of left signal in right output and vice versa which gives widening
  5438. effect. Default is 0.3.
  5439. @item crossfeed
  5440. Cross feed of left into right with inverted phase. This helps in suppressing
  5441. the mono. If the value is 1 it will cancel all the signal common to both
  5442. channels. Default is 0.3.
  5443. @item drymix
  5444. Set level of input signal of original channel. Default is 0.8.
  5445. @end table
  5446. @subsection Commands
  5447. This filter supports the all above options except @code{delay} as @ref{commands}.
  5448. @section superequalizer
  5449. Apply 18 band equalizer.
  5450. The filter accepts the following options:
  5451. @table @option
  5452. @item 1b
  5453. Set 65Hz band gain.
  5454. @item 2b
  5455. Set 92Hz band gain.
  5456. @item 3b
  5457. Set 131Hz band gain.
  5458. @item 4b
  5459. Set 185Hz band gain.
  5460. @item 5b
  5461. Set 262Hz band gain.
  5462. @item 6b
  5463. Set 370Hz band gain.
  5464. @item 7b
  5465. Set 523Hz band gain.
  5466. @item 8b
  5467. Set 740Hz band gain.
  5468. @item 9b
  5469. Set 1047Hz band gain.
  5470. @item 10b
  5471. Set 1480Hz band gain.
  5472. @item 11b
  5473. Set 2093Hz band gain.
  5474. @item 12b
  5475. Set 2960Hz band gain.
  5476. @item 13b
  5477. Set 4186Hz band gain.
  5478. @item 14b
  5479. Set 5920Hz band gain.
  5480. @item 15b
  5481. Set 8372Hz band gain.
  5482. @item 16b
  5483. Set 11840Hz band gain.
  5484. @item 17b
  5485. Set 16744Hz band gain.
  5486. @item 18b
  5487. Set 20000Hz band gain.
  5488. @end table
  5489. @section surround
  5490. Apply audio surround upmix filter.
  5491. This filter allows to produce multichannel output from audio stream.
  5492. The filter accepts the following options:
  5493. @table @option
  5494. @item chl_out
  5495. Set output channel layout. By default, this is @var{5.1}.
  5496. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5497. for the required syntax.
  5498. @item chl_in
  5499. Set input channel layout. By default, this is @var{stereo}.
  5500. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5501. for the required syntax.
  5502. @item level_in
  5503. Set input volume level. By default, this is @var{1}.
  5504. @item level_out
  5505. Set output volume level. By default, this is @var{1}.
  5506. @item lfe
  5507. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5508. @item lfe_low
  5509. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5510. @item lfe_high
  5511. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5512. @item lfe_mode
  5513. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5514. In @var{add} mode, LFE channel is created from input audio and added to output.
  5515. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5516. also all non-LFE output channels are subtracted with output LFE channel.
  5517. @item smooth
  5518. Set temporal smoothness strength, used to gradually change factors when transforming
  5519. stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}.
  5520. Useful to improve output quality with @var{focus} option values greater than @var{0.0}.
  5521. Default is @var{0.0}. Only values inside this range and without edges are effective.
  5522. @item angle
  5523. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5524. Default is @var{90}.
  5525. @item focus
  5526. Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}.
  5527. Default is @var{0}.
  5528. @item fc_in
  5529. Set front center input volume. By default, this is @var{1}.
  5530. @item fc_out
  5531. Set front center output volume. By default, this is @var{1}.
  5532. @item fl_in
  5533. Set front left input volume. By default, this is @var{1}.
  5534. @item fl_out
  5535. Set front left output volume. By default, this is @var{1}.
  5536. @item fr_in
  5537. Set front right input volume. By default, this is @var{1}.
  5538. @item fr_out
  5539. Set front right output volume. By default, this is @var{1}.
  5540. @item sl_in
  5541. Set side left input volume. By default, this is @var{1}.
  5542. @item sl_out
  5543. Set side left output volume. By default, this is @var{1}.
  5544. @item sr_in
  5545. Set side right input volume. By default, this is @var{1}.
  5546. @item sr_out
  5547. Set side right output volume. By default, this is @var{1}.
  5548. @item bl_in
  5549. Set back left input volume. By default, this is @var{1}.
  5550. @item bl_out
  5551. Set back left output volume. By default, this is @var{1}.
  5552. @item br_in
  5553. Set back right input volume. By default, this is @var{1}.
  5554. @item br_out
  5555. Set back right output volume. By default, this is @var{1}.
  5556. @item bc_in
  5557. Set back center input volume. By default, this is @var{1}.
  5558. @item bc_out
  5559. Set back center output volume. By default, this is @var{1}.
  5560. @item lfe_in
  5561. Set LFE input volume. By default, this is @var{1}.
  5562. @item lfe_out
  5563. Set LFE output volume. By default, this is @var{1}.
  5564. @item allx
  5565. Set spread usage of stereo image across X axis for all channels.
  5566. Allowed range is from @var{-1} to @var{15}.
  5567. By default this value is negative @var{-1}, and thus unused.
  5568. @item ally
  5569. Set spread usage of stereo image across Y axis for all channels.
  5570. Allowed range is from @var{-1} to @var{15}.
  5571. By default this value is negative @var{-1}, and thus unused.
  5572. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5573. Set spread usage of stereo image across X axis for each channel.
  5574. Allowed range is from @var{0.06} to @var{15}.
  5575. By default this value is @var{0.5}.
  5576. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5577. Set spread usage of stereo image across Y axis for each channel.
  5578. Allowed range is from @var{0.06} to @var{15}.
  5579. By default this value is @var{0.5}.
  5580. @item win_size
  5581. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5582. @item win_func
  5583. Set window function.
  5584. It accepts the following values:
  5585. @table @samp
  5586. @item rect
  5587. @item bartlett
  5588. @item hann, hanning
  5589. @item hamming
  5590. @item blackman
  5591. @item welch
  5592. @item flattop
  5593. @item bharris
  5594. @item bnuttall
  5595. @item bhann
  5596. @item sine
  5597. @item nuttall
  5598. @item lanczos
  5599. @item gauss
  5600. @item tukey
  5601. @item dolph
  5602. @item cauchy
  5603. @item parzen
  5604. @item poisson
  5605. @item bohman
  5606. @item kaiser
  5607. @end table
  5608. Default is @code{hann}.
  5609. @item overlap
  5610. Set window overlap. If set to 1, the recommended overlap for selected
  5611. window function will be picked. Default is @code{0.5}.
  5612. @end table
  5613. @section tiltshelf
  5614. Boost or cut the lower frequencies and cut or boost higher frequencies
  5615. of the audio using a two-pole shelving filter with a response similar to
  5616. that of a standard hi-fi's tone-controls.
  5617. This is also known as shelving equalisation (EQ).
  5618. The filter accepts the following options:
  5619. @table @option
  5620. @item gain, g
  5621. Give the gain at 0 Hz. Its useful range is about -20
  5622. (for a large cut) to +20 (for a large boost).
  5623. Beware of clipping when using a positive gain.
  5624. @item frequency, f
  5625. Set the filter's central frequency and so can be used
  5626. to extend or reduce the frequency range to be boosted or cut.
  5627. The default value is @code{3000} Hz.
  5628. @item width_type, t
  5629. Set method to specify band-width of filter.
  5630. @table @option
  5631. @item h
  5632. Hz
  5633. @item q
  5634. Q-Factor
  5635. @item o
  5636. octave
  5637. @item s
  5638. slope
  5639. @item k
  5640. kHz
  5641. @end table
  5642. @item width, w
  5643. Determine how steep is the filter's shelf transition.
  5644. @item poles, p
  5645. Set number of poles. Default is 2.
  5646. @item mix, m
  5647. How much to use filtered signal in output. Default is 1.
  5648. Range is between 0 and 1.
  5649. @item channels, c
  5650. Specify which channels to filter, by default all available are filtered.
  5651. @item normalize, n
  5652. Normalize biquad coefficients, by default is disabled.
  5653. Enabling it will normalize magnitude response at DC to 0dB.
  5654. @item transform, a
  5655. Set transform type of IIR filter.
  5656. @table @option
  5657. @item di
  5658. @item dii
  5659. @item tdi
  5660. @item tdii
  5661. @item latt
  5662. @item svf
  5663. @item zdf
  5664. @end table
  5665. @item precision, r
  5666. Set precision of filtering.
  5667. @table @option
  5668. @item auto
  5669. Pick automatic sample format depending on surround filters.
  5670. @item s16
  5671. Always use signed 16-bit.
  5672. @item s32
  5673. Always use signed 32-bit.
  5674. @item f32
  5675. Always use float 32-bit.
  5676. @item f64
  5677. Always use float 64-bit.
  5678. @end table
  5679. @item block_size, b
  5680. Set block size used for reverse IIR processing. If this value is set to high enough
  5681. value (higher than impulse response length truncated when reaches near zero values) filtering
  5682. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5683. Note that filter delay will be exactly this many samples when set to non-zero value.
  5684. @end table
  5685. @subsection Commands
  5686. This filter supports some options as @ref{commands}.
  5687. @section treble, highshelf
  5688. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5689. shelving filter with a response similar to that of a standard
  5690. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5691. The filter accepts the following options:
  5692. @table @option
  5693. @item gain, g
  5694. Give the gain at whichever is the lower of ~22 kHz and the
  5695. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5696. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5697. @item frequency, f
  5698. Set the filter's central frequency and so can be used
  5699. to extend or reduce the frequency range to be boosted or cut.
  5700. The default value is @code{3000} Hz.
  5701. @item width_type, t
  5702. Set method to specify band-width of filter.
  5703. @table @option
  5704. @item h
  5705. Hz
  5706. @item q
  5707. Q-Factor
  5708. @item o
  5709. octave
  5710. @item s
  5711. slope
  5712. @item k
  5713. kHz
  5714. @end table
  5715. @item width, w
  5716. Determine how steep is the filter's shelf transition.
  5717. @item poles, p
  5718. Set number of poles. Default is 2.
  5719. @item mix, m
  5720. How much to use filtered signal in output. Default is 1.
  5721. Range is between 0 and 1.
  5722. @item channels, c
  5723. Specify which channels to filter, by default all available are filtered.
  5724. @item normalize, n
  5725. Normalize biquad coefficients, by default is disabled.
  5726. Enabling it will normalize magnitude response at DC to 0dB.
  5727. @item transform, a
  5728. Set transform type of IIR filter.
  5729. @table @option
  5730. @item di
  5731. @item dii
  5732. @item tdi
  5733. @item tdii
  5734. @item latt
  5735. @item svf
  5736. @item zdf
  5737. @end table
  5738. @item precision, r
  5739. Set precision of filtering.
  5740. @table @option
  5741. @item auto
  5742. Pick automatic sample format depending on surround filters.
  5743. @item s16
  5744. Always use signed 16-bit.
  5745. @item s32
  5746. Always use signed 32-bit.
  5747. @item f32
  5748. Always use float 32-bit.
  5749. @item f64
  5750. Always use float 64-bit.
  5751. @end table
  5752. @item block_size, b
  5753. Set block size used for reverse IIR processing. If this value is set to high enough
  5754. value (higher than impulse response length truncated when reaches near zero values) filtering
  5755. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5756. Note that filter delay will be exactly this many samples when set to non-zero value.
  5757. @end table
  5758. @subsection Commands
  5759. This filter supports the following commands:
  5760. @table @option
  5761. @item frequency, f
  5762. Change treble frequency.
  5763. Syntax for the command is : "@var{frequency}"
  5764. @item width_type, t
  5765. Change treble width_type.
  5766. Syntax for the command is : "@var{width_type}"
  5767. @item width, w
  5768. Change treble width.
  5769. Syntax for the command is : "@var{width}"
  5770. @item gain, g
  5771. Change treble gain.
  5772. Syntax for the command is : "@var{gain}"
  5773. @item mix, m
  5774. Change treble mix.
  5775. Syntax for the command is : "@var{mix}"
  5776. @end table
  5777. @section tremolo
  5778. Sinusoidal amplitude modulation.
  5779. The filter accepts the following options:
  5780. @table @option
  5781. @item f
  5782. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5783. (20 Hz or lower) will result in a tremolo effect.
  5784. This filter may also be used as a ring modulator by specifying
  5785. a modulation frequency higher than 20 Hz.
  5786. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5787. @item d
  5788. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5789. Default value is 0.5.
  5790. @end table
  5791. @section vibrato
  5792. Sinusoidal phase modulation.
  5793. The filter accepts the following options:
  5794. @table @option
  5795. @item f
  5796. Modulation frequency in Hertz.
  5797. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5798. @item d
  5799. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5800. Default value is 0.5.
  5801. @end table
  5802. @section virtualbass
  5803. Apply audio Virtual Bass filter.
  5804. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5805. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5806. This filter outputs front left and front right channels unchanged as available in stereo input.
  5807. The filter accepts the following options:
  5808. @table @option
  5809. @item cutoff
  5810. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5811. Allowed range is from 100 to 500 Hz.
  5812. @item strength
  5813. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5814. Default value is 3.
  5815. @end table
  5816. @section volume
  5817. Adjust the input audio volume.
  5818. It accepts the following parameters:
  5819. @table @option
  5820. @item volume
  5821. Set audio volume expression.
  5822. Output values are clipped to the maximum value.
  5823. The output audio volume is given by the relation:
  5824. @example
  5825. @var{output_volume} = @var{volume} * @var{input_volume}
  5826. @end example
  5827. The default value for @var{volume} is "1.0".
  5828. @item precision
  5829. This parameter represents the mathematical precision.
  5830. It determines which input sample formats will be allowed, which affects the
  5831. precision of the volume scaling.
  5832. @table @option
  5833. @item fixed
  5834. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5835. @item float
  5836. 32-bit floating-point; this limits input sample format to FLT. (default)
  5837. @item double
  5838. 64-bit floating-point; this limits input sample format to DBL.
  5839. @end table
  5840. @item replaygain
  5841. Choose the behaviour on encountering ReplayGain side data in input frames.
  5842. @table @option
  5843. @item drop
  5844. Remove ReplayGain side data, ignoring its contents (the default).
  5845. @item ignore
  5846. Ignore ReplayGain side data, but leave it in the frame.
  5847. @item track
  5848. Prefer the track gain, if present.
  5849. @item album
  5850. Prefer the album gain, if present.
  5851. @end table
  5852. @item replaygain_preamp
  5853. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5854. Default value for @var{replaygain_preamp} is 0.0.
  5855. @item replaygain_noclip
  5856. Prevent clipping by limiting the gain applied.
  5857. Default value for @var{replaygain_noclip} is 1.
  5858. @item eval
  5859. Set when the volume expression is evaluated.
  5860. It accepts the following values:
  5861. @table @samp
  5862. @item once
  5863. only evaluate expression once during the filter initialization, or
  5864. when the @samp{volume} command is sent
  5865. @item frame
  5866. evaluate expression for each incoming frame
  5867. @end table
  5868. Default value is @samp{once}.
  5869. @end table
  5870. The volume expression can contain the following parameters.
  5871. @table @option
  5872. @item n
  5873. frame number (starting at zero)
  5874. @item nb_channels
  5875. number of channels
  5876. @item nb_consumed_samples
  5877. number of samples consumed by the filter
  5878. @item nb_samples
  5879. number of samples in the current frame
  5880. @item pos
  5881. original frame position in the file; deprecated, do not use
  5882. @item pts
  5883. frame PTS
  5884. @item sample_rate
  5885. sample rate
  5886. @item startpts
  5887. PTS at start of stream
  5888. @item startt
  5889. time at start of stream
  5890. @item t
  5891. frame time
  5892. @item tb
  5893. timestamp timebase
  5894. @item volume
  5895. last set volume value
  5896. @end table
  5897. Note that when @option{eval} is set to @samp{once} only the
  5898. @var{sample_rate} and @var{tb} variables are available, all other
  5899. variables will evaluate to NAN.
  5900. @subsection Commands
  5901. This filter supports the following commands:
  5902. @table @option
  5903. @item volume
  5904. Modify the volume expression.
  5905. The command accepts the same syntax of the corresponding option.
  5906. If the specified expression is not valid, it is kept at its current
  5907. value.
  5908. @end table
  5909. @subsection Examples
  5910. @itemize
  5911. @item
  5912. Halve the input audio volume:
  5913. @example
  5914. volume=volume=0.5
  5915. volume=volume=1/2
  5916. volume=volume=-6.0206dB
  5917. @end example
  5918. In all the above example the named key for @option{volume} can be
  5919. omitted, for example like in:
  5920. @example
  5921. volume=0.5
  5922. @end example
  5923. @item
  5924. Increase input audio power by 6 decibels using fixed-point precision:
  5925. @example
  5926. volume=volume=6dB:precision=fixed
  5927. @end example
  5928. @item
  5929. Fade volume after time 10 with an annihilation period of 5 seconds:
  5930. @example
  5931. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5932. @end example
  5933. @end itemize
  5934. @section volumedetect
  5935. Detect the volume of the input video.
  5936. The filter has no parameters. It supports only 16-bit signed integer samples,
  5937. so the input will be converted when needed. Statistics about the volume will
  5938. be printed in the log when the input stream end is reached.
  5939. In particular it will show the mean volume (root mean square), maximum
  5940. volume (on a per-sample basis), and the beginning of a histogram of the
  5941. registered volume values (from the maximum value to a cumulated 1/1000 of
  5942. the samples).
  5943. All volumes are in decibels relative to the maximum PCM value.
  5944. @subsection Examples
  5945. Here is an excerpt of the output:
  5946. @example
  5947. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5948. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5949. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5950. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5951. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5952. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5953. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5954. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5955. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5956. @end example
  5957. It means that:
  5958. @itemize
  5959. @item
  5960. The mean square energy is approximately -27 dB, or 10^-2.7.
  5961. @item
  5962. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5963. @item
  5964. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5965. @end itemize
  5966. In other words, raising the volume by +4 dB does not cause any clipping,
  5967. raising it by +5 dB causes clipping for 6 samples, etc.
  5968. @c man end AUDIO FILTERS
  5969. @chapter Audio Sources
  5970. @c man begin AUDIO SOURCES
  5971. Below is a description of the currently available audio sources.
  5972. @section abuffer
  5973. Buffer audio frames, and make them available to the filter chain.
  5974. This source is mainly intended for a programmatic use, in particular
  5975. through the interface defined in @file{libavfilter/buffersrc.h}.
  5976. It accepts the following parameters:
  5977. @table @option
  5978. @item time_base
  5979. The timebase which will be used for timestamps of submitted frames. It must be
  5980. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5981. @item sample_rate
  5982. The sample rate of the incoming audio buffers.
  5983. @item sample_fmt
  5984. The sample format of the incoming audio buffers.
  5985. Either a sample format name or its corresponding integer representation from
  5986. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5987. @item channel_layout
  5988. The channel layout of the incoming audio buffers.
  5989. Either a channel layout name from channel_layout_map in
  5990. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5991. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5992. @item channels
  5993. The number of channels of the incoming audio buffers.
  5994. If both @var{channels} and @var{channel_layout} are specified, then they
  5995. must be consistent.
  5996. @end table
  5997. @subsection Examples
  5998. @example
  5999. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  6000. @end example
  6001. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  6002. Since the sample format with name "s16p" corresponds to the number
  6003. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  6004. equivalent to:
  6005. @example
  6006. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  6007. @end example
  6008. @section aevalsrc
  6009. Generate an audio signal specified by an expression.
  6010. This source accepts in input one or more expressions (one for each
  6011. channel), which are evaluated and used to generate a corresponding
  6012. audio signal.
  6013. This source accepts the following options:
  6014. @table @option
  6015. @item exprs
  6016. Set the '|'-separated expressions list for each separate channel. In case the
  6017. @option{channel_layout} option is not specified, the selected channel layout
  6018. depends on the number of provided expressions. Otherwise the last
  6019. specified expression is applied to the remaining output channels.
  6020. @item channel_layout, c
  6021. Set the channel layout. The number of channels in the specified layout
  6022. must be equal to the number of specified expressions.
  6023. @item duration, d
  6024. Set the minimum duration of the sourced audio. See
  6025. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6026. for the accepted syntax.
  6027. Note that the resulting duration may be greater than the specified
  6028. duration, as the generated audio is always cut at the end of a
  6029. complete frame.
  6030. If not specified, or the expressed duration is negative, the audio is
  6031. supposed to be generated forever.
  6032. @item nb_samples, n
  6033. Set the number of samples per channel per each output frame,
  6034. default to 1024.
  6035. @item sample_rate, s
  6036. Specify the sample rate, default to 44100.
  6037. @end table
  6038. Each expression in @var{exprs} can contain the following constants:
  6039. @table @option
  6040. @item n
  6041. number of the evaluated sample, starting from 0
  6042. @item t
  6043. time of the evaluated sample expressed in seconds, starting from 0
  6044. @item s
  6045. sample rate
  6046. @end table
  6047. @subsection Examples
  6048. @itemize
  6049. @item
  6050. Generate silence:
  6051. @example
  6052. aevalsrc=0
  6053. @end example
  6054. @item
  6055. Generate a sin signal with frequency of 440 Hz, set sample rate to
  6056. 8000 Hz:
  6057. @example
  6058. aevalsrc="sin(440*2*PI*t):s=8000"
  6059. @end example
  6060. @item
  6061. Generate a two channels signal, specify the channel layout (Front
  6062. Center + Back Center) explicitly:
  6063. @example
  6064. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  6065. @end example
  6066. @item
  6067. Generate white noise:
  6068. @example
  6069. aevalsrc="-2+random(0)"
  6070. @end example
  6071. @item
  6072. Generate an amplitude modulated signal:
  6073. @example
  6074. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  6075. @end example
  6076. @item
  6077. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  6078. @example
  6079. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  6080. @end example
  6081. @end itemize
  6082. @section afdelaysrc
  6083. Generate a fractional delay FIR coefficients.
  6084. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6085. The filter accepts the following options:
  6086. @table @option
  6087. @item delay, d
  6088. Set the fractional delay. Default is 0.
  6089. @item sample_rate, r
  6090. Set the sample rate, default is 44100.
  6091. @item nb_samples, n
  6092. Set the number of samples per each frame. Default is 1024.
  6093. @item taps, t
  6094. Set the number of filter coefficients in output audio stream.
  6095. Default value is 0.
  6096. @item channel_layout, c
  6097. Specifies the channel layout, and can be a string representing a channel layout.
  6098. The default value of @var{channel_layout} is "stereo".
  6099. @end table
  6100. @section afireqsrc
  6101. Generate a FIR equalizer coefficients.
  6102. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6103. The filter accepts the following options:
  6104. @table @option
  6105. @item preset, p
  6106. Set equalizer preset.
  6107. Default preset is @code{flat}.
  6108. Available presets are:
  6109. @table @samp
  6110. @item custom
  6111. @item flat
  6112. @item acoustic
  6113. @item bass
  6114. @item beats
  6115. @item classic
  6116. @item clear
  6117. @item deep bass
  6118. @item dubstep
  6119. @item electronic
  6120. @item hard-style
  6121. @item hip-hop
  6122. @item jazz
  6123. @item metal
  6124. @item movie
  6125. @item pop
  6126. @item r&b
  6127. @item rock
  6128. @item vocal booster
  6129. @end table
  6130. @item gains, g
  6131. Set custom gains for each band. Only used if the preset option is set to @code{custom}.
  6132. Gains are separated by white spaces and each gain is set in dBFS.
  6133. Default is @code{0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}.
  6134. @item bands, b
  6135. Set the custom bands from where custon equalizer gains are set.
  6136. This must be in strictly increasing order. Only used if the preset option is set to @code{custom}.
  6137. Bands are separated by white spaces and each band represent frequency in Hz.
  6138. Default is @code{25 40 63 100 160 250 400 630 1000 1600 2500 4000 6300 10000 16000 24000}.
  6139. @item taps, t
  6140. Set number of filter coefficients in output audio stream.
  6141. Default value is @code{4096}.
  6142. @item sample_rate, r
  6143. Set sample rate of output audio stream, default is @code{44100}.
  6144. @item nb_samples, n
  6145. Set number of samples per each frame in output audio stream. Default is @code{1024}.
  6146. @item interp, i
  6147. Set interpolation method for FIR equalizer coefficients. Can be @code{linear} or @code{cubic}.
  6148. @item phase, h
  6149. Set phase type of FIR filter. Can be @code{linear} or @code{min}: minimum-phase.
  6150. Default is minimum-phase filter.
  6151. @end table
  6152. @section afirsrc
  6153. Generate a FIR coefficients using frequency sampling method.
  6154. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6155. The filter accepts the following options:
  6156. @table @option
  6157. @item taps, t
  6158. Set number of filter coefficients in output audio stream.
  6159. Default value is 1025.
  6160. @item frequency, f
  6161. Set frequency points from where magnitude and phase are set.
  6162. This must be in non decreasing order, and first element must be 0, while last element
  6163. must be 1. Elements are separated by white spaces.
  6164. @item magnitude, m
  6165. Set magnitude value for every frequency point set by @option{frequency}.
  6166. Number of values must be same as number of frequency points.
  6167. Values are separated by white spaces.
  6168. @item phase, p
  6169. Set phase value for every frequency point set by @option{frequency}.
  6170. Number of values must be same as number of frequency points.
  6171. Values are separated by white spaces.
  6172. @item sample_rate, r
  6173. Set sample rate, default is 44100.
  6174. @item nb_samples, n
  6175. Set number of samples per each frame. Default is 1024.
  6176. @item win_func, w
  6177. Set window function. Default is blackman.
  6178. @end table
  6179. @section anullsrc
  6180. The null audio source, return unprocessed audio frames. It is mainly useful
  6181. as a template and to be employed in analysis / debugging tools, or as
  6182. the source for filters which ignore the input data (for example the sox
  6183. synth filter).
  6184. This source accepts the following options:
  6185. @table @option
  6186. @item channel_layout, cl
  6187. Specifies the channel layout, and can be either an integer or a string
  6188. representing a channel layout. The default value of @var{channel_layout}
  6189. is "stereo".
  6190. Check the channel_layout_map definition in
  6191. @file{libavutil/channel_layout.c} for the mapping between strings and
  6192. channel layout values.
  6193. @item sample_rate, r
  6194. Specifies the sample rate, and defaults to 44100.
  6195. @item nb_samples, n
  6196. Set the number of samples per requested frames.
  6197. @item duration, d
  6198. Set the duration of the sourced audio. See
  6199. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6200. for the accepted syntax.
  6201. If not specified, or the expressed duration is negative, the audio is
  6202. supposed to be generated forever.
  6203. @end table
  6204. @subsection Examples
  6205. @itemize
  6206. @item
  6207. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  6208. @example
  6209. anullsrc=r=48000:cl=4
  6210. @end example
  6211. @item
  6212. Do the same operation with a more obvious syntax:
  6213. @example
  6214. anullsrc=r=48000:cl=mono
  6215. @end example
  6216. @end itemize
  6217. All the parameters need to be explicitly defined.
  6218. @section flite
  6219. Synthesize a voice utterance using the libflite library.
  6220. To enable compilation of this filter you need to configure FFmpeg with
  6221. @code{--enable-libflite}.
  6222. Note that versions of the flite library prior to 2.0 are not thread-safe.
  6223. The filter accepts the following options:
  6224. @table @option
  6225. @item list_voices
  6226. If set to 1, list the names of the available voices and exit
  6227. immediately. Default value is 0.
  6228. @item nb_samples, n
  6229. Set the maximum number of samples per frame. Default value is 512.
  6230. @item textfile
  6231. Set the filename containing the text to speak.
  6232. @item text
  6233. Set the text to speak.
  6234. @item voice, v
  6235. Set the voice to use for the speech synthesis. Default value is
  6236. @code{kal}. See also the @var{list_voices} option.
  6237. @end table
  6238. @subsection Examples
  6239. @itemize
  6240. @item
  6241. Read from file @file{speech.txt}, and synthesize the text using the
  6242. standard flite voice:
  6243. @example
  6244. flite=textfile=speech.txt
  6245. @end example
  6246. @item
  6247. Read the specified text selecting the @code{slt} voice:
  6248. @example
  6249. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6250. @end example
  6251. @item
  6252. Input text to ffmpeg:
  6253. @example
  6254. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6255. @end example
  6256. @item
  6257. Make @file{ffplay} speak the specified text, using @code{flite} and
  6258. the @code{lavfi} device:
  6259. @example
  6260. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  6261. @end example
  6262. @end itemize
  6263. For more information about libflite, check:
  6264. @url{http://www.festvox.org/flite/}
  6265. @section anoisesrc
  6266. Generate a noise audio signal.
  6267. The filter accepts the following options:
  6268. @table @option
  6269. @item sample_rate, r
  6270. Specify the sample rate. Default value is 48000 Hz.
  6271. @item amplitude, a
  6272. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  6273. is 1.0.
  6274. @item duration, d
  6275. Specify the duration of the generated audio stream. Not specifying this option
  6276. results in noise with an infinite length.
  6277. @item color, colour, c
  6278. Specify the color of noise. Available noise colors are white, pink, brown,
  6279. blue, violet and velvet. Default color is white.
  6280. @item seed, s
  6281. Specify a value used to seed the PRNG.
  6282. @item nb_samples, n
  6283. Set the number of samples per each output frame, default is 1024.
  6284. @item density
  6285. Set the density (0.0 - 1.0) for the velvet noise generator, default is 0.05.
  6286. @end table
  6287. @subsection Examples
  6288. @itemize
  6289. @item
  6290. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  6291. @example
  6292. anoisesrc=d=60:c=pink:r=44100:a=0.5
  6293. @end example
  6294. @end itemize
  6295. @section hilbert
  6296. Generate odd-tap Hilbert transform FIR coefficients.
  6297. The resulting stream can be used with @ref{afir} filter for phase-shifting
  6298. the signal by 90 degrees.
  6299. This is used in many matrix coding schemes and for analytic signal generation.
  6300. The process is often written as a multiplication by i (or j), the imaginary unit.
  6301. The filter accepts the following options:
  6302. @table @option
  6303. @item sample_rate, s
  6304. Set sample rate, default is 44100.
  6305. @item taps, t
  6306. Set length of FIR filter, default is 22051.
  6307. @item nb_samples, n
  6308. Set number of samples per each frame.
  6309. @item win_func, w
  6310. Set window function to be used when generating FIR coefficients.
  6311. @end table
  6312. @section sinc
  6313. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  6314. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6315. The filter accepts the following options:
  6316. @table @option
  6317. @item sample_rate, r
  6318. Set sample rate, default is 44100.
  6319. @item nb_samples, n
  6320. Set number of samples per each frame. Default is 1024.
  6321. @item hp
  6322. Set high-pass frequency. Default is 0.
  6323. @item lp
  6324. Set low-pass frequency. Default is 0.
  6325. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  6326. is higher than 0 then filter will create band-pass filter coefficients,
  6327. otherwise band-reject filter coefficients.
  6328. @item phase
  6329. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  6330. @item beta
  6331. Set Kaiser window beta.
  6332. @item att
  6333. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  6334. @item round
  6335. Enable rounding, by default is disabled.
  6336. @item hptaps
  6337. Set number of taps for high-pass filter.
  6338. @item lptaps
  6339. Set number of taps for low-pass filter.
  6340. @end table
  6341. @section sine
  6342. Generate an audio signal made of a sine wave with amplitude 1/8.
  6343. The audio signal is bit-exact.
  6344. The filter accepts the following options:
  6345. @table @option
  6346. @item frequency, f
  6347. Set the carrier frequency. Default is 440 Hz.
  6348. @item beep_factor, b
  6349. Enable a periodic beep every second with frequency @var{beep_factor} times
  6350. the carrier frequency. Default is 0, meaning the beep is disabled.
  6351. @item sample_rate, r
  6352. Specify the sample rate, default is 44100.
  6353. @item duration, d
  6354. Specify the duration of the generated audio stream.
  6355. @item samples_per_frame
  6356. Set the number of samples per output frame.
  6357. The expression can contain the following constants:
  6358. @table @option
  6359. @item n
  6360. The (sequential) number of the output audio frame, starting from 0.
  6361. @item pts
  6362. The PTS (Presentation TimeStamp) of the output audio frame,
  6363. expressed in @var{TB} units.
  6364. @item t
  6365. The PTS of the output audio frame, expressed in seconds.
  6366. @item TB
  6367. The timebase of the output audio frames.
  6368. @end table
  6369. Default is @code{1024}.
  6370. @end table
  6371. @subsection Examples
  6372. @itemize
  6373. @item
  6374. Generate a simple 440 Hz sine wave:
  6375. @example
  6376. sine
  6377. @end example
  6378. @item
  6379. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  6380. @example
  6381. sine=220:4:d=5
  6382. sine=f=220:b=4:d=5
  6383. sine=frequency=220:beep_factor=4:duration=5
  6384. @end example
  6385. @item
  6386. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  6387. pattern:
  6388. @example
  6389. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  6390. @end example
  6391. @end itemize
  6392. @c man end AUDIO SOURCES
  6393. @chapter Audio Sinks
  6394. @c man begin AUDIO SINKS
  6395. Below is a description of the currently available audio sinks.
  6396. @section abuffersink
  6397. Buffer audio frames, and make them available to the end of filter chain.
  6398. This sink is mainly intended for programmatic use, in particular
  6399. through the interface defined in @file{libavfilter/buffersink.h}
  6400. or the options system.
  6401. It accepts a pointer to an AVABufferSinkContext structure, which
  6402. defines the incoming buffers' formats, to be passed as the opaque
  6403. parameter to @code{avfilter_init_filter} for initialization.
  6404. @section anullsink
  6405. Null audio sink; do absolutely nothing with the input audio. It is
  6406. mainly useful as a template and for use in analysis / debugging
  6407. tools.
  6408. @c man end AUDIO SINKS
  6409. @chapter Video Filters
  6410. @c man begin VIDEO FILTERS
  6411. When you configure your FFmpeg build, you can disable any of the
  6412. existing filters using @code{--disable-filters}.
  6413. The configure output will show the video filters included in your
  6414. build.
  6415. Below is a description of the currently available video filters.
  6416. @section addroi
  6417. Mark a region of interest in a video frame.
  6418. The frame data is passed through unchanged, but metadata is attached
  6419. to the frame indicating regions of interest which can affect the
  6420. behaviour of later encoding. Multiple regions can be marked by
  6421. applying the filter multiple times.
  6422. @table @option
  6423. @item x
  6424. Region distance in pixels from the left edge of the frame.
  6425. @item y
  6426. Region distance in pixels from the top edge of the frame.
  6427. @item w
  6428. Region width in pixels.
  6429. @item h
  6430. Region height in pixels.
  6431. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  6432. and may contain the following variables:
  6433. @table @option
  6434. @item iw
  6435. Width of the input frame.
  6436. @item ih
  6437. Height of the input frame.
  6438. @end table
  6439. @item qoffset
  6440. Quantisation offset to apply within the region.
  6441. This must be a real value in the range -1 to +1. A value of zero
  6442. indicates no quality change. A negative value asks for better quality
  6443. (less quantisation), while a positive value asks for worse quality
  6444. (greater quantisation).
  6445. The range is calibrated so that the extreme values indicate the
  6446. largest possible offset - if the rest of the frame is encoded with the
  6447. worst possible quality, an offset of -1 indicates that this region
  6448. should be encoded with the best possible quality anyway. Intermediate
  6449. values are then interpolated in some codec-dependent way.
  6450. For example, in 10-bit H.264 the quantisation parameter varies between
  6451. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6452. this region should be encoded with a QP around one-tenth of the full
  6453. range better than the rest of the frame. So, if most of the frame
  6454. were to be encoded with a QP of around 30, this region would get a QP
  6455. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6456. An extreme value of -1 would indicate that this region should be
  6457. encoded with the best possible quality regardless of the treatment of
  6458. the rest of the frame - that is, should be encoded at a QP of -12.
  6459. @item clear
  6460. If set to true, remove any existing regions of interest marked on the
  6461. frame before adding the new one.
  6462. @end table
  6463. @subsection Examples
  6464. @itemize
  6465. @item
  6466. Mark the centre quarter of the frame as interesting.
  6467. @example
  6468. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6469. @end example
  6470. @item
  6471. Mark the 100-pixel-wide region on the left edge of the frame as very
  6472. uninteresting (to be encoded at much lower quality than the rest of
  6473. the frame).
  6474. @example
  6475. addroi=0:0:100:ih:+1/5
  6476. @end example
  6477. @end itemize
  6478. @section alphaextract
  6479. Extract the alpha component from the input as a grayscale video. This
  6480. is especially useful with the @var{alphamerge} filter.
  6481. @section alphamerge
  6482. Add or replace the alpha component of the primary input with the
  6483. grayscale value of a second input. This is intended for use with
  6484. @var{alphaextract} to allow the transmission or storage of frame
  6485. sequences that have alpha in a format that doesn't support an alpha
  6486. channel.
  6487. For example, to reconstruct full frames from a normal YUV-encoded video
  6488. and a separate video created with @var{alphaextract}, you might use:
  6489. @example
  6490. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6491. @end example
  6492. @section amplify
  6493. Amplify differences between current pixel and pixels of adjacent frames in
  6494. same pixel location.
  6495. This filter accepts the following options:
  6496. @table @option
  6497. @item radius
  6498. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6499. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6500. @item factor
  6501. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6502. @item threshold
  6503. Set threshold for difference amplification. Any difference greater or equal to
  6504. this value will not alter source pixel. Default is 10.
  6505. Allowed range is from 0 to 65535.
  6506. @item tolerance
  6507. Set tolerance for difference amplification. Any difference lower to
  6508. this value will not alter source pixel. Default is 0.
  6509. Allowed range is from 0 to 65535.
  6510. @item low
  6511. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6512. This option controls maximum possible value that will decrease source pixel value.
  6513. @item high
  6514. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6515. This option controls maximum possible value that will increase source pixel value.
  6516. @item planes
  6517. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6518. @end table
  6519. @subsection Commands
  6520. This filter supports the following @ref{commands} that corresponds to option of same name:
  6521. @table @option
  6522. @item factor
  6523. @item threshold
  6524. @item tolerance
  6525. @item low
  6526. @item high
  6527. @item planes
  6528. @end table
  6529. @section ass
  6530. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6531. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6532. Substation Alpha) subtitles files.
  6533. This filter accepts the following option in addition to the common options from
  6534. the @ref{subtitles} filter:
  6535. @table @option
  6536. @item shaping
  6537. Set the shaping engine
  6538. Available values are:
  6539. @table @samp
  6540. @item auto
  6541. The default libass shaping engine, which is the best available.
  6542. @item simple
  6543. Fast, font-agnostic shaper that can do only substitutions
  6544. @item complex
  6545. Slower shaper using OpenType for substitutions and positioning
  6546. @end table
  6547. The default is @code{auto}.
  6548. @end table
  6549. @section atadenoise
  6550. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6551. The filter accepts the following options:
  6552. @table @option
  6553. @item 0a
  6554. Set threshold A for 1st plane. Default is 0.02.
  6555. Valid range is 0 to 0.3.
  6556. @item 0b
  6557. Set threshold B for 1st plane. Default is 0.04.
  6558. Valid range is 0 to 5.
  6559. @item 1a
  6560. Set threshold A for 2nd plane. Default is 0.02.
  6561. Valid range is 0 to 0.3.
  6562. @item 1b
  6563. Set threshold B for 2nd plane. Default is 0.04.
  6564. Valid range is 0 to 5.
  6565. @item 2a
  6566. Set threshold A for 3rd plane. Default is 0.02.
  6567. Valid range is 0 to 0.3.
  6568. @item 2b
  6569. Set threshold B for 3rd plane. Default is 0.04.
  6570. Valid range is 0 to 5.
  6571. Threshold A is designed to react on abrupt changes in the input signal and
  6572. threshold B is designed to react on continuous changes in the input signal.
  6573. @item s
  6574. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6575. number in range [5, 129].
  6576. @item p
  6577. Set what planes of frame filter will use for averaging. Default is all.
  6578. @item a
  6579. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6580. Alternatively can be set to @code{s} serial.
  6581. Parallel can be faster then serial, while other way around is never true.
  6582. Parallel will abort early on first change being greater then thresholds, while serial
  6583. will continue processing other side of frames if they are equal or below thresholds.
  6584. @item 0s
  6585. @item 1s
  6586. @item 2s
  6587. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6588. Valid range is from 0 to 32767.
  6589. This options controls weight for each pixel in radius defined by size.
  6590. Default value means every pixel have same weight.
  6591. Setting this option to 0 effectively disables filtering.
  6592. @end table
  6593. @subsection Commands
  6594. This filter supports same @ref{commands} as options except option @code{s}.
  6595. The command accepts the same syntax of the corresponding option.
  6596. @section avgblur
  6597. Apply average blur filter.
  6598. The filter accepts the following options:
  6599. @table @option
  6600. @item sizeX
  6601. Set horizontal radius size.
  6602. @item planes
  6603. Set which planes to filter. By default all planes are filtered.
  6604. @item sizeY
  6605. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6606. Default is @code{0}.
  6607. @end table
  6608. @subsection Commands
  6609. This filter supports same commands as options.
  6610. The command accepts the same syntax of the corresponding option.
  6611. If the specified expression is not valid, it is kept at its current
  6612. value.
  6613. @section backgroundkey
  6614. Turns a static background into transparency.
  6615. The filter accepts the following option:
  6616. @table @option
  6617. @item threshold
  6618. Threshold for scene change detection.
  6619. @item similarity
  6620. Similarity percentage with the background.
  6621. @item blend
  6622. Set the blend amount for pixels that are not similar.
  6623. @end table
  6624. @subsection Commands
  6625. This filter supports the all above options as @ref{commands}.
  6626. @section bbox
  6627. Compute the bounding box for the non-black pixels in the input frame
  6628. luma plane.
  6629. This filter computes the bounding box containing all the pixels with a
  6630. luma value greater than the minimum allowed value.
  6631. The parameters describing the bounding box are printed on the filter
  6632. log.
  6633. The filter accepts the following option:
  6634. @table @option
  6635. @item min_val
  6636. Set the minimal luma value. Default is @code{16}.
  6637. @end table
  6638. @subsection Commands
  6639. This filter supports the all above options as @ref{commands}.
  6640. @section bilateral
  6641. Apply bilateral filter, spatial smoothing while preserving edges.
  6642. The filter accepts the following options:
  6643. @table @option
  6644. @item sigmaS
  6645. Set sigma of gaussian function to calculate spatial weight.
  6646. Allowed range is 0 to 512. Default is 0.1.
  6647. @item sigmaR
  6648. Set sigma of gaussian function to calculate range weight.
  6649. Allowed range is 0 to 1. Default is 0.1.
  6650. @item planes
  6651. Set planes to filter. Default is first only.
  6652. @end table
  6653. @subsection Commands
  6654. This filter supports the all above options as @ref{commands}.
  6655. @section bilateral_cuda
  6656. CUDA accelerated bilateral filter, an edge preserving filter.
  6657. This filter is mathematically accurate thanks to the use of GPU acceleration.
  6658. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  6659. The filter accepts the following options:
  6660. @table @option
  6661. @item sigmaS
  6662. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  6663. Allowed range is 0.1 to 512. Default is 0.1.
  6664. @item sigmaR
  6665. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  6666. Allowed range is 0.1 to 512. Default is 0.1.
  6667. @item window_size
  6668. Set window size of the bilateral function to determine the number of neighbours to loop on.
  6669. If the number entered is even, one will be added automatically.
  6670. Allowed range is 1 to 255. Default is 1.
  6671. @end table
  6672. @subsection Examples
  6673. @itemize
  6674. @item
  6675. Apply the bilateral filter on a video.
  6676. @example
  6677. ./ffmpeg -v verbose \
  6678. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  6679. -init_hw_device cuda \
  6680. -filter_complex \
  6681. " \
  6682. [0:v]scale_cuda=format=yuv444p[scaled_video];
  6683. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  6684. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  6685. @end example
  6686. @end itemize
  6687. @section bitplanenoise
  6688. Show and measure bit plane noise.
  6689. The filter accepts the following options:
  6690. @table @option
  6691. @item bitplane
  6692. Set which plane to analyze. Default is @code{1}.
  6693. @item filter
  6694. Filter out noisy pixels from @code{bitplane} set above.
  6695. Default is disabled.
  6696. @end table
  6697. @section blackdetect
  6698. Detect video intervals that are (almost) completely black. Can be
  6699. useful to detect chapter transitions, commercials, or invalid
  6700. recordings.
  6701. The filter outputs its detection analysis to both the log as well as
  6702. frame metadata. If a black segment of at least the specified minimum
  6703. duration is found, a line with the start and end timestamps as well
  6704. as duration is printed to the log with level @code{info}. In addition,
  6705. a log line with level @code{debug} is printed per frame showing the
  6706. black amount detected for that frame.
  6707. The filter also attaches metadata to the first frame of a black
  6708. segment with key @code{lavfi.black_start} and to the first frame
  6709. after the black segment ends with key @code{lavfi.black_end}. The
  6710. value is the frame's timestamp. This metadata is added regardless
  6711. of the minimum duration specified.
  6712. The filter accepts the following options:
  6713. @table @option
  6714. @item black_min_duration, d
  6715. Set the minimum detected black duration expressed in seconds. It must
  6716. be a non-negative floating point number.
  6717. Default value is 2.0.
  6718. @item picture_black_ratio_th, pic_th
  6719. Set the threshold for considering a picture "black".
  6720. Express the minimum value for the ratio:
  6721. @example
  6722. @var{nb_black_pixels} / @var{nb_pixels}
  6723. @end example
  6724. for which a picture is considered black.
  6725. Default value is 0.98.
  6726. @item pixel_black_th, pix_th
  6727. Set the threshold for considering a pixel "black".
  6728. The threshold expresses the maximum pixel luma value for which a
  6729. pixel is considered "black". The provided value is scaled according to
  6730. the following equation:
  6731. @example
  6732. @var{absolute_threshold} = @var{luma_minimum_value} + @var{pixel_black_th} * @var{luma_range_size}
  6733. @end example
  6734. @var{luma_range_size} and @var{luma_minimum_value} depend on
  6735. the input video format, the range is [0-255] for YUV full-range
  6736. formats and [16-235] for YUV non full-range formats.
  6737. Default value is 0.10.
  6738. @end table
  6739. The following example sets the maximum pixel threshold to the minimum
  6740. value, and detects only black intervals of 2 or more seconds:
  6741. @example
  6742. blackdetect=d=2:pix_th=0.00
  6743. @end example
  6744. @section blackframe
  6745. Detect frames that are (almost) completely black. Can be useful to
  6746. detect chapter transitions or commercials. Output lines consist of
  6747. the frame number of the detected frame, the percentage of blackness,
  6748. the position in the file if known or -1 and the timestamp in seconds.
  6749. In order to display the output lines, you need to set the loglevel at
  6750. least to the AV_LOG_INFO value.
  6751. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6752. The value represents the percentage of pixels in the picture that
  6753. are below the threshold value.
  6754. It accepts the following parameters:
  6755. @table @option
  6756. @item amount
  6757. The percentage of the pixels that have to be below the threshold; it defaults to
  6758. @code{98}.
  6759. @item threshold, thresh
  6760. The threshold below which a pixel value is considered black; it defaults to
  6761. @code{32}.
  6762. @end table
  6763. @anchor{blend}
  6764. @section blend
  6765. Blend two video frames into each other.
  6766. The @code{blend} filter takes two input streams and outputs one
  6767. stream, the first input is the "top" layer and second input is
  6768. "bottom" layer. By default, the output terminates when the longest input terminates.
  6769. The @code{tblend} (time blend) filter takes two consecutive frames
  6770. from one single stream, and outputs the result obtained by blending
  6771. the new frame on top of the old frame.
  6772. A description of the accepted options follows.
  6773. @table @option
  6774. @item c0_mode
  6775. @item c1_mode
  6776. @item c2_mode
  6777. @item c3_mode
  6778. @item all_mode
  6779. Set blend mode for specific pixel component or all pixel components in case
  6780. of @var{all_mode}. Default value is @code{normal}.
  6781. Available values for component modes are:
  6782. @table @samp
  6783. @item addition
  6784. @item and
  6785. @item average
  6786. @item bleach
  6787. @item burn
  6788. @item darken
  6789. @item difference
  6790. @item divide
  6791. @item dodge
  6792. @item exclusion
  6793. @item extremity
  6794. @item freeze
  6795. @item geometric
  6796. @item glow
  6797. @item grainextract
  6798. @item grainmerge
  6799. @item hardlight
  6800. @item hardmix
  6801. @item hardoverlay
  6802. @item harmonic
  6803. @item heat
  6804. @item interpolate
  6805. @item lighten
  6806. @item linearlight
  6807. @item multiply
  6808. @item multiply128
  6809. @item negation
  6810. @item normal
  6811. @item or
  6812. @item overlay
  6813. @item phoenix
  6814. @item pinlight
  6815. @item reflect
  6816. @item screen
  6817. @item softdifference
  6818. @item softlight
  6819. @item stain
  6820. @item subtract
  6821. @item vividlight
  6822. @item xor
  6823. @end table
  6824. @item c0_opacity
  6825. @item c1_opacity
  6826. @item c2_opacity
  6827. @item c3_opacity
  6828. @item all_opacity
  6829. Set blend opacity for specific pixel component or all pixel components in case
  6830. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6831. @item c0_expr
  6832. @item c1_expr
  6833. @item c2_expr
  6834. @item c3_expr
  6835. @item all_expr
  6836. Set blend expression for specific pixel component or all pixel components in case
  6837. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6838. The expressions can use the following variables:
  6839. @table @option
  6840. @item N
  6841. The sequential number of the filtered frame, starting from @code{0}.
  6842. @item X
  6843. @item Y
  6844. the coordinates of the current sample
  6845. @item W
  6846. @item H
  6847. the width and height of currently filtered plane
  6848. @item SW
  6849. @item SH
  6850. Width and height scale for the plane being filtered. It is the
  6851. ratio between the dimensions of the current plane to the luma plane,
  6852. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6853. the luma plane and @code{0.5,0.5} for the chroma planes.
  6854. @item T
  6855. Time of the current frame, expressed in seconds.
  6856. @item TOP, A
  6857. Value of pixel component at current location for first video frame (top layer).
  6858. @item BOTTOM, B
  6859. Value of pixel component at current location for second video frame (bottom layer).
  6860. @end table
  6861. @end table
  6862. The @code{blend} filter also supports the @ref{framesync} options.
  6863. @subsection Examples
  6864. @itemize
  6865. @item
  6866. Apply transition from bottom layer to top layer in first 10 seconds:
  6867. @example
  6868. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6869. @end example
  6870. @item
  6871. Apply linear horizontal transition from top layer to bottom layer:
  6872. @example
  6873. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6874. @end example
  6875. @item
  6876. Apply 1x1 checkerboard effect:
  6877. @example
  6878. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6879. @end example
  6880. @item
  6881. Apply uncover left effect:
  6882. @example
  6883. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6884. @end example
  6885. @item
  6886. Apply uncover down effect:
  6887. @example
  6888. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6889. @end example
  6890. @item
  6891. Apply uncover up-left effect:
  6892. @example
  6893. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6894. @end example
  6895. @item
  6896. Split diagonally video and shows top and bottom layer on each side:
  6897. @example
  6898. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6899. @end example
  6900. @item
  6901. Display differences between the current and the previous frame:
  6902. @example
  6903. tblend=all_mode=grainextract
  6904. @end example
  6905. @end itemize
  6906. @subsection Commands
  6907. This filter supports same @ref{commands} as options.
  6908. @anchor{blockdetect}
  6909. @section blockdetect
  6910. Determines blockiness of frames without altering the input frames.
  6911. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6912. The filter accepts the following options:
  6913. @table @option
  6914. @item period_min
  6915. @item period_max
  6916. Set minimum and maximum values for determining pixel grids (periods).
  6917. Default values are [3,24].
  6918. @item planes
  6919. Set planes to filter. Default is first only.
  6920. @end table
  6921. @subsection Examples
  6922. @itemize
  6923. @item
  6924. Determine blockiness for the first plane and search for periods within [8,32]:
  6925. @example
  6926. blockdetect=period_min=8:period_max=32:planes=1
  6927. @end example
  6928. @end itemize
  6929. @anchor{blurdetect}
  6930. @section blurdetect
  6931. Determines blurriness of frames without altering the input frames.
  6932. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6933. Allows for a block-based abbreviation.
  6934. The filter accepts the following options:
  6935. @table @option
  6936. @item low
  6937. @item high
  6938. Set low and high threshold values used by the Canny thresholding
  6939. algorithm.
  6940. The high threshold selects the "strong" edge pixels, which are then
  6941. connected through 8-connectivity with the "weak" edge pixels selected
  6942. by the low threshold.
  6943. @var{low} and @var{high} threshold values must be chosen in the range
  6944. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6945. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6946. is @code{50/255}.
  6947. @item radius
  6948. Define the radius to search around an edge pixel for local maxima.
  6949. @item block_pct
  6950. Determine blurriness only for the most significant blocks, given in percentage.
  6951. @item block_width
  6952. Determine blurriness for blocks of width @var{block_width}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_height}.
  6953. @item block_height
  6954. Determine blurriness for blocks of height @var{block_height}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_width}.
  6955. @item planes
  6956. Set planes to filter. Default is first only.
  6957. @end table
  6958. @subsection Examples
  6959. @itemize
  6960. @item
  6961. Determine blur for 80% of most significant 32x32 blocks:
  6962. @example
  6963. blurdetect=block_width=32:block_height=32:block_pct=80
  6964. @end example
  6965. @end itemize
  6966. @section bm3d
  6967. Denoise frames using Block-Matching 3D algorithm.
  6968. The filter accepts the following options.
  6969. @table @option
  6970. @item sigma
  6971. Set denoising strength. Default value is 1.
  6972. Allowed range is from 0 to 999.9.
  6973. The denoising algorithm is very sensitive to sigma, so adjust it
  6974. according to the source.
  6975. @item block
  6976. Set local patch size. This sets dimensions in 2D.
  6977. @item bstep
  6978. Set sliding step for processing blocks. Default value is 4.
  6979. Allowed range is from 1 to 64.
  6980. Smaller values allows processing more reference blocks and is slower.
  6981. @item group
  6982. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6983. When set to 1, no block matching is done. Larger values allows more blocks
  6984. in single group.
  6985. Allowed range is from 1 to 256.
  6986. @item range
  6987. Set radius for search block matching. Default is 9.
  6988. Allowed range is from 1 to INT32_MAX.
  6989. @item mstep
  6990. Set step between two search locations for block matching. Default is 1.
  6991. Allowed range is from 1 to 64. Smaller is slower.
  6992. @item thmse
  6993. Set threshold of mean square error for block matching. Valid range is 0 to
  6994. INT32_MAX.
  6995. @item hdthr
  6996. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6997. Larger values results in stronger hard-thresholding filtering in frequency
  6998. domain.
  6999. @item estim
  7000. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  7001. Default is @code{basic}.
  7002. @item ref
  7003. If enabled, filter will use 2nd stream for block matching.
  7004. Default is disabled for @code{basic} value of @var{estim} option,
  7005. and always enabled if value of @var{estim} is @code{final}.
  7006. @item planes
  7007. Set planes to filter. Default is all available except alpha.
  7008. @end table
  7009. @subsection Examples
  7010. @itemize
  7011. @item
  7012. Basic filtering with bm3d:
  7013. @example
  7014. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  7015. @end example
  7016. @item
  7017. Same as above, but filtering only luma:
  7018. @example
  7019. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  7020. @end example
  7021. @item
  7022. Same as above, but with both estimation modes:
  7023. @example
  7024. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  7025. @end example
  7026. @item
  7027. Same as above, but prefilter with @ref{nlmeans} filter instead:
  7028. @example
  7029. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  7030. @end example
  7031. @end itemize
  7032. @section boxblur
  7033. Apply a boxblur algorithm to the input video.
  7034. It accepts the following parameters:
  7035. @table @option
  7036. @item luma_radius, lr
  7037. @item luma_power, lp
  7038. @item chroma_radius, cr
  7039. @item chroma_power, cp
  7040. @item alpha_radius, ar
  7041. @item alpha_power, ap
  7042. @end table
  7043. A description of the accepted options follows.
  7044. @table @option
  7045. @item luma_radius, lr
  7046. @item chroma_radius, cr
  7047. @item alpha_radius, ar
  7048. Set an expression for the box radius in pixels used for blurring the
  7049. corresponding input plane.
  7050. The radius value must be a non-negative number, and must not be
  7051. greater than the value of the expression @code{min(w,h)/2} for the
  7052. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  7053. planes.
  7054. Default value for @option{luma_radius} is "2". If not specified,
  7055. @option{chroma_radius} and @option{alpha_radius} default to the
  7056. corresponding value set for @option{luma_radius}.
  7057. The expressions can contain the following constants:
  7058. @table @option
  7059. @item w
  7060. @item h
  7061. The input width and height in pixels.
  7062. @item cw
  7063. @item ch
  7064. The input chroma image width and height in pixels.
  7065. @item hsub
  7066. @item vsub
  7067. The horizontal and vertical chroma subsample values. For example, for the
  7068. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  7069. @end table
  7070. @item luma_power, lp
  7071. @item chroma_power, cp
  7072. @item alpha_power, ap
  7073. Specify how many times the boxblur filter is applied to the
  7074. corresponding plane.
  7075. Default value for @option{luma_power} is 2. If not specified,
  7076. @option{chroma_power} and @option{alpha_power} default to the
  7077. corresponding value set for @option{luma_power}.
  7078. A value of 0 will disable the effect.
  7079. @end table
  7080. @subsection Examples
  7081. @itemize
  7082. @item
  7083. Apply a boxblur filter with the luma, chroma, and alpha radii
  7084. set to 2:
  7085. @example
  7086. boxblur=luma_radius=2:luma_power=1
  7087. boxblur=2:1
  7088. @end example
  7089. @item
  7090. Set the luma radius to 2, and alpha and chroma radius to 0:
  7091. @example
  7092. boxblur=2:1:cr=0:ar=0
  7093. @end example
  7094. @item
  7095. Set the luma and chroma radii to a fraction of the video dimension:
  7096. @example
  7097. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  7098. @end example
  7099. @end itemize
  7100. @anchor{bwdif}
  7101. @section bwdif
  7102. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  7103. Deinterlacing Filter").
  7104. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  7105. interpolation algorithms.
  7106. It accepts the following parameters:
  7107. @table @option
  7108. @item mode
  7109. The interlacing mode to adopt. It accepts one of the following values:
  7110. @table @option
  7111. @item 0, send_frame
  7112. Output one frame for each frame.
  7113. @item 1, send_field
  7114. Output one frame for each field.
  7115. @end table
  7116. The default value is @code{send_field}.
  7117. @item parity
  7118. The picture field parity assumed for the input interlaced video. It accepts one
  7119. of the following values:
  7120. @table @option
  7121. @item 0, tff
  7122. Assume the top field is first.
  7123. @item 1, bff
  7124. Assume the bottom field is first.
  7125. @item -1, auto
  7126. Enable automatic detection of field parity.
  7127. @end table
  7128. The default value is @code{auto}.
  7129. If the interlacing is unknown or the decoder does not export this information,
  7130. top field first will be assumed.
  7131. @item deint
  7132. Specify which frames to deinterlace. Accepts one of the following
  7133. values:
  7134. @table @option
  7135. @item 0, all
  7136. Deinterlace all frames.
  7137. @item 1, interlaced
  7138. Only deinterlace frames marked as interlaced.
  7139. @end table
  7140. The default value is @code{all}.
  7141. @end table
  7142. @section bwdif_cuda
  7143. Deinterlace the input video using the @ref{bwdif} algorithm, but implemented
  7144. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  7145. and/or nvenc.
  7146. It accepts the following parameters:
  7147. @table @option
  7148. @item mode
  7149. The interlacing mode to adopt. It accepts one of the following values:
  7150. @table @option
  7151. @item 0, send_frame
  7152. Output one frame for each frame.
  7153. @item 1, send_field
  7154. Output one frame for each field.
  7155. @end table
  7156. The default value is @code{send_field}.
  7157. @item parity
  7158. The picture field parity assumed for the input interlaced video. It accepts one
  7159. of the following values:
  7160. @table @option
  7161. @item 0, tff
  7162. Assume the top field is first.
  7163. @item 1, bff
  7164. Assume the bottom field is first.
  7165. @item -1, auto
  7166. Enable automatic detection of field parity.
  7167. @end table
  7168. The default value is @code{auto}.
  7169. If the interlacing is unknown or the decoder does not export this information,
  7170. top field first will be assumed.
  7171. @item deint
  7172. Specify which frames to deinterlace. Accepts one of the following
  7173. values:
  7174. @table @option
  7175. @item 0, all
  7176. Deinterlace all frames.
  7177. @item 1, interlaced
  7178. Only deinterlace frames marked as interlaced.
  7179. @end table
  7180. The default value is @code{all}.
  7181. @end table
  7182. @section ccrepack
  7183. Repack CEA-708 closed captioning side data
  7184. This filter fixes various issues seen with commerical encoders
  7185. related to upstream malformed CEA-708 payloads, specifically
  7186. incorrect number of tuples (wrong cc_count for the target FPS),
  7187. and incorrect ordering of tuples (i.e. the CEA-608 tuples are not at
  7188. the first entries in the payload).
  7189. @section cas
  7190. Apply Contrast Adaptive Sharpen filter to video stream.
  7191. The filter accepts the following options:
  7192. @table @option
  7193. @item strength
  7194. Set the sharpening strength. Default value is 0.
  7195. @item planes
  7196. Set planes to filter. Default value is to filter all
  7197. planes except alpha plane.
  7198. @end table
  7199. @subsection Commands
  7200. This filter supports same @ref{commands} as options.
  7201. @section chromahold
  7202. Remove all color information for all colors except for certain one.
  7203. The filter accepts the following options:
  7204. @table @option
  7205. @item color
  7206. The color which will not be replaced with neutral chroma.
  7207. @item similarity
  7208. Similarity percentage with the above color.
  7209. 0.01 matches only the exact key color, while 1.0 matches everything.
  7210. @item blend
  7211. Blend percentage.
  7212. 0.0 makes pixels either fully gray, or not gray at all.
  7213. Higher values result in more preserved color.
  7214. @item yuv
  7215. Signals that the color passed is already in YUV instead of RGB.
  7216. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7217. This can be used to pass exact YUV values as hexadecimal numbers.
  7218. @end table
  7219. @subsection Commands
  7220. This filter supports same @ref{commands} as options.
  7221. The command accepts the same syntax of the corresponding option.
  7222. If the specified expression is not valid, it is kept at its current
  7223. value.
  7224. @anchor{chromakey}
  7225. @section chromakey
  7226. YUV colorspace color/chroma keying.
  7227. The filter accepts the following options:
  7228. @table @option
  7229. @item color
  7230. The color which will be replaced with transparency.
  7231. @item similarity
  7232. Similarity percentage with the key color.
  7233. 0.01 matches only the exact key color, while 1.0 matches everything.
  7234. @item blend
  7235. Blend percentage.
  7236. 0.0 makes pixels either fully transparent, or not transparent at all.
  7237. Higher values result in semi-transparent pixels, with a higher transparency
  7238. the more similar the pixels color is to the key color.
  7239. @item yuv
  7240. Signals that the color passed is already in YUV instead of RGB.
  7241. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7242. This can be used to pass exact YUV values as hexadecimal numbers.
  7243. @end table
  7244. @subsection Commands
  7245. This filter supports same @ref{commands} as options.
  7246. The command accepts the same syntax of the corresponding option.
  7247. If the specified expression is not valid, it is kept at its current
  7248. value.
  7249. @subsection Examples
  7250. @itemize
  7251. @item
  7252. Make every green pixel in the input image transparent:
  7253. @example
  7254. ffmpeg -i input.png -vf chromakey=green out.png
  7255. @end example
  7256. @item
  7257. Overlay a greenscreen-video on top of a static black background.
  7258. @example
  7259. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  7260. @end example
  7261. @end itemize
  7262. @section chromakey_cuda
  7263. CUDA accelerated YUV colorspace color/chroma keying.
  7264. This filter works like normal chromakey filter but operates on CUDA frames.
  7265. for more details and parameters see @ref{chromakey}.
  7266. @subsection Examples
  7267. @itemize
  7268. @item
  7269. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  7270. @example
  7271. ./ffmpeg \
  7272. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  7273. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  7274. -init_hw_device cuda \
  7275. -filter_complex \
  7276. " \
  7277. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  7278. [1:v]scale_cuda=format=yuv420p[base]; \
  7279. [base][overlay_video]overlay_cuda" \
  7280. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  7281. @end example
  7282. @item
  7283. Process two software sources, explicitly uploading the frames:
  7284. @example
  7285. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  7286. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  7287. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  7288. -filter_complex \
  7289. " \
  7290. [0]hwupload[under]; \
  7291. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  7292. [under][over]overlay_cuda" \
  7293. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  7294. @end example
  7295. @end itemize
  7296. @section chromanr
  7297. Reduce chrominance noise.
  7298. The filter accepts the following options:
  7299. @table @option
  7300. @item thres
  7301. Set threshold for averaging chrominance values.
  7302. Sum of absolute difference of Y, U and V pixel components of current
  7303. pixel and neighbour pixels lower than this threshold will be used in
  7304. averaging. Luma component is left unchanged and is copied to output.
  7305. Default value is 30. Allowed range is from 1 to 200.
  7306. @item sizew
  7307. Set horizontal radius of rectangle used for averaging.
  7308. Allowed range is from 1 to 100. Default value is 5.
  7309. @item sizeh
  7310. Set vertical radius of rectangle used for averaging.
  7311. Allowed range is from 1 to 100. Default value is 5.
  7312. @item stepw
  7313. Set horizontal step when averaging. Default value is 1.
  7314. Allowed range is from 1 to 50.
  7315. Mostly useful to speed-up filtering.
  7316. @item steph
  7317. Set vertical step when averaging. Default value is 1.
  7318. Allowed range is from 1 to 50.
  7319. Mostly useful to speed-up filtering.
  7320. @item threy
  7321. Set Y threshold for averaging chrominance values.
  7322. Set finer control for max allowed difference between Y components
  7323. of current pixel and neigbour pixels.
  7324. Default value is 200. Allowed range is from 1 to 200.
  7325. @item threu
  7326. Set U threshold for averaging chrominance values.
  7327. Set finer control for max allowed difference between U components
  7328. of current pixel and neigbour pixels.
  7329. Default value is 200. Allowed range is from 1 to 200.
  7330. @item threv
  7331. Set V threshold for averaging chrominance values.
  7332. Set finer control for max allowed difference between V components
  7333. of current pixel and neigbour pixels.
  7334. Default value is 200. Allowed range is from 1 to 200.
  7335. @item distance
  7336. Set distance type used in calculations.
  7337. @table @samp
  7338. @item manhattan
  7339. Absolute difference.
  7340. @item euclidean
  7341. Difference squared.
  7342. @end table
  7343. Default distance type is manhattan.
  7344. @end table
  7345. @subsection Commands
  7346. This filter supports same @ref{commands} as options.
  7347. The command accepts the same syntax of the corresponding option.
  7348. @section chromashift
  7349. Shift chroma pixels horizontally and/or vertically.
  7350. The filter accepts the following options:
  7351. @table @option
  7352. @item cbh
  7353. Set amount to shift chroma-blue horizontally.
  7354. @item cbv
  7355. Set amount to shift chroma-blue vertically.
  7356. @item crh
  7357. Set amount to shift chroma-red horizontally.
  7358. @item crv
  7359. Set amount to shift chroma-red vertically.
  7360. @item edge
  7361. Set edge mode, can be @var{smear}, default, or @var{warp}.
  7362. @end table
  7363. @subsection Commands
  7364. This filter supports the all above options as @ref{commands}.
  7365. @section ciescope
  7366. Display CIE color diagram with pixels overlaid onto it.
  7367. The filter accepts the following options:
  7368. @table @option
  7369. @item system
  7370. Set color system.
  7371. @table @samp
  7372. @item ntsc, 470m
  7373. @item ebu, 470bg
  7374. @item smpte
  7375. @item 240m
  7376. @item apple
  7377. @item widergb
  7378. @item cie1931
  7379. @item rec709, hdtv
  7380. @item uhdtv, rec2020
  7381. @item dcip3
  7382. @end table
  7383. @item cie
  7384. Set CIE system.
  7385. @table @samp
  7386. @item xyy
  7387. @item ucs
  7388. @item luv
  7389. @end table
  7390. @item gamuts
  7391. Set what gamuts to draw.
  7392. See @code{system} option for available values.
  7393. @item size, s
  7394. Set ciescope size, by default set to 512.
  7395. @item intensity, i
  7396. Set intensity used to map input pixel values to CIE diagram.
  7397. @item contrast
  7398. Set contrast used to draw tongue colors that are out of active color system gamut.
  7399. @item corrgamma
  7400. Correct gamma displayed on scope, by default enabled.
  7401. @item showwhite
  7402. Show white point on CIE diagram, by default disabled.
  7403. @item gamma
  7404. Set input gamma. Used only with XYZ input color space.
  7405. @item fill
  7406. Fill with CIE colors. By default is enabled.
  7407. @end table
  7408. @section codecview
  7409. Visualize information exported by some codecs.
  7410. Some codecs can export information through frames using side-data or other
  7411. means. For example, some MPEG based codecs export motion vectors through the
  7412. @var{export_mvs} flag in the codec @option{flags2} option.
  7413. The filter accepts the following option:
  7414. @table @option
  7415. @item block
  7416. Display block partition structure using the luma plane.
  7417. @item mv
  7418. Set motion vectors to visualize.
  7419. Available flags for @var{mv} are:
  7420. @table @samp
  7421. @item pf
  7422. forward predicted MVs of P-frames
  7423. @item bf
  7424. forward predicted MVs of B-frames
  7425. @item bb
  7426. backward predicted MVs of B-frames
  7427. @end table
  7428. @item qp
  7429. Display quantization parameters using the chroma planes.
  7430. @item mv_type, mvt
  7431. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7432. Available flags for @var{mv_type} are:
  7433. @table @samp
  7434. @item fp
  7435. forward predicted MVs
  7436. @item bp
  7437. backward predicted MVs
  7438. @end table
  7439. @item frame_type, ft
  7440. Set frame type to visualize motion vectors of.
  7441. Available flags for @var{frame_type} are:
  7442. @table @samp
  7443. @item if
  7444. intra-coded frames (I-frames)
  7445. @item pf
  7446. predicted frames (P-frames)
  7447. @item bf
  7448. bi-directionally predicted frames (B-frames)
  7449. @end table
  7450. @end table
  7451. @subsection Examples
  7452. @itemize
  7453. @item
  7454. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7455. @example
  7456. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7457. @end example
  7458. @item
  7459. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7460. @example
  7461. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7462. @end example
  7463. @end itemize
  7464. @section colorbalance
  7465. Modify intensity of primary colors (red, green and blue) of input frames.
  7466. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7467. regions for the red-cyan, green-magenta or blue-yellow balance.
  7468. A positive adjustment value shifts the balance towards the primary color, a negative
  7469. value towards the complementary color.
  7470. The filter accepts the following options:
  7471. @table @option
  7472. @item rs
  7473. @item gs
  7474. @item bs
  7475. Adjust red, green and blue shadows (darkest pixels).
  7476. @item rm
  7477. @item gm
  7478. @item bm
  7479. Adjust red, green and blue midtones (medium pixels).
  7480. @item rh
  7481. @item gh
  7482. @item bh
  7483. Adjust red, green and blue highlights (brightest pixels).
  7484. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7485. @item pl
  7486. Preserve lightness when changing color balance. Default is disabled.
  7487. @end table
  7488. @subsection Examples
  7489. @itemize
  7490. @item
  7491. Add red color cast to shadows:
  7492. @example
  7493. colorbalance=rs=.3
  7494. @end example
  7495. @end itemize
  7496. @subsection Commands
  7497. This filter supports the all above options as @ref{commands}.
  7498. @section colorcontrast
  7499. Adjust color contrast between RGB components.
  7500. The filter accepts the following options:
  7501. @table @option
  7502. @item rc
  7503. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7504. @item gm
  7505. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7506. @item by
  7507. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7508. @item rcw
  7509. @item gmw
  7510. @item byw
  7511. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7512. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7513. @item pl
  7514. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7515. @end table
  7516. @subsection Commands
  7517. This filter supports the all above options as @ref{commands}.
  7518. @section colorcorrect
  7519. Adjust color white balance selectively for blacks and whites.
  7520. This filter operates in YUV colorspace.
  7521. The filter accepts the following options:
  7522. @table @option
  7523. @item rl
  7524. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7525. Default value is 0.
  7526. @item bl
  7527. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7528. Default value is 0.
  7529. @item rh
  7530. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7531. Default value is 0.
  7532. @item bh
  7533. Set the blue highlight spot. Allowed range is from -1.0 to 1.0.
  7534. Default value is 0.
  7535. @item saturation
  7536. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7537. Default value is 1.
  7538. @item analyze
  7539. If set to anything other than @code{manual} it will analyze every frame and use derived
  7540. parameters for filtering output frame.
  7541. Possible values are:
  7542. @table @samp
  7543. @item manual
  7544. @item average
  7545. @item minmax
  7546. @item median
  7547. @end table
  7548. Default value is @code{manual}.
  7549. @end table
  7550. @subsection Commands
  7551. This filter supports the all above options as @ref{commands}.
  7552. @section colorchannelmixer
  7553. Adjust video input frames by re-mixing color channels.
  7554. This filter modifies a color channel by adding the values associated to
  7555. the other channels of the same pixels. For example if the value to
  7556. modify is red, the output value will be:
  7557. @example
  7558. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7559. @end example
  7560. The filter accepts the following options:
  7561. @table @option
  7562. @item rr
  7563. @item rg
  7564. @item rb
  7565. @item ra
  7566. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7567. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7568. @item gr
  7569. @item gg
  7570. @item gb
  7571. @item ga
  7572. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7573. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7574. @item br
  7575. @item bg
  7576. @item bb
  7577. @item ba
  7578. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7579. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7580. @item ar
  7581. @item ag
  7582. @item ab
  7583. @item aa
  7584. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7585. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7586. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7587. @item pc
  7588. Set preserve color mode. The accepted values are:
  7589. @table @samp
  7590. @item none
  7591. Disable color preserving, this is default.
  7592. @item lum
  7593. Preserve luminance.
  7594. @item max
  7595. Preserve max value of RGB triplet.
  7596. @item avg
  7597. Preserve average value of RGB triplet.
  7598. @item sum
  7599. Preserve sum value of RGB triplet.
  7600. @item nrm
  7601. Preserve normalized value of RGB triplet.
  7602. @item pwr
  7603. Preserve power value of RGB triplet.
  7604. @end table
  7605. @item pa
  7606. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7607. Default is @code{0.0}, thus disabled.
  7608. @end table
  7609. @subsection Examples
  7610. @itemize
  7611. @item
  7612. Convert source to grayscale:
  7613. @example
  7614. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7615. @end example
  7616. @item
  7617. Simulate sepia tones:
  7618. @example
  7619. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7620. @end example
  7621. @end itemize
  7622. @subsection Commands
  7623. This filter supports the all above options as @ref{commands}.
  7624. @section colorize
  7625. Overlay a solid color on the video stream.
  7626. The filter accepts the following options:
  7627. @table @option
  7628. @item hue
  7629. Set the color hue. Allowed range is from 0 to 360.
  7630. Default value is 0.
  7631. @item saturation
  7632. Set the color saturation. Allowed range is from 0 to 1.
  7633. Default value is 0.5.
  7634. @item lightness
  7635. Set the color lightness. Allowed range is from 0 to 1.
  7636. Default value is 0.5.
  7637. @item mix
  7638. Set the mix of source lightness. By default is set to 1.0.
  7639. Allowed range is from 0.0 to 1.0.
  7640. @end table
  7641. @subsection Commands
  7642. This filter supports the all above options as @ref{commands}.
  7643. @section colorkey
  7644. RGB colorspace color keying.
  7645. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7646. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7647. the similarity radius depends on the value of the blend option.
  7648. The filter accepts the following options:
  7649. @table @option
  7650. @item color
  7651. Set the color for which alpha will be set to 0 (full transparency).
  7652. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7653. Default is @code{black}.
  7654. @item similarity
  7655. Set the radius from the key color within which other colors also have full transparency.
  7656. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7657. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7658. around the exact key color, while 1.0 matches everything.
  7659. Default is @code{0.01}.
  7660. @item blend
  7661. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7662. 0.0 makes pixels either fully transparent or fully opaque.
  7663. Higher values result in semi-transparent pixels, with greater transparency
  7664. the more similar the pixel color is to the key color.
  7665. Range is 0.0 to 1.0. Default is @code{0.0}.
  7666. @end table
  7667. @subsection Examples
  7668. @itemize
  7669. @item
  7670. Make every green pixel in the input image transparent:
  7671. @example
  7672. ffmpeg -i input.png -vf colorkey=green out.png
  7673. @end example
  7674. @item
  7675. Overlay a greenscreen-video on top of a static background image.
  7676. @example
  7677. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  7678. @end example
  7679. @end itemize
  7680. @subsection Commands
  7681. This filter supports same @ref{commands} as options.
  7682. The command accepts the same syntax of the corresponding option.
  7683. If the specified expression is not valid, it is kept at its current
  7684. value.
  7685. @section colorhold
  7686. Remove all color information for all RGB colors except for certain one.
  7687. The filter accepts the following options:
  7688. @table @option
  7689. @item color
  7690. The color which will not be replaced with neutral gray.
  7691. @item similarity
  7692. Similarity percentage with the above color.
  7693. 0.01 matches only the exact key color, while 1.0 matches everything.
  7694. @item blend
  7695. Blend percentage. 0.0 makes pixels fully gray.
  7696. Higher values result in more preserved color.
  7697. @end table
  7698. @subsection Commands
  7699. This filter supports same @ref{commands} as options.
  7700. The command accepts the same syntax of the corresponding option.
  7701. If the specified expression is not valid, it is kept at its current
  7702. value.
  7703. @section colorlevels
  7704. Adjust video input frames using levels.
  7705. The filter accepts the following options:
  7706. @table @option
  7707. @item rimin
  7708. @item gimin
  7709. @item bimin
  7710. @item aimin
  7711. Adjust red, green, blue and alpha input black point.
  7712. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7713. @item rimax
  7714. @item gimax
  7715. @item bimax
  7716. @item aimax
  7717. Adjust red, green, blue and alpha input white point.
  7718. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7719. Input levels are used to lighten highlights (bright tones), darken shadows
  7720. (dark tones), change the balance of bright and dark tones.
  7721. @item romin
  7722. @item gomin
  7723. @item bomin
  7724. @item aomin
  7725. Adjust red, green, blue and alpha output black point.
  7726. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7727. @item romax
  7728. @item gomax
  7729. @item bomax
  7730. @item aomax
  7731. Adjust red, green, blue and alpha output white point.
  7732. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7733. Output levels allows manual selection of a constrained output level range.
  7734. @item preserve
  7735. Set preserve color mode. The accepted values are:
  7736. @table @samp
  7737. @item none
  7738. Disable color preserving, this is default.
  7739. @item lum
  7740. Preserve luminance.
  7741. @item max
  7742. Preserve max value of RGB triplet.
  7743. @item avg
  7744. Preserve average value of RGB triplet.
  7745. @item sum
  7746. Preserve sum value of RGB triplet.
  7747. @item nrm
  7748. Preserve normalized value of RGB triplet.
  7749. @item pwr
  7750. Preserve power value of RGB triplet.
  7751. @end table
  7752. @end table
  7753. @subsection Examples
  7754. @itemize
  7755. @item
  7756. Make video output darker:
  7757. @example
  7758. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7759. @end example
  7760. @item
  7761. Increase contrast:
  7762. @example
  7763. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7764. @end example
  7765. @item
  7766. Make video output lighter:
  7767. @example
  7768. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7769. @end example
  7770. @item
  7771. Increase brightness:
  7772. @example
  7773. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7774. @end example
  7775. @end itemize
  7776. @subsection Commands
  7777. This filter supports the all above options as @ref{commands}.
  7778. @section colormap
  7779. Apply custom color maps to video stream.
  7780. This filter needs three input video streams.
  7781. First stream is video stream that is going to be filtered out.
  7782. Second and third video stream specify color patches for source
  7783. color to target color mapping.
  7784. The filter accepts the following options:
  7785. @table @option
  7786. @item patch_size
  7787. Set the source and target video stream patch size in pixels.
  7788. @item nb_patches
  7789. Set the max number of used patches from source and target video stream.
  7790. Default value is number of patches available in additional video streams.
  7791. Max allowed number of patches is @code{64}.
  7792. @item type
  7793. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7794. Defaults is @code{absolute}.
  7795. @item kernel
  7796. Set the kernel used to measure color differences between mapped colors.
  7797. The accepted values are:
  7798. @table @samp
  7799. @item euclidean
  7800. @item weuclidean
  7801. @end table
  7802. Default is @code{euclidean}.
  7803. @end table
  7804. @section colormatrix
  7805. Convert color matrix.
  7806. The filter accepts the following options:
  7807. @table @option
  7808. @item src
  7809. @item dst
  7810. Specify the source and destination color matrix. Both values must be
  7811. specified.
  7812. The accepted values are:
  7813. @table @samp
  7814. @item bt709
  7815. BT.709
  7816. @item fcc
  7817. FCC
  7818. @item bt601
  7819. BT.601
  7820. @item bt470
  7821. BT.470
  7822. @item bt470bg
  7823. BT.470BG
  7824. @item smpte170m
  7825. SMPTE-170M
  7826. @item smpte240m
  7827. SMPTE-240M
  7828. @item bt2020
  7829. BT.2020
  7830. @end table
  7831. @end table
  7832. For example to convert from BT.601 to SMPTE-240M, use the command:
  7833. @example
  7834. colormatrix=bt601:smpte240m
  7835. @end example
  7836. @section colorspace
  7837. Convert colorspace, transfer characteristics or color primaries.
  7838. Input video needs to have an even size.
  7839. The filter accepts the following options:
  7840. @table @option
  7841. @anchor{all}
  7842. @item all
  7843. Specify all color properties at once.
  7844. The accepted values are:
  7845. @table @samp
  7846. @item bt470m
  7847. BT.470M
  7848. @item bt470bg
  7849. BT.470BG
  7850. @item bt601-6-525
  7851. BT.601-6 525
  7852. @item bt601-6-625
  7853. BT.601-6 625
  7854. @item bt709
  7855. BT.709
  7856. @item smpte170m
  7857. SMPTE-170M
  7858. @item smpte240m
  7859. SMPTE-240M
  7860. @item bt2020
  7861. BT.2020
  7862. @end table
  7863. @anchor{space}
  7864. @item space
  7865. Specify output colorspace.
  7866. The accepted values are:
  7867. @table @samp
  7868. @item bt709
  7869. BT.709
  7870. @item fcc
  7871. FCC
  7872. @item bt470bg
  7873. BT.470BG or BT.601-6 625
  7874. @item smpte170m
  7875. SMPTE-170M or BT.601-6 525
  7876. @item smpte240m
  7877. SMPTE-240M
  7878. @item ycgco
  7879. YCgCo
  7880. @item bt2020ncl
  7881. BT.2020 with non-constant luminance
  7882. @end table
  7883. @anchor{trc}
  7884. @item trc
  7885. Specify output transfer characteristics.
  7886. The accepted values are:
  7887. @table @samp
  7888. @item bt709
  7889. BT.709
  7890. @item bt470m
  7891. BT.470M
  7892. @item bt470bg
  7893. BT.470BG
  7894. @item gamma22
  7895. Constant gamma of 2.2
  7896. @item gamma28
  7897. Constant gamma of 2.8
  7898. @item smpte170m
  7899. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7900. @item smpte240m
  7901. SMPTE-240M
  7902. @item srgb
  7903. SRGB
  7904. @item iec61966-2-1
  7905. iec61966-2-1
  7906. @item iec61966-2-4
  7907. iec61966-2-4
  7908. @item xvycc
  7909. xvycc
  7910. @item bt2020-10
  7911. BT.2020 for 10-bits content
  7912. @item bt2020-12
  7913. BT.2020 for 12-bits content
  7914. @end table
  7915. @anchor{primaries}
  7916. @item primaries
  7917. Specify output color primaries.
  7918. The accepted values are:
  7919. @table @samp
  7920. @item bt709
  7921. BT.709
  7922. @item bt470m
  7923. BT.470M
  7924. @item bt470bg
  7925. BT.470BG or BT.601-6 625
  7926. @item smpte170m
  7927. SMPTE-170M or BT.601-6 525
  7928. @item smpte240m
  7929. SMPTE-240M
  7930. @item film
  7931. film
  7932. @item smpte431
  7933. SMPTE-431
  7934. @item smpte432
  7935. SMPTE-432
  7936. @item bt2020
  7937. BT.2020
  7938. @item jedec-p22
  7939. JEDEC P22 phosphors
  7940. @end table
  7941. @anchor{range}
  7942. @item range
  7943. Specify output color range.
  7944. The accepted values are:
  7945. @table @samp
  7946. @item tv
  7947. TV (restricted) range
  7948. @item mpeg
  7949. MPEG (restricted) range
  7950. @item pc
  7951. PC (full) range
  7952. @item jpeg
  7953. JPEG (full) range
  7954. @end table
  7955. @item format
  7956. Specify output color format.
  7957. The accepted values are:
  7958. @table @samp
  7959. @item yuv420p
  7960. YUV 4:2:0 planar 8-bits
  7961. @item yuv420p10
  7962. YUV 4:2:0 planar 10-bits
  7963. @item yuv420p12
  7964. YUV 4:2:0 planar 12-bits
  7965. @item yuv422p
  7966. YUV 4:2:2 planar 8-bits
  7967. @item yuv422p10
  7968. YUV 4:2:2 planar 10-bits
  7969. @item yuv422p12
  7970. YUV 4:2:2 planar 12-bits
  7971. @item yuv444p
  7972. YUV 4:4:4 planar 8-bits
  7973. @item yuv444p10
  7974. YUV 4:4:4 planar 10-bits
  7975. @item yuv444p12
  7976. YUV 4:4:4 planar 12-bits
  7977. @end table
  7978. @item fast
  7979. Do a fast conversion, which skips gamma/primary correction. This will take
  7980. significantly less CPU, but will be mathematically incorrect. To get output
  7981. compatible with that produced by the colormatrix filter, use fast=1.
  7982. @item dither
  7983. Specify dithering mode.
  7984. The accepted values are:
  7985. @table @samp
  7986. @item none
  7987. No dithering
  7988. @item fsb
  7989. Floyd-Steinberg dithering
  7990. @end table
  7991. @item wpadapt
  7992. Whitepoint adaptation mode.
  7993. The accepted values are:
  7994. @table @samp
  7995. @item bradford
  7996. Bradford whitepoint adaptation
  7997. @item vonkries
  7998. von Kries whitepoint adaptation
  7999. @item identity
  8000. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  8001. @end table
  8002. @item iall
  8003. Override all input properties at once. Same accepted values as @ref{all}.
  8004. @item ispace
  8005. Override input colorspace. Same accepted values as @ref{space}.
  8006. @item iprimaries
  8007. Override input color primaries. Same accepted values as @ref{primaries}.
  8008. @item itrc
  8009. Override input transfer characteristics. Same accepted values as @ref{trc}.
  8010. @item irange
  8011. Override input color range. Same accepted values as @ref{range}.
  8012. @end table
  8013. The filter converts the transfer characteristics, color space and color
  8014. primaries to the specified user values. The output value, if not specified,
  8015. is set to a default value based on the "all" property. If that property is
  8016. also not specified, the filter will log an error. The output color range and
  8017. format default to the same value as the input color range and format. The
  8018. input transfer characteristics, color space, color primaries and color range
  8019. should be set on the input data. If any of these are missing, the filter will
  8020. log an error and no conversion will take place.
  8021. For example to convert the input to SMPTE-240M, use the command:
  8022. @example
  8023. colorspace=smpte240m
  8024. @end example
  8025. @section colorspace_cuda
  8026. CUDA accelerated implementation of the colorspace filter.
  8027. It is by no means feature complete compared to the software colorspace filter,
  8028. and at the current time only supports color range conversion between jpeg/full
  8029. and mpeg/limited range.
  8030. The filter accepts the following options:
  8031. @table @option
  8032. @item range
  8033. Specify output color range.
  8034. The accepted values are:
  8035. @table @samp
  8036. @item tv
  8037. TV (restricted) range
  8038. @item mpeg
  8039. MPEG (restricted) range
  8040. @item pc
  8041. PC (full) range
  8042. @item jpeg
  8043. JPEG (full) range
  8044. @end table
  8045. @end table
  8046. @section colortemperature
  8047. Adjust color temperature in video to simulate variations in ambient color temperature.
  8048. The filter accepts the following options:
  8049. @table @option
  8050. @item temperature
  8051. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  8052. Default value is 6500 K.
  8053. @item mix
  8054. Set mixing with filtered output. Allowed range is from 0 to 1.
  8055. Default value is 1.
  8056. @item pl
  8057. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  8058. Default value is 0.
  8059. @end table
  8060. @subsection Commands
  8061. This filter supports same @ref{commands} as options.
  8062. @section convolution
  8063. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  8064. The filter accepts the following options:
  8065. @table @option
  8066. @item 0m
  8067. @item 1m
  8068. @item 2m
  8069. @item 3m
  8070. Set matrix for each plane.
  8071. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  8072. and from 1 to 49 odd number of signed integers in @var{row} mode.
  8073. @item 0rdiv
  8074. @item 1rdiv
  8075. @item 2rdiv
  8076. @item 3rdiv
  8077. Set multiplier for calculated value for each plane.
  8078. If unset or 0, it will be 1/sum of all matrix elements.
  8079. @item 0bias
  8080. @item 1bias
  8081. @item 2bias
  8082. @item 3bias
  8083. Set bias for each plane. This value is added to the result of the multiplication.
  8084. Useful for making the overall image brighter or darker. Default is 0.0.
  8085. @item 0mode
  8086. @item 1mode
  8087. @item 2mode
  8088. @item 3mode
  8089. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  8090. Default is @var{square}.
  8091. @end table
  8092. @subsection Commands
  8093. This filter supports the all above options as @ref{commands}.
  8094. @subsection Examples
  8095. @itemize
  8096. @item
  8097. Apply sharpen:
  8098. @example
  8099. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  8100. @end example
  8101. @item
  8102. Apply blur:
  8103. @example
  8104. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  8105. @end example
  8106. @item
  8107. Apply edge enhance:
  8108. @example
  8109. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  8110. @end example
  8111. @item
  8112. Apply edge detect:
  8113. @example
  8114. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  8115. @end example
  8116. @item
  8117. Apply laplacian edge detector which includes diagonals:
  8118. @example
  8119. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  8120. @end example
  8121. @item
  8122. Apply emboss:
  8123. @example
  8124. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  8125. @end example
  8126. @end itemize
  8127. @section convolve
  8128. Apply 2D convolution of video stream in frequency domain using second stream
  8129. as impulse.
  8130. The filter accepts the following options:
  8131. @table @option
  8132. @item planes
  8133. Set which planes to process.
  8134. @item impulse
  8135. Set which impulse video frames will be processed, can be @var{first}
  8136. or @var{all}. Default is @var{all}.
  8137. @end table
  8138. The @code{convolve} filter also supports the @ref{framesync} options.
  8139. @section copy
  8140. Copy the input video source unchanged to the output. This is mainly useful for
  8141. testing purposes.
  8142. @anchor{coreimage}
  8143. @section coreimage
  8144. Video filtering on GPU using Apple's CoreImage API on OSX.
  8145. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  8146. processed by video hardware. However, software-based OpenGL implementations
  8147. exist which means there is no guarantee for hardware processing. It depends on
  8148. the respective OSX.
  8149. There are many filters and image generators provided by Apple that come with a
  8150. large variety of options. The filter has to be referenced by its name along
  8151. with its options.
  8152. The coreimage filter accepts the following options:
  8153. @table @option
  8154. @item list_filters
  8155. List all available filters and generators along with all their respective
  8156. options as well as possible minimum and maximum values along with the default
  8157. values.
  8158. @example
  8159. list_filters=true
  8160. @end example
  8161. @item filter
  8162. Specify all filters by their respective name and options.
  8163. Use @var{list_filters} to determine all valid filter names and options.
  8164. Numerical options are specified by a float value and are automatically clamped
  8165. to their respective value range. Vector and color options have to be specified
  8166. by a list of space separated float values. Character escaping has to be done.
  8167. A special option name @code{default} is available to use default options for a
  8168. filter.
  8169. It is required to specify either @code{default} or at least one of the filter options.
  8170. All omitted options are used with their default values.
  8171. The syntax of the filter string is as follows:
  8172. @example
  8173. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  8174. @end example
  8175. @item output_rect
  8176. Specify a rectangle where the output of the filter chain is copied into the
  8177. input image. It is given by a list of space separated float values:
  8178. @example
  8179. output_rect=x\ y\ width\ height
  8180. @end example
  8181. If not given, the output rectangle equals the dimensions of the input image.
  8182. The output rectangle is automatically cropped at the borders of the input
  8183. image. Negative values are valid for each component.
  8184. @example
  8185. output_rect=25\ 25\ 100\ 100
  8186. @end example
  8187. @end table
  8188. Several filters can be chained for successive processing without GPU-HOST
  8189. transfers allowing for fast processing of complex filter chains.
  8190. Currently, only filters with zero (generators) or exactly one (filters) input
  8191. image and one output image are supported. Also, transition filters are not yet
  8192. usable as intended.
  8193. Some filters generate output images with additional padding depending on the
  8194. respective filter kernel. The padding is automatically removed to ensure the
  8195. filter output has the same size as the input image.
  8196. For image generators, the size of the output image is determined by the
  8197. previous output image of the filter chain or the input image of the whole
  8198. filterchain, respectively. The generators do not use the pixel information of
  8199. this image to generate their output. However, the generated output is
  8200. blended onto this image, resulting in partial or complete coverage of the
  8201. output image.
  8202. The @ref{coreimagesrc} video source can be used for generating input images
  8203. which are directly fed into the filter chain. By using it, providing input
  8204. images by another video source or an input video is not required.
  8205. @subsection Examples
  8206. @itemize
  8207. @item
  8208. List all filters available:
  8209. @example
  8210. coreimage=list_filters=true
  8211. @end example
  8212. @item
  8213. Use the CIBoxBlur filter with default options to blur an image:
  8214. @example
  8215. coreimage=filter=CIBoxBlur@@default
  8216. @end example
  8217. @item
  8218. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  8219. its center at 100x100 and a radius of 50 pixels:
  8220. @example
  8221. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  8222. @end example
  8223. @item
  8224. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  8225. given as complete and escaped command-line for Apple's standard bash shell:
  8226. @example
  8227. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  8228. @end example
  8229. @end itemize
  8230. @section corr
  8231. Obtain the correlation between two input videos.
  8232. This filter takes two input videos.
  8233. Both input videos must have the same resolution and pixel format for
  8234. this filter to work correctly. Also it assumes that both inputs
  8235. have the same number of frames, which are compared one by one.
  8236. The obtained per component, average, min and max correlation is printed through
  8237. the logging system.
  8238. The filter stores the calculated correlation of each frame in frame metadata.
  8239. This filter also supports the @ref{framesync} options.
  8240. In the below example the input file @file{main.mpg} being processed is compared
  8241. with the reference file @file{ref.mpg}.
  8242. @example
  8243. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  8244. @end example
  8245. @section cover_rect
  8246. Cover a rectangular object
  8247. It accepts the following options:
  8248. @table @option
  8249. @item cover
  8250. Filepath of the optional cover image, needs to be in yuv420.
  8251. @item mode
  8252. Set covering mode.
  8253. It accepts the following values:
  8254. @table @samp
  8255. @item cover
  8256. cover it by the supplied image
  8257. @item blur
  8258. cover it by interpolating the surrounding pixels
  8259. @end table
  8260. Default value is @var{blur}.
  8261. @end table
  8262. @subsection Examples
  8263. @itemize
  8264. @item
  8265. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8266. @example
  8267. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8268. @end example
  8269. @end itemize
  8270. @section crop
  8271. Crop the input video to given dimensions.
  8272. It accepts the following parameters:
  8273. @table @option
  8274. @item w, out_w
  8275. The width of the output video. It defaults to @code{iw}.
  8276. This expression is evaluated only once during the filter
  8277. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  8278. @item h, out_h
  8279. The height of the output video. It defaults to @code{ih}.
  8280. This expression is evaluated only once during the filter
  8281. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  8282. @item x
  8283. The horizontal position, in the input video, of the left edge of the output
  8284. video. It defaults to @code{(in_w-out_w)/2}.
  8285. This expression is evaluated per-frame.
  8286. @item y
  8287. The vertical position, in the input video, of the top edge of the output video.
  8288. It defaults to @code{(in_h-out_h)/2}.
  8289. This expression is evaluated per-frame.
  8290. @item keep_aspect
  8291. If set to 1 will force the output display aspect ratio
  8292. to be the same of the input, by changing the output sample aspect
  8293. ratio. It defaults to 0.
  8294. @item exact
  8295. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  8296. width/height/x/y as specified and will not be rounded to nearest smaller value.
  8297. It defaults to 0.
  8298. @end table
  8299. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  8300. expressions containing the following constants:
  8301. @table @option
  8302. @item x
  8303. @item y
  8304. The computed values for @var{x} and @var{y}. They are evaluated for
  8305. each new frame.
  8306. @item in_w
  8307. @item in_h
  8308. The input width and height.
  8309. @item iw
  8310. @item ih
  8311. These are the same as @var{in_w} and @var{in_h}.
  8312. @item out_w
  8313. @item out_h
  8314. The output (cropped) width and height.
  8315. @item ow
  8316. @item oh
  8317. These are the same as @var{out_w} and @var{out_h}.
  8318. @item a
  8319. same as @var{iw} / @var{ih}
  8320. @item sar
  8321. input sample aspect ratio
  8322. @item dar
  8323. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8324. @item hsub
  8325. @item vsub
  8326. horizontal and vertical chroma subsample values. For example for the
  8327. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8328. @item n
  8329. The number of the input frame, starting from 0.
  8330. @item pos
  8331. the position in the file of the input frame, NAN if unknown; deprecated,
  8332. do not use
  8333. @item t
  8334. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8335. @end table
  8336. The expression for @var{out_w} may depend on the value of @var{out_h},
  8337. and the expression for @var{out_h} may depend on @var{out_w}, but they
  8338. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  8339. evaluated after @var{out_w} and @var{out_h}.
  8340. The @var{x} and @var{y} parameters specify the expressions for the
  8341. position of the top-left corner of the output (non-cropped) area. They
  8342. are evaluated for each frame. If the evaluated value is not valid, it
  8343. is approximated to the nearest valid value.
  8344. The expression for @var{x} may depend on @var{y}, and the expression
  8345. for @var{y} may depend on @var{x}.
  8346. @subsection Examples
  8347. @itemize
  8348. @item
  8349. Crop area with size 100x100 at position (12,34).
  8350. @example
  8351. crop=100:100:12:34
  8352. @end example
  8353. Using named options, the example above becomes:
  8354. @example
  8355. crop=w=100:h=100:x=12:y=34
  8356. @end example
  8357. @item
  8358. Crop the central input area with size 100x100:
  8359. @example
  8360. crop=100:100
  8361. @end example
  8362. @item
  8363. Crop the central input area with size 2/3 of the input video:
  8364. @example
  8365. crop=2/3*in_w:2/3*in_h
  8366. @end example
  8367. @item
  8368. Crop the input video central square:
  8369. @example
  8370. crop=out_w=in_h
  8371. crop=in_h
  8372. @end example
  8373. @item
  8374. Delimit the rectangle with the top-left corner placed at position
  8375. 100:100 and the right-bottom corner corresponding to the right-bottom
  8376. corner of the input image.
  8377. @example
  8378. crop=in_w-100:in_h-100:100:100
  8379. @end example
  8380. @item
  8381. Crop 10 pixels from the left and right borders, and 20 pixels from
  8382. the top and bottom borders
  8383. @example
  8384. crop=in_w-2*10:in_h-2*20
  8385. @end example
  8386. @item
  8387. Keep only the bottom right quarter of the input image:
  8388. @example
  8389. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8390. @end example
  8391. @item
  8392. Crop height for getting Greek harmony:
  8393. @example
  8394. crop=in_w:1/PHI*in_w
  8395. @end example
  8396. @item
  8397. Apply trembling effect:
  8398. @example
  8399. 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)
  8400. @end example
  8401. @item
  8402. Apply erratic camera effect depending on timestamp:
  8403. @example
  8404. 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)
  8405. @end example
  8406. @item
  8407. Set x depending on the value of y:
  8408. @example
  8409. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8410. @end example
  8411. @end itemize
  8412. @subsection Commands
  8413. This filter supports the following commands:
  8414. @table @option
  8415. @item w, out_w
  8416. @item h, out_h
  8417. @item x
  8418. @item y
  8419. Set width/height of the output video and the horizontal/vertical position
  8420. in the input video.
  8421. The command accepts the same syntax of the corresponding option.
  8422. If the specified expression is not valid, it is kept at its current
  8423. value.
  8424. @end table
  8425. @section cropdetect
  8426. Auto-detect the crop size.
  8427. It calculates the necessary cropping parameters and prints the
  8428. recommended parameters via the logging system. The detected dimensions
  8429. correspond to the non-black or video area of the input video according to @var{mode}.
  8430. It accepts the following parameters:
  8431. @table @option
  8432. @item mode
  8433. Depending on @var{mode} crop detection is based on either the mere black value of surrounding pixels or a combination of motion vectors and edge pixels.
  8434. @table @samp
  8435. @item black
  8436. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8437. @item mvedges
  8438. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8439. @end table
  8440. @item limit
  8441. Set higher black value threshold, which can be optionally specified
  8442. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8443. value greater to the set value is considered non-black. It defaults to 24.
  8444. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8445. on the bitdepth of the pixel format.
  8446. @item round
  8447. The value which the width/height should be divisible by. It defaults to
  8448. 16. The offset is automatically adjusted to center the video. Use 2 to
  8449. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8450. encoding to most video codecs.
  8451. @item skip
  8452. Set the number of initial frames for which evaluation is skipped.
  8453. Default is 2. Range is 0 to INT_MAX.
  8454. @item reset_count, reset
  8455. Set the counter that determines after how many frames cropdetect will
  8456. reset the previously detected largest video area and start over to
  8457. detect the current optimal crop area. Default value is 0.
  8458. This can be useful when channel logos distort the video area. 0
  8459. indicates 'never reset', and returns the largest area encountered during
  8460. playback.
  8461. @item mv_threshold
  8462. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8463. @item low
  8464. @item high
  8465. Set low and high threshold values used by the Canny thresholding
  8466. algorithm.
  8467. The high threshold selects the "strong" edge pixels, which are then
  8468. connected through 8-connectivity with the "weak" edge pixels selected
  8469. by the low threshold.
  8470. @var{low} and @var{high} threshold values must be chosen in the range
  8471. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8472. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8473. is @code{15/255}.
  8474. @end table
  8475. @subsection Examples
  8476. @itemize
  8477. @item
  8478. Find video area surrounded by black borders:
  8479. @example
  8480. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8481. @end example
  8482. @item
  8483. Find an embedded video area, generate motion vectors beforehand:
  8484. @example
  8485. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8486. @end example
  8487. @item
  8488. Find an embedded video area, use motion vectors from decoder:
  8489. @example
  8490. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8491. @end example
  8492. @end itemize
  8493. @subsection Commands
  8494. This filter supports the following commands:
  8495. @table @option
  8496. @item limit
  8497. The command accepts the same syntax of the corresponding option.
  8498. If the specified expression is not valid, it is kept at its current value.
  8499. @end table
  8500. @anchor{cue}
  8501. @section cue
  8502. Delay video filtering until a given wallclock timestamp. The filter first
  8503. passes on @option{preroll} amount of frames, then it buffers at most
  8504. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8505. it forwards the buffered frames and also any subsequent frames coming in its
  8506. input.
  8507. The filter can be used synchronize the output of multiple ffmpeg processes for
  8508. realtime output devices like decklink. By putting the delay in the filtering
  8509. chain and pre-buffering frames the process can pass on data to output almost
  8510. immediately after the target wallclock timestamp is reached.
  8511. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8512. some use cases.
  8513. @table @option
  8514. @item cue
  8515. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8516. @item preroll
  8517. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8518. @item buffer
  8519. The maximum duration of content to buffer before waiting for the cue expressed
  8520. in seconds. Default is 0.
  8521. @end table
  8522. @anchor{curves}
  8523. @section curves
  8524. Apply color adjustments using curves.
  8525. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8526. component (red, green and blue) has its values defined by @var{N} key points
  8527. tied from each other using a smooth curve. The x-axis represents the pixel
  8528. values from the input frame, and the y-axis the new pixel values to be set for
  8529. the output frame.
  8530. By default, a component curve is defined by the two points @var{(0;0)} and
  8531. @var{(1;1)}. This creates a straight line where each original pixel value is
  8532. "adjusted" to its own value, which means no change to the image.
  8533. The filter allows you to redefine these two points and add some more. A new
  8534. curve will be defined to pass smoothly through all these new coordinates. The
  8535. new defined points need to be strictly increasing over the x-axis, and their
  8536. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8537. formed by using a natural or monotonic cubic spline interpolation, depending
  8538. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8539. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8540. spline guarantees the transitions between the specified points to be
  8541. monotonic. If the computed curves happened to go outside the vector spaces,
  8542. the values will be clipped accordingly.
  8543. The filter accepts the following options:
  8544. @table @option
  8545. @item preset
  8546. Select one of the available color presets. This option can be used in addition
  8547. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8548. options takes priority on the preset values.
  8549. Available presets are:
  8550. @table @samp
  8551. @item none
  8552. @item color_negative
  8553. @item cross_process
  8554. @item darker
  8555. @item increase_contrast
  8556. @item lighter
  8557. @item linear_contrast
  8558. @item medium_contrast
  8559. @item negative
  8560. @item strong_contrast
  8561. @item vintage
  8562. @end table
  8563. Default is @code{none}.
  8564. @item master, m
  8565. Set the master key points. These points will define a second pass mapping. It
  8566. is sometimes called a "luminance" or "value" mapping. It can be used with
  8567. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8568. post-processing LUT.
  8569. @item red, r
  8570. Set the key points for the red component.
  8571. @item green, g
  8572. Set the key points for the green component.
  8573. @item blue, b
  8574. Set the key points for the blue component.
  8575. @item all
  8576. Set the key points for all components (not including master).
  8577. Can be used in addition to the other key points component
  8578. options. In this case, the unset component(s) will fallback on this
  8579. @option{all} setting.
  8580. @item psfile
  8581. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8582. @item plot
  8583. Save Gnuplot script of the curves in specified file.
  8584. @item interp
  8585. Specify the kind of interpolation. Available algorithms are:
  8586. @table @samp
  8587. @item natural
  8588. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8589. @item pchip
  8590. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8591. @end table
  8592. @end table
  8593. To avoid some filtergraph syntax conflicts, each key points list need to be
  8594. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8595. @subsection Commands
  8596. This filter supports same @ref{commands} as options.
  8597. @subsection Examples
  8598. @itemize
  8599. @item
  8600. Increase slightly the middle level of blue:
  8601. @example
  8602. curves=blue='0/0 0.5/0.58 1/1'
  8603. @end example
  8604. @item
  8605. Vintage effect:
  8606. @example
  8607. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  8608. @end example
  8609. Here we obtain the following coordinates for each components:
  8610. @table @var
  8611. @item red
  8612. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8613. @item green
  8614. @code{(0;0) (0.50;0.48) (1;1)}
  8615. @item blue
  8616. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8617. @end table
  8618. @item
  8619. The previous example can also be achieved with the associated built-in preset:
  8620. @example
  8621. curves=preset=vintage
  8622. @end example
  8623. @item
  8624. Or simply:
  8625. @example
  8626. curves=vintage
  8627. @end example
  8628. @item
  8629. Use a Photoshop preset and redefine the points of the green component:
  8630. @example
  8631. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8632. @end example
  8633. @item
  8634. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8635. and @command{gnuplot}:
  8636. @example
  8637. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8638. gnuplot -p /tmp/curves.plt
  8639. @end example
  8640. @end itemize
  8641. @section datascope
  8642. Video data analysis filter.
  8643. This filter shows hexadecimal pixel values of part of video.
  8644. The filter accepts the following options:
  8645. @table @option
  8646. @item size, s
  8647. Set output video size.
  8648. @item x
  8649. Set x offset from where to pick pixels.
  8650. @item y
  8651. Set y offset from where to pick pixels.
  8652. @item mode
  8653. Set scope mode, can be one of the following:
  8654. @table @samp
  8655. @item mono
  8656. Draw hexadecimal pixel values with white color on black background.
  8657. @item color
  8658. Draw hexadecimal pixel values with input video pixel color on black
  8659. background.
  8660. @item color2
  8661. Draw hexadecimal pixel values on color background picked from input video,
  8662. the text color is picked in such way so its always visible.
  8663. @end table
  8664. @item axis
  8665. Draw rows and columns numbers on left and top of video.
  8666. @item opacity
  8667. Set background opacity.
  8668. @item format
  8669. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8670. @item components
  8671. Set pixel components to display. By default all pixel components are displayed.
  8672. @end table
  8673. @subsection Commands
  8674. This filter supports same @ref{commands} as options excluding @code{size} option.
  8675. @section dblur
  8676. Apply Directional blur filter.
  8677. The filter accepts the following options:
  8678. @table @option
  8679. @item angle
  8680. Set angle of directional blur. Default is @code{45}.
  8681. @item radius
  8682. Set radius of directional blur. Default is @code{5}.
  8683. @item planes
  8684. Set which planes to filter. By default all planes are filtered.
  8685. @end table
  8686. @subsection Commands
  8687. This filter supports same @ref{commands} as options.
  8688. The command accepts the same syntax of the corresponding option.
  8689. If the specified expression is not valid, it is kept at its current
  8690. value.
  8691. @section dctdnoiz
  8692. Denoise frames using 2D DCT (frequency domain filtering).
  8693. This filter is not designed for real time.
  8694. The filter accepts the following options:
  8695. @table @option
  8696. @item sigma, s
  8697. Set the noise sigma constant.
  8698. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8699. coefficient (absolute value) below this threshold with be dropped.
  8700. If you need a more advanced filtering, see @option{expr}.
  8701. Default is @code{0}.
  8702. @item overlap
  8703. Set number overlapping pixels for each block. Since the filter can be slow, you
  8704. may want to reduce this value, at the cost of a less effective filter and the
  8705. risk of various artefacts.
  8706. If the overlapping value doesn't permit processing the whole input width or
  8707. height, a warning will be displayed and according borders won't be denoised.
  8708. Default value is @var{blocksize}-1, which is the best possible setting.
  8709. @item expr, e
  8710. Set the coefficient factor expression.
  8711. For each coefficient of a DCT block, this expression will be evaluated as a
  8712. multiplier value for the coefficient.
  8713. If this is option is set, the @option{sigma} option will be ignored.
  8714. The absolute value of the coefficient can be accessed through the @var{c}
  8715. variable.
  8716. @item n
  8717. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8718. @var{blocksize}, which is the width and height of the processed blocks.
  8719. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8720. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8721. on the speed processing. Also, a larger block size does not necessarily means a
  8722. better de-noising.
  8723. @end table
  8724. @subsection Examples
  8725. Apply a denoise with a @option{sigma} of @code{4.5}:
  8726. @example
  8727. dctdnoiz=4.5
  8728. @end example
  8729. The same operation can be achieved using the expression system:
  8730. @example
  8731. dctdnoiz=e='gte(c, 4.5*3)'
  8732. @end example
  8733. Violent denoise using a block size of @code{16x16}:
  8734. @example
  8735. dctdnoiz=15:n=4
  8736. @end example
  8737. @section deband
  8738. Remove banding artifacts from input video.
  8739. It works by replacing banded pixels with average value of referenced pixels.
  8740. The filter accepts the following options:
  8741. @table @option
  8742. @item 1thr
  8743. @item 2thr
  8744. @item 3thr
  8745. @item 4thr
  8746. Set banding detection threshold for each plane. Default is 0.02.
  8747. Valid range is 0.00003 to 0.5.
  8748. If difference between current pixel and reference pixel is less than threshold,
  8749. it will be considered as banded.
  8750. @item range, r
  8751. Banding detection range in pixels. Default is 16. If positive, random number
  8752. in range 0 to set value will be used. If negative, exact absolute value
  8753. will be used.
  8754. The range defines square of four pixels around current pixel.
  8755. @item direction, d
  8756. Set direction in radians from which four pixel will be compared. If positive,
  8757. random direction from 0 to set direction will be picked. If negative, exact of
  8758. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8759. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8760. column.
  8761. @item blur, b
  8762. If enabled, current pixel is compared with average value of all four
  8763. surrounding pixels. The default is enabled. If disabled current pixel is
  8764. compared with all four surrounding pixels. The pixel is considered banded
  8765. if only all four differences with surrounding pixels are less than threshold.
  8766. @item coupling, c
  8767. If enabled, current pixel is changed if and only if all pixel components are banded,
  8768. e.g. banding detection threshold is triggered for all color components.
  8769. The default is disabled.
  8770. @end table
  8771. @subsection Commands
  8772. This filter supports the all above options as @ref{commands}.
  8773. @section deblock
  8774. Remove blocking artifacts from input video.
  8775. The filter accepts the following options:
  8776. @table @option
  8777. @item filter
  8778. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8779. This controls what kind of deblocking is applied.
  8780. @item block
  8781. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8782. @item alpha
  8783. @item beta
  8784. @item gamma
  8785. @item delta
  8786. Set blocking detection thresholds. Allowed range is 0 to 1.
  8787. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8788. Using higher threshold gives more deblocking strength.
  8789. Setting @var{alpha} controls threshold detection at exact edge of block.
  8790. Remaining options controls threshold detection near the edge. Each one for
  8791. below/above or left/right. Setting any of those to @var{0} disables
  8792. deblocking.
  8793. @item planes
  8794. Set planes to filter. Default is to filter all available planes.
  8795. @end table
  8796. @subsection Examples
  8797. @itemize
  8798. @item
  8799. Deblock using weak filter and block size of 4 pixels.
  8800. @example
  8801. deblock=filter=weak:block=4
  8802. @end example
  8803. @item
  8804. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8805. deblocking more edges.
  8806. @example
  8807. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8808. @end example
  8809. @item
  8810. Similar as above, but filter only first plane.
  8811. @example
  8812. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8813. @end example
  8814. @item
  8815. Similar as above, but filter only second and third plane.
  8816. @example
  8817. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8818. @end example
  8819. @end itemize
  8820. @subsection Commands
  8821. This filter supports the all above options as @ref{commands}.
  8822. @anchor{decimate}
  8823. @section decimate
  8824. Drop duplicated frames at regular intervals.
  8825. The filter accepts the following options:
  8826. @table @option
  8827. @item cycle
  8828. Set the number of frames from which one will be dropped. Setting this to
  8829. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8830. Default is @code{5}.
  8831. @item dupthresh
  8832. Set the threshold for duplicate detection. If the difference metric for a frame
  8833. is less than or equal to this value, then it is declared as duplicate. Default
  8834. is @code{1.1}
  8835. @item scthresh
  8836. Set scene change threshold. Default is @code{15}.
  8837. @item blockx
  8838. @item blocky
  8839. Set the size of the x and y-axis blocks used during metric calculations.
  8840. Larger blocks give better noise suppression, but also give worse detection of
  8841. small movements. Must be a power of two. Default is @code{32}.
  8842. @item ppsrc
  8843. Mark main input as a pre-processed input and activate clean source input
  8844. stream. This allows the input to be pre-processed with various filters to help
  8845. the metrics calculation while keeping the frame selection lossless. When set to
  8846. @code{1}, the first stream is for the pre-processed input, and the second
  8847. stream is the clean source from where the kept frames are chosen. Default is
  8848. @code{0}.
  8849. @item chroma
  8850. Set whether or not chroma is considered in the metric calculations. Default is
  8851. @code{1}.
  8852. @item mixed
  8853. Set whether or not the input only partially contains content to be decimated.
  8854. Default is @code{false}.
  8855. If enabled video output stream will be in variable frame rate.
  8856. @end table
  8857. @section deconvolve
  8858. Apply 2D deconvolution of video stream in frequency domain using second stream
  8859. as impulse.
  8860. The filter accepts the following options:
  8861. @table @option
  8862. @item planes
  8863. Set which planes to process.
  8864. @item impulse
  8865. Set which impulse video frames will be processed, can be @var{first}
  8866. or @var{all}. Default is @var{all}.
  8867. @item noise
  8868. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8869. and height are not same and not power of 2 or if stream prior to convolving
  8870. had noise.
  8871. @end table
  8872. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8873. @section dedot
  8874. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8875. It accepts the following options:
  8876. @table @option
  8877. @item m
  8878. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8879. @var{rainbows} for cross-color reduction.
  8880. @item lt
  8881. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8882. @item tl
  8883. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8884. @item tc
  8885. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8886. @item ct
  8887. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8888. @end table
  8889. @section deflate
  8890. Apply deflate effect to the video.
  8891. This filter replaces the pixel by the local(3x3) average by taking into account
  8892. only values lower than the pixel.
  8893. It accepts the following options:
  8894. @table @option
  8895. @item threshold0
  8896. @item threshold1
  8897. @item threshold2
  8898. @item threshold3
  8899. Limit the maximum change for each plane, default is 65535.
  8900. If 0, plane will remain unchanged.
  8901. @end table
  8902. @subsection Commands
  8903. This filter supports the all above options as @ref{commands}.
  8904. @section deflicker
  8905. Remove temporal frame luminance variations.
  8906. It accepts the following options:
  8907. @table @option
  8908. @item size, s
  8909. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8910. @item mode, m
  8911. Set averaging mode to smooth temporal luminance variations.
  8912. Available values are:
  8913. @table @samp
  8914. @item am
  8915. Arithmetic mean
  8916. @item gm
  8917. Geometric mean
  8918. @item hm
  8919. Harmonic mean
  8920. @item qm
  8921. Quadratic mean
  8922. @item cm
  8923. Cubic mean
  8924. @item pm
  8925. Power mean
  8926. @item median
  8927. Median
  8928. @end table
  8929. @item bypass
  8930. Do not actually modify frame. Useful when one only wants metadata.
  8931. @end table
  8932. @section dejudder
  8933. Remove judder produced by partially interlaced telecined content.
  8934. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8935. source was partially telecined content then the output of @code{pullup,dejudder}
  8936. will have a variable frame rate. May change the recorded frame rate of the
  8937. container. Aside from that change, this filter will not affect constant frame
  8938. rate video.
  8939. The option available in this filter is:
  8940. @table @option
  8941. @item cycle
  8942. Specify the length of the window over which the judder repeats.
  8943. Accepts any integer greater than 1. Useful values are:
  8944. @table @samp
  8945. @item 4
  8946. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8947. @item 5
  8948. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8949. @item 20
  8950. If a mixture of the two.
  8951. @end table
  8952. The default is @samp{4}.
  8953. @end table
  8954. @section delogo
  8955. Suppress a TV station logo by a simple interpolation of the surrounding
  8956. pixels. Just set a rectangle covering the logo and watch it disappear
  8957. (and sometimes something even uglier appear - your mileage may vary).
  8958. It accepts the following parameters:
  8959. @table @option
  8960. @item x
  8961. @item y
  8962. Specify the top left corner coordinates of the logo. They must be
  8963. specified.
  8964. @item w
  8965. @item h
  8966. Specify the width and height of the logo to clear. They must be
  8967. specified.
  8968. @item show
  8969. When set to 1, a green rectangle is drawn on the screen to simplify
  8970. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8971. The default value is 0.
  8972. The rectangle is drawn on the outermost pixels which will be (partly)
  8973. replaced with interpolated values. The values of the next pixels
  8974. immediately outside this rectangle in each direction will be used to
  8975. compute the interpolated pixel values inside the rectangle.
  8976. @end table
  8977. @subsection Examples
  8978. @itemize
  8979. @item
  8980. Set a rectangle covering the area with top left corner coordinates 0,0
  8981. and size 100x77:
  8982. @example
  8983. delogo=x=0:y=0:w=100:h=77
  8984. @end example
  8985. @end itemize
  8986. @anchor{derain}
  8987. @section derain
  8988. Remove the rain in the input image/video by applying the derain methods based on
  8989. convolutional neural networks. Supported models:
  8990. @itemize
  8991. @item
  8992. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8993. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8994. @end itemize
  8995. Training as well as model generation scripts are provided in
  8996. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8997. The filter accepts the following options:
  8998. @table @option
  8999. @item filter_type
  9000. Specify which filter to use. This option accepts the following values:
  9001. @table @samp
  9002. @item derain
  9003. Derain filter. To conduct derain filter, you need to use a derain model.
  9004. @item dehaze
  9005. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  9006. @end table
  9007. Default value is @samp{derain}.
  9008. @item dnn_backend
  9009. Specify which DNN backend to use for model loading and execution. This option accepts
  9010. the following values:
  9011. @table @samp
  9012. @item tensorflow
  9013. TensorFlow backend. To enable this backend you
  9014. need to install the TensorFlow for C library (see
  9015. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  9016. @code{--enable-libtensorflow}
  9017. @end table
  9018. @item model
  9019. Set path to model file specifying network architecture and its parameters.
  9020. Note that different backends use different file formats. TensorFlow can load files for only its format.
  9021. @end table
  9022. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  9023. @section deshake
  9024. Attempt to fix small changes in horizontal and/or vertical shift. This
  9025. filter helps remove camera shake from hand-holding a camera, bumping a
  9026. tripod, moving on a vehicle, etc.
  9027. The filter accepts the following options:
  9028. @table @option
  9029. @item x
  9030. @item y
  9031. @item w
  9032. @item h
  9033. Specify a rectangular area where to limit the search for motion
  9034. vectors.
  9035. If desired the search for motion vectors can be limited to a
  9036. rectangular area of the frame defined by its top left corner, width
  9037. and height. These parameters have the same meaning as the drawbox
  9038. filter which can be used to visualise the position of the bounding
  9039. box.
  9040. This is useful when simultaneous movement of subjects within the frame
  9041. might be confused for camera motion by the motion vector search.
  9042. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  9043. then the full frame is used. This allows later options to be set
  9044. without specifying the bounding box for the motion vector search.
  9045. Default - search the whole frame.
  9046. @item rx
  9047. @item ry
  9048. Specify the maximum extent of movement in x and y directions in the
  9049. range 0-64 pixels. Default 16.
  9050. @item edge
  9051. Specify how to generate pixels to fill blanks at the edge of the
  9052. frame. Available values are:
  9053. @table @samp
  9054. @item blank, 0
  9055. Fill zeroes at blank locations
  9056. @item original, 1
  9057. Original image at blank locations
  9058. @item clamp, 2
  9059. Extruded edge value at blank locations
  9060. @item mirror, 3
  9061. Mirrored edge at blank locations
  9062. @end table
  9063. Default value is @samp{mirror}.
  9064. @item blocksize
  9065. Specify the blocksize to use for motion search. Range 4-128 pixels,
  9066. default 8.
  9067. @item contrast
  9068. Specify the contrast threshold for blocks. Only blocks with more than
  9069. the specified contrast (difference between darkest and lightest
  9070. pixels) will be considered. Range 1-255, default 125.
  9071. @item search
  9072. Specify the search strategy. Available values are:
  9073. @table @samp
  9074. @item exhaustive, 0
  9075. Set exhaustive search
  9076. @item less, 1
  9077. Set less exhaustive search.
  9078. @end table
  9079. Default value is @samp{exhaustive}.
  9080. @item filename
  9081. If set then a detailed log of the motion search is written to the
  9082. specified file.
  9083. @end table
  9084. @section despill
  9085. Remove unwanted contamination of foreground colors, caused by reflected color of
  9086. greenscreen or bluescreen.
  9087. This filter accepts the following options:
  9088. @table @option
  9089. @item type
  9090. Set what type of despill to use.
  9091. @item mix
  9092. Set how spillmap will be generated.
  9093. @item expand
  9094. Set how much to get rid of still remaining spill.
  9095. @item red
  9096. Controls amount of red in spill area.
  9097. @item green
  9098. Controls amount of green in spill area.
  9099. Should be -1 for greenscreen.
  9100. @item blue
  9101. Controls amount of blue in spill area.
  9102. Should be -1 for bluescreen.
  9103. @item brightness
  9104. Controls brightness of spill area, preserving colors.
  9105. @item alpha
  9106. Modify alpha from generated spillmap.
  9107. @end table
  9108. @subsection Commands
  9109. This filter supports the all above options as @ref{commands}.
  9110. @section detelecine
  9111. Apply an exact inverse of the telecine operation. It requires a predefined
  9112. pattern specified using the pattern option which must be the same as that passed
  9113. to the telecine filter.
  9114. This filter accepts the following options:
  9115. @table @option
  9116. @item first_field
  9117. @table @samp
  9118. @item top, t
  9119. top field first
  9120. @item bottom, b
  9121. bottom field first
  9122. The default value is @code{top}.
  9123. @end table
  9124. @item pattern
  9125. A string of numbers representing the pulldown pattern you wish to apply.
  9126. The default value is @code{23}.
  9127. @item start_frame
  9128. A number representing position of the first frame with respect to the telecine
  9129. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  9130. @end table
  9131. @anchor{dilation}
  9132. @section dilation
  9133. Apply dilation effect to the video.
  9134. This filter replaces the pixel by the local(3x3) maximum.
  9135. It accepts the following options:
  9136. @table @option
  9137. @item threshold0
  9138. @item threshold1
  9139. @item threshold2
  9140. @item threshold3
  9141. Limit the maximum change for each plane, default is 65535.
  9142. If 0, plane will remain unchanged.
  9143. @item coordinates
  9144. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9145. pixels are used.
  9146. Flags to local 3x3 coordinates maps like this:
  9147. 1 2 3
  9148. 4 5
  9149. 6 7 8
  9150. @end table
  9151. @subsection Commands
  9152. This filter supports the all above options as @ref{commands}.
  9153. @section displace
  9154. Displace pixels as indicated by second and third input stream.
  9155. It takes three input streams and outputs one stream, the first input is the
  9156. source, and second and third input are displacement maps.
  9157. The second input specifies how much to displace pixels along the
  9158. x-axis, while the third input specifies how much to displace pixels
  9159. along the y-axis.
  9160. If one of displacement map streams terminates, last frame from that
  9161. displacement map will be used.
  9162. Note that once generated, displacements maps can be reused over and over again.
  9163. A description of the accepted options follows.
  9164. @table @option
  9165. @item edge
  9166. Set displace behavior for pixels that are out of range.
  9167. Available values are:
  9168. @table @samp
  9169. @item blank
  9170. Missing pixels are replaced by black pixels.
  9171. @item smear
  9172. Adjacent pixels will spread out to replace missing pixels.
  9173. @item wrap
  9174. Out of range pixels are wrapped so they point to pixels of other side.
  9175. @item mirror
  9176. Out of range pixels will be replaced with mirrored pixels.
  9177. @end table
  9178. Default is @samp{smear}.
  9179. @end table
  9180. @subsection Examples
  9181. @itemize
  9182. @item
  9183. Add ripple effect to rgb input of video size hd720:
  9184. @example
  9185. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  9186. @end example
  9187. @item
  9188. Add wave effect to rgb input of video size hd720:
  9189. @example
  9190. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  9191. @end example
  9192. @end itemize
  9193. @section dnn_classify
  9194. Do classification with deep neural networks based on bounding boxes.
  9195. The filter accepts the following options:
  9196. @table @option
  9197. @item dnn_backend
  9198. Specify which DNN backend to use for model loading and execution. This option accepts
  9199. only openvino now, tensorflow backends will be added.
  9200. @item model
  9201. Set path to model file specifying network architecture and its parameters.
  9202. Note that different backends use different file formats.
  9203. @item input
  9204. Set the input name of the dnn network.
  9205. @item output
  9206. Set the output name of the dnn network.
  9207. @item confidence
  9208. Set the confidence threshold (default: 0.5).
  9209. @item labels
  9210. Set path to label file specifying the mapping between label id and name.
  9211. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9212. The first line is the name of label id 0,
  9213. and the second line is the name of label id 1, etc.
  9214. The label id is considered as name if the label file is not provided.
  9215. @item backend_configs
  9216. Set the configs to be passed into backend
  9217. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9218. please use tools/python/tf_sess_config.py to get the configs for your system.
  9219. @end table
  9220. @section dnn_detect
  9221. Do object detection with deep neural networks.
  9222. The filter accepts the following options:
  9223. @table @option
  9224. @item dnn_backend
  9225. Specify which DNN backend to use for model loading and execution. This option accepts
  9226. only openvino now, tensorflow backends will be added.
  9227. @item model
  9228. Set path to model file specifying network architecture and its parameters.
  9229. Note that different backends use different file formats.
  9230. @item input
  9231. Set the input name of the dnn network.
  9232. @item output
  9233. Set the output name of the dnn network.
  9234. @item confidence
  9235. Set the confidence threshold (default: 0.5).
  9236. @item labels
  9237. Set path to label file specifying the mapping between label id and name.
  9238. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9239. The first line is the name of label id 0 (usually it is 'background'),
  9240. and the second line is the name of label id 1, etc.
  9241. The label id is considered as name if the label file is not provided.
  9242. @item backend_configs
  9243. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9244. Roll back to sync execution if the backend does not support async.
  9245. @end table
  9246. @anchor{dnn_processing}
  9247. @section dnn_processing
  9248. Do image processing with deep neural networks. It works together with another filter
  9249. which converts the pixel format of the Frame to what the dnn network requires.
  9250. The filter accepts the following options:
  9251. @table @option
  9252. @item dnn_backend
  9253. Specify which DNN backend to use for model loading and execution. This option accepts
  9254. the following values:
  9255. @table @samp
  9256. @item tensorflow
  9257. TensorFlow backend. To enable this backend you
  9258. need to install the TensorFlow for C library (see
  9259. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  9260. @code{--enable-libtensorflow}
  9261. @item openvino
  9262. OpenVINO backend. To enable this backend you
  9263. need to build and install the OpenVINO for C library (see
  9264. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  9265. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  9266. be needed if the header files and libraries are not installed into system path)
  9267. @item torch
  9268. Libtorch backend. To enable this backend you need to build and install Libtroch
  9269. for C++ library. Please download cxx11 ABI version (see
  9270. @url{https://pytorch.org/get-started/locally})
  9271. and configure FFmpeg with @code{--enable-libtorch
  9272. --extra-cflags=-I/libtorch_root/libtorch/include
  9273. --extra-cflags=-I/libtorch_root/libtorch/include/torch/csrc/api/include
  9274. --extra-ldflags=-L/libtorch_root/libtorch/lib/}
  9275. @end table
  9276. @item model
  9277. Set path to model file specifying network architecture and its parameters.
  9278. Note that different backends use different file formats. TensorFlow, OpenVINO
  9279. and Libtorch backend can load files for only its format.
  9280. @item input
  9281. Set the input name of the dnn network.
  9282. @item output
  9283. Set the output name of the dnn network.
  9284. @item backend_configs
  9285. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9286. Roll back to sync execution if the backend does not support async.
  9287. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9288. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9289. @end table
  9290. @subsection Examples
  9291. @itemize
  9292. @item
  9293. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  9294. @example
  9295. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  9296. @end example
  9297. @item
  9298. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  9299. @example
  9300. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  9301. @end example
  9302. @item
  9303. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  9304. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9305. @example
  9306. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y:backend_configs=sess_config=0x10022805320e09cdccccccccccec3f20012a01303801 -y tmp.espcn.jpg
  9307. @end example
  9308. @end itemize
  9309. @section drawbox
  9310. Draw a colored box on the input image.
  9311. It accepts the following parameters:
  9312. @table @option
  9313. @item x
  9314. @item y
  9315. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  9316. @item width, w
  9317. @item height, h
  9318. The expressions which specify the width and height of the box; if 0 they are interpreted as
  9319. the input width and height. It defaults to 0.
  9320. @item color, c
  9321. Specify the color of the box to write. For the general syntax of this option,
  9322. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9323. value @code{invert} is used, the box edge color is the same as the
  9324. video with inverted luma.
  9325. @item thickness, t
  9326. The expression which sets the thickness of the box edge.
  9327. A value of @code{fill} will create a filled box. Default value is @code{3}.
  9328. See below for the list of accepted constants.
  9329. @item replace
  9330. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  9331. will overwrite the video's color and alpha pixels.
  9332. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  9333. @end table
  9334. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9335. following constants:
  9336. @table @option
  9337. @item dar
  9338. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9339. @item hsub
  9340. @item vsub
  9341. horizontal and vertical chroma subsample values. For example for the
  9342. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9343. @item in_h, ih
  9344. @item in_w, iw
  9345. The input width and height.
  9346. @item sar
  9347. The input sample aspect ratio.
  9348. @item x
  9349. @item y
  9350. The x and y offset coordinates where the box is drawn.
  9351. @item w
  9352. @item h
  9353. The width and height of the drawn box.
  9354. @item box_source
  9355. Box source can be set as side_data_detection_bboxes if you want to use box data in
  9356. detection bboxes of side data.
  9357. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  9358. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  9359. not sure about the box source.
  9360. @item t
  9361. The thickness of the drawn box.
  9362. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9363. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9364. @end table
  9365. @subsection Examples
  9366. @itemize
  9367. @item
  9368. Draw a black box around the edge of the input image:
  9369. @example
  9370. drawbox
  9371. @end example
  9372. @item
  9373. Draw a box with color red and an opacity of 50%:
  9374. @example
  9375. drawbox=10:20:200:60:red@@0.5
  9376. @end example
  9377. The previous example can be specified as:
  9378. @example
  9379. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9380. @end example
  9381. @item
  9382. Fill the box with pink color:
  9383. @example
  9384. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9385. @end example
  9386. @item
  9387. Draw a 2-pixel red 2.40:1 mask:
  9388. @example
  9389. 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
  9390. @end example
  9391. @end itemize
  9392. @subsection Commands
  9393. This filter supports same commands as options.
  9394. The command accepts the same syntax of the corresponding option.
  9395. If the specified expression is not valid, it is kept at its current
  9396. value.
  9397. @anchor{drawgraph}
  9398. @section drawgraph
  9399. Draw a graph using input video metadata.
  9400. It accepts the following parameters:
  9401. @table @option
  9402. @item m1
  9403. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9404. @item fg1
  9405. Set 1st foreground color expression.
  9406. @item m2
  9407. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9408. @item fg2
  9409. Set 2nd foreground color expression.
  9410. @item m3
  9411. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9412. @item fg3
  9413. Set 3rd foreground color expression.
  9414. @item m4
  9415. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9416. @item fg4
  9417. Set 4th foreground color expression.
  9418. @item min
  9419. Set minimal value of metadata value.
  9420. @item max
  9421. Set maximal value of metadata value.
  9422. @item bg
  9423. Set graph background color. Default is white.
  9424. @item mode
  9425. Set graph mode.
  9426. Available values for mode is:
  9427. @table @samp
  9428. @item bar
  9429. @item dot
  9430. @item line
  9431. @end table
  9432. Default is @code{line}.
  9433. @item slide
  9434. Set slide mode.
  9435. Available values for slide is:
  9436. @table @samp
  9437. @item frame
  9438. Draw new frame when right border is reached.
  9439. @item replace
  9440. Replace old columns with new ones.
  9441. @item scroll
  9442. Scroll from right to left.
  9443. @item rscroll
  9444. Scroll from left to right.
  9445. @item picture
  9446. Draw single picture.
  9447. @end table
  9448. Default is @code{frame}.
  9449. @item size
  9450. Set size of graph video. For the syntax of this option, check the
  9451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9452. The default value is @code{900x256}.
  9453. @item rate, r
  9454. Set the output frame rate. Default value is @code{25}.
  9455. The foreground color expressions can use the following variables:
  9456. @table @option
  9457. @item MIN
  9458. Minimal value of metadata value.
  9459. @item MAX
  9460. Maximal value of metadata value.
  9461. @item VAL
  9462. Current metadata key value.
  9463. @end table
  9464. The color is defined as 0xAABBGGRR.
  9465. @end table
  9466. Example using metadata from @ref{signalstats} filter:
  9467. @example
  9468. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9469. @end example
  9470. Example using metadata from @ref{ebur128} filter:
  9471. @example
  9472. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9473. @end example
  9474. @section drawgrid
  9475. Draw a grid on the input image.
  9476. It accepts the following parameters:
  9477. @table @option
  9478. @item x
  9479. @item y
  9480. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9481. @item width, w
  9482. @item height, h
  9483. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9484. input width and height, respectively, minus @code{thickness}, so image gets
  9485. framed. Default to 0.
  9486. @item color, c
  9487. Specify the color of the grid. For the general syntax of this option,
  9488. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9489. value @code{invert} is used, the grid color is the same as the
  9490. video with inverted luma.
  9491. @item thickness, t
  9492. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9493. See below for the list of accepted constants.
  9494. @item replace
  9495. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9496. will overwrite the video's color and alpha pixels.
  9497. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9498. @end table
  9499. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9500. following constants:
  9501. @table @option
  9502. @item dar
  9503. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9504. @item hsub
  9505. @item vsub
  9506. horizontal and vertical chroma subsample values. For example for the
  9507. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9508. @item in_h, ih
  9509. @item in_w, iw
  9510. The input grid cell width and height.
  9511. @item sar
  9512. The input sample aspect ratio.
  9513. @item x
  9514. @item y
  9515. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9516. @item w
  9517. @item h
  9518. The width and height of the drawn cell.
  9519. @item t
  9520. The thickness of the drawn cell.
  9521. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9522. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9523. @end table
  9524. @subsection Examples
  9525. @itemize
  9526. @item
  9527. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9528. @example
  9529. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9530. @end example
  9531. @item
  9532. Draw a white 3x3 grid with an opacity of 50%:
  9533. @example
  9534. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9535. @end example
  9536. @end itemize
  9537. @subsection Commands
  9538. This filter supports same commands as options.
  9539. The command accepts the same syntax of the corresponding option.
  9540. If the specified expression is not valid, it is kept at its current
  9541. value.
  9542. @anchor{drawtext}
  9543. @section drawtext
  9544. Draw a text string or text from a specified file on top of a video, using the
  9545. libfreetype library.
  9546. To enable compilation of this filter, you need to configure FFmpeg with
  9547. @code{--enable-libfreetype} and @code{--enable-libharfbuzz}.
  9548. To enable default font fallback and the @var{font} option you need to
  9549. configure FFmpeg with @code{--enable-libfontconfig}.
  9550. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9551. @code{--enable-libfribidi}.
  9552. @subsection Syntax
  9553. It accepts the following parameters:
  9554. @table @option
  9555. @item box
  9556. Used to draw a box around text using the background color.
  9557. The value must be either 1 (enable) or 0 (disable).
  9558. The default value of @var{box} is 0.
  9559. @item boxborderw
  9560. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9561. The value must be specified using one of the following formats:
  9562. @itemize @bullet
  9563. @item @code{boxborderw=10} set the width of all the borders to 10
  9564. @item @code{boxborderw=10|20} set the width of the top and bottom borders to 10
  9565. and the width of the left and right borders to 20
  9566. @item @code{boxborderw=10|20|30} set the width of the top border to 10, the width
  9567. of the bottom border to 30 and the width of the left and right borders to 20
  9568. @item @code{boxborderw=10|20|30|40} set the borders width to 10 (top), 20 (right),
  9569. 30 (bottom), 40 (left)
  9570. @end itemize
  9571. The default value of @var{boxborderw} is "0".
  9572. @item boxcolor
  9573. The color to be used for drawing box around text. For the syntax of this
  9574. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9575. The default value of @var{boxcolor} is "white".
  9576. @item line_spacing
  9577. Set the line spacing in pixels. The default value of @var{line_spacing} is 0.
  9578. @item text_align
  9579. Set the vertical and horizontal alignment of the text with respect to the box boundaries.
  9580. The value is combination of flags, one for the vertical alignment (T=top,
  9581. M=middle, B=bottom) and one for the horizontal alignment (L=left, C=center, R=right).
  9582. Please note that tab characters are only supported with the left horizontal alignment.
  9583. @item y_align
  9584. Specify what the @var{y} value is referred to. Possible values are:
  9585. @itemize @bullet
  9586. @item @code{text} the top of the highest glyph of the first text line is placed at @var{y}
  9587. @item @code{baseline} the baseline of the first text line is placed at @var{y}
  9588. @item @code{font} the baseline of the first text line is placed at @var{y} plus the
  9589. ascent (in pixels) defined in the font metrics
  9590. @end itemize
  9591. The default value of @var{y_align} is "text" for backward compatibility.
  9592. @item borderw
  9593. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9594. The default value of @var{borderw} is 0.
  9595. @item bordercolor
  9596. Set the color to be used for drawing border around text. For the syntax of this
  9597. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9598. The default value of @var{bordercolor} is "black".
  9599. @item expansion
  9600. Select how the @var{text} is expanded. Can be either @code{none},
  9601. @code{strftime} (deprecated) or @code{normal} (default). See the
  9602. @ref{drawtext_expansion, Text expansion} section below for details.
  9603. @item basetime
  9604. Set a start time for the count. Value is in microseconds. Only applied
  9605. in the deprecated @code{strftime} expansion mode. To emulate in normal expansion
  9606. mode use the @code{pts} function, supplying the start time (in seconds)
  9607. as the second argument.
  9608. @item fix_bounds
  9609. If true, check and fix text coords to avoid clipping.
  9610. @item fontcolor
  9611. The color to be used for drawing fonts. For the syntax of this option, check
  9612. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9613. The default value of @var{fontcolor} is "black".
  9614. @item fontcolor_expr
  9615. String which is expanded the same way as @var{text} to obtain dynamic
  9616. @var{fontcolor} value. By default this option has empty value and is not
  9617. processed. When this option is set, it overrides @var{fontcolor} option.
  9618. @item font
  9619. The font family to be used for drawing text. By default Sans.
  9620. @item fontfile
  9621. The font file to be used for drawing text. The path must be included.
  9622. This parameter is mandatory if the fontconfig support is disabled.
  9623. @item alpha
  9624. Draw the text applying alpha blending. The value can
  9625. be a number between 0.0 and 1.0.
  9626. The expression accepts the same variables @var{x, y} as well.
  9627. The default value is 1.
  9628. Please see @var{fontcolor_expr}.
  9629. @item fontsize
  9630. The font size to be used for drawing text.
  9631. The default value of @var{fontsize} is 16.
  9632. @item text_shaping
  9633. If set to 1, attempt to shape the text (for example, reverse the order of
  9634. right-to-left text and join Arabic characters) before drawing it.
  9635. Otherwise, just draw the text exactly as given.
  9636. By default 1 (if supported).
  9637. @item ft_load_flags
  9638. The flags to be used for loading the fonts.
  9639. The flags map the corresponding flags supported by libfreetype, and are
  9640. a combination of the following values:
  9641. @table @var
  9642. @item default
  9643. @item no_scale
  9644. @item no_hinting
  9645. @item render
  9646. @item no_bitmap
  9647. @item vertical_layout
  9648. @item force_autohint
  9649. @item crop_bitmap
  9650. @item pedantic
  9651. @item ignore_global_advance_width
  9652. @item no_recurse
  9653. @item ignore_transform
  9654. @item monochrome
  9655. @item linear_design
  9656. @item no_autohint
  9657. @end table
  9658. Default value is "default".
  9659. For more information consult the documentation for the FT_LOAD_*
  9660. libfreetype flags.
  9661. @item shadowcolor
  9662. The color to be used for drawing a shadow behind the drawn text. For the
  9663. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9664. ffmpeg-utils manual,ffmpeg-utils}.
  9665. The default value of @var{shadowcolor} is "black".
  9666. @item boxw
  9667. Set the width of the box to be drawn around text.
  9668. The default value of @var{boxw} is computed automatically to match the text width
  9669. @item boxh
  9670. Set the height of the box to be drawn around text.
  9671. The default value of @var{boxh} is computed automatically to match the text height
  9672. @item shadowx
  9673. @item shadowy
  9674. The x and y offsets for the text shadow position with respect to the
  9675. position of the text. They can be either positive or negative
  9676. values. The default value for both is "0".
  9677. @item start_number
  9678. The starting frame number for the n/frame_num variable. The default value
  9679. is "0".
  9680. @item tabsize
  9681. The size in number of spaces to use for rendering the tab.
  9682. Default value is 4.
  9683. @item timecode
  9684. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9685. format. It can be used with or without text parameter. @var{timecode_rate}
  9686. option must be specified.
  9687. @item timecode_rate, rate, r
  9688. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9689. integer. Minimum value is "1".
  9690. Drop-frame timecode is supported for frame rates 30 & 60.
  9691. @item tc24hmax
  9692. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9693. Default is 0 (disabled).
  9694. @item text
  9695. The text string to be drawn. The text must be a sequence of UTF-8
  9696. encoded characters.
  9697. This parameter is mandatory if no file is specified with the parameter
  9698. @var{textfile}.
  9699. @item textfile
  9700. A text file containing text to be drawn. The text must be a sequence
  9701. of UTF-8 encoded characters.
  9702. This parameter is mandatory if no text string is specified with the
  9703. parameter @var{text}.
  9704. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9705. @item text_source
  9706. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9707. detection bboxes of side data.
  9708. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9709. text data in detection bboxes of side data. So please do not use this parameter
  9710. if you are not sure about the text source.
  9711. @item reload
  9712. The @var{textfile} will be reloaded at specified frame interval.
  9713. Be sure to update @var{textfile} atomically, or it may be read partially,
  9714. or even fail.
  9715. Range is 0 to INT_MAX. Default is 0.
  9716. @item x
  9717. @item y
  9718. The expressions which specify the offsets where text will be drawn
  9719. within the video frame. They are relative to the top/left border of the
  9720. output image.
  9721. The default value of @var{x} and @var{y} is "0".
  9722. See below for the list of accepted constants and functions.
  9723. @end table
  9724. The parameters for @var{x} and @var{y} are expressions containing the
  9725. following constants and functions:
  9726. @table @option
  9727. @item dar
  9728. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9729. @item hsub
  9730. @item vsub
  9731. horizontal and vertical chroma subsample values. For example for the
  9732. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9733. @item line_h, lh
  9734. the height of each text line
  9735. @item main_h, h, H
  9736. the input height
  9737. @item main_w, w, W
  9738. the input width
  9739. @item max_glyph_a, ascent
  9740. the maximum distance from the baseline to the highest/upper grid
  9741. coordinate used to place a glyph outline point, for all the rendered
  9742. glyphs.
  9743. It is a positive value, due to the grid's orientation with the Y axis
  9744. upwards.
  9745. @item max_glyph_d, descent
  9746. the maximum distance from the baseline to the lowest grid coordinate
  9747. used to place a glyph outline point, for all the rendered glyphs.
  9748. This is a negative value, due to the grid's orientation, with the Y axis
  9749. upwards.
  9750. @item max_glyph_h
  9751. maximum glyph height, that is the maximum height for all the glyphs
  9752. contained in the rendered text, it is equivalent to @var{ascent} -
  9753. @var{descent}.
  9754. @item max_glyph_w
  9755. maximum glyph width, that is the maximum width for all the glyphs
  9756. contained in the rendered text
  9757. @item font_a
  9758. the ascent size defined in the font metrics
  9759. @item font_d
  9760. the descent size defined in the font metrics
  9761. @item top_a
  9762. the maximum ascender of the glyphs of the first text line
  9763. @item bottom_d
  9764. the maximum descender of the glyphs of the last text line
  9765. @item n
  9766. the number of input frame, starting from 0
  9767. @item rand(min, max)
  9768. return a random number included between @var{min} and @var{max}
  9769. @item sar
  9770. The input sample aspect ratio.
  9771. @item t
  9772. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9773. @item text_h, th
  9774. the height of the rendered text
  9775. @item text_w, tw
  9776. the width of the rendered text
  9777. @item x
  9778. @item y
  9779. the x and y offset coordinates where the text is drawn.
  9780. These parameters allow the @var{x} and @var{y} expressions to refer
  9781. to each other, so you can for example specify @code{y=x/dar}.
  9782. @item pict_type
  9783. A one character description of the current frame's picture type.
  9784. @item pkt_pos
  9785. The current packet's position in the input file or stream
  9786. (in bytes, from the start of the input). A value of -1 indicates
  9787. this info is not available.
  9788. @item duration
  9789. The current packet's duration, in seconds.
  9790. @item pkt_size
  9791. The current packet's size (in bytes).
  9792. @end table
  9793. @anchor{drawtext_expansion}
  9794. @subsection Text expansion
  9795. If @option{expansion} is set to @code{strftime}, the filter recognizes
  9796. sequences accepted by the @code{strftime} C function in the provided
  9797. text and expands them accordingly. Check the documentation of
  9798. @code{strftime}. This feature is deprecated in favor of @code{normal}
  9799. expansion with the @code{gmtime} or @code{localtime} expansion
  9800. functions.
  9801. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9802. If @option{expansion} is set to @code{normal} (which is the default),
  9803. the following expansion mechanism is used.
  9804. The backslash character @samp{\}, followed by any character, always expands to
  9805. the second character.
  9806. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9807. braces is a function name, possibly followed by arguments separated by ':'.
  9808. If the arguments contain special characters or delimiters (':' or '@}'),
  9809. they should be escaped.
  9810. Note that they probably must also be escaped as the value for the @option{text}
  9811. option in the filter argument string and as the filter argument in the
  9812. filtergraph description, and possibly also for the shell, that makes up to four
  9813. levels of escaping; using a text file with the @option{textfile} option avoids
  9814. these problems.
  9815. The following functions are available:
  9816. @table @command
  9817. @item expr, e
  9818. The expression evaluation result.
  9819. It must take one argument specifying the expression to be evaluated,
  9820. which accepts the same constants and functions as the @var{x} and
  9821. @var{y} values. Note that not all constants should be used, for
  9822. example the text size is not known when evaluating the expression, so
  9823. the constants @var{text_w} and @var{text_h} will have an undefined
  9824. value.
  9825. @item expr_int_format, eif
  9826. Evaluate the expression's value and output as formatted integer.
  9827. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9828. The second argument specifies the output format. Allowed values are @samp{x},
  9829. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9830. @code{printf} function.
  9831. The third parameter is optional and sets the number of positions taken by the output.
  9832. It can be used to add padding with zeros from the left.
  9833. @item gmtime
  9834. The time at which the filter is running, expressed in UTC.
  9835. It can accept an argument: a @code{strftime} C function format string.
  9836. The format string is extended to support the variable @var{%[1-6]N}
  9837. which prints fractions of the second with optionally specified number of digits.
  9838. @item localtime
  9839. The time at which the filter is running, expressed in the local time zone.
  9840. It can accept an argument: a @code{strftime} C function format string.
  9841. The format string is extended to support the variable @var{%[1-6]N}
  9842. which prints fractions of the second with optionally specified number of digits.
  9843. @item metadata
  9844. Frame metadata. Takes one or two arguments.
  9845. The first argument is mandatory and specifies the metadata key.
  9846. The second argument is optional and specifies a default value, used when the
  9847. metadata key is not found or empty.
  9848. Available metadata can be identified by inspecting entries
  9849. starting with TAG included within each frame section
  9850. printed by running @code{ffprobe -show_frames}.
  9851. String metadata generated in filters leading to
  9852. the drawtext filter are also available.
  9853. @item n, frame_num
  9854. The frame number, starting from 0.
  9855. @item pict_type
  9856. A one character description of the current picture type.
  9857. @item pts
  9858. The timestamp of the current frame.
  9859. It can take up to three arguments.
  9860. The first argument is the format of the timestamp; it defaults to @code{flt}
  9861. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9862. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9863. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9864. @code{localtime} stands for the timestamp of the frame formatted as
  9865. local time zone time.
  9866. The second argument is an offset added to the timestamp.
  9867. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9868. supplied to present the hour part of the formatted timestamp in 24h format
  9869. (00-23).
  9870. If the format is set to @code{localtime} or @code{gmtime}, a third
  9871. argument may be supplied: a @code{strftime} C function format string.
  9872. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9873. @end table
  9874. @subsection Commands
  9875. This filter supports altering parameters via commands:
  9876. @table @option
  9877. @item reinit
  9878. Alter existing filter parameters.
  9879. Syntax for the argument is the same as for filter invocation, e.g.
  9880. @example
  9881. fontsize=56:fontcolor=green:text='Hello World'
  9882. @end example
  9883. Full filter invocation with sendcmd would look like this:
  9884. @example
  9885. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9886. @end example
  9887. If the entire argument can't be parsed or applied as valid values then the filter will
  9888. continue with its existing parameters.
  9889. @end table
  9890. The following options are also supported as @ref{commands}:
  9891. @itemize @bullet
  9892. @item x
  9893. @item y
  9894. @item alpha
  9895. @item fontsize
  9896. @item fontcolor
  9897. @item boxcolor
  9898. @item bordercolor
  9899. @item shadowcolor
  9900. @item box
  9901. @item boxw
  9902. @item boxh
  9903. @item boxborderw
  9904. @item line_spacing
  9905. @item text_align
  9906. @item shadowx
  9907. @item shadowy
  9908. @item borderw
  9909. @end itemize
  9910. @subsection Examples
  9911. @itemize
  9912. @item
  9913. Draw "Test Text" with font FreeSerif, using the default values for the
  9914. optional parameters.
  9915. @example
  9916. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9917. @end example
  9918. @item
  9919. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9920. and y=50 (counting from the top-left corner of the screen), text is
  9921. yellow with a red box around it. Both the text and the box have an
  9922. opacity of 20%.
  9923. @example
  9924. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9925. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9926. @end example
  9927. Note that the double quotes are not necessary if spaces are not used
  9928. within the parameter list.
  9929. @item
  9930. Show the text at the center of the video frame:
  9931. @example
  9932. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9933. @end example
  9934. @item
  9935. Show the text at a random position, switching to a new position every 30 seconds:
  9936. @example
  9937. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  9938. @end example
  9939. @item
  9940. Show a text line sliding from right to left in the last row of the video
  9941. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9942. with no newlines.
  9943. @example
  9944. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9945. @end example
  9946. @item
  9947. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9948. @example
  9949. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9950. @end example
  9951. @item
  9952. Draw a single green letter "g", at the center of the input video.
  9953. The glyph baseline is placed at half screen height.
  9954. @example
  9955. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9956. @end example
  9957. @item
  9958. Show text for 1 second every 3 seconds:
  9959. @example
  9960. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9961. @end example
  9962. @item
  9963. Use fontconfig to set the font. Note that the colons need to be escaped.
  9964. @example
  9965. drawtext='fontfile=Linux Libertine O-40\\:style=Semibold:text=FFmpeg'
  9966. @end example
  9967. @item
  9968. Draw "Test Text" with font size dependent on height of the video.
  9969. @example
  9970. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9971. @end example
  9972. @item
  9973. Print the date of a real-time encoding (see documentation for the
  9974. @code{strftime} C function):
  9975. @example
  9976. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9977. @end example
  9978. @item
  9979. Show text fading in and out (appearing/disappearing):
  9980. @example
  9981. #!/bin/sh
  9982. DS=1.0 # display start
  9983. DE=10.0 # display end
  9984. FID=1.5 # fade in duration
  9985. FOD=5 # fade out duration
  9986. ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
  9987. @end example
  9988. @item
  9989. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9990. and the @option{fontsize} value are included in the @option{y} offset.
  9991. @example
  9992. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9993. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9994. @end example
  9995. @item
  9996. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9997. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9998. must have option @option{-export_path_metadata 1} for the special metadata fields
  9999. to be available for filters.
  10000. @example
  10001. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  10002. @end example
  10003. @end itemize
  10004. For more information about libfreetype, check:
  10005. @url{http://www.freetype.org/}.
  10006. For more information about fontconfig, check:
  10007. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  10008. For more information about libfribidi, check:
  10009. @url{http://fribidi.org/}.
  10010. For more information about libharfbuzz, check:
  10011. @url{https://github.com/harfbuzz/harfbuzz}.
  10012. @section edgedetect
  10013. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  10014. The filter accepts the following options:
  10015. @table @option
  10016. @item low
  10017. @item high
  10018. Set low and high threshold values used by the Canny thresholding
  10019. algorithm.
  10020. The high threshold selects the "strong" edge pixels, which are then
  10021. connected through 8-connectivity with the "weak" edge pixels selected
  10022. by the low threshold.
  10023. @var{low} and @var{high} threshold values must be chosen in the range
  10024. [0,1], and @var{low} should be lesser or equal to @var{high}.
  10025. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  10026. is @code{50/255}.
  10027. @item mode
  10028. Define the drawing mode.
  10029. @table @samp
  10030. @item wires
  10031. Draw white/gray wires on black background.
  10032. @item colormix
  10033. Mix the colors to create a paint/cartoon effect.
  10034. @item canny
  10035. Apply Canny edge detector on all selected planes.
  10036. @end table
  10037. Default value is @var{wires}.
  10038. @item planes
  10039. Select planes for filtering. By default all available planes are filtered.
  10040. @end table
  10041. @subsection Examples
  10042. @itemize
  10043. @item
  10044. Standard edge detection with custom values for the hysteresis thresholding:
  10045. @example
  10046. edgedetect=low=0.1:high=0.4
  10047. @end example
  10048. @item
  10049. Painting effect without thresholding:
  10050. @example
  10051. edgedetect=mode=colormix:high=0
  10052. @end example
  10053. @end itemize
  10054. @section elbg
  10055. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  10056. For each input image, the filter will compute the optimal mapping from
  10057. the input to the output given the codebook length, that is the number
  10058. of distinct output colors.
  10059. This filter accepts the following options.
  10060. @table @option
  10061. @item codebook_length, l
  10062. Set codebook length. The value must be a positive integer, and
  10063. represents the number of distinct output colors. Default value is 256.
  10064. @item nb_steps, n
  10065. Set the maximum number of iterations to apply for computing the optimal
  10066. mapping. The higher the value the better the result and the higher the
  10067. computation time. Default value is 1.
  10068. @item seed, s
  10069. Set a random seed, must be an integer included between 0 and
  10070. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  10071. will try to use a good random seed on a best effort basis.
  10072. @item pal8
  10073. Set pal8 output pixel format. This option does not work with codebook
  10074. length greater than 256. Default is disabled.
  10075. @item use_alpha
  10076. Include alpha values in the quantization calculation. Allows creating
  10077. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  10078. @end table
  10079. @section entropy
  10080. Measure graylevel entropy in histogram of color channels of video frames.
  10081. It accepts the following parameters:
  10082. @table @option
  10083. @item mode
  10084. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  10085. @var{diff} mode measures entropy of histogram delta values, absolute differences
  10086. between neighbour histogram values.
  10087. @end table
  10088. @section epx
  10089. Apply the EPX magnification filter which is designed for pixel art.
  10090. It accepts the following option:
  10091. @table @option
  10092. @item n
  10093. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  10094. @code{3xEPX}.
  10095. Default is @code{3}.
  10096. @end table
  10097. @section eq
  10098. Set brightness, contrast, saturation and approximate gamma adjustment.
  10099. The filter accepts the following options:
  10100. @table @option
  10101. @item contrast
  10102. Set the contrast expression. The value must be a float value in range
  10103. @code{-1000.0} to @code{1000.0}. The default value is "1".
  10104. @item brightness
  10105. Set the brightness expression. The value must be a float value in
  10106. range @code{-1.0} to @code{1.0}. The default value is "0".
  10107. @item saturation
  10108. Set the saturation expression. The value must be a float in
  10109. range @code{0.0} to @code{3.0}. The default value is "1".
  10110. @item gamma
  10111. Set the gamma expression. The value must be a float in range
  10112. @code{0.1} to @code{10.0}. The default value is "1".
  10113. @item gamma_r
  10114. Set the gamma expression for red. The value must be a float in
  10115. range @code{0.1} to @code{10.0}. The default value is "1".
  10116. @item gamma_g
  10117. Set the gamma expression for green. The value must be a float in range
  10118. @code{0.1} to @code{10.0}. The default value is "1".
  10119. @item gamma_b
  10120. Set the gamma expression for blue. The value must be a float in range
  10121. @code{0.1} to @code{10.0}. The default value is "1".
  10122. @item gamma_weight
  10123. Set the gamma weight expression. It can be used to reduce the effect
  10124. of a high gamma value on bright image areas, e.g. keep them from
  10125. getting overamplified and just plain white. The value must be a float
  10126. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  10127. gamma correction all the way down while @code{1.0} leaves it at its
  10128. full strength. Default is "1".
  10129. @item eval
  10130. Set when the expressions for brightness, contrast, saturation and
  10131. gamma expressions are evaluated.
  10132. It accepts the following values:
  10133. @table @samp
  10134. @item init
  10135. only evaluate expressions once during the filter initialization or
  10136. when a command is processed
  10137. @item frame
  10138. evaluate expressions for each incoming frame
  10139. @end table
  10140. Default value is @samp{init}.
  10141. @end table
  10142. The expressions accept the following parameters:
  10143. @table @option
  10144. @item n
  10145. frame count of the input frame starting from 0
  10146. @item pos
  10147. byte position of the corresponding packet in the input file, NAN if
  10148. unspecified; deprecated, do not use
  10149. @item r
  10150. frame rate of the input video, NAN if the input frame rate is unknown
  10151. @item t
  10152. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10153. @end table
  10154. @subsection Commands
  10155. The filter supports the following commands:
  10156. @table @option
  10157. @item contrast
  10158. Set the contrast expression.
  10159. @item brightness
  10160. Set the brightness expression.
  10161. @item saturation
  10162. Set the saturation expression.
  10163. @item gamma
  10164. Set the gamma expression.
  10165. @item gamma_r
  10166. Set the gamma_r expression.
  10167. @item gamma_g
  10168. Set gamma_g expression.
  10169. @item gamma_b
  10170. Set gamma_b expression.
  10171. @item gamma_weight
  10172. Set gamma_weight expression.
  10173. The command accepts the same syntax of the corresponding option.
  10174. If the specified expression is not valid, it is kept at its current
  10175. value.
  10176. @end table
  10177. @anchor{erosion}
  10178. @section erosion
  10179. Apply erosion effect to the video.
  10180. This filter replaces the pixel by the local(3x3) minimum.
  10181. It accepts the following options:
  10182. @table @option
  10183. @item threshold0
  10184. @item threshold1
  10185. @item threshold2
  10186. @item threshold3
  10187. Limit the maximum change for each plane, default is 65535.
  10188. If 0, plane will remain unchanged.
  10189. @item coordinates
  10190. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  10191. pixels are used.
  10192. Flags to local 3x3 coordinates maps like this:
  10193. 1 2 3
  10194. 4 5
  10195. 6 7 8
  10196. @end table
  10197. @subsection Commands
  10198. This filter supports the all above options as @ref{commands}.
  10199. @section estdif
  10200. Deinterlace the input video ("estdif" stands for "Edge Slope
  10201. Tracing Deinterlacing Filter").
  10202. Spatial only filter that uses edge slope tracing algorithm
  10203. to interpolate missing lines.
  10204. It accepts the following parameters:
  10205. @table @option
  10206. @item mode
  10207. The interlacing mode to adopt. It accepts one of the following values:
  10208. @table @option
  10209. @item frame
  10210. Output one frame for each frame.
  10211. @item field
  10212. Output one frame for each field.
  10213. @end table
  10214. The default value is @code{field}.
  10215. @item parity
  10216. The picture field parity assumed for the input interlaced video. It accepts one
  10217. of the following values:
  10218. @table @option
  10219. @item tff
  10220. Assume the top field is first.
  10221. @item bff
  10222. Assume the bottom field is first.
  10223. @item auto
  10224. Enable automatic detection of field parity.
  10225. @end table
  10226. The default value is @code{auto}.
  10227. If the interlacing is unknown or the decoder does not export this information,
  10228. top field first will be assumed.
  10229. @item deint
  10230. Specify which frames to deinterlace. Accepts one of the following
  10231. values:
  10232. @table @option
  10233. @item all
  10234. Deinterlace all frames.
  10235. @item interlaced
  10236. Only deinterlace frames marked as interlaced.
  10237. @end table
  10238. The default value is @code{all}.
  10239. @item rslope
  10240. Specify the search radius for edge slope tracing. Default value is 1.
  10241. Allowed range is from 1 to 15.
  10242. @item redge
  10243. Specify the search radius for best edge matching. Default value is 2.
  10244. Allowed range is from 0 to 15.
  10245. @item ecost
  10246. Specify the edge cost for edge matching. Default value is 2.
  10247. Allowed range is from 0 to 50.
  10248. @item mcost
  10249. Specify the middle cost for edge matching. Default value is 1.
  10250. Allowed range is from 0 to 50.
  10251. @item dcost
  10252. Specify the distance cost for edge matching. Default value is 1.
  10253. Allowed range is from 0 to 50.
  10254. @item interp
  10255. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  10256. of the following values:
  10257. @table @option
  10258. @item 2p
  10259. Two-point interpolation.
  10260. @item 4p
  10261. Four-point interpolation.
  10262. @item 6p
  10263. Six-point interpolation.
  10264. @end table
  10265. @end table
  10266. @subsection Commands
  10267. This filter supports same @ref{commands} as options.
  10268. @section exposure
  10269. Adjust exposure of the video stream.
  10270. The filter accepts the following options:
  10271. @table @option
  10272. @item exposure
  10273. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  10274. Default value is 0 EV.
  10275. @item black
  10276. Set the black level correction. Allowed range is from -1.0 to 1.0.
  10277. Default value is 0.
  10278. @end table
  10279. @subsection Commands
  10280. This filter supports same @ref{commands} as options.
  10281. @section extractplanes
  10282. Extract color channel components from input video stream into
  10283. separate grayscale video streams.
  10284. The filter accepts the following option:
  10285. @table @option
  10286. @item planes
  10287. Set plane(s) to extract.
  10288. Available values for planes are:
  10289. @table @samp
  10290. @item y
  10291. @item u
  10292. @item v
  10293. @item a
  10294. @item r
  10295. @item g
  10296. @item b
  10297. @end table
  10298. Choosing planes not available in the input will result in an error.
  10299. That means you cannot select @code{r}, @code{g}, @code{b} planes
  10300. with @code{y}, @code{u}, @code{v} planes at same time.
  10301. @end table
  10302. @subsection Examples
  10303. @itemize
  10304. @item
  10305. Extract luma, u and v color channel component from input video frame
  10306. into 3 grayscale outputs:
  10307. @example
  10308. 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
  10309. @end example
  10310. @end itemize
  10311. @section fade
  10312. Apply a fade-in/out effect to the input video.
  10313. It accepts the following parameters:
  10314. @table @option
  10315. @item type, t
  10316. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  10317. effect.
  10318. Default is @code{in}.
  10319. @item start_frame, s
  10320. Specify the number of the frame to start applying the fade
  10321. effect at. Default is 0.
  10322. @item nb_frames, n
  10323. The number of frames that the fade effect lasts. At the end of the
  10324. fade-in effect, the output video will have the same intensity as the input video.
  10325. At the end of the fade-out transition, the output video will be filled with the
  10326. selected @option{color}.
  10327. Default is 25.
  10328. @item alpha
  10329. If set to 1, fade only alpha channel, if one exists on the input.
  10330. Default value is 0.
  10331. @item start_time, st
  10332. Specify the timestamp (in seconds) of the frame to start to apply the fade
  10333. effect. If both start_frame and start_time are specified, the fade will start at
  10334. whichever comes last. Default is 0.
  10335. @item duration, d
  10336. The number of seconds for which the fade effect has to last. At the end of the
  10337. fade-in effect the output video will have the same intensity as the input video,
  10338. at the end of the fade-out transition the output video will be filled with the
  10339. selected @option{color}.
  10340. If both duration and nb_frames are specified, duration is used. Default is 0
  10341. (nb_frames is used by default).
  10342. @item color, c
  10343. Specify the color of the fade. Default is "black".
  10344. @end table
  10345. @subsection Examples
  10346. @itemize
  10347. @item
  10348. Fade in the first 30 frames of video:
  10349. @example
  10350. fade=in:0:30
  10351. @end example
  10352. The command above is equivalent to:
  10353. @example
  10354. fade=t=in:s=0:n=30
  10355. @end example
  10356. @item
  10357. Fade out the last 45 frames of a 200-frame video:
  10358. @example
  10359. fade=out:155:45
  10360. fade=type=out:start_frame=155:nb_frames=45
  10361. @end example
  10362. @item
  10363. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  10364. @example
  10365. fade=in:0:25, fade=out:975:25
  10366. @end example
  10367. @item
  10368. Make the first 5 frames yellow, then fade in from frame 5-24:
  10369. @example
  10370. fade=in:5:20:color=yellow
  10371. @end example
  10372. @item
  10373. Fade in alpha over first 25 frames of video:
  10374. @example
  10375. fade=in:0:25:alpha=1
  10376. @end example
  10377. @item
  10378. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  10379. @example
  10380. fade=t=in:st=5.5:d=0.5
  10381. @end example
  10382. @end itemize
  10383. @section feedback
  10384. Apply feedback video filter.
  10385. This filter pass cropped input frames to 2nd output.
  10386. From there it can be filtered with other video filters.
  10387. After filter receives frame from 2nd input, that frame
  10388. is combined on top of original frame from 1st input and passed
  10389. to 1st output.
  10390. The typical usage is filter only part of frame.
  10391. The filter accepts the following options:
  10392. @table @option
  10393. @item x
  10394. @item y
  10395. Set the top left crop position.
  10396. @item w
  10397. @item h
  10398. Set the crop size.
  10399. @end table
  10400. @subsection Examples
  10401. @itemize
  10402. @item
  10403. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  10404. @example
  10405. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  10406. @end example
  10407. @item
  10408. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  10409. @example
  10410. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]drawbox=x=0:y=0:w=100:h=100:t=100[blurin]
  10411. @end example
  10412. @item
  10413. Pixelize rectangular part of video frame of size 100x100 with pixelize filter.
  10414. @example
  10415. [in][blurin]feedback=x=320:y=240:w=100:h=100[out][blurout];[blurout]pixelize[blurin]
  10416. @end example
  10417. @end itemize
  10418. @section fftdnoiz
  10419. Denoise frames using 3D FFT (frequency domain filtering).
  10420. The filter accepts the following options:
  10421. @table @option
  10422. @item sigma
  10423. Set the noise sigma constant. This sets denoising strength.
  10424. Default value is 1. Allowed range is from 0 to 30.
  10425. Using very high sigma with low overlap may give blocking artifacts.
  10426. @item amount
  10427. Set amount of denoising. By default all detected noise is reduced.
  10428. Default value is 1. Allowed range is from 0 to 1.
  10429. @item block
  10430. Set size of block in pixels, Default is 32, can be 8 to 256.
  10431. @item overlap
  10432. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10433. @item method
  10434. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10435. @item prev
  10436. Set number of previous frames to use for denoising. By default is set to 0.
  10437. @item next
  10438. Set number of next frames to to use for denoising. By default is set to 0.
  10439. @item planes
  10440. Set planes which will be filtered, by default are all available filtered
  10441. except alpha.
  10442. @end table
  10443. @section fftfilt
  10444. Apply arbitrary expressions to samples in frequency domain
  10445. @table @option
  10446. @item dc_Y
  10447. Adjust the dc value (gain) of the luma plane of the image. The filter
  10448. accepts an integer value in range @code{0} to @code{1000}. The default
  10449. value is set to @code{0}.
  10450. @item dc_U
  10451. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10452. filter accepts an integer value in range @code{0} to @code{1000}. The
  10453. default value is set to @code{0}.
  10454. @item dc_V
  10455. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10456. filter accepts an integer value in range @code{0} to @code{1000}. The
  10457. default value is set to @code{0}.
  10458. @item weight_Y
  10459. Set the frequency domain weight expression for the luma plane.
  10460. @item weight_U
  10461. Set the frequency domain weight expression for the 1st chroma plane.
  10462. @item weight_V
  10463. Set the frequency domain weight expression for the 2nd chroma plane.
  10464. @item eval
  10465. Set when the expressions are evaluated.
  10466. It accepts the following values:
  10467. @table @samp
  10468. @item init
  10469. Only evaluate expressions once during the filter initialization.
  10470. @item frame
  10471. Evaluate expressions for each incoming frame.
  10472. @end table
  10473. Default value is @samp{init}.
  10474. The filter accepts the following variables:
  10475. @item X
  10476. @item Y
  10477. The coordinates of the current sample.
  10478. @item W
  10479. @item H
  10480. The width and height of the image.
  10481. @item N
  10482. The number of input frame, starting from 0.
  10483. @item WS
  10484. @item HS
  10485. The size of FFT array for horizontal and vertical processing.
  10486. @end table
  10487. @subsection Examples
  10488. @itemize
  10489. @item
  10490. High-pass:
  10491. @example
  10492. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10493. @end example
  10494. @item
  10495. Low-pass:
  10496. @example
  10497. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10498. @end example
  10499. @item
  10500. Sharpen:
  10501. @example
  10502. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10503. @end example
  10504. @item
  10505. Blur:
  10506. @example
  10507. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10508. @end example
  10509. @end itemize
  10510. @section field
  10511. Extract a single field from an interlaced image using stride
  10512. arithmetic to avoid wasting CPU time. The output frames are marked as
  10513. non-interlaced.
  10514. The filter accepts the following options:
  10515. @table @option
  10516. @item type
  10517. Specify whether to extract the top (if the value is @code{0} or
  10518. @code{top}) or the bottom field (if the value is @code{1} or
  10519. @code{bottom}).
  10520. @end table
  10521. @section fieldhint
  10522. Create new frames by copying the top and bottom fields from surrounding frames
  10523. supplied as numbers by the hint file.
  10524. @table @option
  10525. @item hint
  10526. Set file containing hints: absolute/relative frame numbers.
  10527. There must be one line for each frame in a clip. Each line must contain two
  10528. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10529. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10530. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10531. for @code{relative} mode. First number tells from which frame to pick up top
  10532. field and second number tells from which frame to pick up bottom field.
  10533. If optionally followed by @code{+} output frame will be marked as interlaced,
  10534. else if followed by @code{-} output frame will be marked as progressive, else
  10535. it will be marked same as input frame.
  10536. If optionally followed by @code{t} output frame will use only top field, or in
  10537. case of @code{b} it will use only bottom field.
  10538. If line starts with @code{#} or @code{;} that line is skipped.
  10539. @item mode
  10540. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10541. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10542. are more frames to process than @code{hint} file is seek back to start.
  10543. @end table
  10544. Example of first several lines of @code{hint} file for @code{relative} mode:
  10545. @example
  10546. 0,0 - # first frame
  10547. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10548. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10549. 1,0 -
  10550. 0,0 -
  10551. 0,0 -
  10552. 1,0 -
  10553. 1,0 -
  10554. 1,0 -
  10555. 0,0 -
  10556. 0,0 -
  10557. 1,0 -
  10558. 1,0 -
  10559. 1,0 -
  10560. 0,0 -
  10561. @end example
  10562. @section fieldmatch
  10563. Field matching filter for inverse telecine. It is meant to reconstruct the
  10564. progressive frames from a telecined stream. The filter does not drop duplicated
  10565. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10566. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10567. The separation of the field matching and the decimation is notably motivated by
  10568. the possibility of inserting a de-interlacing filter fallback between the two.
  10569. If the source has mixed telecined and real interlaced content,
  10570. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10571. But these remaining combed frames will be marked as interlaced, and thus can be
  10572. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10573. In addition to the various configuration options, @code{fieldmatch} can take an
  10574. optional second stream, activated through the @option{ppsrc} option. If
  10575. enabled, the frames reconstruction will be based on the fields and frames from
  10576. this second stream. This allows the first input to be pre-processed in order to
  10577. help the various algorithms of the filter, while keeping the output lossless
  10578. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10579. or brightness/contrast adjustments can help.
  10580. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10581. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10582. which @code{fieldmatch} is based on. While the semantic and usage are very
  10583. close, some behaviour and options names can differ.
  10584. The @ref{decimate} filter currently only works for constant frame rate input.
  10585. If your input has mixed telecined (30fps) and progressive content with a lower
  10586. framerate like 24fps use the following filterchain to produce the necessary cfr
  10587. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10588. The filter accepts the following options:
  10589. @table @option
  10590. @item order
  10591. Specify the assumed field order of the input stream. Available values are:
  10592. @table @samp
  10593. @item auto
  10594. Auto detect parity (use FFmpeg's internal parity value).
  10595. @item bff
  10596. Assume bottom field first.
  10597. @item tff
  10598. Assume top field first.
  10599. @end table
  10600. Note that it is sometimes recommended not to trust the parity announced by the
  10601. stream.
  10602. Default value is @var{auto}.
  10603. @item mode
  10604. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10605. sense that it won't risk creating jerkiness due to duplicate frames when
  10606. possible, but if there are bad edits or blended fields it will end up
  10607. outputting combed frames when a good match might actually exist. On the other
  10608. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10609. but will almost always find a good frame if there is one. The other values are
  10610. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10611. jerkiness and creating duplicate frames versus finding good matches in sections
  10612. with bad edits, orphaned fields, blended fields, etc.
  10613. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10614. Available values are:
  10615. @table @samp
  10616. @item pc
  10617. 2-way matching (p/c)
  10618. @item pc_n
  10619. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10620. @item pc_u
  10621. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10622. @item pc_n_ub
  10623. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10624. still combed (p/c + n + u/b)
  10625. @item pcn
  10626. 3-way matching (p/c/n)
  10627. @item pcn_ub
  10628. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10629. detected as combed (p/c/n + u/b)
  10630. @end table
  10631. The parenthesis at the end indicate the matches that would be used for that
  10632. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10633. @var{top}).
  10634. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10635. the slowest.
  10636. Default value is @var{pc_n}.
  10637. @item ppsrc
  10638. Mark the main input stream as a pre-processed input, and enable the secondary
  10639. input stream as the clean source to pick the fields from. See the filter
  10640. introduction for more details. It is similar to the @option{clip2} feature from
  10641. VFM/TFM.
  10642. Default value is @code{0} (disabled).
  10643. @item field
  10644. Set the field to match from. It is recommended to set this to the same value as
  10645. @option{order} unless you experience matching failures with that setting. In
  10646. certain circumstances changing the field that is used to match from can have a
  10647. large impact on matching performance. Available values are:
  10648. @table @samp
  10649. @item auto
  10650. Automatic (same value as @option{order}).
  10651. @item bottom
  10652. Match from the bottom field.
  10653. @item top
  10654. Match from the top field.
  10655. @end table
  10656. Default value is @var{auto}.
  10657. @item mchroma
  10658. Set whether or not chroma is included during the match comparisons. In most
  10659. cases it is recommended to leave this enabled. You should set this to @code{0}
  10660. only if your clip has bad chroma problems such as heavy rainbowing or other
  10661. artifacts. Setting this to @code{0} could also be used to speed things up at
  10662. the cost of some accuracy.
  10663. Default value is @code{1}.
  10664. @item y0
  10665. @item y1
  10666. These define an exclusion band which excludes the lines between @option{y0} and
  10667. @option{y1} from being included in the field matching decision. An exclusion
  10668. band can be used to ignore subtitles, a logo, or other things that may
  10669. interfere with the matching. @option{y0} sets the starting scan line and
  10670. @option{y1} sets the ending line; all lines in between @option{y0} and
  10671. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10672. @option{y0} and @option{y1} to the same value will disable the feature.
  10673. @option{y0} and @option{y1} defaults to @code{0}.
  10674. @item scthresh
  10675. Set the scene change detection threshold as a percentage of maximum change on
  10676. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10677. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10678. @option{scthresh} is @code{[0.0, 100.0]}.
  10679. Default value is @code{12.0}.
  10680. @item combmatch
  10681. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10682. account the combed scores of matches when deciding what match to use as the
  10683. final match. Available values are:
  10684. @table @samp
  10685. @item none
  10686. No final matching based on combed scores.
  10687. @item sc
  10688. Combed scores are only used when a scene change is detected.
  10689. @item full
  10690. Use combed scores all the time.
  10691. @end table
  10692. Default is @var{sc}.
  10693. @item combdbg
  10694. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10695. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10696. Available values are:
  10697. @table @samp
  10698. @item none
  10699. No forced calculation.
  10700. @item pcn
  10701. Force p/c/n calculations.
  10702. @item pcnub
  10703. Force p/c/n/u/b calculations.
  10704. @end table
  10705. Default value is @var{none}.
  10706. @item cthresh
  10707. This is the area combing threshold used for combed frame detection. This
  10708. essentially controls how "strong" or "visible" combing must be to be detected.
  10709. Larger values mean combing must be more visible and smaller values mean combing
  10710. can be less visible or strong and still be detected. Valid settings are from
  10711. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10712. be detected as combed). This is basically a pixel difference value. A good
  10713. range is @code{[8, 12]}.
  10714. Default value is @code{9}.
  10715. @item chroma
  10716. Sets whether or not chroma is considered in the combed frame decision. Only
  10717. disable this if your source has chroma problems (rainbowing, etc.) that are
  10718. causing problems for the combed frame detection with chroma enabled. Actually,
  10719. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10720. where there is chroma only combing in the source.
  10721. Default value is @code{0}.
  10722. @item blockx
  10723. @item blocky
  10724. Respectively set the x-axis and y-axis size of the window used during combed
  10725. frame detection. This has to do with the size of the area in which
  10726. @option{combpel} pixels are required to be detected as combed for a frame to be
  10727. declared combed. See the @option{combpel} parameter description for more info.
  10728. Possible values are any number that is a power of 2 starting at 4 and going up
  10729. to 512.
  10730. Default value is @code{16}.
  10731. @item combpel
  10732. The number of combed pixels inside any of the @option{blocky} by
  10733. @option{blockx} size blocks on the frame for the frame to be detected as
  10734. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10735. setting controls "how much" combing there must be in any localized area (a
  10736. window defined by the @option{blockx} and @option{blocky} settings) on the
  10737. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10738. which point no frames will ever be detected as combed). This setting is known
  10739. as @option{MI} in TFM/VFM vocabulary.
  10740. Default value is @code{80}.
  10741. @end table
  10742. @anchor{p/c/n/u/b meaning}
  10743. @subsection p/c/n/u/b meaning
  10744. @subsubsection p/c/n
  10745. We assume the following telecined stream:
  10746. @example
  10747. Top fields: 1 2 2 3 4
  10748. Bottom fields: 1 2 3 4 4
  10749. @end example
  10750. The numbers correspond to the progressive frame the fields relate to. Here, the
  10751. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10752. When @code{fieldmatch} is configured to run a matching from bottom
  10753. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10754. @example
  10755. Input stream:
  10756. T 1 2 2 3 4
  10757. B 1 2 3 4 4 <-- matching reference
  10758. Matches: c c n n c
  10759. Output stream:
  10760. T 1 2 3 4 4
  10761. B 1 2 3 4 4
  10762. @end example
  10763. As a result of the field matching, we can see that some frames get duplicated.
  10764. To perform a complete inverse telecine, you need to rely on a decimation filter
  10765. after this operation. See for instance the @ref{decimate} filter.
  10766. The same operation now matching from top fields (@option{field}=@var{top})
  10767. looks like this:
  10768. @example
  10769. Input stream:
  10770. T 1 2 2 3 4 <-- matching reference
  10771. B 1 2 3 4 4
  10772. Matches: c c p p c
  10773. Output stream:
  10774. T 1 2 2 3 4
  10775. B 1 2 2 3 4
  10776. @end example
  10777. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10778. basically, they refer to the frame and field of the opposite parity:
  10779. @itemize
  10780. @item @var{p} matches the field of the opposite parity in the previous frame
  10781. @item @var{c} matches the field of the opposite parity in the current frame
  10782. @item @var{n} matches the field of the opposite parity in the next frame
  10783. @end itemize
  10784. @subsubsection u/b
  10785. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10786. from the opposite parity flag. In the following examples, we assume that we are
  10787. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10788. 'x' is placed above and below each matched fields.
  10789. With bottom matching (@option{field}=@var{bottom}):
  10790. @example
  10791. Match: c p n b u
  10792. x x x x x
  10793. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10794. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10795. x x x x x
  10796. Output frames:
  10797. 2 1 2 2 2
  10798. 2 2 2 1 3
  10799. @end example
  10800. With top matching (@option{field}=@var{top}):
  10801. @example
  10802. Match: c p n b u
  10803. x x x x x
  10804. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10805. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10806. x x x x x
  10807. Output frames:
  10808. 2 2 2 1 2
  10809. 2 1 3 2 2
  10810. @end example
  10811. @subsection Examples
  10812. Simple IVTC of a top field first telecined stream:
  10813. @example
  10814. fieldmatch=order=tff:combmatch=none, decimate
  10815. @end example
  10816. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10817. @example
  10818. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10819. @end example
  10820. @section fieldorder
  10821. Transform the field order of the input video.
  10822. It accepts the following parameters:
  10823. @table @option
  10824. @item order
  10825. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10826. for bottom field first.
  10827. @end table
  10828. The default value is @samp{tff}.
  10829. The transformation is done by shifting the picture content up or down
  10830. by one line, and filling the remaining line with appropriate picture content.
  10831. This method is consistent with most broadcast field order converters.
  10832. If the input video is not flagged as being interlaced, or it is already
  10833. flagged as being of the required output field order, then this filter does
  10834. not alter the incoming video.
  10835. It is very useful when converting to or from PAL DV material,
  10836. which is bottom field first.
  10837. For example:
  10838. @example
  10839. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10840. @end example
  10841. @section fillborders
  10842. Fill borders of the input video, without changing video stream dimensions.
  10843. Sometimes video can have garbage at the four edges and you may not want to
  10844. crop video input to keep size multiple of some number.
  10845. This filter accepts the following options:
  10846. @table @option
  10847. @item left
  10848. Number of pixels to fill from left border.
  10849. @item right
  10850. Number of pixels to fill from right border.
  10851. @item top
  10852. Number of pixels to fill from top border.
  10853. @item bottom
  10854. Number of pixels to fill from bottom border.
  10855. @item mode
  10856. Set fill mode.
  10857. It accepts the following values:
  10858. @table @samp
  10859. @item smear
  10860. fill pixels using outermost pixels
  10861. @item mirror
  10862. fill pixels using mirroring (half sample symmetric)
  10863. @item fixed
  10864. fill pixels with constant value
  10865. @item reflect
  10866. fill pixels using reflecting (whole sample symmetric)
  10867. @item wrap
  10868. fill pixels using wrapping
  10869. @item fade
  10870. fade pixels to constant value
  10871. @item margins
  10872. fill pixels at top and bottom with weighted averages pixels near borders
  10873. @end table
  10874. Default is @var{smear}.
  10875. @item color
  10876. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10877. @end table
  10878. @subsection Commands
  10879. This filter supports same @ref{commands} as options.
  10880. The command accepts the same syntax of the corresponding option.
  10881. If the specified expression is not valid, it is kept at its current
  10882. value.
  10883. @section find_rect
  10884. Find a rectangular object in the input video.
  10885. The object to search for must be specified as a gray8 image specified with the
  10886. @option{object} option.
  10887. For each possible match, a score is computed. If the score reaches the specified
  10888. threshold, the object is considered found.
  10889. If the input video contains multiple instances of the object, the filter will
  10890. find only one of them.
  10891. When an object is found, the following metadata entries are set in the matching
  10892. frame:
  10893. @table @option
  10894. @item lavfi.rect.w
  10895. width of object
  10896. @item lavfi.rect.h
  10897. height of object
  10898. @item lavfi.rect.x
  10899. x position of object
  10900. @item lavfi.rect.y
  10901. y position of object
  10902. @item lavfi.rect.score
  10903. match score of the found object
  10904. @end table
  10905. It accepts the following options:
  10906. @table @option
  10907. @item object
  10908. Filepath of the object image, needs to be in gray8.
  10909. @item threshold
  10910. Detection threshold, expressed as a decimal number in the range 0-1.
  10911. A threshold value of 0.01 means only exact matches, a threshold of 0.99 means
  10912. almost everything matches.
  10913. Default value is 0.5.
  10914. @item mipmaps
  10915. Number of mipmaps, default is 3.
  10916. @item xmin, ymin, xmax, ymax
  10917. Specifies the rectangle in which to search.
  10918. @item discard
  10919. Discard frames where object is not detected. Default is disabled.
  10920. @end table
  10921. @subsection Examples
  10922. @itemize
  10923. @item
  10924. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10925. @example
  10926. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10927. @end example
  10928. @item
  10929. Find the position of an object in each frame using @command{ffprobe} and write
  10930. it to a log file:
  10931. @example
  10932. ffprobe -f lavfi movie=test.mp4,find_rect=object=object.pgm:threshold=0.3 \
  10933. -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.x,lavfi.rect.y \
  10934. -of csv -o find_rect.csv
  10935. @end example
  10936. @end itemize
  10937. @section floodfill
  10938. Flood area with values of same pixel components with another values.
  10939. It accepts the following options:
  10940. @table @option
  10941. @item x
  10942. Set pixel x coordinate.
  10943. @item y
  10944. Set pixel y coordinate.
  10945. @item s0
  10946. Set source #0 component value.
  10947. @item s1
  10948. Set source #1 component value.
  10949. @item s2
  10950. Set source #2 component value.
  10951. @item s3
  10952. Set source #3 component value.
  10953. @item d0
  10954. Set destination #0 component value.
  10955. @item d1
  10956. Set destination #1 component value.
  10957. @item d2
  10958. Set destination #2 component value.
  10959. @item d3
  10960. Set destination #3 component value.
  10961. @end table
  10962. @anchor{format}
  10963. @section format
  10964. Convert the input video to one of the specified pixel formats.
  10965. Libavfilter will try to pick one that is suitable as input to
  10966. the next filter.
  10967. It accepts the following parameters:
  10968. @table @option
  10969. @item pix_fmts
  10970. A '|'-separated list of pixel format names, such as
  10971. "pix_fmts=yuv420p|monow|rgb24".
  10972. @item color_spaces
  10973. A '|'-separated list of color space names, such as
  10974. "color_spaces=bt709|bt470bg|bt2020nc".
  10975. @item color_ranges
  10976. A '|'-separated list of color range names, such as
  10977. "color_spaces=tv|pc".
  10978. @end table
  10979. @subsection Examples
  10980. @itemize
  10981. @item
  10982. Convert the input video to the @var{yuv420p} format
  10983. @example
  10984. format=pix_fmts=yuv420p
  10985. @end example
  10986. Convert the input video to any of the formats in the list
  10987. @example
  10988. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10989. @end example
  10990. @end itemize
  10991. @anchor{fps}
  10992. @section fps
  10993. Convert the video to specified constant frame rate by duplicating or dropping
  10994. frames as necessary.
  10995. It accepts the following parameters:
  10996. @table @option
  10997. @item fps
  10998. The desired output frame rate. It accepts expressions containing the following
  10999. constants:
  11000. @table @samp
  11001. @item source_fps
  11002. The input's frame rate
  11003. @item ntsc
  11004. NTSC frame rate of @code{30000/1001}
  11005. @item pal
  11006. PAL frame rate of @code{25.0}
  11007. @item film
  11008. Film frame rate of @code{24.0}
  11009. @item ntsc_film
  11010. NTSC-film frame rate of @code{24000/1001}
  11011. @end table
  11012. The default is @code{25}.
  11013. @item start_time
  11014. Assume the first PTS should be the given value, in seconds. This allows for
  11015. padding/trimming at the start of stream. By default, no assumption is made
  11016. about the first frame's expected PTS, so no padding or trimming is done.
  11017. For example, this could be set to 0 to pad the beginning with duplicates of
  11018. the first frame if a video stream starts after the audio stream or to trim any
  11019. frames with a negative PTS.
  11020. @item round
  11021. Timestamp (PTS) rounding method.
  11022. Possible values are:
  11023. @table @option
  11024. @item zero
  11025. round towards 0
  11026. @item inf
  11027. round away from 0
  11028. @item down
  11029. round towards -infinity
  11030. @item up
  11031. round towards +infinity
  11032. @item near
  11033. round to nearest
  11034. @end table
  11035. The default is @code{near}.
  11036. @item eof_action
  11037. Action performed when reading the last frame.
  11038. Possible values are:
  11039. @table @option
  11040. @item round
  11041. Use same timestamp rounding method as used for other frames.
  11042. @item pass
  11043. Pass through last frame if input duration has not been reached yet.
  11044. @end table
  11045. The default is @code{round}.
  11046. @end table
  11047. Alternatively, the options can be specified as a flat string:
  11048. @var{fps}[:@var{start_time}[:@var{round}]].
  11049. See also the @ref{setpts} filter.
  11050. @subsection Examples
  11051. @itemize
  11052. @item
  11053. A typical usage in order to set the fps to 25:
  11054. @example
  11055. fps=fps=25
  11056. @end example
  11057. @item
  11058. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  11059. @example
  11060. fps=fps=film:round=near
  11061. @end example
  11062. @end itemize
  11063. @section framepack
  11064. Pack two different video streams into a stereoscopic video, setting proper
  11065. metadata on supported codecs. The two views should have the same size and
  11066. framerate and processing will stop when the shorter video ends. Please note
  11067. that you may conveniently adjust view properties with the @ref{scale} and
  11068. @ref{fps} filters.
  11069. It accepts the following parameters:
  11070. @table @option
  11071. @item format
  11072. The desired packing format. Supported values are:
  11073. @table @option
  11074. @item sbs
  11075. The views are next to each other (default).
  11076. @item tab
  11077. The views are on top of each other.
  11078. @item lines
  11079. The views are packed by line.
  11080. @item columns
  11081. The views are packed by column.
  11082. @item frameseq
  11083. The views are temporally interleaved.
  11084. @end table
  11085. @end table
  11086. Some examples:
  11087. @example
  11088. # Convert left and right views into a frame-sequential video
  11089. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  11090. # Convert views into a side-by-side video with the same output resolution as the input
  11091. ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
  11092. @end example
  11093. @section framerate
  11094. Change the frame rate by interpolating new video output frames from the source
  11095. frames.
  11096. This filter is not designed to function correctly with interlaced media. If
  11097. you wish to change the frame rate of interlaced media then you are required
  11098. to deinterlace before this filter and re-interlace after this filter.
  11099. A description of the accepted options follows.
  11100. @table @option
  11101. @item fps
  11102. Specify the output frames per second. This option can also be specified
  11103. as a value alone. The default is @code{50}.
  11104. @item interp_start
  11105. Specify the start of a range where the output frame will be created as a
  11106. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11107. the default is @code{15}.
  11108. @item interp_end
  11109. Specify the end of a range where the output frame will be created as a
  11110. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11111. the default is @code{240}.
  11112. @item scene
  11113. Specify the level at which a scene change is detected as a value between
  11114. 0 and 100 to indicate a new scene; a low value reflects a low
  11115. probability for the current frame to introduce a new scene, while a higher
  11116. value means the current frame is more likely to be one.
  11117. The default is @code{8.2}.
  11118. @item flags
  11119. Specify flags influencing the filter process.
  11120. Available value for @var{flags} is:
  11121. @table @option
  11122. @item scene_change_detect, scd
  11123. Enable scene change detection using the value of the option @var{scene}.
  11124. This flag is enabled by default.
  11125. @end table
  11126. @end table
  11127. @section framestep
  11128. Select one frame every N-th frame.
  11129. This filter accepts the following option:
  11130. @table @option
  11131. @item step
  11132. Select frame after every @code{step} frames.
  11133. Allowed values are positive integers higher than 0. Default value is @code{1}.
  11134. @end table
  11135. @section freezedetect
  11136. Detect frozen video.
  11137. This filter logs a message and sets frame metadata when it detects that the
  11138. input video has no significant change in content during a specified duration.
  11139. Video freeze detection calculates the mean average absolute difference of all
  11140. the components of video frames and compares it to a noise floor.
  11141. The printed times and duration are expressed in seconds. The
  11142. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  11143. whose timestamp equals or exceeds the detection duration and it contains the
  11144. timestamp of the first frame of the freeze. The
  11145. @code{lavfi.freezedetect.freeze_duration} and
  11146. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  11147. after the freeze.
  11148. The filter accepts the following options:
  11149. @table @option
  11150. @item noise, n
  11151. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  11152. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  11153. 0.001.
  11154. @item duration, d
  11155. Set freeze duration until notification (default is 2 seconds).
  11156. @end table
  11157. @section freezeframes
  11158. Freeze video frames.
  11159. This filter freezes video frames using frame from 2nd input.
  11160. The filter accepts the following options:
  11161. @table @option
  11162. @item first
  11163. Set number of first frame from which to start freeze.
  11164. @item last
  11165. Set number of last frame from which to end freeze.
  11166. @item replace
  11167. Set number of frame from 2nd input which will be used instead of replaced frames.
  11168. @end table
  11169. @anchor{frei0r}
  11170. @section frei0r
  11171. Apply a frei0r effect to the input video.
  11172. To enable the compilation of this filter, you need to install the frei0r
  11173. header and configure FFmpeg with @code{--enable-frei0r}.
  11174. It accepts the following parameters:
  11175. @table @option
  11176. @item filter_name
  11177. The name of the frei0r effect to load. If the environment variable
  11178. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  11179. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  11180. Otherwise, the standard frei0r paths are searched, in this order:
  11181. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  11182. @file{/usr/lib/frei0r-1/}.
  11183. @item filter_params
  11184. A '|'-separated list of parameters to pass to the frei0r effect.
  11185. @end table
  11186. A frei0r effect parameter can be a boolean (its value is either
  11187. "y" or "n"), a double, a color (specified as
  11188. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  11189. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  11190. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  11191. a position (specified as @var{X}/@var{Y}, where
  11192. @var{X} and @var{Y} are floating point numbers) and/or a string.
  11193. The number and types of parameters depend on the loaded effect. If an
  11194. effect parameter is not specified, the default value is set.
  11195. @subsection Examples
  11196. @itemize
  11197. @item
  11198. Apply the distort0r effect, setting the first two double parameters:
  11199. @example
  11200. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  11201. @end example
  11202. @item
  11203. Apply the colordistance effect, taking a color as the first parameter:
  11204. @example
  11205. frei0r=colordistance:0.2/0.3/0.4
  11206. frei0r=colordistance:violet
  11207. frei0r=colordistance:0x112233
  11208. @end example
  11209. @item
  11210. Apply the perspective effect, specifying the top left and top right image
  11211. positions:
  11212. @example
  11213. frei0r=perspective:0.2/0.2|0.8/0.2
  11214. @end example
  11215. @end itemize
  11216. For more information, see
  11217. @url{http://frei0r.dyne.org}
  11218. @subsection Commands
  11219. This filter supports the @option{filter_params} option as @ref{commands}.
  11220. @section fspp
  11221. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  11222. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  11223. processing filter, one of them is performed once per block, not per pixel.
  11224. This allows for much higher speed.
  11225. The filter accepts the following options:
  11226. @table @option
  11227. @item quality
  11228. Set quality. This option defines the number of levels for averaging. It accepts
  11229. an integer in the range 4-5. Default value is @code{4}.
  11230. @item qp
  11231. Force a constant quantization parameter. It accepts an integer in range 0-63.
  11232. If not set, the filter will use the QP from the video stream (if available).
  11233. @item strength
  11234. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  11235. more details but also more artifacts, while higher values make the image smoother
  11236. but also blurrier. Default value is @code{0} − PSNR optimal.
  11237. @item use_bframe_qp
  11238. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11239. option may cause flicker since the B-Frames have often larger QP. Default is
  11240. @code{0} (not enabled).
  11241. @end table
  11242. @anchor{fsync}
  11243. @section fsync
  11244. Synchronize video frames with an external mapping from a file.
  11245. For each input PTS given in the map file it either drops or creates as many
  11246. frames as necessary to recreate the sequence of output frames given in the
  11247. map file.
  11248. This filter is useful to recreate the output frames of a framerate conversion
  11249. by the @ref{fps} filter, recorded into a map file using the ffmpeg option
  11250. @code{-stats_mux_pre}, and do further processing to the corresponding frames
  11251. e.g. quality comparison.
  11252. Each line of the map file must contain three items per input frame, the input
  11253. PTS (decimal), the output PTS (decimal) and the
  11254. output TIMEBASE (decimal/decimal), seperated by a space.
  11255. This file format corresponds to the output
  11256. of @code{-stats_mux_pre_fmt="@{ptsi@} @{pts@} @{tb@}"}.
  11257. The filter assumes the map file is sorted by increasing input PTS.
  11258. The filter accepts the following options:
  11259. @table @option
  11260. @item file, f
  11261. The filename of the map file to be used.
  11262. @end table
  11263. Example:
  11264. @example
  11265. # Convert a video to 25 fps and record a MAP_FILE file with the default format of this filter
  11266. ffmpeg -i INPUT -vf fps=fps=25 -stats_mux_pre MAP_FILE -stats_mux_pre_fmt "@{ptsi@} @{pts@} @{tb@}" OUTPUT
  11267. # Sort MAP_FILE by increasing input PTS
  11268. sort -n MAP_FILE
  11269. # Use INPUT, OUTPUT and the MAP_FILE from above to compare the corresponding frames in INPUT and OUTPUT via SSIM
  11270. ffmpeg -i INPUT -i OUTPUT -filter_complex '[0:v]fsync=file=MAP_FILE[ref];[1:v][ref]ssim' -f null -
  11271. @end example
  11272. @section gblur
  11273. Apply Gaussian blur filter.
  11274. The filter accepts the following options:
  11275. @table @option
  11276. @item sigma
  11277. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  11278. @item steps
  11279. Set number of steps for Gaussian approximation. Default is @code{1}.
  11280. @item planes
  11281. Set which planes to filter. By default all planes are filtered.
  11282. @item sigmaV
  11283. Set vertical sigma, if negative it will be same as @code{sigma}.
  11284. Default is @code{-1}.
  11285. @end table
  11286. @subsection Commands
  11287. This filter supports same commands as options.
  11288. The command accepts the same syntax of the corresponding option.
  11289. If the specified expression is not valid, it is kept at its current
  11290. value.
  11291. @section geq
  11292. Apply generic equation to each pixel.
  11293. The filter accepts the following options:
  11294. @table @option
  11295. @item lum_expr, lum
  11296. Set the luma expression.
  11297. @item cb_expr, cb
  11298. Set the chrominance blue expression.
  11299. @item cr_expr, cr
  11300. Set the chrominance red expression.
  11301. @item alpha_expr, a
  11302. Set the alpha expression.
  11303. @item red_expr, r
  11304. Set the red expression.
  11305. @item green_expr, g
  11306. Set the green expression.
  11307. @item blue_expr, b
  11308. Set the blue expression.
  11309. @end table
  11310. The colorspace is selected according to the specified options. If one
  11311. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  11312. options is specified, the filter will automatically select a YCbCr
  11313. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  11314. @option{blue_expr} options is specified, it will select an RGB
  11315. colorspace.
  11316. If one of the chrominance expression is not defined, it falls back on the other
  11317. one. If no alpha expression is specified it will evaluate to opaque value.
  11318. If none of chrominance expressions are specified, they will evaluate
  11319. to the luma expression.
  11320. The expressions can use the following variables and functions:
  11321. @table @option
  11322. @item N
  11323. The sequential number of the filtered frame, starting from @code{0}.
  11324. @item X
  11325. @item Y
  11326. The coordinates of the current sample.
  11327. @item W
  11328. @item H
  11329. The width and height of the image.
  11330. @item SW
  11331. @item SH
  11332. Width and height scale depending on the currently filtered plane. It is the
  11333. ratio between the corresponding luma plane number of pixels and the current
  11334. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  11335. @code{0.5,0.5} for chroma planes.
  11336. @item T
  11337. Time of the current frame, expressed in seconds.
  11338. @item p(x, y)
  11339. Return the value of the pixel at location (@var{x},@var{y}) of the current
  11340. plane.
  11341. @item lum(x, y)
  11342. Return the value of the pixel at location (@var{x},@var{y}) of the luma
  11343. plane.
  11344. @item cb(x, y)
  11345. Return the value of the pixel at location (@var{x},@var{y}) of the
  11346. blue-difference chroma plane. Return 0 if there is no such plane.
  11347. @item cr(x, y)
  11348. Return the value of the pixel at location (@var{x},@var{y}) of the
  11349. red-difference chroma plane. Return 0 if there is no such plane.
  11350. @item r(x, y)
  11351. @item g(x, y)
  11352. @item b(x, y)
  11353. Return the value of the pixel at location (@var{x},@var{y}) of the
  11354. red/green/blue component. Return 0 if there is no such component.
  11355. @item alpha(x, y)
  11356. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  11357. plane. Return 0 if there is no such plane.
  11358. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  11359. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  11360. sums of samples within a rectangle. See the functions without the sum postfix.
  11361. @item interpolation
  11362. Set one of interpolation methods:
  11363. @table @option
  11364. @item nearest, n
  11365. @item bilinear, b
  11366. @end table
  11367. Default is bilinear.
  11368. @end table
  11369. For functions, if @var{x} and @var{y} are outside the area, the value will be
  11370. automatically clipped to the closer edge.
  11371. Please note that this filter can use multiple threads in which case each slice
  11372. will have its own expression state. If you want to use only a single expression
  11373. state because your expressions depend on previous state then you should limit
  11374. the number of filter threads to 1.
  11375. @subsection Examples
  11376. @itemize
  11377. @item
  11378. Flip the image horizontally:
  11379. @example
  11380. geq=p(W-X\,Y)
  11381. @end example
  11382. @item
  11383. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  11384. wavelength of 100 pixels:
  11385. @example
  11386. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  11387. @end example
  11388. @item
  11389. Generate a fancy enigmatic moving light:
  11390. @example
  11391. 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
  11392. @end example
  11393. @item
  11394. Generate a quick emboss effect:
  11395. @example
  11396. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  11397. @end example
  11398. @item
  11399. Modify RGB components depending on pixel position:
  11400. @example
  11401. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  11402. @end example
  11403. @item
  11404. Create a radial gradient that is the same size as the input (also see
  11405. the @ref{vignette} filter):
  11406. @example
  11407. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  11408. @end example
  11409. @end itemize
  11410. @section gradfun
  11411. Fix the banding artifacts that are sometimes introduced into nearly flat
  11412. regions by truncation to 8-bit color depth.
  11413. Interpolate the gradients that should go where the bands are, and
  11414. dither them.
  11415. It is designed for playback only. Do not use it prior to
  11416. lossy compression, because compression tends to lose the dither and
  11417. bring back the bands.
  11418. It accepts the following parameters:
  11419. @table @option
  11420. @item strength
  11421. The maximum amount by which the filter will change any one pixel. This is also
  11422. the threshold for detecting nearly flat regions. Acceptable values range from
  11423. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  11424. valid range.
  11425. @item radius
  11426. The neighborhood to fit the gradient to. A larger radius makes for smoother
  11427. gradients, but also prevents the filter from modifying the pixels near detailed
  11428. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  11429. values will be clipped to the valid range.
  11430. @end table
  11431. Alternatively, the options can be specified as a flat string:
  11432. @var{strength}[:@var{radius}]
  11433. @subsection Examples
  11434. @itemize
  11435. @item
  11436. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  11437. @example
  11438. gradfun=3.5:8
  11439. @end example
  11440. @item
  11441. Specify radius, omitting the strength (which will fall-back to the default
  11442. value):
  11443. @example
  11444. gradfun=radius=8
  11445. @end example
  11446. @end itemize
  11447. @anchor{graphmonitor}
  11448. @section graphmonitor
  11449. Show various filtergraph stats.
  11450. With this filter one can debug complete filtergraph.
  11451. Especially issues with links filling with queued frames.
  11452. The filter accepts the following options:
  11453. @table @option
  11454. @item size, s
  11455. Set video output size. Default is @var{hd720}.
  11456. @item opacity, o
  11457. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  11458. @item mode, m
  11459. Set output mode flags.
  11460. Available values for flags are:
  11461. @table @samp
  11462. @item full
  11463. No any filtering. Default.
  11464. @item compact
  11465. Show only filters with queued frames.
  11466. @item nozero
  11467. Show only filters with non-zero stats.
  11468. @item noeof
  11469. Show only filters with non-eof stat.
  11470. @item nodisabled
  11471. Show only filters that are enabled in timeline.
  11472. @end table
  11473. @item flags, f
  11474. Set flags which enable which stats are shown in video.
  11475. Available values for flags are:
  11476. @table @samp
  11477. @item none
  11478. All flags turned off.
  11479. @item all
  11480. All flags turned on.
  11481. @item queue
  11482. Display number of queued frames in each link.
  11483. @item frame_count_in
  11484. Display number of frames taken from filter.
  11485. @item frame_count_out
  11486. Display number of frames given out from filter.
  11487. @item frame_count_delta
  11488. Display delta number of frames between above two values.
  11489. @item pts
  11490. Display current filtered frame pts.
  11491. @item pts_delta
  11492. Display pts delta between current and previous frame.
  11493. @item time
  11494. Display current filtered frame time.
  11495. @item time_delta
  11496. Display time delta between current and previous frame.
  11497. @item timebase
  11498. Display time base for filter link.
  11499. @item format
  11500. Display used format for filter link.
  11501. @item size
  11502. Display video size or number of audio channels in case of audio used by filter link.
  11503. @item rate
  11504. Display video frame rate or sample rate in case of audio used by filter link.
  11505. @item eof
  11506. Display link output status.
  11507. @item sample_count_in
  11508. Display number of samples taken from filter.
  11509. @item sample_count_out
  11510. Display number of samples given out from filter.
  11511. @item sample_count_delta
  11512. Display delta number of samples between above two values.
  11513. @item disabled
  11514. Show the timeline filter status.
  11515. @end table
  11516. @item rate, r
  11517. Set upper limit for video rate of output stream, Default value is @var{25}.
  11518. This guarantee that output video frame rate will not be higher than this value.
  11519. @end table
  11520. @section grayworld
  11521. A color constancy filter that applies color correction based on the grayworld assumption
  11522. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11523. The algorithm uses linear light, so input
  11524. data should be linearized beforehand (and possibly correctly tagged).
  11525. @example
  11526. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11527. @end example
  11528. @section greyedge
  11529. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11530. and corrects the scene colors accordingly.
  11531. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11532. The filter accepts the following options:
  11533. @table @option
  11534. @item difford
  11535. The order of differentiation to be applied on the scene. Must be chosen in the range
  11536. [0,2] and default value is 1.
  11537. @item minknorm
  11538. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11539. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11540. max value instead of calculating Minkowski distance.
  11541. @item sigma
  11542. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11543. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11544. can't be equal to 0 if @var{difford} is greater than 0.
  11545. @end table
  11546. @subsection Examples
  11547. @itemize
  11548. @item
  11549. Grey Edge:
  11550. @example
  11551. greyedge=difford=1:minknorm=5:sigma=2
  11552. @end example
  11553. @item
  11554. Max Edge:
  11555. @example
  11556. greyedge=difford=1:minknorm=0:sigma=2
  11557. @end example
  11558. @end itemize
  11559. @section guided
  11560. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11561. The filter accepts the following options:
  11562. @table @option
  11563. @item radius
  11564. Set the box radius in pixels.
  11565. Allowed range is 1 to 20. Default is 3.
  11566. @item eps
  11567. Set regularization parameter (with square).
  11568. Allowed range is 0 to 1. Default is 0.01.
  11569. @item mode
  11570. Set filter mode. Can be @code{basic} or @code{fast}.
  11571. Default is @code{basic}.
  11572. @item sub
  11573. Set subsampling ratio for @code{fast} mode.
  11574. Range is 2 to 64. Default is 4.
  11575. No subsampling occurs in @code{basic} mode.
  11576. @item guidance
  11577. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11578. If @code{off}, single input is required.
  11579. If @code{on}, two inputs of the same resolution and pixel format are required.
  11580. The second input serves as the guidance.
  11581. @item planes
  11582. Set planes to filter. Default is first only.
  11583. @end table
  11584. @subsection Commands
  11585. This filter supports the all above options as @ref{commands}.
  11586. @subsection Examples
  11587. @itemize
  11588. @item
  11589. Edge-preserving smoothing with guided filter:
  11590. @example
  11591. ffmpeg -i in.png -vf guided out.png
  11592. @end example
  11593. @item
  11594. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11595. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11596. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11597. @example
  11598. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11599. @end example
  11600. @end itemize
  11601. @anchor{haldclut}
  11602. @section haldclut
  11603. Apply a Hald CLUT to a video stream.
  11604. First input is the video stream to process, and second one is the Hald CLUT.
  11605. The Hald CLUT input can be a simple picture or a complete video stream.
  11606. The filter accepts the following options:
  11607. @table @option
  11608. @item clut
  11609. Set which CLUT video frames will be processed from second input stream,
  11610. can be @var{first} or @var{all}. Default is @var{all}.
  11611. @item shortest
  11612. Force termination when the shortest input terminates. Default is @code{0}.
  11613. @item repeatlast
  11614. Continue applying the last CLUT after the end of the stream. A value of
  11615. @code{0} disable the filter after the last frame of the CLUT is reached.
  11616. Default is @code{1}.
  11617. @end table
  11618. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11619. filters share the same internals).
  11620. This filter also supports the @ref{framesync} options.
  11621. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11622. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11623. @subsection Commands
  11624. This filter supports the @code{interp} option as @ref{commands}.
  11625. @subsection Workflow examples
  11626. @subsubsection Hald CLUT video stream
  11627. Generate an identity Hald CLUT stream altered with various effects:
  11628. @example
  11629. 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
  11630. @end example
  11631. Note: make sure you use a lossless codec.
  11632. Then use it with @code{haldclut} to apply it on some random stream:
  11633. @example
  11634. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11635. @end example
  11636. The Hald CLUT will be applied to the 10 first seconds (duration of
  11637. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11638. to the remaining frames of the @code{mandelbrot} stream.
  11639. @subsubsection Hald CLUT with preview
  11640. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11641. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11642. biggest possible square starting at the top left of the picture. The remaining
  11643. padding pixels (bottom or right) will be ignored. This area can be used to add
  11644. a preview of the Hald CLUT.
  11645. Typically, the following generated Hald CLUT will be supported by the
  11646. @code{haldclut} filter:
  11647. @example
  11648. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11649. pad=iw+320 [padded_clut];
  11650. smptebars=s=320x256, split [a][b];
  11651. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11652. [main][b] overlay=W-320" -frames:v 1 clut.png
  11653. @end example
  11654. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11655. bars are displayed on the right-top, and below the same color bars processed by
  11656. the color changes.
  11657. Then, the effect of this Hald CLUT can be visualized with:
  11658. @example
  11659. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11660. @end example
  11661. @section hflip
  11662. Flip the input video horizontally.
  11663. For example, to horizontally flip the input video with @command{ffmpeg}:
  11664. @example
  11665. ffmpeg -i in.avi -vf "hflip" out.avi
  11666. @end example
  11667. @section histeq
  11668. This filter applies a global color histogram equalization on a
  11669. per-frame basis.
  11670. It can be used to correct video that has a compressed range of pixel
  11671. intensities. The filter redistributes the pixel intensities to
  11672. equalize their distribution across the intensity range. It may be
  11673. viewed as an "automatically adjusting contrast filter". This filter is
  11674. useful only for correcting degraded or poorly captured source
  11675. video.
  11676. The filter accepts the following options:
  11677. @table @option
  11678. @item strength
  11679. Determine the amount of equalization to be applied. As the strength
  11680. is reduced, the distribution of pixel intensities more-and-more
  11681. approaches that of the input frame. The value must be a float number
  11682. in the range [0,1] and defaults to 0.200.
  11683. @item intensity
  11684. Set the maximum intensity that can generated and scale the output
  11685. values appropriately. The strength should be set as desired and then
  11686. the intensity can be limited if needed to avoid washing-out. The value
  11687. must be a float number in the range [0,1] and defaults to 0.210.
  11688. @item antibanding
  11689. Set the antibanding level. If enabled the filter will randomly vary
  11690. the luminance of output pixels by a small amount to avoid banding of
  11691. the histogram. Possible values are @code{none}, @code{weak} or
  11692. @code{strong}. It defaults to @code{none}.
  11693. @end table
  11694. @anchor{histogram}
  11695. @section histogram
  11696. Compute and draw a color distribution histogram for the input video.
  11697. The computed histogram is a representation of the color component
  11698. distribution in an image.
  11699. Standard histogram displays the color components distribution in an image.
  11700. Displays color graph for each color component. Shows distribution of
  11701. the Y, U, V, A or R, G, B components, depending on input format, in the
  11702. current frame. Below each graph a color component scale meter is shown.
  11703. The filter accepts the following options:
  11704. @table @option
  11705. @item level_height
  11706. Set height of level. Default value is @code{200}.
  11707. Allowed range is [50, 2048].
  11708. @item scale_height
  11709. Set height of color scale. Default value is @code{12}.
  11710. Allowed range is [0, 40].
  11711. @item display_mode
  11712. Set display mode.
  11713. It accepts the following values:
  11714. @table @samp
  11715. @item stack
  11716. Per color component graphs are placed below each other.
  11717. @item parade
  11718. Per color component graphs are placed side by side.
  11719. @item overlay
  11720. Presents information identical to that in the @code{parade}, except
  11721. that the graphs representing color components are superimposed directly
  11722. over one another.
  11723. @end table
  11724. Default is @code{stack}.
  11725. @item levels_mode
  11726. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11727. Default is @code{linear}.
  11728. @item components
  11729. Set what color components to display.
  11730. Default is @code{7}.
  11731. @item fgopacity
  11732. Set foreground opacity. Default is @code{0.7}.
  11733. @item bgopacity
  11734. Set background opacity. Default is @code{0.5}.
  11735. @item colors_mode
  11736. Set colors mode.
  11737. It accepts the following values:
  11738. @table @samp
  11739. @item whiteonblack
  11740. @item blackonwhite
  11741. @item whiteongray
  11742. @item blackongray
  11743. @item coloronblack
  11744. @item coloronwhite
  11745. @item colorongray
  11746. @item blackoncolor
  11747. @item whiteoncolor
  11748. @item grayoncolor
  11749. @end table
  11750. Default is @code{whiteonblack}.
  11751. @end table
  11752. @subsection Examples
  11753. @itemize
  11754. @item
  11755. Calculate and draw histogram:
  11756. @example
  11757. ffplay -i input -vf histogram
  11758. @end example
  11759. @end itemize
  11760. @anchor{hqdn3d}
  11761. @section hqdn3d
  11762. This is a high precision/quality 3d denoise filter. It aims to reduce
  11763. image noise, producing smooth images and making still images really
  11764. still. It should enhance compressibility.
  11765. It accepts the following optional parameters:
  11766. @table @option
  11767. @item luma_spatial
  11768. A non-negative floating point number which specifies spatial luma strength.
  11769. It defaults to 4.0.
  11770. @item chroma_spatial
  11771. A non-negative floating point number which specifies spatial chroma strength.
  11772. It defaults to 3.0*@var{luma_spatial}/4.0.
  11773. @item luma_tmp
  11774. A floating point number which specifies luma temporal strength. It defaults to
  11775. 6.0*@var{luma_spatial}/4.0.
  11776. @item chroma_tmp
  11777. A floating point number which specifies chroma temporal strength. It defaults to
  11778. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11779. @end table
  11780. @subsection Commands
  11781. This filter supports same @ref{commands} as options.
  11782. The command accepts the same syntax of the corresponding option.
  11783. If the specified expression is not valid, it is kept at its current
  11784. value.
  11785. @anchor{hwdownload}
  11786. @section hwdownload
  11787. Download hardware frames to system memory.
  11788. The input must be in hardware frames, and the output a non-hardware format.
  11789. Not all formats will be supported on the output - it may be necessary to insert
  11790. an additional @option{format} filter immediately following in the graph to get
  11791. the output in a supported format.
  11792. @section hwmap
  11793. Map hardware frames to system memory or to another device.
  11794. This filter has several different modes of operation; which one is used depends
  11795. on the input and output formats:
  11796. @itemize
  11797. @item
  11798. Hardware frame input, normal frame output
  11799. Map the input frames to system memory and pass them to the output. If the
  11800. original hardware frame is later required (for example, after overlaying
  11801. something else on part of it), the @option{hwmap} filter can be used again
  11802. in the next mode to retrieve it.
  11803. @item
  11804. Normal frame input, hardware frame output
  11805. If the input is actually a software-mapped hardware frame, then unmap it -
  11806. that is, return the original hardware frame.
  11807. Otherwise, a device must be provided. Create new hardware surfaces on that
  11808. device for the output, then map them back to the software format at the input
  11809. and give those frames to the preceding filter. This will then act like the
  11810. @option{hwupload} filter, but may be able to avoid an additional copy when
  11811. the input is already in a compatible format.
  11812. @item
  11813. Hardware frame input and output
  11814. A device must be supplied for the output, either directly or with the
  11815. @option{derive_device} option. The input and output devices must be of
  11816. different types and compatible - the exact meaning of this is
  11817. system-dependent, but typically it means that they must refer to the same
  11818. underlying hardware context (for example, refer to the same graphics card).
  11819. If the input frames were originally created on the output device, then unmap
  11820. to retrieve the original frames.
  11821. Otherwise, map the frames to the output device - create new hardware frames
  11822. on the output corresponding to the frames on the input.
  11823. @end itemize
  11824. The following additional parameters are accepted:
  11825. @table @option
  11826. @item mode
  11827. Set the frame mapping mode. Some combination of:
  11828. @table @var
  11829. @item read
  11830. The mapped frame should be readable.
  11831. @item write
  11832. The mapped frame should be writeable.
  11833. @item overwrite
  11834. The mapping will always overwrite the entire frame.
  11835. This may improve performance in some cases, as the original contents of the
  11836. frame need not be loaded.
  11837. @item direct
  11838. The mapping must not involve any copying.
  11839. Indirect mappings to copies of frames are created in some cases where either
  11840. direct mapping is not possible or it would have unexpected properties.
  11841. Setting this flag ensures that the mapping is direct and will fail if that is
  11842. not possible.
  11843. @end table
  11844. Defaults to @var{read+write} if not specified.
  11845. @item derive_device @var{type}
  11846. Rather than using the device supplied at initialisation, instead derive a new
  11847. device of type @var{type} from the device the input frames exist on.
  11848. @item reverse
  11849. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11850. and map them back to the source. This may be necessary in some cases where
  11851. a mapping in one direction is required but only the opposite direction is
  11852. supported by the devices being used.
  11853. This option is dangerous - it may break the preceding filter in undefined
  11854. ways if there are any additional constraints on that filter's output.
  11855. Do not use it without fully understanding the implications of its use.
  11856. @end table
  11857. @anchor{hwupload}
  11858. @section hwupload
  11859. Upload system memory frames to hardware surfaces.
  11860. The device to upload to must be supplied when the filter is initialised. If
  11861. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11862. option or with the @option{derive_device} option. The input and output devices
  11863. must be of different types and compatible - the exact meaning of this is
  11864. system-dependent, but typically it means that they must refer to the same
  11865. underlying hardware context (for example, refer to the same graphics card).
  11866. The following additional parameters are accepted:
  11867. @table @option
  11868. @item derive_device @var{type}
  11869. Rather than using the device supplied at initialisation, instead derive a new
  11870. device of type @var{type} from the device the input frames exist on.
  11871. @end table
  11872. @anchor{hwupload_cuda}
  11873. @section hwupload_cuda
  11874. Upload system memory frames to a CUDA device.
  11875. It accepts the following optional parameters:
  11876. @table @option
  11877. @item device
  11878. The number of the CUDA device to use
  11879. @end table
  11880. @section hqx
  11881. Apply a high-quality magnification filter designed for pixel art. This filter
  11882. was originally created by Maxim Stepin.
  11883. It accepts the following option:
  11884. @table @option
  11885. @item n
  11886. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11887. @code{hq3x} and @code{4} for @code{hq4x}.
  11888. Default is @code{3}.
  11889. @end table
  11890. @anchor{hstack}
  11891. @section hstack
  11892. Stack input videos horizontally.
  11893. All streams must be of same pixel format and of same height.
  11894. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11895. to create same output.
  11896. The filter accepts the following option:
  11897. @table @option
  11898. @item inputs
  11899. Set number of input streams. Default is 2.
  11900. @item shortest
  11901. If set to 1, force the output to terminate when the shortest input
  11902. terminates. Default value is 0.
  11903. @end table
  11904. @section hsvhold
  11905. Turns a certain HSV range into gray values.
  11906. This filter measures color difference between set HSV color in options
  11907. and ones measured in video stream. Depending on options, output
  11908. colors can be changed to be gray or not.
  11909. The filter accepts the following options:
  11910. @table @option
  11911. @item hue
  11912. Set the hue value which will be used in color difference calculation.
  11913. Allowed range is from -360 to 360. Default value is 0.
  11914. @item sat
  11915. Set the saturation value which will be used in color difference calculation.
  11916. Allowed range is from -1 to 1. Default value is 0.
  11917. @item val
  11918. Set the value which will be used in color difference calculation.
  11919. Allowed range is from -1 to 1. Default value is 0.
  11920. @item similarity
  11921. Set similarity percentage with the key color.
  11922. Allowed range is from 0 to 1. Default value is 0.01.
  11923. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11924. @item blend
  11925. Blend percentage.
  11926. Allowed range is from 0 to 1. Default value is 0.
  11927. 0.0 makes pixels either fully gray, or not gray at all.
  11928. Higher values result in more gray pixels, with a higher gray pixel
  11929. the more similar the pixels color is to the key color.
  11930. @end table
  11931. @section hsvkey
  11932. Turns a certain HSV range into transparency.
  11933. This filter measures color difference between set HSV color in options
  11934. and ones measured in video stream. Depending on options, output
  11935. colors can be changed to transparent by adding alpha channel.
  11936. The filter accepts the following options:
  11937. @table @option
  11938. @item hue
  11939. Set the hue value which will be used in color difference calculation.
  11940. Allowed range is from -360 to 360. Default value is 0.
  11941. @item sat
  11942. Set the saturation value which will be used in color difference calculation.
  11943. Allowed range is from -1 to 1. Default value is 0.
  11944. @item val
  11945. Set the value which will be used in color difference calculation.
  11946. Allowed range is from -1 to 1. Default value is 0.
  11947. @item similarity
  11948. Set similarity percentage with the key color.
  11949. Allowed range is from 0 to 1. Default value is 0.01.
  11950. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11951. @item blend
  11952. Blend percentage.
  11953. Allowed range is from 0 to 1. Default value is 0.
  11954. 0.0 makes pixels either fully transparent, or not transparent at all.
  11955. Higher values result in semi-transparent pixels, with a higher transparency
  11956. the more similar the pixels color is to the key color.
  11957. @end table
  11958. @section hue
  11959. Modify the hue and/or the saturation of the input.
  11960. It accepts the following parameters:
  11961. @table @option
  11962. @item h
  11963. Specify the hue angle as a number of degrees. It accepts an expression,
  11964. and defaults to "0".
  11965. @item s
  11966. Specify the saturation in the [-10,10] range. It accepts an expression and
  11967. defaults to "1".
  11968. @item H
  11969. Specify the hue angle as a number of radians. It accepts an
  11970. expression, and defaults to "0".
  11971. @item b
  11972. Specify the brightness in the [-10,10] range. It accepts an expression and
  11973. defaults to "0".
  11974. @end table
  11975. @option{h} and @option{H} are mutually exclusive, and can't be
  11976. specified at the same time.
  11977. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11978. expressions containing the following constants:
  11979. @table @option
  11980. @item n
  11981. frame count of the input frame starting from 0
  11982. @item pts
  11983. presentation timestamp of the input frame expressed in time base units
  11984. @item r
  11985. frame rate of the input video, NAN if the input frame rate is unknown
  11986. @item t
  11987. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11988. @item tb
  11989. time base of the input video
  11990. @end table
  11991. @subsection Examples
  11992. @itemize
  11993. @item
  11994. Set the hue to 90 degrees and the saturation to 1.0:
  11995. @example
  11996. hue=h=90:s=1
  11997. @end example
  11998. @item
  11999. Same command but expressing the hue in radians:
  12000. @example
  12001. hue=H=PI/2:s=1
  12002. @end example
  12003. @item
  12004. Rotate hue and make the saturation swing between 0
  12005. and 2 over a period of 1 second:
  12006. @example
  12007. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  12008. @end example
  12009. @item
  12010. Apply a 3 seconds saturation fade-in effect starting at 0:
  12011. @example
  12012. hue="s=min(t/3\,1)"
  12013. @end example
  12014. The general fade-in expression can be written as:
  12015. @example
  12016. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  12017. @end example
  12018. @item
  12019. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  12020. @example
  12021. hue="s=max(0\, min(1\, (8-t)/3))"
  12022. @end example
  12023. The general fade-out expression can be written as:
  12024. @example
  12025. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  12026. @end example
  12027. @end itemize
  12028. @subsection Commands
  12029. This filter supports the following commands:
  12030. @table @option
  12031. @item b
  12032. @item s
  12033. @item h
  12034. @item H
  12035. Modify the hue and/or the saturation and/or brightness of the input video.
  12036. The command accepts the same syntax of the corresponding option.
  12037. If the specified expression is not valid, it is kept at its current
  12038. value.
  12039. @end table
  12040. @section huesaturation
  12041. Apply hue-saturation-intensity adjustments to input video stream.
  12042. This filter operates in RGB colorspace.
  12043. This filter accepts the following options:
  12044. @table @option
  12045. @item hue
  12046. Set the hue shift in degrees to apply. Default is 0.
  12047. Allowed range is from -180 to 180.
  12048. @item saturation
  12049. Set the saturation shift. Default is 0.
  12050. Allowed range is from -1 to 1.
  12051. @item intensity
  12052. Set the intensity shift. Default is 0.
  12053. Allowed range is from -1 to 1.
  12054. @item colors
  12055. Set which primary and complementary colors are going to be adjusted.
  12056. This options is set by providing one or multiple values.
  12057. This can select multiple colors at once. By default all colors are selected.
  12058. @table @samp
  12059. @item r
  12060. Adjust reds.
  12061. @item y
  12062. Adjust yellows.
  12063. @item g
  12064. Adjust greens.
  12065. @item c
  12066. Adjust cyans.
  12067. @item b
  12068. Adjust blues.
  12069. @item m
  12070. Adjust magentas.
  12071. @item a
  12072. Adjust all colors.
  12073. @end table
  12074. @item strength
  12075. Set strength of filtering. Allowed range is from 0 to 100.
  12076. Default value is 1.
  12077. @item rw, gw, bw
  12078. Set weight for each RGB component. Allowed range is from 0 to 1.
  12079. By default is set to 0.333, 0.334, 0.333.
  12080. Those options are used in saturation and lightess processing.
  12081. @item lightness
  12082. Set preserving lightness, by default is disabled.
  12083. Adjusting hues can change lightness from original RGB triplet,
  12084. with this option enabled lightness is kept at same value.
  12085. @end table
  12086. @section hysteresis
  12087. Grow first stream into second stream by connecting components.
  12088. This makes it possible to build more robust edge masks.
  12089. This filter accepts the following options:
  12090. @table @option
  12091. @item planes
  12092. Set which planes will be processed as bitmap, unprocessed planes will be
  12093. copied from first stream.
  12094. By default value 0xf, all planes will be processed.
  12095. @item threshold
  12096. Set threshold which is used in filtering. If pixel component value is higher than
  12097. this value filter algorithm for connecting components is activated.
  12098. By default value is 0.
  12099. @end table
  12100. The @code{hysteresis} filter also supports the @ref{framesync} options.
  12101. @section iccdetect
  12102. Detect the colorspace from an embedded ICC profile (if present), and update
  12103. the frame's tags accordingly.
  12104. This filter accepts the following options:
  12105. @table @option
  12106. @item force
  12107. If true, the frame's existing colorspace tags will always be overridden by
  12108. values detected from an ICC profile. Otherwise, they will only be assigned if
  12109. they contain @code{unknown}. Enabled by default.
  12110. @end table
  12111. @section iccgen
  12112. Generate ICC profiles and attach them to frames.
  12113. This filter accepts the following options:
  12114. @table @option
  12115. @item color_primaries
  12116. @item color_trc
  12117. Configure the colorspace that the ICC profile will be generated for. The
  12118. default value of @code{auto} infers the value from the input frame's metadata,
  12119. defaulting to BT.709/sRGB as appropriate.
  12120. See the @ref{setparams} filter for a list of possible values, but note that
  12121. @code{unknown} are not valid values for this filter.
  12122. @item force
  12123. If true, an ICC profile will be generated even if it would overwrite an
  12124. already existing ICC profile. Disabled by default.
  12125. @end table
  12126. @section identity
  12127. Obtain the identity score between two input videos.
  12128. This filter takes two input videos.
  12129. Both input videos must have the same resolution and pixel format for
  12130. this filter to work correctly. Also it assumes that both inputs
  12131. have the same number of frames, which are compared one by one.
  12132. The obtained per component, average, min and max identity score is printed through
  12133. the logging system.
  12134. The filter stores the calculated identity scores of each frame in frame metadata.
  12135. This filter also supports the @ref{framesync} options.
  12136. In the below example the input file @file{main.mpg} being processed is compared
  12137. with the reference file @file{ref.mpg}.
  12138. @example
  12139. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  12140. @end example
  12141. @section idet
  12142. Detect video interlacing type.
  12143. This filter tries to detect if the input frames are interlaced, progressive,
  12144. top or bottom field first. It will also try to detect fields that are
  12145. repeated between adjacent frames (a sign of telecine).
  12146. Single frame detection considers only immediately adjacent frames when classifying each frame.
  12147. Multiple frame detection incorporates the classification history of previous frames.
  12148. The filter will log these metadata values:
  12149. @table @option
  12150. @item single.current_frame
  12151. Detected type of current frame using single-frame detection. One of:
  12152. ``tff'' (top field first), ``bff'' (bottom field first),
  12153. ``progressive'', or ``undetermined''
  12154. @item single.tff
  12155. Cumulative number of frames detected as top field first using single-frame detection.
  12156. @item multiple.tff
  12157. Cumulative number of frames detected as top field first using multiple-frame detection.
  12158. @item single.bff
  12159. Cumulative number of frames detected as bottom field first using single-frame detection.
  12160. @item multiple.current_frame
  12161. Detected type of current frame using multiple-frame detection. One of:
  12162. ``tff'' (top field first), ``bff'' (bottom field first),
  12163. ``progressive'', or ``undetermined''
  12164. @item multiple.bff
  12165. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  12166. @item single.progressive
  12167. Cumulative number of frames detected as progressive using single-frame detection.
  12168. @item multiple.progressive
  12169. Cumulative number of frames detected as progressive using multiple-frame detection.
  12170. @item single.undetermined
  12171. Cumulative number of frames that could not be classified using single-frame detection.
  12172. @item multiple.undetermined
  12173. Cumulative number of frames that could not be classified using multiple-frame detection.
  12174. @item repeated.current_frame
  12175. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  12176. @item repeated.neither
  12177. Cumulative number of frames with no repeated field.
  12178. @item repeated.top
  12179. Cumulative number of frames with the top field repeated from the previous frame's top field.
  12180. @item repeated.bottom
  12181. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  12182. @end table
  12183. The filter accepts the following options:
  12184. @table @option
  12185. @item intl_thres
  12186. Set interlacing threshold.
  12187. @item prog_thres
  12188. Set progressive threshold.
  12189. @item rep_thres
  12190. Threshold for repeated field detection.
  12191. @item half_life
  12192. Number of frames after which a given frame's contribution to the
  12193. statistics is halved (i.e., it contributes only 0.5 to its
  12194. classification). The default of 0 means that all frames seen are given
  12195. full weight of 1.0 forever.
  12196. @item analyze_interlaced_flag
  12197. When this is not 0 then idet will use the specified number of frames to determine
  12198. if the interlaced flag is accurate, it will not count undetermined frames.
  12199. If the flag is found to be accurate it will be used without any further
  12200. computations, if it is found to be inaccurate it will be cleared without any
  12201. further computations. This allows inserting the idet filter as a low computational
  12202. method to clean up the interlaced flag
  12203. @end table
  12204. @subsection Examples
  12205. Inspect the field order of the first 360 frames in a video, in verbose detail:
  12206. @example
  12207. ffmpeg -i INPUT -filter:v idet,metadata=mode=print -frames:v 360 -an -f null -
  12208. @end example
  12209. The idet filter will add analysis metadata to each frame, which will then be
  12210. discarded. At the end, the filter will also print a final report with statistics.
  12211. @section il
  12212. Deinterleave or interleave fields.
  12213. This filter allows one to process interlaced images fields without
  12214. deinterlacing them. Deinterleaving splits the input frame into 2
  12215. fields (so called half pictures). Odd lines are moved to the top
  12216. half of the output image, even lines to the bottom half.
  12217. You can process (filter) them independently and then re-interleave them.
  12218. The filter accepts the following options:
  12219. @table @option
  12220. @item luma_mode, l
  12221. @item chroma_mode, c
  12222. @item alpha_mode, a
  12223. Available values for @var{luma_mode}, @var{chroma_mode} and
  12224. @var{alpha_mode} are:
  12225. @table @samp
  12226. @item none
  12227. Do nothing.
  12228. @item deinterleave, d
  12229. Deinterleave fields, placing one above the other.
  12230. @item interleave, i
  12231. Interleave fields. Reverse the effect of deinterleaving.
  12232. @end table
  12233. Default value is @code{none}.
  12234. @item luma_swap, ls
  12235. @item chroma_swap, cs
  12236. @item alpha_swap, as
  12237. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  12238. @end table
  12239. @subsection Commands
  12240. This filter supports the all above options as @ref{commands}.
  12241. @section inflate
  12242. Apply inflate effect to the video.
  12243. This filter replaces the pixel by the local(3x3) average by taking into account
  12244. only values higher than the pixel.
  12245. It accepts the following options:
  12246. @table @option
  12247. @item threshold0
  12248. @item threshold1
  12249. @item threshold2
  12250. @item threshold3
  12251. Limit the maximum change for each plane, default is 65535.
  12252. If 0, plane will remain unchanged.
  12253. @end table
  12254. @subsection Commands
  12255. This filter supports the all above options as @ref{commands}.
  12256. @section interlace
  12257. Simple interlacing filter from progressive contents. This interleaves upper (or
  12258. lower) lines from odd frames with lower (or upper) lines from even frames,
  12259. halving the frame rate and preserving image height.
  12260. @example
  12261. Original Original New Frame
  12262. Frame 'j' Frame 'j+1' (tff)
  12263. ========== =========== ==================
  12264. Line 0 --------------------> Frame 'j' Line 0
  12265. Line 1 Line 1 ----> Frame 'j+1' Line 1
  12266. Line 2 ---------------------> Frame 'j' Line 2
  12267. Line 3 Line 3 ----> Frame 'j+1' Line 3
  12268. ... ... ...
  12269. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  12270. @end example
  12271. It accepts the following optional parameters:
  12272. @table @option
  12273. @item scan
  12274. This determines whether the interlaced frame is taken from the even
  12275. (tff - default) or odd (bff) lines of the progressive frame.
  12276. @item lowpass
  12277. Vertical lowpass filter to avoid twitter interlacing and
  12278. reduce moire patterns.
  12279. @table @samp
  12280. @item 0, off
  12281. Disable vertical lowpass filter
  12282. @item 1, linear
  12283. Enable linear filter (default)
  12284. @item 2, complex
  12285. Enable complex filter. This will slightly less reduce twitter and moire
  12286. but better retain detail and subjective sharpness impression.
  12287. @end table
  12288. @end table
  12289. @section kerndeint
  12290. Deinterlace input video by applying Donald Graft's adaptive kernel
  12291. deinterling. Work on interlaced parts of a video to produce
  12292. progressive frames.
  12293. The description of the accepted parameters follows.
  12294. @table @option
  12295. @item thresh
  12296. Set the threshold which affects the filter's tolerance when
  12297. determining if a pixel line must be processed. It must be an integer
  12298. in the range [0,255] and defaults to 10. A value of 0 will result in
  12299. applying the process on every pixels.
  12300. @item map
  12301. Paint pixels exceeding the threshold value to white if set to 1.
  12302. Default is 0.
  12303. @item order
  12304. Set the fields order. Swap fields if set to 1, leave fields alone if
  12305. 0. Default is 0.
  12306. @item sharp
  12307. Enable additional sharpening if set to 1. Default is 0.
  12308. @item twoway
  12309. Enable twoway sharpening if set to 1. Default is 0.
  12310. @end table
  12311. @subsection Examples
  12312. @itemize
  12313. @item
  12314. Apply default values:
  12315. @example
  12316. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  12317. @end example
  12318. @item
  12319. Enable additional sharpening:
  12320. @example
  12321. kerndeint=sharp=1
  12322. @end example
  12323. @item
  12324. Paint processed pixels in white:
  12325. @example
  12326. kerndeint=map=1
  12327. @end example
  12328. @end itemize
  12329. @section kirsch
  12330. Apply kirsch operator to input video stream.
  12331. The filter accepts the following option:
  12332. @table @option
  12333. @item planes
  12334. Set which planes will be processed, unprocessed planes will be copied.
  12335. By default value 0xf, all planes will be processed.
  12336. @item scale
  12337. Set value which will be multiplied with filtered result.
  12338. @item delta
  12339. Set value which will be added to filtered result.
  12340. @end table
  12341. @subsection Commands
  12342. This filter supports the all above options as @ref{commands}.
  12343. @section lagfun
  12344. Slowly update darker pixels.
  12345. This filter makes short flashes of light appear longer.
  12346. This filter accepts the following options:
  12347. @table @option
  12348. @item decay
  12349. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  12350. @item planes
  12351. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12352. @end table
  12353. @subsection Commands
  12354. This filter supports the all above options as @ref{commands}.
  12355. @section lenscorrection
  12356. Correct radial lens distortion
  12357. This filter can be used to correct for radial distortion as can result from the use
  12358. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  12359. one can use tools available for example as part of opencv or simply trial-and-error.
  12360. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  12361. and extract the k1 and k2 coefficients from the resulting matrix.
  12362. Note that effectively the same filter is available in the open-source tools Krita and
  12363. Digikam from the KDE project.
  12364. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  12365. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  12366. brightness distribution, so you may want to use both filters together in certain
  12367. cases, though you will have to take care of ordering, i.e. whether vignetting should
  12368. be applied before or after lens correction.
  12369. @subsection Options
  12370. The filter accepts the following options:
  12371. @table @option
  12372. @item cx
  12373. Relative x-coordinate of the focal point of the image, and thereby the center of the
  12374. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12375. width. Default is 0.5.
  12376. @item cy
  12377. Relative y-coordinate of the focal point of the image, and thereby the center of the
  12378. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12379. height. Default is 0.5.
  12380. @item k1
  12381. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  12382. no correction. Default is 0.
  12383. @item k2
  12384. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  12385. 0 means no correction. Default is 0.
  12386. @item i
  12387. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  12388. Default is @code{nearest}.
  12389. @item fc
  12390. Specify the color of the unmapped pixels. For the syntax of this option,
  12391. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12392. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  12393. @end table
  12394. The formula that generates the correction is:
  12395. @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
  12396. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  12397. distances from the focal point in the source and target images, respectively.
  12398. @subsection Commands
  12399. This filter supports the all above options as @ref{commands}.
  12400. @section lensfun
  12401. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  12402. The @code{lensfun} filter requires the camera make, camera model, and lens model
  12403. to apply the lens correction. The filter will load the lensfun database and
  12404. query it to find the corresponding camera and lens entries in the database. As
  12405. long as these entries can be found with the given options, the filter can
  12406. perform corrections on frames. Note that incomplete strings will result in the
  12407. filter choosing the best match with the given options, and the filter will
  12408. output the chosen camera and lens models (logged with level "info"). You must
  12409. provide the make, camera model, and lens model as they are required.
  12410. To obtain a list of available makes and models, leave out one or both of @code{make} and
  12411. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  12412. The first column is the make and the second column is the model.
  12413. To obtain a list of available lenses, set any values for make and model and leave out the
  12414. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  12415. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  12416. The filter accepts the following options:
  12417. @table @option
  12418. @item make
  12419. The make of the camera (for example, "Canon"). This option is required.
  12420. @item model
  12421. The model of the camera (for example, "Canon EOS 100D"). This option is
  12422. required.
  12423. @item lens_model
  12424. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  12425. option is required.
  12426. @item db_path
  12427. The full path to the lens database folder. If not set, the filter will attempt to
  12428. load the database from the install path when the library was built. Default is unset.
  12429. @item mode
  12430. The type of correction to apply. The following values are valid options:
  12431. @table @samp
  12432. @item vignetting
  12433. Enables fixing lens vignetting.
  12434. @item geometry
  12435. Enables fixing lens geometry. This is the default.
  12436. @item subpixel
  12437. Enables fixing chromatic aberrations.
  12438. @item vig_geo
  12439. Enables fixing lens vignetting and lens geometry.
  12440. @item vig_subpixel
  12441. Enables fixing lens vignetting and chromatic aberrations.
  12442. @item distortion
  12443. Enables fixing both lens geometry and chromatic aberrations.
  12444. @item all
  12445. Enables all possible corrections.
  12446. @end table
  12447. @item focal_length
  12448. The focal length of the image/video (zoom; expected constant for video). For
  12449. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  12450. range should be chosen when using that lens. Default 18.
  12451. @item aperture
  12452. The aperture of the image/video (expected constant for video). Note that
  12453. aperture is only used for vignetting correction. Default 3.5.
  12454. @item focus_distance
  12455. The focus distance of the image/video (expected constant for video). Note that
  12456. focus distance is only used for vignetting and only slightly affects the
  12457. vignetting correction process. If unknown, leave it at the default value (which
  12458. is 1000).
  12459. @item scale
  12460. The scale factor which is applied after transformation. After correction the
  12461. video is no longer necessarily rectangular. This parameter controls how much of
  12462. the resulting image is visible. The value 0 means that a value will be chosen
  12463. automatically such that there is little or no unmapped area in the output
  12464. image. 1.0 means that no additional scaling is done. Lower values may result
  12465. in more of the corrected image being visible, while higher values may avoid
  12466. unmapped areas in the output.
  12467. @item target_geometry
  12468. The target geometry of the output image/video. The following values are valid
  12469. options:
  12470. @table @samp
  12471. @item rectilinear (default)
  12472. @item fisheye
  12473. @item panoramic
  12474. @item equirectangular
  12475. @item fisheye_orthographic
  12476. @item fisheye_stereographic
  12477. @item fisheye_equisolid
  12478. @item fisheye_thoby
  12479. @end table
  12480. @item reverse
  12481. Apply the reverse of image correction (instead of correcting distortion, apply
  12482. it).
  12483. @item interpolation
  12484. The type of interpolation used when correcting distortion. The following values
  12485. are valid options:
  12486. @table @samp
  12487. @item nearest
  12488. @item linear (default)
  12489. @item lanczos
  12490. @end table
  12491. @end table
  12492. @subsection Examples
  12493. @itemize
  12494. @item
  12495. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  12496. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  12497. aperture of "8.0".
  12498. @example
  12499. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
  12500. @end example
  12501. @item
  12502. Apply the same as before, but only for the first 5 seconds of video.
  12503. @example
  12504. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
  12505. @end example
  12506. @end itemize
  12507. @section libplacebo
  12508. Flexible GPU-accelerated processing filter based on libplacebo
  12509. (@url{https://code.videolan.org/videolan/libplacebo}).
  12510. @subsection Options
  12511. The options for this filter are divided into the following sections:
  12512. @subsubsection Output mode
  12513. These options control the overall output mode. By default, libplacebo will try
  12514. to preserve the source colorimetry and size as best as it can, but it will
  12515. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12516. in source frames.
  12517. @table @option
  12518. @item inputs
  12519. Set the number of inputs. This can be used, alongside the @code{idx} variable,
  12520. to allow placing/blending multiple inputs inside the output frame. This
  12521. effectively enables functionality similar to @ref{hstack}, @ref{overlay}, etc.
  12522. @item w
  12523. @item h
  12524. Set the output video dimension expression. Default values are @code{iw} and
  12525. @code{ih}.
  12526. Allows for the same expressions as the @ref{scale} filter.
  12527. @item crop_x
  12528. @item crop_y
  12529. Set the input crop x/y expressions, default values are @code{(iw-cw)/2} and
  12530. @code{(ih-ch)/2}.
  12531. @item crop_w
  12532. @item crop_h
  12533. Set the input crop width/height expressions, default values are @code{iw} and
  12534. @code{ih}.
  12535. @item pos_x
  12536. @item pos_y
  12537. Set the output placement x/y expressions, default values are @code{(ow-pw)/2}
  12538. and @code{(oh-ph)/2}.
  12539. @item pos_w
  12540. @item pos_h
  12541. Set the output placement width/height expressions, default values are @code{ow}
  12542. and @code{oh}.
  12543. @item fps
  12544. Set the output frame rate. This can be rational, e.g. @code{60000/1001}. If
  12545. set to the special string @code{none} (the default), input timestamps will
  12546. instead be passed through to the output unmodified. Otherwise, the input video
  12547. frames will be interpolated as necessary to rescale the video to the specified
  12548. target framerate, in a manner as determined by the @option{frame_mixer} option.
  12549. @item format
  12550. Set the output format override. If unset (the default), frames will be output
  12551. in the same format as the respective input frames. Otherwise, format conversion
  12552. will be performed.
  12553. @item force_original_aspect_ratio
  12554. @item force_divisible_by
  12555. Work the same as the identical @ref{scale} filter options.
  12556. @item normalize_sar
  12557. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12558. will introduce additional padding/cropping as necessary. If disabled (the
  12559. default), any aspect ratio mismatches, including those from e.g. anamorphic
  12560. video sources, are forwarded to the output pixel aspect ratio.
  12561. @item pad_crop_ratio
  12562. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12563. cropping when the input aspect ratio does not match the output aspect ratio and
  12564. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12565. content with black borders, while a value of @code{1.0} always crops off parts
  12566. of the content. Intermediate values are possible, leading to a mix of the two
  12567. approaches.
  12568. @item fillcolor
  12569. Set the color used to fill the output area not covered by the output image, for
  12570. example as a result of @option{normalize_sar}. For the general syntax of this
  12571. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12572. manual,ffmpeg-utils}. Defaults to @code{black}.
  12573. @item corner_rounding
  12574. Render frames with rounded corners. The value, given as a float ranging from
  12575. @code{0.0} to @code{1.0}, indicates the relative degree of rounding, from fully
  12576. square to fully circular. In other words, it gives the radius divided by half
  12577. the smaller side length. Defaults to @code{0.0}.
  12578. @item extra_opts
  12579. Pass extra libplacebo internal configuration options. These can be specified
  12580. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  12581. shows how to configure a custom filter kernel ("EWA LanczosSharp") and use it
  12582. to double the input image resolution:
  12583. @example
  12584. -vf "libplacebo=w=iw*2:h=ih*2:extra_opts='upscaler=custom\:upscaler_preset=ewa_lanczos\:upscaler_blur=0.9812505644269356'"
  12585. @end example
  12586. @item colorspace
  12587. @item color_primaries
  12588. @item color_trc
  12589. @item range
  12590. Configure the colorspace that output frames will be delivered in. The default
  12591. value of @code{auto} outputs frames in the same format as the input frames,
  12592. leading to no change. For any other value, conversion will be performed.
  12593. See the @ref{setparams} filter for a list of possible values.
  12594. @item apply_filmgrain
  12595. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12596. it from the output. Enabled by default.
  12597. @item apply_dolbyvision
  12598. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12599. the output. Enabled by default. Note that Dolby Vision will always output
  12600. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12601. picked as the values of @code{auto} for the respective frame output options.
  12602. @end table
  12603. In addition to the expression constants documented for the @ref{scale} filter,
  12604. the @option{crop_w}, @option{crop_h}, @option{crop_x}, @option{crop_y},
  12605. @option{pos_w}, @option{pos_h}, @option{pos_x} and @option{pos_y} options can
  12606. also contain the following constants:
  12607. @table @option
  12608. @item in_idx, idx
  12609. The (0-based) numeric index of the currently active input stream.
  12610. @item crop_w, cw
  12611. @item crop_h, ch
  12612. The computed values of @option{crop_w} and @option{crop_h}.
  12613. @item pos_w, pw
  12614. @item pos_h, ph
  12615. The computed values of @option{pos_w} and @option{pos_h}.
  12616. @item in_t, t
  12617. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12618. @item out_t, ot
  12619. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12620. @item n
  12621. The input frame number, starting with 0.
  12622. @end table
  12623. @subsubsection Scaling
  12624. The options in this section control how libplacebo performs upscaling and (if
  12625. necessary) downscaling. Note that libplacebo will always internally operate on
  12626. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12627. necessarily be upsampled and downsampled as part of the rendering process. That
  12628. means scaling might be in effect even if the source and destination resolution
  12629. are the same.
  12630. @table @option
  12631. @item upscaler
  12632. @item downscaler
  12633. Configure the filter kernel used for upscaling and downscaling. The respective
  12634. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12635. values, pass @code{help} to these options. The most important values are:
  12636. @table @samp
  12637. @item none
  12638. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12639. fast but poor quality, especially when downscaling.
  12640. @item bilinear
  12641. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12642. doing so would lead to aliasing. Fast and low quality.
  12643. @item nearest
  12644. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12645. @item oversample
  12646. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12647. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12648. minimal distortion of the artistic appearance.
  12649. @item lanczos
  12650. Standard sinc-sinc interpolation kernel.
  12651. @item spline36
  12652. Cubic spline approximation of lanczos. No difference in performance, but has
  12653. very slightly less ringing.
  12654. @item ewa_lanczos
  12655. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  12656. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12657. quality.
  12658. @item gaussian
  12659. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12660. very blurry.
  12661. @item mitchell
  12662. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12663. little ringing.
  12664. @end table
  12665. @item frame_mixer
  12666. Controls the kernel used for mixing frames temporally. The default value is
  12667. @code{none}, which disables frame mixing. For a full list of possible values,
  12668. pass @code{help} to this option. The most important values are:
  12669. @table @samp
  12670. @item none
  12671. Disables frame mixing, giving a result equivalent to "nearest neighbour"
  12672. semantics.
  12673. @item oversample
  12674. Oversamples the input video to create a "Smooth Motion"-type effect: if an
  12675. output frame would exactly fall on the transition between two video frames, it
  12676. is blended according to the relative overlap. This is the recommended option
  12677. whenever preserving the original subjective appearance is desired.
  12678. @item mitchell_clamp
  12679. Larger filter kernel that smoothly interpolates multiple frames in a manner
  12680. designed to eliminate ringing and other artefacts as much as possible. This is
  12681. the recommended option wherever maximum visual smoothness is desired.
  12682. @item linear
  12683. Linear blend/fade between frames. Especially useful for constructing e.g.
  12684. slideshows.
  12685. @end table
  12686. @item lut_entries
  12687. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  12688. default of @code{0} will pick libplacebo's internal default, typically
  12689. @code{64}.
  12690. @item antiringing
  12691. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12692. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12693. aliasing if set too high. Disabled by default.
  12694. @item sigmoid
  12695. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12696. Enabled by default.
  12697. @end table
  12698. @subsubsection Debanding
  12699. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12700. many common sources of banding and blocking. Turning this on is highly
  12701. recommended whenever quality is desired.
  12702. @table @option
  12703. @item deband
  12704. Enable (fast) debanding algorithm. Disabled by default.
  12705. @item deband_iterations
  12706. Number of deband iterations of the debanding algorithm. Each iteration is
  12707. performed with progressively increased radius (and diminished threshold).
  12708. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12709. @item deband_threshold
  12710. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12711. Defaults to @code{4.0}.
  12712. @item deband_radius
  12713. Debanding filter radius. A higher radius is better for slow gradients, while
  12714. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12715. @item deband_grain
  12716. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12717. @code{6.0}.
  12718. @end table
  12719. @subsubsection Color adjustment
  12720. A collection of subjective color controls. Not very rigorous, so the exact
  12721. effect will vary somewhat depending on the input primaries and colorspace.
  12722. @table @option
  12723. @item brightness
  12724. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12725. @item contrast
  12726. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12727. @item saturation
  12728. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12729. @item hue
  12730. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12731. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12732. coefficients for RGB inputs.
  12733. @item gamma
  12734. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12735. @item cones
  12736. Cone model to use for color blindness simulation. Accepts any combination of
  12737. @code{l}, @code{m} and @code{s}. Here are some examples:
  12738. @table @samp
  12739. @item m
  12740. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12741. @item l
  12742. Protanomaly / protanopia (affecting 1%-2% of the population)
  12743. @item l+m
  12744. Monochromacy (very rare)
  12745. @item l+m+s
  12746. Achromatopsy (complete loss of daytime vision, extremely rare)
  12747. @end table
  12748. @item cone-strength
  12749. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12750. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12751. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12752. above @code{1.0} result in exaggerating the differences between cones, which
  12753. may help compensate for reduced color vision.
  12754. @end table
  12755. @subsubsection Peak detection
  12756. To help deal with sources that only have static HDR10 metadata (or no tagging
  12757. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12758. analyze source frames and adapt the tone mapping function in realtime. If this
  12759. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12760. recommended to turn this feature off.
  12761. @table @option
  12762. @item peak_detect
  12763. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12764. dynamic detection from the input. Note that the detected values do not get
  12765. written back to the output frames, they merely guide the internal tone mapping
  12766. process. Enabled by default.
  12767. @item smoothing_period
  12768. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12769. values result in peak detection becoming less responsive to changes in the
  12770. input. Defaults to @code{100.0}.
  12771. @item minimum_peak
  12772. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12773. and @code{100.0}. Defaults to @code{1.0}.
  12774. @item scene_threshold_low
  12775. @item scene_threshold_high
  12776. Lower and upper thresholds for scene change detection. Expressed in a
  12777. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12778. and @code{10.0}, respectively. Setting either to a negative value disables
  12779. this functionality.
  12780. @item percentile
  12781. Which percentile of the frame brightness histogram to use as the source peak
  12782. for tone-mapping. Defaults to @code{99.995}, a fairly conservative value.
  12783. Setting this to @code{100.0} disables frame histogram measurement and instead
  12784. uses the true peak brightness for tone-mapping.
  12785. @end table
  12786. @subsubsection Tone mapping
  12787. The options in this section control how libplacebo performs tone-mapping and
  12788. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12789. In general, libplacebo relies on accurate source tagging and mastering display
  12790. gamut information to produce the best results.
  12791. @table @option
  12792. @item gamut_mode
  12793. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12794. gamut mapping.
  12795. @table @samp
  12796. @item clip
  12797. Do nothing, simply clip out-of-range colors to the RGB volume. Low quality but
  12798. extremely fast.
  12799. @item perceptual
  12800. Perceptually soft-clip colors to the gamut volume. This is the default.
  12801. @item relative
  12802. Relative colorimetric hard-clip. Similar to @code{perceptual} but without
  12803. the soft knee.
  12804. @item saturation
  12805. Saturation mapping, maps primaries directly to primaries in RGB space.
  12806. Not recommended except for artificial computer graphics for which a bright,
  12807. saturated display is desired.
  12808. @item absolute
  12809. Absolute colorimetric hard-clip. Performs no adjustment of the white point.
  12810. @item desaturate
  12811. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12812. luminance. Has a tendency to distort the visual appearance of bright objects.
  12813. @item darken
  12814. Linearly reduces content brightness to preserves saturated details, followed by
  12815. clipping the remaining out-of-gamut colors.
  12816. @item warn
  12817. Highlight out-of-gamut pixels (by inverting/marking them).
  12818. @item linear
  12819. Linearly reduces chromaticity of the entire image to make it fit within the
  12820. target color volume. Be careful when using this on BT.2020 sources without
  12821. proper mastering metadata, as doing so will lead to excessive desaturation.
  12822. @end table
  12823. @item tonemapping
  12824. Tone-mapping algorithm to use. Available values are:
  12825. @table @samp
  12826. @item auto
  12827. Automatic selection based on internal heuristics. This is the default.
  12828. @item clip
  12829. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12830. accuracy for in-range colors but completely destroys out-of-range information.
  12831. Does not perform any black point adaptation. Not configurable.
  12832. @item st2094-40
  12833. EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
  12834. dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
  12835. is adjusted based on the ratio between the targeted and actual display peak
  12836. luminances.
  12837. @item st2094-10
  12838. EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
  12839. average luminance in addition to the maximum/minimum. The configurable contrast
  12840. parameter influences the slope of the linear output segment, defaulting to
  12841. @code{1.0} for no increase/decrease in contrast. Note that this does not
  12842. currently include the subjective gain/offset/gamma controls defined in Annex
  12843. B.3.
  12844. @item bt.2390
  12845. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12846. segment. The knee point offset is configurable. Note that this parameter
  12847. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12848. spec.
  12849. @item bt.2446a
  12850. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12851. sources. Can be used for both forward and inverse tone mapping. Not
  12852. configurable.
  12853. @item spline
  12854. Simple spline consisting of two polynomials, joined by a single pivot point.
  12855. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12856. Can be used for both forward and inverse tone mapping.
  12857. @item reinhard
  12858. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12859. local contrast coefficient at the display peak. Essentially, a parameter of
  12860. @code{0.5} implies that the reference white will be about half as bright as
  12861. when clipping. Defaults to @code{0.5}, which results in the simplest
  12862. formulation of this function.
  12863. @item mobius
  12864. Generalization of the reinhard tone mapping algorithm to support an additional
  12865. linear slope near black. The tone mapping parameter indicates the trade-off
  12866. between the linear section and the non-linear section. Essentially, for a given
  12867. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12868. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12869. this curve behave like @code{clip}, while values near @code{0.0} make this
  12870. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12871. provides a good balance between colorimetric accuracy and preserving
  12872. out-of-gamut details.
  12873. @item hable
  12874. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12875. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12876. Popularized by its use in video games with HDR rendering. Preserves both dark
  12877. and bright details very well, but comes with the drawback of changing the
  12878. average brightness quite significantly. This is sort of similar to
  12879. @code{reinhard} with parameter @code{0.24}.
  12880. @item gamma
  12881. Fits a gamma (power) function to transfer between the source and target color
  12882. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12883. linear sections. This preserves details at all scales fairly accurately, but
  12884. can result in an image with a muted or dull appearance. The parameter is used
  12885. as the cutoff point, defaulting to @code{0.5}.
  12886. @item linear
  12887. Linearly stretches the input range to the output range, in PQ space. This will
  12888. preserve all details accurately, but results in a significantly different
  12889. average brightness. Can be used for inverse tone-mapping in addition to regular
  12890. tone-mapping. The parameter can be used as an additional linear gain
  12891. coefficient (defaulting to @code{1.0}).
  12892. @end table
  12893. @item tonemapping_param
  12894. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12895. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12896. value of @code{0.0} is replaced by the curve's preferred default setting.
  12897. @item inverse_tonemapping
  12898. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12899. output color volumes. Disabled by default.
  12900. @item tonemapping_lut_size
  12901. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12902. @code{256}. Note that this figure is squared when combined with
  12903. @code{peak_detect}.
  12904. @item contrast_recovery
  12905. Contrast recovery strength. If set to a value above @code{0.0}, the source
  12906. image will be divided into high-frequency and low-frequency components, and a
  12907. portion of the high-frequency image is added back onto the tone-mapped output.
  12908. May cause excessive ringing artifacts for some HDR sources, but can improve the
  12909. subjective sharpness and detail left over in the image after tone-mapping.
  12910. Defaults to @code{0.30}.
  12911. @item contrast_smoothness
  12912. Contrast recovery lowpass kernel size. Defaults to @code{3.5}. Increasing or
  12913. decreasing this will affect the visual appearance substantially. Has no effect
  12914. when @code{contrast_recovery} is disabled.
  12915. @end table
  12916. @subsubsection Dithering
  12917. By default, libplacebo will dither whenever necessary, which includes rendering
  12918. to any integer format below 16-bit precision. It's recommended to always leave
  12919. this on, since not doing so may result in visible banding in the output, even
  12920. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12921. use @code{ordered_fixed} instead of disabling dithering.
  12922. @table @option
  12923. @item dithering
  12924. Dithering method to use. Accepts the following values:
  12925. @table @samp
  12926. @item none
  12927. Disables dithering completely. May result in visible banding.
  12928. @item blue
  12929. Dither with pseudo-blue noise. This is the default.
  12930. @item ordered
  12931. Tunable ordered dither pattern.
  12932. @item ordered_fixed
  12933. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12934. @item white
  12935. Dither with white noise. Texture-less.
  12936. @end table
  12937. @item dither_lut_size
  12938. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12939. @code{6}, corresponding to a LUT size of @code{64x64}.
  12940. @item dither_temporal
  12941. Enables temporal dithering. Disabled by default.
  12942. @end table
  12943. @subsubsection Custom shaders
  12944. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12945. syntax. A collection of such shaders can be found here:
  12946. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12947. A full description of the mpv shader format is beyond the scope of this
  12948. section, but a summary can be found here:
  12949. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12950. @table @option
  12951. @item custom_shader_path
  12952. Specifies a path to a custom shader file to load at runtime.
  12953. @item custom_shader_bin
  12954. Specifies a complete custom shader as a raw string.
  12955. @end table
  12956. @subsubsection Debugging / performance
  12957. All of the options in this section default off. They may be of assistance when
  12958. attempting to squeeze the maximum performance at the cost of quality.
  12959. @table @option
  12960. @item skip_aa
  12961. Disable anti-aliasing when downscaling.
  12962. @item polar_cutoff
  12963. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12964. @code{0.0} and @code{1.0}.
  12965. @item disable_linear
  12966. Disable linear light scaling.
  12967. @item disable_builtin
  12968. Disable built-in GPU sampling (forces LUT).
  12969. @item disable_fbos
  12970. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12971. offering the maximum possible speed.
  12972. @end table
  12973. @subsection Commands
  12974. This filter supports almost all of the above options as @ref{commands}.
  12975. @subsection Examples
  12976. @itemize
  12977. @item
  12978. Tone-map input to standard gamut BT.709 output:
  12979. @example
  12980. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12981. @end example
  12982. @item
  12983. Rescale input to fit into standard 1080p, with high quality scaling:
  12984. @example
  12985. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12986. @end example
  12987. @item
  12988. Interpolate low FPS / VFR input to smoothed constant 60 fps output:
  12989. @example
  12990. libplacebo=fps=60:frame_mixer=mitchell_clamp
  12991. @end example
  12992. @item
  12993. Convert input to standard sRGB JPEG:
  12994. @example
  12995. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12996. @end example
  12997. @item
  12998. Use higher quality debanding settings:
  12999. @example
  13000. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  13001. @end example
  13002. @item
  13003. Run this filter on the CPU, on systems with Mesa installed (and with the most
  13004. expensive options disabled):
  13005. @example
  13006. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  13007. @end example
  13008. @item
  13009. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  13010. doing it with this filter. Note that this is only a gain if the frames are
  13011. either already on the GPU, or if you're using libplacebo for other purposes,
  13012. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  13013. @example
  13014. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  13015. @end example
  13016. @item
  13017. Interop with VAAPI hwdec to avoid round-tripping through RAM:
  13018. @example
  13019. ffmpeg -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi ... -vf libplacebo
  13020. @end example
  13021. @end itemize
  13022. @anchor{libvmaf}
  13023. @section libvmaf
  13024. Calculate the VMAF (Video Multi-Method Assessment Fusion) score for a
  13025. reference/distorted pair of input videos.
  13026. The first input is the distorted video, and the second input is the reference video.
  13027. The obtained VMAF score is printed through the logging system.
  13028. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  13029. After installing the library it can be enabled using:
  13030. @code{./configure --enable-libvmaf}.
  13031. The filter has following options:
  13032. @table @option
  13033. @item model
  13034. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  13035. Default value: @code{"version=vmaf_v0.6.1"}
  13036. @item feature
  13037. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  13038. @item log_path
  13039. Set the file path to be used to store log files.
  13040. @item log_fmt
  13041. Set the format of the log file (xml, json, csv, or sub).
  13042. @item pool
  13043. Set the pool method to be used for computing vmaf.
  13044. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  13045. @item n_threads
  13046. Set number of threads to be used when initializing libvmaf.
  13047. Default value: @code{0}, no threads.
  13048. @item n_subsample
  13049. Set frame subsampling interval to be used.
  13050. @end table
  13051. This filter also supports the @ref{framesync} options.
  13052. @subsection Examples
  13053. @itemize
  13054. @item
  13055. In the examples below, a distorted video @file{distorted.mpg} is
  13056. compared with a reference file @file{reference.mpg}.
  13057. @item
  13058. Basic usage:
  13059. @example
  13060. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  13061. @end example
  13062. @item
  13063. Example with multiple models:
  13064. @example
  13065. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='model=version=vmaf_v0.6.1\\:name=vmaf|version=vmaf_v0.6.1neg\\:name=vmaf_neg' -f null -
  13066. @end example
  13067. @item
  13068. Example with multiple additional features:
  13069. @example
  13070. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  13071. @end example
  13072. @item
  13073. Example with options and different containers:
  13074. @example
  13075. ffmpeg -i distorted.mpg -i reference.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=log_fmt=json:log_path=output.json" -f null -
  13076. @end example
  13077. @end itemize
  13078. @section libvmaf_cuda
  13079. This is the CUDA variant of the @ref{libvmaf} filter. It only accepts CUDA frames.
  13080. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  13081. After installing the library it can be enabled using:
  13082. @code{./configure --enable-nonfree --enable-ffnvcodec --enable-libvmaf}.
  13083. @subsection Examples
  13084. @itemize
  13085. @item
  13086. Basic usage showing CUVID hardware decoding and CUDA scaling with @ref{scale_cuda}:
  13087. @example
  13088. ffmpeg \
  13089. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i dis.obu \
  13090. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i ref.obu \
  13091. -filter_complex "
  13092. [0:v]scale_cuda=format=yuv420p[dis]; \
  13093. [1:v]scale_cuda=format=yuv420p[ref]; \
  13094. [dis][ref]libvmaf_cuda=log_fmt=json:log_path=output.json
  13095. " \
  13096. -f null -
  13097. @end example
  13098. @end itemize
  13099. @section limitdiff
  13100. Apply limited difference filter using second and optionally third video stream.
  13101. The filter accepts the following options:
  13102. @table @option
  13103. @item threshold
  13104. Set the threshold to use when allowing certain differences between video streams.
  13105. Any absolute difference value lower or exact than this threshold will pick pixel components from
  13106. first video stream.
  13107. @item elasticity
  13108. Set the elasticity of soft thresholding when processing video streams.
  13109. This value multiplied with first one sets second threshold.
  13110. Any absolute difference value greater or exact than second threshold will pick pixel components
  13111. from second video stream. For values between those two threshold
  13112. linear interpolation between first and second video stream will be used.
  13113. @item reference
  13114. Enable the reference (third) video stream processing. By default is disabled.
  13115. If set, this video stream will be used for calculating absolute difference with first video
  13116. stream.
  13117. @item planes
  13118. Specify which planes will be processed. Defaults to all available.
  13119. @end table
  13120. @subsection Commands
  13121. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  13122. @section limiter
  13123. Limits the pixel components values to the specified range [min, max].
  13124. The filter accepts the following options:
  13125. @table @option
  13126. @item min
  13127. Lower bound. Defaults to the lowest allowed value for the input.
  13128. @item max
  13129. Upper bound. Defaults to the highest allowed value for the input.
  13130. @item planes
  13131. Specify which planes will be processed. Defaults to all available.
  13132. @end table
  13133. @subsection Commands
  13134. This filter supports the all above options as @ref{commands}.
  13135. @section loop
  13136. Loop video frames.
  13137. The filter accepts the following options:
  13138. @table @option
  13139. @item loop
  13140. Set the number of loops. Setting this value to -1 will result in infinite loops.
  13141. Default is 0.
  13142. @item size
  13143. Set maximal size in number of frames. Default is 0.
  13144. @item start
  13145. Set first frame of loop. Default is 0.
  13146. @item time
  13147. Set the time of loop start in seconds.
  13148. Only used if option named @var{start} is set to @code{-1}.
  13149. @end table
  13150. @subsection Examples
  13151. @itemize
  13152. @item
  13153. Loop single first frame infinitely:
  13154. @example
  13155. loop=loop=-1:size=1:start=0
  13156. @end example
  13157. @item
  13158. Loop single first frame 10 times:
  13159. @example
  13160. loop=loop=10:size=1:start=0
  13161. @end example
  13162. @item
  13163. Loop 10 first frames 5 times:
  13164. @example
  13165. loop=loop=5:size=10:start=0
  13166. @end example
  13167. @end itemize
  13168. @section lut1d
  13169. Apply a 1D LUT to an input video.
  13170. The filter accepts the following options:
  13171. @table @option
  13172. @item file
  13173. Set the 1D LUT file name.
  13174. Currently supported formats:
  13175. @table @samp
  13176. @item cube
  13177. Iridas
  13178. @item csp
  13179. cineSpace
  13180. @end table
  13181. @item interp
  13182. Select interpolation mode.
  13183. Available values are:
  13184. @table @samp
  13185. @item nearest
  13186. Use values from the nearest defined point.
  13187. @item linear
  13188. Interpolate values using the linear interpolation.
  13189. @item cosine
  13190. Interpolate values using the cosine interpolation.
  13191. @item cubic
  13192. Interpolate values using the cubic interpolation.
  13193. @item spline
  13194. Interpolate values using the spline interpolation.
  13195. @end table
  13196. @end table
  13197. @subsection Commands
  13198. This filter supports the all above options as @ref{commands}.
  13199. @anchor{lut3d}
  13200. @section lut3d
  13201. Apply a 3D LUT to an input video.
  13202. The filter accepts the following options:
  13203. @table @option
  13204. @item file
  13205. Set the 3D LUT file name.
  13206. Currently supported formats:
  13207. @table @samp
  13208. @item 3dl
  13209. AfterEffects
  13210. @item cube
  13211. Iridas
  13212. @item dat
  13213. DaVinci
  13214. @item m3d
  13215. Pandora
  13216. @item csp
  13217. cineSpace
  13218. @end table
  13219. @item interp
  13220. Select interpolation mode.
  13221. Available values are:
  13222. @table @samp
  13223. @item nearest
  13224. Use values from the nearest defined point.
  13225. @item trilinear
  13226. Interpolate values using the 8 points defining a cube.
  13227. @item tetrahedral
  13228. Interpolate values using a tetrahedron.
  13229. @item pyramid
  13230. Interpolate values using a pyramid.
  13231. @item prism
  13232. Interpolate values using a prism.
  13233. @end table
  13234. @end table
  13235. @subsection Commands
  13236. This filter supports the @code{interp} option as @ref{commands}.
  13237. @section lumakey
  13238. Turn certain luma values into transparency.
  13239. The filter accepts the following options:
  13240. @table @option
  13241. @item threshold
  13242. Set the luma which will be used as base for transparency.
  13243. Default value is @code{0}.
  13244. @item tolerance
  13245. Set the range of luma values to be keyed out.
  13246. Default value is @code{0.01}.
  13247. @item softness
  13248. Set the range of softness. Default value is @code{0}.
  13249. Use this to control gradual transition from zero to full transparency.
  13250. @end table
  13251. @subsection Commands
  13252. This filter supports same @ref{commands} as options.
  13253. The command accepts the same syntax of the corresponding option.
  13254. If the specified expression is not valid, it is kept at its current
  13255. value.
  13256. @anchor{lutrgb}
  13257. @anchor{lutyuv}
  13258. @anchor{lut}
  13259. @section lut, lutrgb, lutyuv
  13260. Compute a look-up table for binding each pixel component input value
  13261. to an output value, and apply it to the input video.
  13262. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  13263. to an RGB input video.
  13264. These filters accept the following parameters:
  13265. @table @option
  13266. @item c0
  13267. set first pixel component expression
  13268. @item c1
  13269. set second pixel component expression
  13270. @item c2
  13271. set third pixel component expression
  13272. @item c3
  13273. set fourth pixel component expression, corresponds to the alpha component
  13274. @item r
  13275. set red component expression
  13276. @item g
  13277. set green component expression
  13278. @item b
  13279. set blue component expression
  13280. @item a
  13281. alpha component expression
  13282. @item y
  13283. set Y/luma component expression
  13284. @item u
  13285. set U/Cb component expression
  13286. @item v
  13287. set V/Cr component expression
  13288. @end table
  13289. Each of them specifies the expression to use for computing the lookup table for
  13290. the corresponding pixel component values.
  13291. The exact component associated to each of the @var{c*} options depends on the
  13292. format in input.
  13293. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  13294. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  13295. The expressions can contain the following constants and functions:
  13296. @table @option
  13297. @item w
  13298. @item h
  13299. The input width and height.
  13300. @item val
  13301. The input value for the pixel component.
  13302. @item clipval
  13303. The input value, clipped to the @var{minval}-@var{maxval} range.
  13304. @item maxval
  13305. The maximum value for the pixel component.
  13306. @item minval
  13307. The minimum value for the pixel component.
  13308. @item negval
  13309. The negated value for the pixel component value, clipped to the
  13310. @var{minval}-@var{maxval} range; it corresponds to the expression
  13311. "maxval-clipval+minval".
  13312. @item clip(val)
  13313. The computed value in @var{val}, clipped to the
  13314. @var{minval}-@var{maxval} range.
  13315. @item gammaval(gamma)
  13316. The computed gamma correction value of the pixel component value,
  13317. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  13318. expression
  13319. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  13320. @end table
  13321. All expressions default to "clipval".
  13322. @subsection Commands
  13323. This filter supports same @ref{commands} as options.
  13324. @subsection Examples
  13325. @itemize
  13326. @item
  13327. Negate input video:
  13328. @example
  13329. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  13330. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  13331. @end example
  13332. The above is the same as:
  13333. @example
  13334. lutrgb="r=negval:g=negval:b=negval"
  13335. lutyuv="y=negval:u=negval:v=negval"
  13336. @end example
  13337. @item
  13338. Negate luma:
  13339. @example
  13340. lutyuv=y=negval
  13341. @end example
  13342. @item
  13343. Remove chroma components, turning the video into a graytone image:
  13344. @example
  13345. lutyuv="u=128:v=128"
  13346. @end example
  13347. @item
  13348. Apply a luma burning effect:
  13349. @example
  13350. lutyuv="y=2*val"
  13351. @end example
  13352. @item
  13353. Remove green and blue components:
  13354. @example
  13355. lutrgb="g=0:b=0"
  13356. @end example
  13357. @item
  13358. Set a constant alpha channel value on input:
  13359. @example
  13360. format=rgba,lutrgb=a="maxval-minval/2"
  13361. @end example
  13362. @item
  13363. Correct luma gamma by a factor of 0.5:
  13364. @example
  13365. lutyuv=y=gammaval(0.5)
  13366. @end example
  13367. @item
  13368. Discard least significant bits of luma:
  13369. @example
  13370. lutyuv=y='bitand(val, 128+64+32)'
  13371. @end example
  13372. @item
  13373. Technicolor like effect:
  13374. @example
  13375. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  13376. @end example
  13377. @end itemize
  13378. @section lut2, tlut2
  13379. The @code{lut2} filter takes two input streams and outputs one
  13380. stream.
  13381. The @code{tlut2} (time lut2) filter takes two consecutive frames
  13382. from one single stream.
  13383. This filter accepts the following parameters:
  13384. @table @option
  13385. @item c0
  13386. set first pixel component expression
  13387. @item c1
  13388. set second pixel component expression
  13389. @item c2
  13390. set third pixel component expression
  13391. @item c3
  13392. set fourth pixel component expression, corresponds to the alpha component
  13393. @item d
  13394. set output bit depth, only available for @code{lut2} filter. By default is 0,
  13395. which means bit depth is automatically picked from first input format.
  13396. @end table
  13397. The @code{lut2} filter also supports the @ref{framesync} options.
  13398. Each of them specifies the expression to use for computing the lookup table for
  13399. the corresponding pixel component values.
  13400. The exact component associated to each of the @var{c*} options depends on the
  13401. format in inputs.
  13402. The expressions can contain the following constants:
  13403. @table @option
  13404. @item w
  13405. @item h
  13406. The input width and height.
  13407. @item x
  13408. The first input value for the pixel component.
  13409. @item y
  13410. The second input value for the pixel component.
  13411. @item bdx
  13412. The first input video bit depth.
  13413. @item bdy
  13414. The second input video bit depth.
  13415. @end table
  13416. All expressions default to "x".
  13417. @subsection Commands
  13418. This filter supports the all above options as @ref{commands} except option @code{d}.
  13419. @subsection Examples
  13420. @itemize
  13421. @item
  13422. Highlight differences between two RGB video streams:
  13423. @example
  13424. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  13425. @end example
  13426. @item
  13427. Highlight differences between two YUV video streams:
  13428. @example
  13429. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  13430. @end example
  13431. @item
  13432. Show max difference between two video streams:
  13433. @example
  13434. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  13435. @end example
  13436. @end itemize
  13437. @section maskedclamp
  13438. Clamp the first input stream with the second input and third input stream.
  13439. Returns the value of first stream to be between second input
  13440. stream - @code{undershoot} and third input stream + @code{overshoot}.
  13441. This filter accepts the following options:
  13442. @table @option
  13443. @item undershoot
  13444. Default value is @code{0}.
  13445. @item overshoot
  13446. Default value is @code{0}.
  13447. @item planes
  13448. Set which planes will be processed as bitmap, unprocessed planes will be
  13449. copied from first stream.
  13450. By default value 0xf, all planes will be processed.
  13451. @end table
  13452. @subsection Commands
  13453. This filter supports the all above options as @ref{commands}.
  13454. @section maskedmax
  13455. Merge the second and third input stream into output stream using absolute differences
  13456. between second input stream and first input stream and absolute difference between
  13457. third input stream and first input stream. The picked value will be from second input
  13458. stream if second absolute difference is greater than first one or from third input stream
  13459. otherwise.
  13460. This filter accepts the following options:
  13461. @table @option
  13462. @item planes
  13463. Set which planes will be processed as bitmap, unprocessed planes will be
  13464. copied from first stream.
  13465. By default value 0xf, all planes will be processed.
  13466. @end table
  13467. @subsection Commands
  13468. This filter supports the all above options as @ref{commands}.
  13469. @section maskedmerge
  13470. Merge the first input stream with the second input stream using per pixel
  13471. weights in the third input stream.
  13472. A value of 0 in the third stream pixel component means that pixel component
  13473. from first stream is returned unchanged, while maximum value (eg. 255 for
  13474. 8-bit videos) means that pixel component from second stream is returned
  13475. unchanged. Intermediate values define the amount of merging between both
  13476. input stream's pixel components.
  13477. This filter accepts the following options:
  13478. @table @option
  13479. @item planes
  13480. Set which planes will be processed as bitmap, unprocessed planes will be
  13481. copied from first stream.
  13482. By default value 0xf, all planes will be processed.
  13483. @end table
  13484. @subsection Commands
  13485. This filter supports the all above options as @ref{commands}.
  13486. @section maskedmin
  13487. Merge the second and third input stream into output stream using absolute differences
  13488. between second input stream and first input stream and absolute difference between
  13489. third input stream and first input stream. The picked value will be from second input
  13490. stream if second absolute difference is less than first one or from third input stream
  13491. otherwise.
  13492. This filter accepts the following options:
  13493. @table @option
  13494. @item planes
  13495. Set which planes will be processed as bitmap, unprocessed planes will be
  13496. copied from first stream.
  13497. By default value 0xf, all planes will be processed.
  13498. @end table
  13499. @subsection Commands
  13500. This filter supports the all above options as @ref{commands}.
  13501. @section maskedthreshold
  13502. Pick pixels comparing absolute difference of two video streams with fixed
  13503. threshold.
  13504. If absolute difference between pixel component of first and second video
  13505. stream is equal or lower than user supplied threshold than pixel component
  13506. from first video stream is picked, otherwise pixel component from second
  13507. video stream is picked.
  13508. This filter accepts the following options:
  13509. @table @option
  13510. @item threshold
  13511. Set threshold used when picking pixels from absolute difference from two input
  13512. video streams.
  13513. @item planes
  13514. Set which planes will be processed as bitmap, unprocessed planes will be
  13515. copied from second stream.
  13516. By default value 0xf, all planes will be processed.
  13517. @item mode
  13518. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  13519. Default is @code{abs}.
  13520. @end table
  13521. @subsection Commands
  13522. This filter supports the all above options as @ref{commands}.
  13523. @section maskfun
  13524. Create mask from input video.
  13525. For example it is useful to create motion masks after @code{tblend} filter.
  13526. This filter accepts the following options:
  13527. @table @option
  13528. @item low
  13529. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  13530. @item high
  13531. Set high threshold. Any pixel component higher than this value will be set to max value
  13532. allowed for current pixel format.
  13533. @item planes
  13534. Set planes to filter, by default all available planes are filtered.
  13535. @item fill
  13536. Fill all frame pixels with this value.
  13537. @item sum
  13538. Set max average pixel value for frame. If sum of all pixel components is higher that this
  13539. average, output frame will be completely filled with value set by @var{fill} option.
  13540. Typically useful for scene changes when used in combination with @code{tblend} filter.
  13541. @end table
  13542. @subsection Commands
  13543. This filter supports the all above options as @ref{commands}.
  13544. @section mcdeint
  13545. Apply motion-compensation deinterlacing.
  13546. It needs one field per frame as input and must thus be used together
  13547. with yadif=1/3 or equivalent.
  13548. This filter accepts the following options:
  13549. @table @option
  13550. @item mode
  13551. Set the deinterlacing mode.
  13552. It accepts one of the following values:
  13553. @table @samp
  13554. @item fast
  13555. @item medium
  13556. @item slow
  13557. use iterative motion estimation
  13558. @item extra_slow
  13559. like @samp{slow}, but use multiple reference frames.
  13560. @end table
  13561. Default value is @samp{fast}.
  13562. @item parity
  13563. Set the picture field parity assumed for the input video. It must be
  13564. one of the following values:
  13565. @table @samp
  13566. @item 0, tff
  13567. assume top field first
  13568. @item 1, bff
  13569. assume bottom field first
  13570. @end table
  13571. Default value is @samp{bff}.
  13572. @item qp
  13573. Set per-block quantization parameter (QP) used by the internal
  13574. encoder.
  13575. Higher values should result in a smoother motion vector field but less
  13576. optimal individual vectors. Default value is 1.
  13577. @end table
  13578. @section median
  13579. Pick median pixel from certain rectangle defined by radius.
  13580. This filter accepts the following options:
  13581. @table @option
  13582. @item radius
  13583. Set horizontal radius size. Default value is @code{1}.
  13584. Allowed range is integer from 1 to 127.
  13585. @item planes
  13586. Set which planes to process. Default is @code{15}, which is all available planes.
  13587. @item radiusV
  13588. Set vertical radius size. Default value is @code{0}.
  13589. Allowed range is integer from 0 to 127.
  13590. If it is 0, value will be picked from horizontal @code{radius} option.
  13591. @item percentile
  13592. Set median percentile. Default value is @code{0.5}.
  13593. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13594. minimum values, and @code{1} maximum values.
  13595. @end table
  13596. @subsection Commands
  13597. This filter supports same @ref{commands} as options.
  13598. The command accepts the same syntax of the corresponding option.
  13599. If the specified expression is not valid, it is kept at its current
  13600. value.
  13601. @section mergeplanes
  13602. Merge color channel components from several video streams.
  13603. The filter accepts up to 4 input streams, and merge selected input
  13604. planes to the output video.
  13605. This filter accepts the following options:
  13606. @table @option
  13607. @item mapping
  13608. Set input to output plane mapping. Default is @code{0}.
  13609. The mappings is specified as a bitmap. It should be specified as a
  13610. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13611. mapping for the first plane of the output stream. 'A' sets the number of
  13612. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13613. corresponding input to use (from 0 to 3). The rest of the mappings is
  13614. similar, 'Bb' describes the mapping for the output stream second
  13615. plane, 'Cc' describes the mapping for the output stream third plane and
  13616. 'Dd' describes the mapping for the output stream fourth plane.
  13617. @item format
  13618. Set output pixel format. Default is @code{yuva444p}.
  13619. @item map0s
  13620. @item map1s
  13621. @item map2s
  13622. @item map3s
  13623. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13624. @item map0p
  13625. @item map1p
  13626. @item map2p
  13627. @item map3p
  13628. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13629. @end table
  13630. @subsection Examples
  13631. @itemize
  13632. @item
  13633. Merge three gray video streams of same width and height into single video stream:
  13634. @example
  13635. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13636. @end example
  13637. @item
  13638. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13639. @example
  13640. [a0][a1]mergeplanes=0x00010210:yuva444p
  13641. @end example
  13642. @item
  13643. Swap Y and A plane in yuva444p stream:
  13644. @example
  13645. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13646. @end example
  13647. @item
  13648. Swap U and V plane in yuv420p stream:
  13649. @example
  13650. format=yuv420p,mergeplanes=0x000201:yuv420p
  13651. @end example
  13652. @item
  13653. Cast a rgb24 clip to yuv444p:
  13654. @example
  13655. format=rgb24,mergeplanes=0x000102:yuv444p
  13656. @end example
  13657. @end itemize
  13658. @section mestimate
  13659. Estimate and export motion vectors using block matching algorithms.
  13660. Motion vectors are stored in frame side data to be used by other filters.
  13661. This filter accepts the following options:
  13662. @table @option
  13663. @item method
  13664. Specify the motion estimation method. Accepts one of the following values:
  13665. @table @samp
  13666. @item esa
  13667. Exhaustive search algorithm.
  13668. @item tss
  13669. Three step search algorithm.
  13670. @item tdls
  13671. Two dimensional logarithmic search algorithm.
  13672. @item ntss
  13673. New three step search algorithm.
  13674. @item fss
  13675. Four step search algorithm.
  13676. @item ds
  13677. Diamond search algorithm.
  13678. @item hexbs
  13679. Hexagon-based search algorithm.
  13680. @item epzs
  13681. Enhanced predictive zonal search algorithm.
  13682. @item umh
  13683. Uneven multi-hexagon search algorithm.
  13684. @end table
  13685. Default value is @samp{esa}.
  13686. @item mb_size
  13687. Macroblock size. Default @code{16}.
  13688. @item search_param
  13689. Search parameter. Default @code{7}.
  13690. @end table
  13691. @section midequalizer
  13692. Apply Midway Image Equalization effect using two video streams.
  13693. Midway Image Equalization adjusts a pair of images to have the same
  13694. histogram, while maintaining their dynamics as much as possible. It's
  13695. useful for e.g. matching exposures from a pair of stereo cameras.
  13696. This filter has two inputs and one output, which must be of same pixel format, but
  13697. may be of different sizes. The output of filter is first input adjusted with
  13698. midway histogram of both inputs.
  13699. This filter accepts the following option:
  13700. @table @option
  13701. @item planes
  13702. Set which planes to process. Default is @code{15}, which is all available planes.
  13703. @end table
  13704. @section minterpolate
  13705. Convert the video to specified frame rate using motion interpolation.
  13706. This filter accepts the following options:
  13707. @table @option
  13708. @item fps
  13709. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  13710. @item mi_mode
  13711. Motion interpolation mode. Following values are accepted:
  13712. @table @samp
  13713. @item dup
  13714. Duplicate previous or next frame for interpolating new ones.
  13715. @item blend
  13716. Blend source frames. Interpolated frame is mean of previous and next frames.
  13717. @item mci
  13718. Motion compensated interpolation. Following options are effective when this mode is selected:
  13719. @table @samp
  13720. @item mc_mode
  13721. Motion compensation mode. Following values are accepted:
  13722. @table @samp
  13723. @item obmc
  13724. Overlapped block motion compensation.
  13725. @item aobmc
  13726. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13727. @end table
  13728. Default mode is @samp{obmc}.
  13729. @item me_mode
  13730. Motion estimation mode. Following values are accepted:
  13731. @table @samp
  13732. @item bidir
  13733. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13734. @item bilat
  13735. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13736. @end table
  13737. Default mode is @samp{bilat}.
  13738. @item me
  13739. The algorithm to be used for motion estimation. Following values are accepted:
  13740. @table @samp
  13741. @item esa
  13742. Exhaustive search algorithm.
  13743. @item tss
  13744. Three step search algorithm.
  13745. @item tdls
  13746. Two dimensional logarithmic search algorithm.
  13747. @item ntss
  13748. New three step search algorithm.
  13749. @item fss
  13750. Four step search algorithm.
  13751. @item ds
  13752. Diamond search algorithm.
  13753. @item hexbs
  13754. Hexagon-based search algorithm.
  13755. @item epzs
  13756. Enhanced predictive zonal search algorithm.
  13757. @item umh
  13758. Uneven multi-hexagon search algorithm.
  13759. @end table
  13760. Default algorithm is @samp{epzs}.
  13761. @item mb_size
  13762. Macroblock size. Default @code{16}.
  13763. @item search_param
  13764. Motion estimation search parameter. Default @code{32}.
  13765. @item vsbmc
  13766. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make them less blurry. Default is @code{0} (disabled).
  13767. @end table
  13768. @end table
  13769. @item scd
  13770. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  13771. @table @samp
  13772. @item none
  13773. Disable scene change detection.
  13774. @item fdiff
  13775. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13776. @end table
  13777. Default method is @samp{fdiff}.
  13778. @item scd_threshold
  13779. Scene change detection threshold. Default is @code{10.}.
  13780. @end table
  13781. @section mix
  13782. Mix several video input streams into one video stream.
  13783. A description of the accepted options follows.
  13784. @table @option
  13785. @item inputs
  13786. The number of inputs. If unspecified, it defaults to 2.
  13787. @item weights
  13788. Specify weight of each input video stream as sequence.
  13789. Each weight is separated by space. If number of weights
  13790. is smaller than number of @var{frames} last specified
  13791. weight will be used for all remaining unset weights.
  13792. @item scale
  13793. Specify scale, if it is set it will be multiplied with sum
  13794. of each weight multiplied with pixel values to give final destination
  13795. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13796. @item planes
  13797. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13798. @item duration
  13799. Specify how end of stream is determined.
  13800. @table @samp
  13801. @item longest
  13802. The duration of the longest input. (default)
  13803. @item shortest
  13804. The duration of the shortest input.
  13805. @item first
  13806. The duration of the first input.
  13807. @end table
  13808. @end table
  13809. @subsection Commands
  13810. This filter supports the following commands:
  13811. @table @option
  13812. @item weights
  13813. @item scale
  13814. @item planes
  13815. Syntax is same as option with same name.
  13816. @end table
  13817. @section monochrome
  13818. Convert video to gray using custom color filter.
  13819. A description of the accepted options follows.
  13820. @table @option
  13821. @item cb
  13822. Set the chroma blue spot. Allowed range is from -1 to 1.
  13823. Default value is 0.
  13824. @item cr
  13825. Set the chroma red spot. Allowed range is from -1 to 1.
  13826. Default value is 0.
  13827. @item size
  13828. Set the color filter size. Allowed range is from .1 to 10.
  13829. Default value is 1.
  13830. @item high
  13831. Set the highlights strength. Allowed range is from 0 to 1.
  13832. Default value is 0.
  13833. @end table
  13834. @subsection Commands
  13835. This filter supports the all above options as @ref{commands}.
  13836. @section morpho
  13837. This filter allows to apply main morphological grayscale transforms,
  13838. erode and dilate with arbitrary structures set in second input stream.
  13839. Unlike naive implementation and much slower performance in @ref{erosion}
  13840. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13841. should be used instead.
  13842. A description of accepted options follows,
  13843. @table @option
  13844. @item mode
  13845. Set morphological transform to apply, can be:
  13846. @table @samp
  13847. @item erode
  13848. @item dilate
  13849. @item open
  13850. @item close
  13851. @item gradient
  13852. @item tophat
  13853. @item blackhat
  13854. @end table
  13855. Default is @code{erode}.
  13856. @item planes
  13857. Set planes to filter, by default all planes except alpha are filtered.
  13858. @item structure
  13859. Set which structure video frames will be processed from second input stream,
  13860. can be @var{first} or @var{all}. Default is @var{all}.
  13861. @end table
  13862. The @code{morpho} filter also supports the @ref{framesync} options.
  13863. @subsection Commands
  13864. This filter supports same @ref{commands} as options.
  13865. @section mpdecimate
  13866. Drop frames that do not differ greatly from the previous frame in
  13867. order to reduce frame rate.
  13868. The main use of this filter is for very-low-bitrate encoding
  13869. (e.g. streaming over dialup modem), but it could in theory be used for
  13870. fixing movies that were inverse-telecined incorrectly.
  13871. A description of the accepted options follows.
  13872. @table @option
  13873. @item max
  13874. Set the maximum number of consecutive frames which can be dropped (if
  13875. positive), or the minimum interval between dropped frames (if
  13876. negative). If the value is 0, the frame is dropped disregarding the
  13877. number of previous sequentially dropped frames.
  13878. Default value is 0.
  13879. @item keep
  13880. Set the maximum number of consecutive similar frames to ignore before to start dropping them.
  13881. If the value is 0, the frame is dropped disregarding the
  13882. number of previous sequentially similar frames.
  13883. Default value is 0.
  13884. @item hi
  13885. @item lo
  13886. @item frac
  13887. Set the dropping threshold values.
  13888. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13889. represent actual pixel value differences, so a threshold of 64
  13890. corresponds to 1 unit of difference for each pixel, or the same spread
  13891. out differently over the block.
  13892. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13893. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13894. meaning the whole image) differ by more than a threshold of @option{lo}.
  13895. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13896. 64*5, and default value for @option{frac} is 0.33.
  13897. @end table
  13898. @section msad
  13899. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13900. This filter takes two input videos.
  13901. Both input videos must have the same resolution and pixel format for
  13902. this filter to work correctly. Also it assumes that both inputs
  13903. have the same number of frames, which are compared one by one.
  13904. The obtained per component, average, min and max MSAD is printed through
  13905. the logging system.
  13906. The filter stores the calculated MSAD of each frame in frame metadata.
  13907. This filter also supports the @ref{framesync} options.
  13908. In the below example the input file @file{main.mpg} being processed is compared
  13909. with the reference file @file{ref.mpg}.
  13910. @example
  13911. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13912. @end example
  13913. @section multiply
  13914. Multiply first video stream pixels values with second video stream pixels values.
  13915. The filter accepts the following options:
  13916. @table @option
  13917. @item scale
  13918. Set the scale applied to second video stream. By default is @code{1}.
  13919. Allowed range is from @code{0} to @code{9}.
  13920. @item offset
  13921. Set the offset applied to second video stream. By default is @code{0.5}.
  13922. Allowed range is from @code{-1} to @code{1}.
  13923. @item planes
  13924. Specify planes from input video stream that will be processed.
  13925. By default all planes are processed.
  13926. @end table
  13927. @subsection Commands
  13928. This filter supports same @ref{commands} as options.
  13929. @section negate
  13930. Negate (invert) the input video.
  13931. It accepts the following option:
  13932. @table @option
  13933. @item components
  13934. Set components to negate.
  13935. Available values for components are:
  13936. @table @samp
  13937. @item y
  13938. @item u
  13939. @item v
  13940. @item a
  13941. @item r
  13942. @item g
  13943. @item b
  13944. @end table
  13945. @item negate_alpha
  13946. With value 1, it negates the alpha component, if present. Default value is 0.
  13947. @end table
  13948. @subsection Commands
  13949. This filter supports same @ref{commands} as options.
  13950. @anchor{nlmeans}
  13951. @section nlmeans
  13952. Denoise frames using Non-Local Means algorithm.
  13953. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13954. context similarity is defined by comparing their surrounding patches of size
  13955. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13956. around the pixel.
  13957. Note that the research area defines centers for patches, which means some
  13958. patches will be made of pixels outside that research area.
  13959. The filter accepts the following options.
  13960. @table @option
  13961. @item s
  13962. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13963. @item p
  13964. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13965. @item pc
  13966. Same as @option{p} but for chroma planes.
  13967. The default value is @var{0} and means automatic.
  13968. @item r
  13969. Set research size. Default is 15. Must be odd number in range [0, 99].
  13970. @item rc
  13971. Same as @option{r} but for chroma planes.
  13972. The default value is @var{0} and means automatic.
  13973. @end table
  13974. @section nnedi
  13975. Deinterlace video using neural network edge directed interpolation.
  13976. This filter accepts the following options:
  13977. @table @option
  13978. @item weights
  13979. Mandatory option, without binary file filter can not work.
  13980. Currently file can be found here:
  13981. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13982. @item deint
  13983. Set which frames to deinterlace, by default it is @code{all}.
  13984. Can be @code{all} or @code{interlaced}.
  13985. @item field
  13986. Set mode of operation.
  13987. Can be one of the following:
  13988. @table @samp
  13989. @item af
  13990. Use frame flags, both fields.
  13991. @item a
  13992. Use frame flags, single field.
  13993. @item t
  13994. Use top field only.
  13995. @item b
  13996. Use bottom field only.
  13997. @item tf
  13998. Use both fields, top first.
  13999. @item bf
  14000. Use both fields, bottom first.
  14001. @end table
  14002. @item planes
  14003. Set which planes to process, by default filter process all frames.
  14004. @item nsize
  14005. Set size of local neighborhood around each pixel, used by the predictor neural
  14006. network.
  14007. Can be one of the following:
  14008. @table @samp
  14009. @item s8x6
  14010. @item s16x6
  14011. @item s32x6
  14012. @item s48x6
  14013. @item s8x4
  14014. @item s16x4
  14015. @item s32x4
  14016. @end table
  14017. @item nns
  14018. Set the number of neurons in predictor neural network.
  14019. Can be one of the following:
  14020. @table @samp
  14021. @item n16
  14022. @item n32
  14023. @item n64
  14024. @item n128
  14025. @item n256
  14026. @end table
  14027. @item qual
  14028. Controls the number of different neural network predictions that are blended
  14029. together to compute the final output value. Can be @code{fast}, default or
  14030. @code{slow}.
  14031. @item etype
  14032. Set which set of weights to use in the predictor.
  14033. Can be one of the following:
  14034. @table @samp
  14035. @item a, abs
  14036. weights trained to minimize absolute error
  14037. @item s, mse
  14038. weights trained to minimize squared error
  14039. @end table
  14040. @item pscrn
  14041. Controls whether or not the prescreener neural network is used to decide
  14042. which pixels should be processed by the predictor neural network and which
  14043. can be handled by simple cubic interpolation.
  14044. The prescreener is trained to know whether cubic interpolation will be
  14045. sufficient for a pixel or whether it should be predicted by the predictor nn.
  14046. The computational complexity of the prescreener nn is much less than that of
  14047. the predictor nn. Since most pixels can be handled by cubic interpolation,
  14048. using the prescreener generally results in much faster processing.
  14049. The prescreener is pretty accurate, so the difference between using it and not
  14050. using it is almost always unnoticeable.
  14051. Can be one of the following:
  14052. @table @samp
  14053. @item none
  14054. @item original
  14055. @item new
  14056. @item new2
  14057. @item new3
  14058. @end table
  14059. Default is @code{new}.
  14060. @end table
  14061. @subsection Commands
  14062. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  14063. @section noformat
  14064. Force libavfilter not to use any of the specified pixel formats for the
  14065. input to the next filter.
  14066. It accepts the following parameters:
  14067. @table @option
  14068. @item pix_fmts
  14069. A '|'-separated list of pixel format names, such as
  14070. pix_fmts=yuv420p|monow|rgb24".
  14071. @end table
  14072. @subsection Examples
  14073. @itemize
  14074. @item
  14075. Force libavfilter to use a format different from @var{yuv420p} for the
  14076. input to the vflip filter:
  14077. @example
  14078. noformat=pix_fmts=yuv420p,vflip
  14079. @end example
  14080. @item
  14081. Convert the input video to any of the formats not contained in the list:
  14082. @example
  14083. noformat=yuv420p|yuv444p|yuv410p
  14084. @end example
  14085. @end itemize
  14086. @section noise
  14087. Add noise on video input frame.
  14088. The filter accepts the following options:
  14089. @table @option
  14090. @item all_seed
  14091. @item c0_seed
  14092. @item c1_seed
  14093. @item c2_seed
  14094. @item c3_seed
  14095. Set noise seed for specific pixel component or all pixel components in case
  14096. of @var{all_seed}. Default value is @code{123457}.
  14097. @item all_strength, alls
  14098. @item c0_strength, c0s
  14099. @item c1_strength, c1s
  14100. @item c2_strength, c2s
  14101. @item c3_strength, c3s
  14102. Set noise strength for specific pixel component or all pixel components in case
  14103. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  14104. @item all_flags, allf
  14105. @item c0_flags, c0f
  14106. @item c1_flags, c1f
  14107. @item c2_flags, c2f
  14108. @item c3_flags, c3f
  14109. Set pixel component flags or set flags for all components if @var{all_flags}.
  14110. Available values for component flags are:
  14111. @table @samp
  14112. @item a
  14113. averaged temporal noise (smoother)
  14114. @item p
  14115. mix random noise with a (semi)regular pattern
  14116. @item t
  14117. temporal noise (noise pattern changes between frames)
  14118. @item u
  14119. uniform noise (gaussian otherwise)
  14120. @end table
  14121. @end table
  14122. @subsection Examples
  14123. Add temporal and uniform noise to input video:
  14124. @example
  14125. noise=alls=20:allf=t+u
  14126. @end example
  14127. @section normalize
  14128. Normalize RGB video (aka histogram stretching, contrast stretching).
  14129. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  14130. For each channel of each frame, the filter computes the input range and maps
  14131. it linearly to the user-specified output range. The output range defaults
  14132. to the full dynamic range from pure black to pure white.
  14133. Temporal smoothing can be used on the input range to reduce flickering (rapid
  14134. changes in brightness) caused when small dark or bright objects enter or leave
  14135. the scene. This is similar to the auto-exposure (automatic gain control) on a
  14136. video camera, and, like a video camera, it may cause a period of over- or
  14137. under-exposure of the video.
  14138. The R,G,B channels can be normalized independently, which may cause some
  14139. color shifting, or linked together as a single channel, which prevents
  14140. color shifting. Linked normalization preserves hue. Independent normalization
  14141. does not, so it can be used to remove some color casts. Independent and linked
  14142. normalization can be combined in any ratio.
  14143. The normalize filter accepts the following options:
  14144. @table @option
  14145. @item blackpt
  14146. @item whitept
  14147. Colors which define the output range. The minimum input value is mapped to
  14148. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  14149. The defaults are black and white respectively. Specifying white for
  14150. @var{blackpt} and black for @var{whitept} will give color-inverted,
  14151. normalized video. Shades of grey can be used to reduce the dynamic range
  14152. (contrast). Specifying saturated colors here can create some interesting
  14153. effects.
  14154. @item smoothing
  14155. The number of previous frames to use for temporal smoothing. The input range
  14156. of each channel is smoothed using a rolling average over the current frame
  14157. and the @var{smoothing} previous frames. The default is 0 (no temporal
  14158. smoothing).
  14159. @item independence
  14160. Controls the ratio of independent (color shifting) channel normalization to
  14161. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  14162. independent. Defaults to 1.0 (fully independent).
  14163. @item strength
  14164. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  14165. expensive no-op. Defaults to 1.0 (full strength).
  14166. @end table
  14167. @subsection Commands
  14168. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  14169. The command accepts the same syntax of the corresponding option.
  14170. If the specified expression is not valid, it is kept at its current
  14171. value.
  14172. @subsection Examples
  14173. Stretch video contrast to use the full dynamic range, with no temporal
  14174. smoothing; may flicker depending on the source content:
  14175. @example
  14176. normalize=blackpt=black:whitept=white:smoothing=0
  14177. @end example
  14178. As above, but with 50 frames of temporal smoothing; flicker should be
  14179. reduced, depending on the source content:
  14180. @example
  14181. normalize=blackpt=black:whitept=white:smoothing=50
  14182. @end example
  14183. As above, but with hue-preserving linked channel normalization:
  14184. @example
  14185. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  14186. @end example
  14187. As above, but with half strength:
  14188. @example
  14189. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  14190. @end example
  14191. Map the darkest input color to red, the brightest input color to cyan:
  14192. @example
  14193. normalize=blackpt=red:whitept=cyan
  14194. @end example
  14195. @section null
  14196. Pass the video source unchanged to the output.
  14197. @section ocr
  14198. Optical Character Recognition
  14199. This filter uses Tesseract for optical character recognition. To enable
  14200. compilation of this filter, you need to configure FFmpeg with
  14201. @code{--enable-libtesseract}.
  14202. It accepts the following options:
  14203. @table @option
  14204. @item datapath
  14205. Set datapath to tesseract data. Default is to use whatever was
  14206. set at installation.
  14207. @item language
  14208. Set language, default is "eng".
  14209. @item whitelist
  14210. Set character whitelist.
  14211. @item blacklist
  14212. Set character blacklist.
  14213. @end table
  14214. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  14215. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  14216. @section ocv
  14217. Apply a video transform using libopencv.
  14218. To enable this filter, install the libopencv library and headers and
  14219. configure FFmpeg with @code{--enable-libopencv}.
  14220. It accepts the following parameters:
  14221. @table @option
  14222. @item filter_name
  14223. The name of the libopencv filter to apply.
  14224. @item filter_params
  14225. The parameters to pass to the libopencv filter. If not specified, the default
  14226. values are assumed.
  14227. @end table
  14228. Refer to the official libopencv documentation for more precise
  14229. information:
  14230. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  14231. Several libopencv filters are supported; see the following subsections.
  14232. @anchor{dilate}
  14233. @subsection dilate
  14234. Dilate an image by using a specific structuring element.
  14235. It corresponds to the libopencv function @code{cvDilate}.
  14236. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  14237. @var{struct_el} represents a structuring element, and has the syntax:
  14238. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  14239. @var{cols} and @var{rows} represent the number of columns and rows of
  14240. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  14241. point, and @var{shape} the shape for the structuring element. @var{shape}
  14242. must be "rect", "cross", "ellipse", or "custom".
  14243. If the value for @var{shape} is "custom", it must be followed by a
  14244. string of the form "=@var{filename}". The file with name
  14245. @var{filename} is assumed to represent a binary image, with each
  14246. printable character corresponding to a bright pixel. When a custom
  14247. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  14248. or columns and rows of the read file are assumed instead.
  14249. The default value for @var{struct_el} is "3x3+0x0/rect".
  14250. @var{nb_iterations} specifies the number of times the transform is
  14251. applied to the image, and defaults to 1.
  14252. Some examples:
  14253. @example
  14254. # Use the default values
  14255. ocv=dilate
  14256. # Dilate using a structuring element with a 5x5 cross, iterating two times
  14257. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  14258. # Read the shape from the file diamond.shape, iterating two times.
  14259. # The file diamond.shape may contain a pattern of characters like this
  14260. # *
  14261. # ***
  14262. # *****
  14263. # ***
  14264. # *
  14265. # The specified columns and rows are ignored
  14266. # but the anchor point coordinates are not
  14267. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  14268. @end example
  14269. @subsection erode
  14270. Erode an image by using a specific structuring element.
  14271. It corresponds to the libopencv function @code{cvErode}.
  14272. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  14273. with the same syntax and semantics as the @ref{dilate} filter.
  14274. @subsection smooth
  14275. Smooth the input video.
  14276. The filter takes the following parameters:
  14277. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  14278. @var{type} is the type of smooth filter to apply, and must be one of
  14279. the following values: "blur", "blur_no_scale", "median", "gaussian",
  14280. or "bilateral". The default value is "gaussian".
  14281. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  14282. depends on the smooth type. @var{param1} and
  14283. @var{param2} accept integer positive values or 0. @var{param3} and
  14284. @var{param4} accept floating point values.
  14285. The default value for @var{param1} is 3. The default value for the
  14286. other parameters is 0.
  14287. These parameters correspond to the parameters assigned to the
  14288. libopencv function @code{cvSmooth}.
  14289. @section oscilloscope
  14290. 2D Video Oscilloscope.
  14291. Useful to measure spatial impulse, step responses, chroma delays, etc.
  14292. It accepts the following parameters:
  14293. @table @option
  14294. @item x
  14295. Set scope center x position.
  14296. @item y
  14297. Set scope center y position.
  14298. @item s
  14299. Set scope size, relative to frame diagonal.
  14300. @item t
  14301. Set scope tilt/rotation.
  14302. @item o
  14303. Set trace opacity.
  14304. @item tx
  14305. Set trace center x position.
  14306. @item ty
  14307. Set trace center y position.
  14308. @item tw
  14309. Set trace width, relative to width of frame.
  14310. @item th
  14311. Set trace height, relative to height of frame.
  14312. @item c
  14313. Set which components to trace. By default it traces first three components.
  14314. @item g
  14315. Draw trace grid. By default is enabled.
  14316. @item st
  14317. Draw some statistics. By default is enabled.
  14318. @item sc
  14319. Draw scope. By default is enabled.
  14320. @end table
  14321. @subsection Commands
  14322. This filter supports same @ref{commands} as options.
  14323. The command accepts the same syntax of the corresponding option.
  14324. If the specified expression is not valid, it is kept at its current
  14325. value.
  14326. @subsection Examples
  14327. @itemize
  14328. @item
  14329. Inspect full first row of video frame.
  14330. @example
  14331. oscilloscope=x=0.5:y=0:s=1
  14332. @end example
  14333. @item
  14334. Inspect full last row of video frame.
  14335. @example
  14336. oscilloscope=x=0.5:y=1:s=1
  14337. @end example
  14338. @item
  14339. Inspect full 5th line of video frame of height 1080.
  14340. @example
  14341. oscilloscope=x=0.5:y=5/1080:s=1
  14342. @end example
  14343. @item
  14344. Inspect full last column of video frame.
  14345. @example
  14346. oscilloscope=x=1:y=0.5:s=1:t=1
  14347. @end example
  14348. @end itemize
  14349. @anchor{overlay}
  14350. @section overlay
  14351. Overlay one video on top of another.
  14352. It takes two inputs and has one output. The first input is the "main"
  14353. video on which the second input is overlaid.
  14354. It accepts the following parameters:
  14355. A description of the accepted options follows.
  14356. @table @option
  14357. @item x
  14358. @item y
  14359. Set the expression for the x and y coordinates of the overlaid video
  14360. on the main video. Default value is "0" for both expressions. In case
  14361. the expression is invalid, it is set to a huge value (meaning that the
  14362. overlay will not be displayed within the output visible area).
  14363. @item eof_action
  14364. See @ref{framesync}.
  14365. @item eval
  14366. Set when the expressions for @option{x}, and @option{y} are evaluated.
  14367. It accepts the following values:
  14368. @table @samp
  14369. @item init
  14370. only evaluate expressions once during the filter initialization or
  14371. when a command is processed
  14372. @item frame
  14373. evaluate expressions for each incoming frame
  14374. @end table
  14375. Default value is @samp{frame}.
  14376. @item shortest
  14377. See @ref{framesync}.
  14378. @item format
  14379. Set the format for the output video.
  14380. It accepts the following values:
  14381. @table @samp
  14382. @item yuv420
  14383. force YUV 4:2:0 8-bit planar output
  14384. @item yuv420p10
  14385. force YUV 4:2:0 10-bit planar output
  14386. @item yuv422
  14387. force YUV 4:2:2 8-bit planar output
  14388. @item yuv422p10
  14389. force YUV 4:2:2 10-bit planar output
  14390. @item yuv444
  14391. force YUV 4:4:4 8-bit planar output
  14392. @item yuv444p10
  14393. force YUV 4:4:4 10-bit planar output
  14394. @item rgb
  14395. force RGB 8-bit packed output
  14396. @item gbrp
  14397. force RGB 8-bit planar output
  14398. @item auto
  14399. automatically pick format
  14400. @end table
  14401. Default value is @samp{yuv420}.
  14402. @item repeatlast
  14403. See @ref{framesync}.
  14404. @item alpha
  14405. Set format of alpha of the overlaid video, it can be @var{straight} or
  14406. @var{premultiplied}. Default is @var{straight}.
  14407. @end table
  14408. The @option{x}, and @option{y} expressions can contain the following
  14409. parameters.
  14410. @table @option
  14411. @item main_w, W
  14412. @item main_h, H
  14413. The main input width and height.
  14414. @item overlay_w, w
  14415. @item overlay_h, h
  14416. The overlay input width and height.
  14417. @item x
  14418. @item y
  14419. The computed values for @var{x} and @var{y}. They are evaluated for
  14420. each new frame.
  14421. @item hsub
  14422. @item vsub
  14423. horizontal and vertical chroma subsample values of the output
  14424. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  14425. @var{vsub} is 1.
  14426. @item n
  14427. the number of input frame, starting from 0
  14428. @item pos
  14429. the position in the file of the input frame, NAN if unknown; deprecated,
  14430. do not use
  14431. @item t
  14432. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  14433. @end table
  14434. This filter also supports the @ref{framesync} options.
  14435. Note that the @var{n}, @var{t} variables are available only
  14436. when evaluation is done @emph{per frame}, and will evaluate to NAN
  14437. when @option{eval} is set to @samp{init}.
  14438. Be aware that frames are taken from each input video in timestamp
  14439. order, hence, if their initial timestamps differ, it is a good idea
  14440. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  14441. have them begin in the same zero timestamp, as the example for
  14442. the @var{movie} filter does.
  14443. You can chain together more overlays but you should test the
  14444. efficiency of such approach.
  14445. @subsection Commands
  14446. This filter supports the following commands:
  14447. @table @option
  14448. @item x
  14449. @item y
  14450. Modify the x and y of the overlay input.
  14451. The command accepts the same syntax of the corresponding option.
  14452. If the specified expression is not valid, it is kept at its current
  14453. value.
  14454. @end table
  14455. @subsection Examples
  14456. @itemize
  14457. @item
  14458. Draw the overlay at 10 pixels from the bottom right corner of the main
  14459. video:
  14460. @example
  14461. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  14462. @end example
  14463. Using named options the example above becomes:
  14464. @example
  14465. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  14466. @end example
  14467. @item
  14468. Insert a transparent PNG logo in the bottom left corner of the input,
  14469. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  14470. @example
  14471. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  14472. @end example
  14473. @item
  14474. Insert 2 different transparent PNG logos (second logo on bottom
  14475. right corner) using the @command{ffmpeg} tool:
  14476. @example
  14477. 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
  14478. @end example
  14479. @item
  14480. Add a transparent color layer on top of the main video; @code{WxH}
  14481. must specify the size of the main input to the overlay filter:
  14482. @example
  14483. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  14484. @end example
  14485. @item
  14486. Play an original video and a filtered version (here with the deshake
  14487. filter) side by side using the @command{ffplay} tool:
  14488. @example
  14489. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  14490. @end example
  14491. The above command is the same as:
  14492. @example
  14493. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  14494. @end example
  14495. @item
  14496. Make a sliding overlay appearing from the left to the right top part of the
  14497. screen starting since time 2:
  14498. @example
  14499. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  14500. @end example
  14501. @item
  14502. Compose output by putting two input videos side to side:
  14503. @example
  14504. ffmpeg -i left.avi -i right.avi -filter_complex "
  14505. nullsrc=size=200x100 [background];
  14506. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  14507. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  14508. [background][left] overlay=shortest=1 [background+left];
  14509. [background+left][right] overlay=shortest=1:x=100 [left+right]
  14510. "
  14511. @end example
  14512. @item
  14513. Mask 10-20 seconds of a video by applying the delogo filter to a section
  14514. @example
  14515. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  14516. -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
  14517. masked.avi
  14518. @end example
  14519. @item
  14520. Chain several overlays in cascade:
  14521. @example
  14522. nullsrc=s=200x200 [bg];
  14523. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  14524. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  14525. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  14526. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  14527. [in3] null, [mid2] overlay=100:100 [out0]
  14528. @end example
  14529. @end itemize
  14530. @anchor{overlay_cuda}
  14531. @section overlay_cuda
  14532. Overlay one video on top of another.
  14533. This is the CUDA variant of the @ref{overlay} filter.
  14534. It only accepts CUDA frames. The underlying input pixel formats have to match.
  14535. It takes two inputs and has one output. The first input is the "main"
  14536. video on which the second input is overlaid.
  14537. It accepts the following parameters:
  14538. @table @option
  14539. @item x
  14540. @item y
  14541. Set expressions for the x and y coordinates of the overlaid video
  14542. on the main video.
  14543. They can contain the following parameters:
  14544. @table @option
  14545. @item main_w, W
  14546. @item main_h, H
  14547. The main input width and height.
  14548. @item overlay_w, w
  14549. @item overlay_h, h
  14550. The overlay input width and height.
  14551. @item x
  14552. @item y
  14553. The computed values for @var{x} and @var{y}. They are evaluated for
  14554. each new frame.
  14555. @item n
  14556. The ordinal index of the main input frame, starting from 0.
  14557. @item pos
  14558. The byte offset position in the file of the main input frame, NAN if unknown.
  14559. Deprecated, do not use.
  14560. @item t
  14561. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  14562. @end table
  14563. Default value is "0" for both expressions.
  14564. @item eval
  14565. Set when the expressions for @option{x} and @option{y} are evaluated.
  14566. It accepts the following values:
  14567. @table @option
  14568. @item init
  14569. Evaluate expressions once during filter initialization or
  14570. when a command is processed.
  14571. @item frame
  14572. Evaluate expressions for each incoming frame
  14573. @end table
  14574. Default value is @option{frame}.
  14575. @item eof_action
  14576. See @ref{framesync}.
  14577. @item shortest
  14578. See @ref{framesync}.
  14579. @item repeatlast
  14580. See @ref{framesync}.
  14581. @end table
  14582. This filter also supports the @ref{framesync} options.
  14583. @section owdenoise
  14584. Apply Overcomplete Wavelet denoiser.
  14585. The filter accepts the following options:
  14586. @table @option
  14587. @item depth
  14588. Set depth.
  14589. Larger depth values will denoise lower frequency components more, but
  14590. slow down filtering.
  14591. Must be an int in the range 8-16, default is @code{8}.
  14592. @item luma_strength, ls
  14593. Set luma strength.
  14594. Must be a double value in the range 0-1000, default is @code{1.0}.
  14595. @item chroma_strength, cs
  14596. Set chroma strength.
  14597. Must be a double value in the range 0-1000, default is @code{1.0}.
  14598. @end table
  14599. @anchor{pad}
  14600. @section pad
  14601. Add paddings to the input image, and place the original input at the
  14602. provided @var{x}, @var{y} coordinates.
  14603. It accepts the following parameters:
  14604. @table @option
  14605. @item width, w
  14606. @item height, h
  14607. Specify an expression for the size of the output image with the
  14608. paddings added. If the value for @var{width} or @var{height} is 0, the
  14609. corresponding input size is used for the output.
  14610. The @var{width} expression can reference the value set by the
  14611. @var{height} expression, and vice versa.
  14612. The default value of @var{width} and @var{height} is 0.
  14613. @item x
  14614. @item y
  14615. Specify the offsets to place the input image at within the padded area,
  14616. with respect to the top/left border of the output image.
  14617. The @var{x} expression can reference the value set by the @var{y}
  14618. expression, and vice versa.
  14619. The default value of @var{x} and @var{y} is 0.
  14620. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14621. so the input image is centered on the padded area.
  14622. @item color
  14623. Specify the color of the padded area. For the syntax of this option,
  14624. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14625. manual,ffmpeg-utils}.
  14626. The default value of @var{color} is "black".
  14627. @item eval
  14628. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14629. It accepts the following values:
  14630. @table @samp
  14631. @item init
  14632. Only evaluate expressions once during the filter initialization or when
  14633. a command is processed.
  14634. @item frame
  14635. Evaluate expressions for each incoming frame.
  14636. @end table
  14637. Default value is @samp{init}.
  14638. @item aspect
  14639. Pad to aspect instead to a resolution.
  14640. @end table
  14641. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14642. options are expressions containing the following constants:
  14643. @table @option
  14644. @item in_w
  14645. @item in_h
  14646. The input video width and height.
  14647. @item iw
  14648. @item ih
  14649. These are the same as @var{in_w} and @var{in_h}.
  14650. @item out_w
  14651. @item out_h
  14652. The output width and height (the size of the padded area), as
  14653. specified by the @var{width} and @var{height} expressions.
  14654. @item ow
  14655. @item oh
  14656. These are the same as @var{out_w} and @var{out_h}.
  14657. @item x
  14658. @item y
  14659. The x and y offsets as specified by the @var{x} and @var{y}
  14660. expressions, or NAN if not yet specified.
  14661. @item a
  14662. same as @var{iw} / @var{ih}
  14663. @item sar
  14664. input sample aspect ratio
  14665. @item dar
  14666. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14667. @item hsub
  14668. @item vsub
  14669. The horizontal and vertical chroma subsample values. For example for the
  14670. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14671. @end table
  14672. @subsection Examples
  14673. @itemize
  14674. @item
  14675. Add paddings with the color "violet" to the input video. The output video
  14676. size is 640x480, and the top-left corner of the input video is placed at
  14677. column 0, row 40
  14678. @example
  14679. pad=640:480:0:40:violet
  14680. @end example
  14681. The example above is equivalent to the following command:
  14682. @example
  14683. pad=width=640:height=480:x=0:y=40:color=violet
  14684. @end example
  14685. @item
  14686. Pad the input to get an output with dimensions increased by 3/2,
  14687. and put the input video at the center of the padded area:
  14688. @example
  14689. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14690. @end example
  14691. @item
  14692. Pad the input to get a squared output with size equal to the maximum
  14693. value between the input width and height, and put the input video at
  14694. the center of the padded area:
  14695. @example
  14696. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14697. @end example
  14698. @item
  14699. Pad the input to get a final w/h ratio of 16:9:
  14700. @example
  14701. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14702. @end example
  14703. @item
  14704. In case of anamorphic video, in order to set the output display aspect
  14705. correctly, it is necessary to use @var{sar} in the expression,
  14706. according to the relation:
  14707. @example
  14708. (ih * X / ih) * sar = output_dar
  14709. X = output_dar / sar
  14710. @end example
  14711. Thus the previous example needs to be modified to:
  14712. @example
  14713. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14714. @end example
  14715. @item
  14716. Double the output size and put the input video in the bottom-right
  14717. corner of the output padded area:
  14718. @example
  14719. pad="2*iw:2*ih:ow-iw:oh-ih"
  14720. @end example
  14721. @end itemize
  14722. @anchor{palettegen}
  14723. @section palettegen
  14724. Generate one palette for a whole video stream.
  14725. It accepts the following options:
  14726. @table @option
  14727. @item max_colors
  14728. Set the maximum number of colors to quantize in the palette.
  14729. Note: the palette will still contain 256 colors; the unused palette entries
  14730. will be black.
  14731. @item reserve_transparent
  14732. Create a palette of 255 colors maximum and reserve the last one for
  14733. transparency. Reserving the transparency color is useful for GIF optimization.
  14734. If not set, the maximum of colors in the palette will be 256. You probably want
  14735. to disable this option for a standalone image.
  14736. Set by default.
  14737. @item transparency_color
  14738. Set the color that will be used as background for transparency.
  14739. @item stats_mode
  14740. Set statistics mode.
  14741. It accepts the following values:
  14742. @table @samp
  14743. @item full
  14744. Compute full frame histograms.
  14745. @item diff
  14746. Compute histograms only for the part that differs from previous frame. This
  14747. might be relevant to give more importance to the moving part of your input if
  14748. the background is static.
  14749. @item single
  14750. Compute new histogram for each frame.
  14751. @end table
  14752. Default value is @var{full}.
  14753. @end table
  14754. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14755. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14756. color quantization of the palette. This information is also visible at
  14757. @var{info} logging level.
  14758. @subsection Examples
  14759. @itemize
  14760. @item
  14761. Generate a representative palette of a given video using @command{ffmpeg}:
  14762. @example
  14763. ffmpeg -i input.mkv -vf palettegen palette.png
  14764. @end example
  14765. @end itemize
  14766. @section paletteuse
  14767. Use a palette to downsample an input video stream.
  14768. The filter takes two inputs: one video stream and a palette. The palette must
  14769. be a 256 pixels image.
  14770. It accepts the following options:
  14771. @table @option
  14772. @item dither
  14773. Select dithering mode. Available algorithms are:
  14774. @table @samp
  14775. @item bayer
  14776. Ordered 8x8 bayer dithering (deterministic)
  14777. @item heckbert
  14778. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14779. Note: this dithering is sometimes considered "wrong" and is included as a
  14780. reference.
  14781. @item floyd_steinberg
  14782. Floyd and Steingberg dithering (error diffusion)
  14783. @item sierra2
  14784. Frankie Sierra dithering v2 (error diffusion)
  14785. @item sierra2_4a
  14786. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14787. @item sierra3
  14788. Frankie Sierra dithering v3 (error diffusion)
  14789. @item burkes
  14790. Burkes dithering (error diffusion)
  14791. @item atkinson
  14792. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14793. @item none
  14794. Disable dithering.
  14795. @end table
  14796. Default is @var{sierra2_4a}.
  14797. @item bayer_scale
  14798. When @var{bayer} dithering is selected, this option defines the scale of the
  14799. pattern (how much the crosshatch pattern is visible). A low value means more
  14800. visible pattern for less banding, and higher value means less visible pattern
  14801. at the cost of more banding.
  14802. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14803. @item diff_mode
  14804. If set, define the zone to process
  14805. @table @samp
  14806. @item rectangle
  14807. Only the changing rectangle will be reprocessed. This is similar to GIF
  14808. cropping/offsetting compression mechanism. This option can be useful for speed
  14809. if only a part of the image is changing, and has use cases such as limiting the
  14810. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14811. moving scene (it leads to more deterministic output if the scene doesn't change
  14812. much, and as a result less moving noise and better GIF compression).
  14813. @end table
  14814. Default is @var{none}.
  14815. @item new
  14816. Take new palette for each output frame.
  14817. @item alpha_threshold
  14818. Sets the alpha threshold for transparency. Alpha values above this threshold
  14819. will be treated as completely opaque, and values below this threshold will be
  14820. treated as completely transparent.
  14821. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14822. @end table
  14823. @subsection Examples
  14824. @itemize
  14825. @item
  14826. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14827. using @command{ffmpeg}:
  14828. @example
  14829. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14830. @end example
  14831. @end itemize
  14832. @section perspective
  14833. Correct perspective of video not recorded perpendicular to the screen.
  14834. A description of the accepted parameters follows.
  14835. @table @option
  14836. @item x0
  14837. @item y0
  14838. @item x1
  14839. @item y1
  14840. @item x2
  14841. @item y2
  14842. @item x3
  14843. @item y3
  14844. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14845. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14846. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14847. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14848. then the corners of the source will be sent to the specified coordinates.
  14849. The expressions can use the following variables:
  14850. @table @option
  14851. @item W
  14852. @item H
  14853. the width and height of video frame.
  14854. @item in
  14855. Input frame count.
  14856. @item on
  14857. Output frame count.
  14858. @end table
  14859. @item interpolation
  14860. Set interpolation for perspective correction.
  14861. It accepts the following values:
  14862. @table @samp
  14863. @item linear
  14864. @item cubic
  14865. @end table
  14866. Default value is @samp{linear}.
  14867. @item sense
  14868. Set interpretation of coordinate options.
  14869. It accepts the following values:
  14870. @table @samp
  14871. @item 0, source
  14872. Send point in the source specified by the given coordinates to
  14873. the corners of the destination.
  14874. @item 1, destination
  14875. Send the corners of the source to the point in the destination specified
  14876. by the given coordinates.
  14877. Default value is @samp{source}.
  14878. @end table
  14879. @item eval
  14880. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14881. It accepts the following values:
  14882. @table @samp
  14883. @item init
  14884. only evaluate expressions once during the filter initialization or
  14885. when a command is processed
  14886. @item frame
  14887. evaluate expressions for each incoming frame
  14888. @end table
  14889. Default value is @samp{init}.
  14890. @end table
  14891. @section phase
  14892. Delay interlaced video by one field time so that the field order changes.
  14893. The intended use is to fix PAL movies that have been captured with the
  14894. opposite field order to the film-to-video transfer.
  14895. A description of the accepted parameters follows.
  14896. @table @option
  14897. @item mode
  14898. Set phase mode.
  14899. It accepts the following values:
  14900. @table @samp
  14901. @item t
  14902. Capture field order top-first, transfer bottom-first.
  14903. Filter will delay the bottom field.
  14904. @item b
  14905. Capture field order bottom-first, transfer top-first.
  14906. Filter will delay the top field.
  14907. @item p
  14908. Capture and transfer with the same field order. This mode only exists
  14909. for the documentation of the other options to refer to, but if you
  14910. actually select it, the filter will faithfully do nothing.
  14911. @item a
  14912. Capture field order determined automatically by field flags, transfer
  14913. opposite.
  14914. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14915. basis using field flags. If no field information is available,
  14916. then this works just like @samp{u}.
  14917. @item u
  14918. Capture unknown or varying, transfer opposite.
  14919. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14920. analyzing the images and selecting the alternative that produces best
  14921. match between the fields.
  14922. @item T
  14923. Capture top-first, transfer unknown or varying.
  14924. Filter selects among @samp{t} and @samp{p} using image analysis.
  14925. @item B
  14926. Capture bottom-first, transfer unknown or varying.
  14927. Filter selects among @samp{b} and @samp{p} using image analysis.
  14928. @item A
  14929. Capture determined by field flags, transfer unknown or varying.
  14930. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14931. image analysis. If no field information is available, then this works just
  14932. like @samp{U}. This is the default mode.
  14933. @item U
  14934. Both capture and transfer unknown or varying.
  14935. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14936. @end table
  14937. @end table
  14938. @subsection Commands
  14939. This filter supports the all above options as @ref{commands}.
  14940. @section photosensitivity
  14941. Reduce various flashes in video, so to help users with epilepsy.
  14942. It accepts the following options:
  14943. @table @option
  14944. @item frames, f
  14945. Set how many frames to use when filtering. Default is 30.
  14946. @item threshold, t
  14947. Set detection threshold factor. Default is 1.
  14948. Lower is stricter.
  14949. @item skip
  14950. Set how many pixels to skip when sampling frames. Default is 1.
  14951. Allowed range is from 1 to 1024.
  14952. @item bypass
  14953. Leave frames unchanged. Default is disabled.
  14954. @end table
  14955. @section pixdesctest
  14956. Pixel format descriptor test filter, mainly useful for internal
  14957. testing. The output video should be equal to the input video.
  14958. For example:
  14959. @example
  14960. format=monow, pixdesctest
  14961. @end example
  14962. can be used to test the monowhite pixel format descriptor definition.
  14963. @section pixelize
  14964. Apply pixelization to video stream.
  14965. The filter accepts the following options:
  14966. @table @option
  14967. @item width, w
  14968. @item height, h
  14969. Set block dimensions that will be used for pixelization.
  14970. Default value is @code{16}.
  14971. @item mode, m
  14972. Set the mode of pixelization used.
  14973. Possible values are:
  14974. @table @samp
  14975. @item avg
  14976. @item min
  14977. @item max
  14978. @end table
  14979. Default value is @code{avg}.
  14980. @item planes, p
  14981. Set what planes to filter. Default is to filter all planes.
  14982. @end table
  14983. @subsection Commands
  14984. This filter supports all options as @ref{commands}.
  14985. @section pixscope
  14986. Display sample values of color channels. Mainly useful for checking color
  14987. and levels. Minimum supported resolution is 640x480.
  14988. The filters accept the following options:
  14989. @table @option
  14990. @item x
  14991. Set scope X position, relative offset on X axis.
  14992. @item y
  14993. Set scope Y position, relative offset on Y axis.
  14994. @item w
  14995. Set scope width.
  14996. @item h
  14997. Set scope height.
  14998. @item o
  14999. Set window opacity. This window also holds statistics about pixel area.
  15000. @item wx
  15001. Set window X position, relative offset on X axis.
  15002. @item wy
  15003. Set window Y position, relative offset on Y axis.
  15004. @end table
  15005. @subsection Commands
  15006. This filter supports same @ref{commands} as options.
  15007. @section pp
  15008. Enable the specified chain of postprocessing subfilters using libpostproc. This
  15009. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  15010. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  15011. Each subfilter and some options have a short and a long name that can be used
  15012. interchangeably, i.e. dr/dering are the same.
  15013. The filters accept the following options:
  15014. @table @option
  15015. @item subfilters
  15016. Set postprocessing subfilters string.
  15017. @end table
  15018. All subfilters share common options to determine their scope:
  15019. @table @option
  15020. @item a/autoq
  15021. Honor the quality commands for this subfilter.
  15022. @item c/chrom
  15023. Do chrominance filtering, too (default).
  15024. @item y/nochrom
  15025. Do luma filtering only (no chrominance).
  15026. @item n/noluma
  15027. Do chrominance filtering only (no luma).
  15028. @end table
  15029. These options can be appended after the subfilter name, separated by a '|'.
  15030. Available subfilters are:
  15031. @table @option
  15032. @item hb/hdeblock[|difference[|flatness]]
  15033. Horizontal deblocking filter
  15034. @table @option
  15035. @item difference
  15036. Difference factor where higher values mean more deblocking (default: @code{32}).
  15037. @item flatness
  15038. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15039. @end table
  15040. @item vb/vdeblock[|difference[|flatness]]
  15041. Vertical deblocking filter
  15042. @table @option
  15043. @item difference
  15044. Difference factor where higher values mean more deblocking (default: @code{32}).
  15045. @item flatness
  15046. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15047. @end table
  15048. @item ha/hadeblock[|difference[|flatness]]
  15049. Accurate horizontal deblocking filter
  15050. @table @option
  15051. @item difference
  15052. Difference factor where higher values mean more deblocking (default: @code{32}).
  15053. @item flatness
  15054. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15055. @end table
  15056. @item va/vadeblock[|difference[|flatness]]
  15057. Accurate vertical deblocking filter
  15058. @table @option
  15059. @item difference
  15060. Difference factor where higher values mean more deblocking (default: @code{32}).
  15061. @item flatness
  15062. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15063. @end table
  15064. @end table
  15065. The horizontal and vertical deblocking filters share the difference and
  15066. flatness values so you cannot set different horizontal and vertical
  15067. thresholds.
  15068. @table @option
  15069. @item h1/x1hdeblock
  15070. Experimental horizontal deblocking filter
  15071. @item v1/x1vdeblock
  15072. Experimental vertical deblocking filter
  15073. @item dr/dering
  15074. Deringing filter
  15075. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  15076. @table @option
  15077. @item threshold1
  15078. larger -> stronger filtering
  15079. @item threshold2
  15080. larger -> stronger filtering
  15081. @item threshold3
  15082. larger -> stronger filtering
  15083. @end table
  15084. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  15085. @table @option
  15086. @item f/fullyrange
  15087. Stretch luma to @code{0-255}.
  15088. @end table
  15089. @item lb/linblenddeint
  15090. Linear blend deinterlacing filter that deinterlaces the given block by
  15091. filtering all lines with a @code{(1 2 1)} filter.
  15092. @item li/linipoldeint
  15093. Linear interpolating deinterlacing filter that deinterlaces the given block by
  15094. linearly interpolating every second line.
  15095. @item ci/cubicipoldeint
  15096. Cubic interpolating deinterlacing filter deinterlaces the given block by
  15097. cubically interpolating every second line.
  15098. @item md/mediandeint
  15099. Median deinterlacing filter that deinterlaces the given block by applying a
  15100. median filter to every second line.
  15101. @item fd/ffmpegdeint
  15102. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  15103. second line with a @code{(-1 4 2 4 -1)} filter.
  15104. @item l5/lowpass5
  15105. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  15106. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  15107. @item fq/forceQuant[|quantizer]
  15108. Overrides the quantizer table from the input with the constant quantizer you
  15109. specify.
  15110. @table @option
  15111. @item quantizer
  15112. Quantizer to use
  15113. @end table
  15114. @item de/default
  15115. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  15116. @item fa/fast
  15117. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  15118. @item ac
  15119. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  15120. @end table
  15121. @subsection Examples
  15122. @itemize
  15123. @item
  15124. Apply horizontal and vertical deblocking, deringing and automatic
  15125. brightness/contrast:
  15126. @example
  15127. pp=hb/vb/dr/al
  15128. @end example
  15129. @item
  15130. Apply default filters without brightness/contrast correction:
  15131. @example
  15132. pp=de/-al
  15133. @end example
  15134. @item
  15135. Apply default filters and temporal denoiser:
  15136. @example
  15137. pp=default/tmpnoise|1|2|3
  15138. @end example
  15139. @item
  15140. Apply deblocking on luma only, and switch vertical deblocking on or off
  15141. automatically depending on available CPU time:
  15142. @example
  15143. pp=hb|y/vb|a
  15144. @end example
  15145. @end itemize
  15146. @section pp7
  15147. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  15148. similar to spp = 6 with 7 point DCT, where only the center sample is
  15149. used after IDCT.
  15150. The filter accepts the following options:
  15151. @table @option
  15152. @item qp
  15153. Force a constant quantization parameter. It accepts an integer in range
  15154. 0 to 63. If not set, the filter will use the QP from the video stream
  15155. (if available).
  15156. @item mode
  15157. Set thresholding mode. Available modes are:
  15158. @table @samp
  15159. @item hard
  15160. Set hard thresholding.
  15161. @item soft
  15162. Set soft thresholding (better de-ringing effect, but likely blurrier).
  15163. @item medium
  15164. Set medium thresholding (good results, default).
  15165. @end table
  15166. @end table
  15167. @section premultiply
  15168. Apply alpha premultiply effect to input video stream using first plane
  15169. of second stream as alpha.
  15170. Both streams must have same dimensions and same pixel format.
  15171. The filter accepts the following option:
  15172. @table @option
  15173. @item planes
  15174. Set which planes will be processed, unprocessed planes will be copied.
  15175. By default value 0xf, all planes will be processed.
  15176. @item inplace
  15177. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15178. @end table
  15179. @section prewitt
  15180. Apply prewitt operator to input video stream.
  15181. The filter accepts the following option:
  15182. @table @option
  15183. @item planes
  15184. Set which planes will be processed, unprocessed planes will be copied.
  15185. By default value 0xf, all planes will be processed.
  15186. @item scale
  15187. Set value which will be multiplied with filtered result.
  15188. @item delta
  15189. Set value which will be added to filtered result.
  15190. @end table
  15191. @subsection Commands
  15192. This filter supports the all above options as @ref{commands}.
  15193. @section pseudocolor
  15194. Alter frame colors in video with pseudocolors.
  15195. This filter accepts the following options:
  15196. @table @option
  15197. @item c0
  15198. set pixel first component expression
  15199. @item c1
  15200. set pixel second component expression
  15201. @item c2
  15202. set pixel third component expression
  15203. @item c3
  15204. set pixel fourth component expression, corresponds to the alpha component
  15205. @item index, i
  15206. set component to use as base for altering colors
  15207. @item preset, p
  15208. Pick one of built-in LUTs. By default is set to none.
  15209. Available LUTs:
  15210. @table @samp
  15211. @item magma
  15212. @item inferno
  15213. @item plasma
  15214. @item viridis
  15215. @item turbo
  15216. @item cividis
  15217. @item range1
  15218. @item range2
  15219. @item shadows
  15220. @item highlights
  15221. @item solar
  15222. @item nominal
  15223. @item preferred
  15224. @item total
  15225. @item spectral
  15226. @item cool
  15227. @item heat
  15228. @item fiery
  15229. @item blues
  15230. @item green
  15231. @item helix
  15232. @end table
  15233. @item opacity
  15234. Set opacity of output colors. Allowed range is from 0 to 1.
  15235. Default value is set to 1.
  15236. @end table
  15237. Each of the expression options specifies the expression to use for computing
  15238. the lookup table for the corresponding pixel component values.
  15239. The expressions can contain the following constants and functions:
  15240. @table @option
  15241. @item w
  15242. @item h
  15243. The input width and height.
  15244. @item val
  15245. The input value for the pixel component.
  15246. @item ymin, umin, vmin, amin
  15247. The minimum allowed component value.
  15248. @item ymax, umax, vmax, amax
  15249. The maximum allowed component value.
  15250. @end table
  15251. All expressions default to "val".
  15252. @subsection Commands
  15253. This filter supports the all above options as @ref{commands}.
  15254. @subsection Examples
  15255. @itemize
  15256. @item
  15257. Change too high luma values to gradient:
  15258. @example
  15259. pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
  15260. @end example
  15261. @end itemize
  15262. @anchor{psnr}
  15263. @section psnr
  15264. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  15265. Ratio) between two input videos.
  15266. This filter takes in input two input videos, the first input is
  15267. considered the "main" source and is passed unchanged to the
  15268. output. The second input is used as a "reference" video for computing
  15269. the PSNR.
  15270. Both video inputs must have the same resolution and pixel format for
  15271. this filter to work correctly. Also it assumes that both inputs
  15272. have the same number of frames, which are compared one by one.
  15273. The obtained average PSNR is printed through the logging system.
  15274. The filter stores the accumulated MSE (mean squared error) of each
  15275. frame, and at the end of the processing it is averaged across all frames
  15276. equally, and the following formula is applied to obtain the PSNR:
  15277. @example
  15278. PSNR = 10*log10(MAX^2/MSE)
  15279. @end example
  15280. Where MAX is the average of the maximum values of each component of the
  15281. image.
  15282. The description of the accepted parameters follows.
  15283. @table @option
  15284. @item stats_file, f
  15285. If specified the filter will use the named file to save the PSNR of
  15286. each individual frame. When filename equals "-" the data is sent to
  15287. standard output.
  15288. @item stats_version
  15289. Specifies which version of the stats file format to use. Details of
  15290. each format are written below.
  15291. Default value is 1.
  15292. @item stats_add_max
  15293. Determines whether the max value is output to the stats log.
  15294. Default value is 0.
  15295. Requires stats_version >= 2. If this is set and stats_version < 2,
  15296. the filter will return an error.
  15297. @end table
  15298. This filter also supports the @ref{framesync} options.
  15299. The file printed if @var{stats_file} is selected, contains a sequence of
  15300. key/value pairs of the form @var{key}:@var{value} for each compared
  15301. couple of frames.
  15302. If a @var{stats_version} greater than 1 is specified, a header line precedes
  15303. the list of per-frame-pair stats, with key value pairs following the frame
  15304. format with the following parameters:
  15305. @table @option
  15306. @item psnr_log_version
  15307. The version of the log file format. Will match @var{stats_version}.
  15308. @item fields
  15309. A comma separated list of the per-frame-pair parameters included in
  15310. the log.
  15311. @end table
  15312. A description of each shown per-frame-pair parameter follows:
  15313. @table @option
  15314. @item n
  15315. sequential number of the input frame, starting from 1
  15316. @item mse_avg
  15317. Mean Square Error pixel-by-pixel average difference of the compared
  15318. frames, averaged over all the image components.
  15319. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  15320. Mean Square Error pixel-by-pixel average difference of the compared
  15321. frames for the component specified by the suffix.
  15322. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  15323. Peak Signal to Noise ratio of the compared frames for the component
  15324. specified by the suffix.
  15325. @item max_avg, max_y, max_u, max_v
  15326. Maximum allowed value for each channel, and average over all
  15327. channels.
  15328. @end table
  15329. @subsection Examples
  15330. @itemize
  15331. @item
  15332. For example:
  15333. @example
  15334. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15335. [main][ref] psnr="stats_file=stats.log" [out]
  15336. @end example
  15337. On this example the input file being processed is compared with the
  15338. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  15339. is stored in @file{stats.log}.
  15340. @item
  15341. Another example with different containers:
  15342. @example
  15343. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]psnr" -f null -
  15344. @end example
  15345. @end itemize
  15346. @anchor{pullup}
  15347. @section pullup
  15348. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  15349. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  15350. content.
  15351. The pullup filter is designed to take advantage of future context in making
  15352. its decisions. This filter is stateless in the sense that it does not lock
  15353. onto a pattern to follow, but it instead looks forward to the following
  15354. fields in order to identify matches and rebuild progressive frames.
  15355. To produce content with an even framerate, insert the fps filter after
  15356. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  15357. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  15358. The filter accepts the following options:
  15359. @table @option
  15360. @item jl
  15361. @item jr
  15362. @item jt
  15363. @item jb
  15364. These options set the amount of "junk" to ignore at the left, right, top, and
  15365. bottom of the image, respectively. Left and right are in units of 8 pixels,
  15366. while top and bottom are in units of 2 lines.
  15367. The default is 8 pixels on each side.
  15368. @item sb
  15369. Set the strict breaks. Setting this option to 1 will reduce the chances of
  15370. filter generating an occasional mismatched frame, but it may also cause an
  15371. excessive number of frames to be dropped during high motion sequences.
  15372. Conversely, setting it to -1 will make filter match fields more easily.
  15373. This may help processing of video where there is slight blurring between
  15374. the fields, but may also cause there to be interlaced frames in the output.
  15375. Default value is @code{0}.
  15376. @item mp
  15377. Set the metric plane to use. It accepts the following values:
  15378. @table @samp
  15379. @item l
  15380. Use luma plane.
  15381. @item u
  15382. Use chroma blue plane.
  15383. @item v
  15384. Use chroma red plane.
  15385. @end table
  15386. This option may be set to use chroma plane instead of the default luma plane
  15387. for doing filter's computations. This may improve accuracy on very clean
  15388. source material, but more likely will decrease accuracy, especially if there
  15389. is chroma noise (rainbow effect) or any grayscale video.
  15390. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  15391. load and make pullup usable in realtime on slow machines.
  15392. @end table
  15393. For best results (without duplicated frames in the output file) it is
  15394. necessary to change the output frame rate. For example, to inverse
  15395. telecine NTSC input:
  15396. @example
  15397. ffmpeg -i input -vf pullup -r 24000/1001 ...
  15398. @end example
  15399. @section qp
  15400. Change video quantization parameters (QP).
  15401. The filter accepts the following option:
  15402. @table @option
  15403. @item qp
  15404. Set expression for quantization parameter.
  15405. @end table
  15406. The expression is evaluated through the eval API and can contain, among others,
  15407. the following constants:
  15408. @table @var
  15409. @item known
  15410. 1 if index is not 129, 0 otherwise.
  15411. @item qp
  15412. Sequential index starting from -129 to 128.
  15413. @end table
  15414. @subsection Examples
  15415. @itemize
  15416. @item
  15417. Some equation like:
  15418. @example
  15419. qp=2+2*sin(PI*qp)
  15420. @end example
  15421. @end itemize
  15422. @section qrencode
  15423. Generate a QR code using the libqrencode library (see
  15424. @url{https://fukuchi.org/works/qrencode/}), and overlay it on top of the current
  15425. frame.
  15426. To enable the compilation of this filter, you need to configure FFmpeg with
  15427. @code{--enable-libqrencode}.
  15428. The QR code is generated from the provided text or text pattern. The
  15429. corresponding QR code is scaled and overlayed into the video output according to
  15430. the specified options.
  15431. In case no text is specified, no QR code is overlaied.
  15432. This filter accepts the following options:
  15433. @table @option
  15434. @item qrcode_width, q
  15435. @item padded_qrcode_width, Q
  15436. Specify an expression for the width of the rendered QR code, with and without
  15437. padding. The @var{qrcode_width} expression can reference the value set by the
  15438. @var{padded_qrcode_width} expression, and vice versa.
  15439. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  15440. there is no padding.
  15441. These expressions are evaluated for each new frame.
  15442. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15443. @item x
  15444. @item y
  15445. Specify an expression for positioning the padded QR code top-left corner. The
  15446. @var{x} expression can reference the value set by the @var{y} expression, and
  15447. vice.
  15448. By default @var{x} and @var{y} are set set to @var{0}, meaning that the QR code
  15449. is placed in the top left corner of the input.
  15450. These expressions are evaluated for each new frame.
  15451. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15452. @item case_sensitive, cs
  15453. Instruct libqrencode to use case sensitive encoding. This is enabled by
  15454. default. This can be disabled to reduce the QR encoding size.
  15455. @item level, l
  15456. Specify the QR encoding error correction level. With an higher correction level,
  15457. the encoding size will increase but the code will be more robust to corruption.
  15458. Lower level is @var{L}.
  15459. It accepts the following values:
  15460. @table @samp
  15461. @item L
  15462. @item M
  15463. @item Q
  15464. @item H
  15465. @end table
  15466. @item expansion
  15467. Select how the input text is expanded. Can be either @code{none}, or
  15468. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  15469. section below for details.
  15470. @item text
  15471. @item textfile
  15472. Define the text to be rendered. In case neither is specified, no QR is encoded
  15473. (just an empty colored frame).
  15474. In case expansion is enabled, the text is treated as a text template, using the
  15475. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  15476. Text expansion} section below for details.
  15477. @item background_color, bc
  15478. @item foreground_color, fc
  15479. Set the QR code and background color. The default value of
  15480. @var{foreground_color} is "black", the default value of @var{background_color}
  15481. is "white".
  15482. For the syntax of the color options, check the @ref{color syntax,,"Color"
  15483. section in the ffmpeg-utils manual,ffmpeg-utils}.
  15484. @end table
  15485. @anchor{qrencode_expressions}
  15486. @subsection qrencode Expressions
  15487. The expressions set by the options contain the following constants and functions.
  15488. @table @option
  15489. @item dar
  15490. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  15491. @item duration
  15492. the current frame's duration, in seconds
  15493. @item hsub
  15494. @item vsub
  15495. horizontal and vertical chroma subsample values. For example for the
  15496. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15497. @item main_h, H
  15498. the input height
  15499. @item main_w, W
  15500. the input width
  15501. @item n
  15502. the number of input frame, starting from 0
  15503. @item pict_type
  15504. a number representing the picture type
  15505. @item qr_w, w
  15506. the width of the encoded QR code
  15507. @item rendered_qr_w, q
  15508. @item rendered_padded_qr_w, Q
  15509. the width of the rendered QR code, without and without padding.
  15510. These parameters allow the @var{q} and @var{Q} expressions to refer to each
  15511. other, so you can for example specify @code{q=3/4*Q}.
  15512. @item rand(min, max)
  15513. return a random number included between @var{min} and @var{max}
  15514. @item sar
  15515. the input sample aspect ratio
  15516. @item t
  15517. timestamp expressed in seconds, NAN if the input timestamp is unknown
  15518. @item x
  15519. @item y
  15520. the x and y offset coordinates where the text is drawn.
  15521. These parameters allow the @var{x} and @var{y} expressions to refer to each
  15522. other, so you can for example specify @code{y=x/dar}.
  15523. @end table
  15524. @anchor{qrencode_text_expansion}
  15525. @subsection qrencode Text expansion
  15526. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  15527. If @option{expansion} is set to @code{normal} (which is the default),
  15528. the following expansion mechanism is used.
  15529. The backslash character @samp{\}, followed by any character, always expands to
  15530. the second character.
  15531. Sequences of the form @code{%@{...@}} are expanded. The text between the
  15532. braces is a function name, possibly followed by arguments separated by ':'.
  15533. If the arguments contain special characters or delimiters (':' or '@}'),
  15534. they should be escaped.
  15535. Note that they probably must also be escaped as the value for the @option{text}
  15536. option in the filter argument string and as the filter argument in the
  15537. filtergraph description, and possibly also for the shell, that makes up to four
  15538. levels of escaping; using a text file with the @option{textfile} option avoids
  15539. these problems.
  15540. The following functions are available:
  15541. @table @command
  15542. @item n, frame_num
  15543. return the frame number
  15544. @item pts
  15545. Return the presentation timestamp of the current frame.
  15546. It can take up to two arguments.
  15547. The first argument is the format of the timestamp; it defaults to @code{flt} for
  15548. seconds as a decimal number with microsecond accuracy; @code{hms} stands for a
  15549. formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  15550. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  15551. @code{localtime} stands for the timestamp of the frame formatted as local time
  15552. zone time. If the format is set to @code{hms24hh}, the time is formatted in 24h
  15553. format (00-23).
  15554. The second argument is an offset added to the timestamp.
  15555. If the format is set to @code{localtime} or @code{gmtime}, a third argument may
  15556. be supplied: a @code{strftime} C function format string. By default,
  15557. @var{YYYY-MM-DD HH:MM:SS} format will be used.
  15558. @item expr, e
  15559. Evaluate the expression's value and output as a double.
  15560. It must take one argument specifying the expression to be evaluated, accepting
  15561. the constants and functions defined in @ref{qrencode_expressions}.
  15562. @item expr_formatted, ef
  15563. Evaluate the expression's value and output as a formatted string.
  15564. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  15565. The second argument specifies the output format. Allowed values are @samp{x},
  15566. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  15567. @code{printf} function.
  15568. The third parameter is optional and sets the number of positions taken by the output.
  15569. It can be used to add padding with zeros from the left.
  15570. @item gmtime
  15571. The time at which the filter is running, expressed in UTC.
  15572. It can accept an argument: a @code{strftime} C function format string.
  15573. The format string is extended to support the variable @var{%[1-6]N}
  15574. which prints fractions of the second with optionally specified number of digits.
  15575. @item localtime
  15576. The time at which the filter is running, expressed in the local time zone.
  15577. It can accept an argument: a @code{strftime} C function format string.
  15578. The format string is extended to support the variable @var{%[1-6]N}
  15579. which prints fractions of the second with optionally specified number of digits.
  15580. @item metadata
  15581. Frame metadata. Takes one or two arguments.
  15582. The first argument is mandatory and specifies the metadata key.
  15583. The second argument is optional and specifies a default value, used when the
  15584. metadata key is not found or empty.
  15585. Available metadata can be identified by inspecting entries starting with TAG
  15586. included within each frame section printed by running @code{ffprobe
  15587. -show_frames}.
  15588. String metadata generated in filters leading to the qrencode filter are also
  15589. available.
  15590. @item rand(min, max)
  15591. return a random number included between @var{min} and @var{max}
  15592. @end table
  15593. @subsection Examples
  15594. @itemize
  15595. @item
  15596. Generate a QR code encoding the specified text with the default size, overalaid
  15597. in the top left corner of the input video, with the default size:
  15598. @example
  15599. qrencode=text=www.ffmpeg.org
  15600. @end example
  15601. @item
  15602. Same as below, but select blue on pink colors:
  15603. @example
  15604. qrencode=text=www.ffmpeg.org:bc=pink@@0.5:fc=blue
  15605. @end example
  15606. @item
  15607. Place the QR code in the bottom right corner of the input video:
  15608. @example
  15609. qrencode=text=www.ffmpeg.org:x=W-Q:y=H-Q
  15610. @end example
  15611. @item
  15612. Generate a QR code with width of 200 pixels and padding, making the padded width
  15613. 4/3 of the QR code width:
  15614. @example
  15615. qrencode=text=www.ffmpeg.org:q=200:Q=4/3*q
  15616. @end example
  15617. @item
  15618. Generate a QR code with padded width of 200 pixels and padding, making the QR
  15619. code width 3/4 of the padded width:
  15620. @example
  15621. qrencode=text=www.ffmpeg.org:Q=200:q=3/4*Q
  15622. @end example
  15623. @item
  15624. Make the QR code a fraction of the input video width:
  15625. @example
  15626. qrencode=text=www.ffmpeg.org:q=W/5
  15627. @end example
  15628. @item
  15629. Generate a QR code encoding the frame number:
  15630. @example
  15631. qrencode=text=%@{n@}
  15632. @end example
  15633. @item
  15634. Generate a QR code encoding the GMT timestamp:
  15635. @example
  15636. qrencode=text=%@{gmtime@}
  15637. @end example
  15638. @item
  15639. Generate a QR code encoding the timestamp expressed as a float:
  15640. @example
  15641. qrencode=text=%@{pts@}
  15642. @end example
  15643. @end itemize
  15644. @section quirc
  15645. Identify and decode a QR code using the libquirc library (see
  15646. @url{https://github.com/dlbeer/quirc/}), and print the identified QR codes
  15647. positions and payload as metadata.
  15648. To enable the compilation of this filter, you need to configure FFmpeg with
  15649. @code{--enable-libquirc}.
  15650. For each found QR code in the input video, some metadata entries are added with
  15651. the prefix @var{lavfi.quirc.N}, where @var{N} is the index, starting from 0,
  15652. associated to the QR code.
  15653. A description of each metadata value follows:
  15654. @table @option
  15655. @item lavfi.quirc.count
  15656. the number of found QR codes, it is not set in case none was found
  15657. @item lavfi.quirc.N.corner.M.x
  15658. @item lavfi.quirc.N.coreer.M.y
  15659. the x/y positions of the four corners of the square containing the QR code,
  15660. where @var{M} is the index of the corner starting from 0
  15661. @item lavfi.quirc.N.payload
  15662. the payload of the QR code
  15663. @end table
  15664. @section random
  15665. Flush video frames from internal cache of frames into a random order.
  15666. No frame is discarded.
  15667. Inspired by @ref{frei0r} nervous filter.
  15668. @table @option
  15669. @item frames
  15670. Set size in number of frames of internal cache, in range from @code{2} to
  15671. @code{512}. Default is @code{30}.
  15672. @item seed
  15673. Set seed for random number generator, must be an integer included between
  15674. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15675. less than @code{0}, the filter will try to use a good random seed on a
  15676. best effort basis.
  15677. @end table
  15678. @section readeia608
  15679. Read closed captioning (EIA-608) information from the top lines of a video frame.
  15680. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  15681. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  15682. with EIA-608 data (starting from 0). A description of each metadata value follows:
  15683. @table @option
  15684. @item lavfi.readeia608.X.cc
  15685. The two bytes stored as EIA-608 data (printed in hexadecimal).
  15686. @item lavfi.readeia608.X.line
  15687. The number of the line on which the EIA-608 data was identified and read.
  15688. @end table
  15689. This filter accepts the following options:
  15690. @table @option
  15691. @item scan_min
  15692. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  15693. @item scan_max
  15694. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  15695. @item spw
  15696. Set the ratio of width reserved for sync code detection.
  15697. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  15698. @item chp
  15699. Enable checking the parity bit. In the event of a parity error, the filter will output
  15700. @code{0x00} for that character. Default is false.
  15701. @item lp
  15702. Lowpass lines prior to further processing. Default is enabled.
  15703. @end table
  15704. @subsection Commands
  15705. This filter supports the all above options as @ref{commands}.
  15706. @subsection Examples
  15707. @itemize
  15708. @item
  15709. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  15710. @example
  15711. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  15712. @end example
  15713. @end itemize
  15714. @section readvitc
  15715. Read vertical interval timecode (VITC) information from the top lines of a
  15716. video frame.
  15717. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  15718. timecode value, if a valid timecode has been detected. Further metadata key
  15719. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  15720. timecode data has been found or not.
  15721. This filter accepts the following options:
  15722. @table @option
  15723. @item scan_max
  15724. Set the maximum number of lines to scan for VITC data. If the value is set to
  15725. @code{-1} the full video frame is scanned. Default is @code{45}.
  15726. @item thr_b
  15727. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  15728. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  15729. @item thr_w
  15730. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  15731. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  15732. @end table
  15733. @subsection Examples
  15734. @itemize
  15735. @item
  15736. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  15737. draw @code{--:--:--:--} as a placeholder:
  15738. @example
  15739. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  15740. @end example
  15741. @end itemize
  15742. @section remap
  15743. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  15744. Destination pixel at position (X, Y) will be picked from source (x, y) position
  15745. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  15746. value for pixel will be used for destination pixel.
  15747. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  15748. will have Xmap/Ymap video stream dimensions.
  15749. Xmap and Ymap input video streams are 16bit depth, single channel.
  15750. @table @option
  15751. @item format
  15752. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  15753. Default is @code{color}.
  15754. @item fill
  15755. Specify the color of the unmapped pixels. For the syntax of this option,
  15756. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15757. manual,ffmpeg-utils}. Default color is @code{black}.
  15758. @end table
  15759. @section removegrain
  15760. The removegrain filter is a spatial denoiser for progressive video.
  15761. @table @option
  15762. @item m0
  15763. Set mode for the first plane.
  15764. @item m1
  15765. Set mode for the second plane.
  15766. @item m2
  15767. Set mode for the third plane.
  15768. @item m3
  15769. Set mode for the fourth plane.
  15770. @end table
  15771. Range of mode is from 0 to 24. Description of each mode follows:
  15772. @table @var
  15773. @item 0
  15774. Leave input plane unchanged. Default.
  15775. @item 1
  15776. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  15777. @item 2
  15778. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  15779. @item 3
  15780. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  15781. @item 4
  15782. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  15783. This is equivalent to a median filter.
  15784. @item 5
  15785. Line-sensitive clipping giving the minimal change.
  15786. @item 6
  15787. Line-sensitive clipping, intermediate.
  15788. @item 7
  15789. Line-sensitive clipping, intermediate.
  15790. @item 8
  15791. Line-sensitive clipping, intermediate.
  15792. @item 9
  15793. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  15794. @item 10
  15795. Replaces the target pixel with the closest neighbour.
  15796. @item 11
  15797. [1 2 1] horizontal and vertical kernel blur.
  15798. @item 12
  15799. Same as mode 11.
  15800. @item 13
  15801. Bob mode, interpolates top field from the line where the neighbours
  15802. pixels are the closest.
  15803. @item 14
  15804. Bob mode, interpolates bottom field from the line where the neighbours
  15805. pixels are the closest.
  15806. @item 15
  15807. Bob mode, interpolates top field. Same as 13 but with a more complicated
  15808. interpolation formula.
  15809. @item 16
  15810. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  15811. interpolation formula.
  15812. @item 17
  15813. Clips the pixel with the minimum and maximum of respectively the maximum and
  15814. minimum of each pair of opposite neighbour pixels.
  15815. @item 18
  15816. Line-sensitive clipping using opposite neighbours whose greatest distance from
  15817. the current pixel is minimal.
  15818. @item 19
  15819. Replaces the pixel with the average of its 8 neighbours.
  15820. @item 20
  15821. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  15822. @item 21
  15823. Clips pixels using the averages of opposite neighbour.
  15824. @item 22
  15825. Same as mode 21 but simpler and faster.
  15826. @item 23
  15827. Small edge and halo removal, but reputed useless.
  15828. @item 24
  15829. Similar as 23.
  15830. @end table
  15831. @section removelogo
  15832. Suppress a TV station logo, using an image file to determine which
  15833. pixels comprise the logo. It works by filling in the pixels that
  15834. comprise the logo with neighboring pixels.
  15835. The filter accepts the following options:
  15836. @table @option
  15837. @item filename, f
  15838. Set the filter bitmap file, which can be any image format supported by
  15839. libavformat. The width and height of the image file must match those of the
  15840. video stream being processed.
  15841. @end table
  15842. Pixels in the provided bitmap image with a value of zero are not
  15843. considered part of the logo, non-zero pixels are considered part of
  15844. the logo. If you use white (255) for the logo and black (0) for the
  15845. rest, you will be safe. For making the filter bitmap, it is
  15846. recommended to take a screen capture of a black frame with the logo
  15847. visible, and then using a threshold filter followed by the erode
  15848. filter once or twice.
  15849. If needed, little splotches can be fixed manually. Remember that if
  15850. logo pixels are not covered, the filter quality will be much
  15851. reduced. Marking too many pixels as part of the logo does not hurt as
  15852. much, but it will increase the amount of blurring needed to cover over
  15853. the image and will destroy more information than necessary, and extra
  15854. pixels will slow things down on a large logo.
  15855. @section repeatfields
  15856. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15857. fields based on its value.
  15858. @section reverse
  15859. Reverse a video clip.
  15860. Warning: This filter requires memory to buffer the entire clip, so trimming
  15861. is suggested.
  15862. @subsection Examples
  15863. @itemize
  15864. @item
  15865. Take the first 5 seconds of a clip, and reverse it.
  15866. @example
  15867. trim=end=5,reverse
  15868. @end example
  15869. @end itemize
  15870. @section rgbashift
  15871. Shift R/G/B/A pixels horizontally and/or vertically.
  15872. The filter accepts the following options:
  15873. @table @option
  15874. @item rh
  15875. Set amount to shift red horizontally.
  15876. @item rv
  15877. Set amount to shift red vertically.
  15878. @item gh
  15879. Set amount to shift green horizontally.
  15880. @item gv
  15881. Set amount to shift green vertically.
  15882. @item bh
  15883. Set amount to shift blue horizontally.
  15884. @item bv
  15885. Set amount to shift blue vertically.
  15886. @item ah
  15887. Set amount to shift alpha horizontally.
  15888. @item av
  15889. Set amount to shift alpha vertically.
  15890. @item edge
  15891. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15892. @end table
  15893. @subsection Commands
  15894. This filter supports the all above options as @ref{commands}.
  15895. @section roberts
  15896. Apply roberts cross operator to input video stream.
  15897. The filter accepts the following option:
  15898. @table @option
  15899. @item planes
  15900. Set which planes will be processed, unprocessed planes will be copied.
  15901. By default value 0xf, all planes will be processed.
  15902. @item scale
  15903. Set value which will be multiplied with filtered result.
  15904. @item delta
  15905. Set value which will be added to filtered result.
  15906. @end table
  15907. @subsection Commands
  15908. This filter supports the all above options as @ref{commands}.
  15909. @section rotate
  15910. Rotate video by an arbitrary angle expressed in radians.
  15911. The filter accepts the following options:
  15912. A description of the optional parameters follows.
  15913. @table @option
  15914. @item angle, a
  15915. Set an expression for the angle by which to rotate the input video
  15916. clockwise, expressed as a number of radians. A negative value will
  15917. result in a counter-clockwise rotation. By default it is set to "0".
  15918. This expression is evaluated for each frame.
  15919. @item out_w, ow
  15920. Set the output width expression, default value is "iw".
  15921. This expression is evaluated just once during configuration.
  15922. @item out_h, oh
  15923. Set the output height expression, default value is "ih".
  15924. This expression is evaluated just once during configuration.
  15925. @item bilinear
  15926. Enable bilinear interpolation if set to 1, a value of 0 disables
  15927. it. Default value is 1.
  15928. @item fillcolor, c
  15929. Set the color used to fill the output area not covered by the rotated
  15930. image. For the general syntax of this option, check the
  15931. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15932. If the special value "none" is selected then no
  15933. background is printed (useful for example if the background is never shown).
  15934. Default value is "black".
  15935. @end table
  15936. The expressions for the angle and the output size can contain the
  15937. following constants and functions:
  15938. @table @option
  15939. @item n
  15940. sequential number of the input frame, starting from 0. It is always NAN
  15941. before the first frame is filtered.
  15942. @item t
  15943. time in seconds of the input frame, it is set to 0 when the filter is
  15944. configured. It is always NAN before the first frame is filtered.
  15945. @item hsub
  15946. @item vsub
  15947. horizontal and vertical chroma subsample values. For example for the
  15948. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15949. @item in_w, iw
  15950. @item in_h, ih
  15951. the input video width and height
  15952. @item out_w, ow
  15953. @item out_h, oh
  15954. the output width and height, that is the size of the padded area as
  15955. specified by the @var{width} and @var{height} expressions
  15956. @item rotw(a)
  15957. @item roth(a)
  15958. the minimal width/height required for completely containing the input
  15959. video rotated by @var{a} radians.
  15960. These are only available when computing the @option{out_w} and
  15961. @option{out_h} expressions.
  15962. @end table
  15963. @subsection Examples
  15964. @itemize
  15965. @item
  15966. Rotate the input by PI/6 radians clockwise:
  15967. @example
  15968. rotate=PI/6
  15969. @end example
  15970. @item
  15971. Rotate the input by PI/6 radians counter-clockwise:
  15972. @example
  15973. rotate=-PI/6
  15974. @end example
  15975. @item
  15976. Rotate the input by 45 degrees clockwise:
  15977. @example
  15978. rotate=45*PI/180
  15979. @end example
  15980. @item
  15981. Apply a constant rotation with period T, starting from an angle of PI/3:
  15982. @example
  15983. rotate=PI/3+2*PI*t/T
  15984. @end example
  15985. @item
  15986. Make the input video rotation oscillating with a period of T
  15987. seconds and an amplitude of A radians:
  15988. @example
  15989. rotate=A*sin(2*PI/T*t)
  15990. @end example
  15991. @item
  15992. Rotate the video, output size is chosen so that the whole rotating
  15993. input video is always completely contained in the output:
  15994. @example
  15995. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15996. @end example
  15997. @item
  15998. Rotate the video, reduce the output size so that no background is ever
  15999. shown:
  16000. @example
  16001. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  16002. @end example
  16003. @end itemize
  16004. @subsection Commands
  16005. The filter supports the following commands:
  16006. @table @option
  16007. @item a, angle
  16008. Set the angle expression.
  16009. The command accepts the same syntax of the corresponding option.
  16010. If the specified expression is not valid, it is kept at its current
  16011. value.
  16012. @end table
  16013. @section sab
  16014. Apply Shape Adaptive Blur.
  16015. The filter accepts the following options:
  16016. @table @option
  16017. @item luma_radius, lr
  16018. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  16019. value is 1.0. A greater value will result in a more blurred image, and
  16020. in slower processing.
  16021. @item luma_pre_filter_radius, lpfr
  16022. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  16023. value is 1.0.
  16024. @item luma_strength, ls
  16025. Set luma maximum difference between pixels to still be considered, must
  16026. be a value in the 0.1-100.0 range, default value is 1.0.
  16027. @item chroma_radius, cr
  16028. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  16029. greater value will result in a more blurred image, and in slower
  16030. processing.
  16031. @item chroma_pre_filter_radius, cpfr
  16032. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  16033. @item chroma_strength, cs
  16034. Set chroma maximum difference between pixels to still be considered,
  16035. must be a value in the -0.9-100.0 range.
  16036. @end table
  16037. Each chroma option value, if not explicitly specified, is set to the
  16038. corresponding luma option value.
  16039. @anchor{scale}
  16040. @section scale
  16041. Scale (resize) the input video, using the libswscale library.
  16042. The scale filter forces the output display aspect ratio to be the same
  16043. of the input, by changing the output sample aspect ratio.
  16044. If the input image format is different from the format requested by
  16045. the next filter, the scale filter will convert the input to the
  16046. requested format.
  16047. @subsection Options
  16048. The filter accepts the following options, any of the options supported
  16049. by the libswscale scaler, as well as any of the @ref{framesync} options.
  16050. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  16051. the complete list of scaler options.
  16052. @table @option
  16053. @item width, w
  16054. @item height, h
  16055. Set the output video dimension expression. Default value is the input
  16056. dimension.
  16057. If the @var{width} or @var{w} value is 0, the input width is used for
  16058. the output. If the @var{height} or @var{h} value is 0, the input height
  16059. is used for the output.
  16060. If one and only one of the values is -n with n >= 1, the scale filter
  16061. will use a value that maintains the aspect ratio of the input image,
  16062. calculated from the other specified dimension. After that it will,
  16063. however, make sure that the calculated dimension is divisible by n and
  16064. adjust the value if necessary.
  16065. If both values are -n with n >= 1, the behavior will be identical to
  16066. both values being set to 0 as previously detailed.
  16067. See below for the list of accepted constants for use in the dimension
  16068. expression.
  16069. @item eval
  16070. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  16071. @table @samp
  16072. @item init
  16073. Only evaluate expressions once during the filter initialization or when a command is processed.
  16074. @item frame
  16075. Evaluate expressions for each incoming frame.
  16076. @end table
  16077. Default value is @samp{init}.
  16078. @item interl
  16079. Set the interlacing mode. It accepts the following values:
  16080. @table @samp
  16081. @item 1
  16082. Force interlaced aware scaling.
  16083. @item 0
  16084. Do not apply interlaced scaling.
  16085. @item -1
  16086. Select interlaced aware scaling depending on whether the source frames
  16087. are flagged as interlaced or not.
  16088. @end table
  16089. Default value is @samp{0}.
  16090. @item flags
  16091. Set libswscale scaling flags. See
  16092. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  16093. complete list of values. If not explicitly specified the filter applies
  16094. the default flags.
  16095. @item param0, param1
  16096. Set libswscale input parameters for scaling algorithms that need them. See
  16097. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  16098. complete documentation. If not explicitly specified the filter applies
  16099. empty parameters.
  16100. @item size, s
  16101. Set the video size. For the syntax of this option, check the
  16102. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16103. @item in_color_matrix
  16104. @item out_color_matrix
  16105. Set in/output YCbCr color space type.
  16106. This allows the autodetected value to be overridden as well as allows forcing
  16107. a specific value used for the output and encoder.
  16108. If not specified, the color space type depends on the pixel format.
  16109. Possible values:
  16110. @table @samp
  16111. @item auto
  16112. Choose automatically.
  16113. @item bt709
  16114. Format conforming to International Telecommunication Union (ITU)
  16115. Recommendation BT.709.
  16116. @item fcc
  16117. Set color space conforming to the United States Federal Communications
  16118. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  16119. @item bt601
  16120. @item bt470
  16121. @item smpte170m
  16122. Set color space conforming to:
  16123. @itemize
  16124. @item
  16125. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  16126. @item
  16127. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  16128. @item
  16129. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  16130. @end itemize
  16131. @item smpte240m
  16132. Set color space conforming to SMPTE ST 240:1999.
  16133. @item bt2020
  16134. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  16135. @end table
  16136. @item in_range
  16137. @item out_range
  16138. Set in/output YCbCr sample range.
  16139. This allows the autodetected value to be overridden as well as allows forcing
  16140. a specific value used for the output and encoder. If not specified, the
  16141. range depends on the pixel format. Possible values:
  16142. @table @samp
  16143. @item auto/unknown
  16144. Choose automatically.
  16145. @item jpeg/full/pc
  16146. Set full range (0-255 in case of 8-bit luma).
  16147. @item mpeg/limited/tv
  16148. Set "MPEG" range (16-235 in case of 8-bit luma).
  16149. @end table
  16150. @item in_chroma_loc
  16151. @item out_chroma_loc
  16152. Set in/output chroma sample location. If not specified, center-sited chroma
  16153. is used by default. Possible values:
  16154. @table @samp
  16155. @item auto, unknown
  16156. @item left
  16157. @item center
  16158. @item topleft
  16159. @item top
  16160. @item bottomleft
  16161. @item bottom
  16162. @end table
  16163. @item force_original_aspect_ratio
  16164. Enable decreasing or increasing output video width or height if necessary to
  16165. keep the original aspect ratio. Possible values:
  16166. @table @samp
  16167. @item disable
  16168. Scale the video as specified and disable this feature.
  16169. @item decrease
  16170. The output video dimensions will automatically be decreased if needed.
  16171. @item increase
  16172. The output video dimensions will automatically be increased if needed.
  16173. @end table
  16174. One useful instance of this option is that when you know a specific device's
  16175. maximum allowed resolution, you can use this to limit the output video to
  16176. that, while retaining the aspect ratio. For example, device A allows
  16177. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  16178. decrease) and specifying 1280x720 to the command line makes the output
  16179. 1280x533.
  16180. Please note that this is a different thing than specifying -1 for @option{w}
  16181. or @option{h}, you still need to specify the output resolution for this option
  16182. to work.
  16183. @item force_divisible_by
  16184. Ensures that both the output dimensions, width and height, are divisible by the
  16185. given integer when used together with @option{force_original_aspect_ratio}. This
  16186. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16187. This option respects the value set for @option{force_original_aspect_ratio},
  16188. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16189. may be slightly modified.
  16190. This option can be handy if you need to have a video fit within or exceed
  16191. a defined resolution using @option{force_original_aspect_ratio} but also have
  16192. encoder restrictions on width or height divisibility.
  16193. @end table
  16194. The values of the @option{w} and @option{h} options are expressions
  16195. containing the following constants:
  16196. @table @var
  16197. @item in_w
  16198. @item in_h
  16199. The input width and height
  16200. @item iw
  16201. @item ih
  16202. These are the same as @var{in_w} and @var{in_h}.
  16203. @item out_w
  16204. @item out_h
  16205. The output (scaled) width and height
  16206. @item ow
  16207. @item oh
  16208. These are the same as @var{out_w} and @var{out_h}
  16209. @item a
  16210. The same as @var{iw} / @var{ih}
  16211. @item sar
  16212. input sample aspect ratio
  16213. @item dar
  16214. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16215. @item hsub
  16216. @item vsub
  16217. horizontal and vertical input chroma subsample values. For example for the
  16218. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16219. @item ohsub
  16220. @item ovsub
  16221. horizontal and vertical output chroma subsample values. For example for the
  16222. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16223. @item n
  16224. The (sequential) number of the input frame, starting from 0.
  16225. Only available with @code{eval=frame}.
  16226. @item t
  16227. The presentation timestamp of the input frame, expressed as a number of
  16228. seconds. Only available with @code{eval=frame}.
  16229. @item pos
  16230. The position (byte offset) of the frame in the input stream, or NaN if
  16231. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16232. Only available with @code{eval=frame}.
  16233. Deprecated, do not use.
  16234. @item ref_w, rw
  16235. @item ref_h, rh
  16236. @item ref_a
  16237. @item ref_dar, rdar
  16238. @item ref_n
  16239. @item ref_t
  16240. @item ref_pos
  16241. Eqvuialent to the above, but for a second reference input. If any of these
  16242. variables are present, this filter accepts two inputs.
  16243. @end table
  16244. @subsection Examples
  16245. @itemize
  16246. @item
  16247. Scale the input video to a size of 200x100
  16248. @example
  16249. scale=w=200:h=100
  16250. @end example
  16251. This is equivalent to:
  16252. @example
  16253. scale=200:100
  16254. @end example
  16255. or:
  16256. @example
  16257. scale=200x100
  16258. @end example
  16259. @item
  16260. Specify a size abbreviation for the output size:
  16261. @example
  16262. scale=qcif
  16263. @end example
  16264. which can also be written as:
  16265. @example
  16266. scale=size=qcif
  16267. @end example
  16268. @item
  16269. Scale the input to 2x:
  16270. @example
  16271. scale=w=2*iw:h=2*ih
  16272. @end example
  16273. @item
  16274. The above is the same as:
  16275. @example
  16276. scale=2*in_w:2*in_h
  16277. @end example
  16278. @item
  16279. Scale the input to 2x with forced interlaced scaling:
  16280. @example
  16281. scale=2*iw:2*ih:interl=1
  16282. @end example
  16283. @item
  16284. Scale the input to half size:
  16285. @example
  16286. scale=w=iw/2:h=ih/2
  16287. @end example
  16288. @item
  16289. Increase the width, and set the height to the same size:
  16290. @example
  16291. scale=3/2*iw:ow
  16292. @end example
  16293. @item
  16294. Seek Greek harmony:
  16295. @example
  16296. scale=iw:1/PHI*iw
  16297. scale=ih*PHI:ih
  16298. @end example
  16299. @item
  16300. Increase the height, and set the width to 3/2 of the height:
  16301. @example
  16302. scale=w=3/2*oh:h=3/5*ih
  16303. @end example
  16304. @item
  16305. Increase the size, making the size a multiple of the chroma
  16306. subsample values:
  16307. @example
  16308. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  16309. @end example
  16310. @item
  16311. Increase the width to a maximum of 500 pixels,
  16312. keeping the same aspect ratio as the input:
  16313. @example
  16314. scale=w='min(500\, iw*3/2):h=-1'
  16315. @end example
  16316. @item
  16317. Make pixels square by combining scale and setsar:
  16318. @example
  16319. scale='trunc(ih*dar):ih',setsar=1/1
  16320. @end example
  16321. @item
  16322. Make pixels square by combining scale and setsar,
  16323. making sure the resulting resolution is even (required by some codecs):
  16324. @example
  16325. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  16326. @end example
  16327. @item
  16328. Scale a subtitle stream (sub) to match the main video (main) in size before
  16329. overlaying. ("scale2ref")
  16330. @example
  16331. '[main]split[a][b]; [ref][a]scale=rw:rh[c]; [b][c]overlay'
  16332. @end example
  16333. @item
  16334. Scale a logo to 1/10th the height of a video, while preserving its display
  16335. aspect ratio.
  16336. @example
  16337. [logo-in][video-in]scale=w=oh*dar:h=rh/10[logo-out]
  16338. @end example
  16339. @end itemize
  16340. @subsection Commands
  16341. This filter supports the following commands:
  16342. @table @option
  16343. @item width, w
  16344. @item height, h
  16345. Set the output video dimension expression.
  16346. The command accepts the same syntax of the corresponding option.
  16347. If the specified expression is not valid, it is kept at its current
  16348. value.
  16349. @end table
  16350. @anchor{scale_cuda}
  16351. @section scale_cuda
  16352. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  16353. Setting the output width and height works in the same way as for the @ref{scale} filter.
  16354. The filter accepts the following options:
  16355. @table @option
  16356. @item w
  16357. @item h
  16358. Set the output video dimension expression. Default value is the input dimension.
  16359. Allows for the same expressions as the @ref{scale} filter.
  16360. @item interp_algo
  16361. Sets the algorithm used for scaling:
  16362. @table @var
  16363. @item nearest
  16364. Nearest neighbour
  16365. Used by default if input parameters match the desired output.
  16366. @item bilinear
  16367. Bilinear
  16368. @item bicubic
  16369. Bicubic
  16370. This is the default.
  16371. @item lanczos
  16372. Lanczos
  16373. @end table
  16374. @item format
  16375. Controls the output pixel format. By default, or if none is specified, the input
  16376. pixel format is used.
  16377. The filter does not support converting between YUV and RGB pixel formats.
  16378. @item passthrough
  16379. If set to 0, every frame is processed, even if no conversion is necessary.
  16380. This mode can be useful to use the filter as a buffer for a downstream
  16381. frame-consumer that exhausts the limited decoder frame pool.
  16382. If set to 1, frames are passed through as-is if they match the desired output
  16383. parameters. This is the default behaviour.
  16384. @item param
  16385. Algorithm-Specific parameter.
  16386. Affects the curves of the bicubic algorithm.
  16387. @item force_original_aspect_ratio
  16388. @item force_divisible_by
  16389. Work the same as the identical @ref{scale} filter options.
  16390. @end table
  16391. @subsection Examples
  16392. @itemize
  16393. @item
  16394. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  16395. @example
  16396. scale_cuda=-2:720:format=yuv420p
  16397. @end example
  16398. @item
  16399. Upscale to 4K using nearest neighbour algorithm.
  16400. @example
  16401. scale_cuda=4096:2160:interp_algo=nearest
  16402. @end example
  16403. @item
  16404. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  16405. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  16406. decoders frame pool.
  16407. @example
  16408. scale_cuda=passthrough=0
  16409. @end example
  16410. @end itemize
  16411. @anchor{scale_npp}
  16412. @section scale_npp
  16413. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  16414. format conversion on CUDA video frames. Setting the output width and height
  16415. works in the same way as for the @var{scale} filter.
  16416. The following additional options are accepted:
  16417. @table @option
  16418. @item format
  16419. The pixel format of the output CUDA frames. If set to the string "same" (the
  16420. default), the input format will be kept. Note that automatic format negotiation
  16421. and conversion is not yet supported for hardware frames
  16422. @item interp_algo
  16423. The interpolation algorithm used for resizing. One of the following:
  16424. @table @option
  16425. @item nn
  16426. Nearest neighbour.
  16427. @item linear
  16428. @item cubic
  16429. @item cubic2p_bspline
  16430. 2-parameter cubic (B=1, C=0)
  16431. @item cubic2p_catmullrom
  16432. 2-parameter cubic (B=0, C=1/2)
  16433. @item cubic2p_b05c03
  16434. 2-parameter cubic (B=1/2, C=3/10)
  16435. @item super
  16436. Supersampling
  16437. @item lanczos
  16438. @end table
  16439. @item force_original_aspect_ratio
  16440. Enable decreasing or increasing output video width or height if necessary to
  16441. keep the original aspect ratio. Possible values:
  16442. @table @samp
  16443. @item disable
  16444. Scale the video as specified and disable this feature.
  16445. @item decrease
  16446. The output video dimensions will automatically be decreased if needed.
  16447. @item increase
  16448. The output video dimensions will automatically be increased if needed.
  16449. @end table
  16450. One useful instance of this option is that when you know a specific device's
  16451. maximum allowed resolution, you can use this to limit the output video to
  16452. that, while retaining the aspect ratio. For example, device A allows
  16453. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  16454. decrease) and specifying 1280x720 to the command line makes the output
  16455. 1280x533.
  16456. Please note that this is a different thing than specifying -1 for @option{w}
  16457. or @option{h}, you still need to specify the output resolution for this option
  16458. to work.
  16459. @item force_divisible_by
  16460. Ensures that both the output dimensions, width and height, are divisible by the
  16461. given integer when used together with @option{force_original_aspect_ratio}. This
  16462. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16463. This option respects the value set for @option{force_original_aspect_ratio},
  16464. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16465. may be slightly modified.
  16466. This option can be handy if you need to have a video fit within or exceed
  16467. a defined resolution using @option{force_original_aspect_ratio} but also have
  16468. encoder restrictions on width or height divisibility.
  16469. @item eval
  16470. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  16471. @table @samp
  16472. @item init
  16473. Only evaluate expressions once during the filter initialization or when a command is processed.
  16474. @item frame
  16475. Evaluate expressions for each incoming frame.
  16476. @end table
  16477. @end table
  16478. The values of the @option{w} and @option{h} options are expressions
  16479. containing the following constants:
  16480. @table @var
  16481. @item in_w
  16482. @item in_h
  16483. The input width and height
  16484. @item iw
  16485. @item ih
  16486. These are the same as @var{in_w} and @var{in_h}.
  16487. @item out_w
  16488. @item out_h
  16489. The output (scaled) width and height
  16490. @item ow
  16491. @item oh
  16492. These are the same as @var{out_w} and @var{out_h}
  16493. @item a
  16494. The same as @var{iw} / @var{ih}
  16495. @item sar
  16496. input sample aspect ratio
  16497. @item dar
  16498. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16499. @item n
  16500. The (sequential) number of the input frame, starting from 0.
  16501. Only available with @code{eval=frame}.
  16502. @item t
  16503. The presentation timestamp of the input frame, expressed as a number of
  16504. seconds. Only available with @code{eval=frame}.
  16505. @item pos
  16506. The position (byte offset) of the frame in the input stream, or NaN if
  16507. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16508. Only available with @code{eval=frame}.
  16509. Deprecated, do not use.
  16510. @end table
  16511. @section scale2ref_npp
  16512. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  16513. video, based on a reference video.
  16514. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  16515. but uses the reference video instead of the main input as basis. scale2ref_npp
  16516. also supports the following additional constants for the @option{w} and
  16517. @option{h} options:
  16518. @table @var
  16519. @item main_w
  16520. @item main_h
  16521. The main input video's width and height
  16522. @item main_a
  16523. The same as @var{main_w} / @var{main_h}
  16524. @item main_sar
  16525. The main input video's sample aspect ratio
  16526. @item main_dar, mdar
  16527. The main input video's display aspect ratio. Calculated from
  16528. @code{(main_w / main_h) * main_sar}.
  16529. @item main_n
  16530. The (sequential) number of the main input frame, starting from 0.
  16531. Only available with @code{eval=frame}.
  16532. @item main_t
  16533. The presentation timestamp of the main input frame, expressed as a number of
  16534. seconds. Only available with @code{eval=frame}.
  16535. @item main_pos
  16536. The position (byte offset) of the frame in the main input stream, or NaN if
  16537. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16538. Only available with @code{eval=frame}.
  16539. @end table
  16540. @subsection Examples
  16541. @itemize
  16542. @item
  16543. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  16544. @example
  16545. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  16546. @end example
  16547. @item
  16548. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  16549. @example
  16550. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  16551. @end example
  16552. @end itemize
  16553. @section scale_vt
  16554. Scale and convert the color parameters using VTPixelTransferSession.
  16555. The filter accepts the following options:
  16556. @table @option
  16557. @item w
  16558. @item h
  16559. Set the output video dimension expression. Default value is the input dimension.
  16560. @item color_matrix
  16561. Set the output colorspace matrix.
  16562. @item color_primaries
  16563. Set the output color primaries.
  16564. @item color_transfer
  16565. Set the output transfer characteristics.
  16566. @end table
  16567. @section scharr
  16568. Apply scharr operator to input video stream.
  16569. The filter accepts the following option:
  16570. @table @option
  16571. @item planes
  16572. Set which planes will be processed, unprocessed planes will be copied.
  16573. By default value 0xf, all planes will be processed.
  16574. @item scale
  16575. Set value which will be multiplied with filtered result.
  16576. @item delta
  16577. Set value which will be added to filtered result.
  16578. @end table
  16579. @subsection Commands
  16580. This filter supports the all above options as @ref{commands}.
  16581. @section scroll
  16582. Scroll input video horizontally and/or vertically by constant speed.
  16583. The filter accepts the following options:
  16584. @table @option
  16585. @item horizontal, h
  16586. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16587. Negative values changes scrolling direction.
  16588. @item vertical, v
  16589. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16590. Negative values changes scrolling direction.
  16591. @item hpos
  16592. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  16593. @item vpos
  16594. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  16595. @end table
  16596. @subsection Commands
  16597. This filter supports the following @ref{commands}:
  16598. @table @option
  16599. @item horizontal, h
  16600. Set the horizontal scrolling speed.
  16601. @item vertical, v
  16602. Set the vertical scrolling speed.
  16603. @end table
  16604. @anchor{scdet}
  16605. @section scdet
  16606. Detect video scene change.
  16607. This filter sets frame metadata with mafd between frame, the scene score, and
  16608. forward the frame to the next filter, so they can use these metadata to detect
  16609. scene change or others.
  16610. In addition, this filter logs a message and sets frame metadata when it detects
  16611. a scene change by @option{threshold}.
  16612. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  16613. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  16614. to detect scene change.
  16615. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  16616. detect scene change with @option{threshold}.
  16617. The filter accepts the following options:
  16618. @table @option
  16619. @item threshold, t
  16620. Set the scene change detection threshold as a percentage of maximum change. Good
  16621. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  16622. @code{[0., 100.]}.
  16623. Default value is @code{10.}.
  16624. @item sc_pass, s
  16625. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  16626. You can enable it if you want to get snapshot of scene change frames only.
  16627. @end table
  16628. @anchor{selectivecolor}
  16629. @section selectivecolor
  16630. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  16631. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  16632. by the "purity" of the color (that is, how saturated it already is).
  16633. This filter is similar to the Adobe Photoshop Selective Color tool.
  16634. The filter accepts the following options:
  16635. @table @option
  16636. @item correction_method
  16637. Select color correction method.
  16638. Available values are:
  16639. @table @samp
  16640. @item absolute
  16641. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  16642. component value).
  16643. @item relative
  16644. Specified adjustments are relative to the original component value.
  16645. @end table
  16646. Default is @code{absolute}.
  16647. @item reds
  16648. Adjustments for red pixels (pixels where the red component is the maximum)
  16649. @item yellows
  16650. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  16651. @item greens
  16652. Adjustments for green pixels (pixels where the green component is the maximum)
  16653. @item cyans
  16654. Adjustments for cyan pixels (pixels where the red component is the minimum)
  16655. @item blues
  16656. Adjustments for blue pixels (pixels where the blue component is the maximum)
  16657. @item magentas
  16658. Adjustments for magenta pixels (pixels where the green component is the minimum)
  16659. @item whites
  16660. Adjustments for white pixels (pixels where all components are greater than 128)
  16661. @item neutrals
  16662. Adjustments for all pixels except pure black and pure white
  16663. @item blacks
  16664. Adjustments for black pixels (pixels where all components are lesser than 128)
  16665. @item psfile
  16666. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  16667. @end table
  16668. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  16669. 4 space separated floating point adjustment values in the [-1,1] range,
  16670. respectively to adjust the amount of cyan, magenta, yellow and black for the
  16671. pixels of its range.
  16672. @subsection Examples
  16673. @itemize
  16674. @item
  16675. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  16676. increase magenta by 27% in blue areas:
  16677. @example
  16678. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  16679. @end example
  16680. @item
  16681. Use a Photoshop selective color preset:
  16682. @example
  16683. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  16684. @end example
  16685. @end itemize
  16686. @anchor{separatefields}
  16687. @section separatefields
  16688. The @code{separatefields} takes a frame-based video input and splits
  16689. each frame into its components fields, producing a new half height clip
  16690. with twice the frame rate and twice the frame count.
  16691. This filter use field-dominance information in frame to decide which
  16692. of each pair of fields to place first in the output.
  16693. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  16694. @section setdar, setsar
  16695. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  16696. output video.
  16697. This is done by changing the specified Sample (aka Pixel) Aspect
  16698. Ratio, according to the following equation:
  16699. @example
  16700. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  16701. @end example
  16702. Keep in mind that the @code{setdar} filter does not modify the pixel
  16703. dimensions of the video frame. Also, the display aspect ratio set by
  16704. this filter may be changed by later filters in the filterchain,
  16705. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  16706. applied.
  16707. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  16708. the filter output video.
  16709. Note that as a consequence of the application of this filter, the
  16710. output display aspect ratio will change according to the equation
  16711. above.
  16712. Keep in mind that the sample aspect ratio set by the @code{setsar}
  16713. filter may be changed by later filters in the filterchain, e.g. if
  16714. another "setsar" or a "setdar" filter is applied.
  16715. It accepts the following parameters:
  16716. @table @option
  16717. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  16718. Set the aspect ratio used by the filter.
  16719. The parameter can be a floating point number string, or an expression. If the
  16720. parameter is not specified, the value "0" is assumed, meaning that the same
  16721. input value is used.
  16722. @item max
  16723. Set the maximum integer value to use for expressing numerator and
  16724. denominator when reducing the expressed aspect ratio to a rational.
  16725. Default value is @code{100}.
  16726. @end table
  16727. The parameter @var{sar} is an expression containing the following constants:
  16728. @table @option
  16729. @item w, h
  16730. The input width and height.
  16731. @item a
  16732. Same as @var{w} / @var{h}.
  16733. @item sar
  16734. The input sample aspect ratio.
  16735. @item dar
  16736. The input display aspect ratio. It is the same as
  16737. (@var{w} / @var{h}) * @var{sar}.
  16738. @item hsub, vsub
  16739. Horizontal and vertical chroma subsample values. For example, for the
  16740. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16741. @end table
  16742. @subsection Examples
  16743. @itemize
  16744. @item
  16745. To change the display aspect ratio to 16:9, specify one of the following:
  16746. @example
  16747. setdar=dar=1.77777
  16748. setdar=dar=16/9
  16749. @end example
  16750. @item
  16751. To change the sample aspect ratio to 10:11, specify:
  16752. @example
  16753. setsar=sar=10/11
  16754. @end example
  16755. @item
  16756. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  16757. 1000 in the aspect ratio reduction, use the command:
  16758. @example
  16759. setdar=ratio=16/9:max=1000
  16760. @end example
  16761. @end itemize
  16762. @anchor{setfield}
  16763. @section setfield
  16764. Force field for the output video frame.
  16765. The @code{setfield} filter marks the interlace type field for the
  16766. output frames. It does not change the input frame, but only sets the
  16767. corresponding property, which affects how the frame is treated by
  16768. following filters (e.g. @code{fieldorder} or @code{yadif}).
  16769. The filter accepts the following options:
  16770. @table @option
  16771. @item mode
  16772. Available values are:
  16773. @table @samp
  16774. @item auto
  16775. Keep the same field property.
  16776. @item bff
  16777. Mark the frame as bottom-field-first.
  16778. @item tff
  16779. Mark the frame as top-field-first.
  16780. @item prog
  16781. Mark the frame as progressive.
  16782. @end table
  16783. @end table
  16784. @anchor{setparams}
  16785. @section setparams
  16786. Force frame parameter for the output video frame.
  16787. The @code{setparams} filter marks interlace and color range for the
  16788. output frames. It does not change the input frame, but only sets the
  16789. corresponding property, which affects how the frame is treated by
  16790. filters/encoders.
  16791. @table @option
  16792. @item field_mode
  16793. Available values are:
  16794. @table @samp
  16795. @item auto
  16796. Keep the same field property (default).
  16797. @item bff
  16798. Mark the frame as bottom-field-first.
  16799. @item tff
  16800. Mark the frame as top-field-first.
  16801. @item prog
  16802. Mark the frame as progressive.
  16803. @end table
  16804. @item range
  16805. Available values are:
  16806. @table @samp
  16807. @item auto
  16808. Keep the same color range property (default).
  16809. @item unspecified, unknown
  16810. Mark the frame as unspecified color range.
  16811. @item limited, tv, mpeg
  16812. Mark the frame as limited range.
  16813. @item full, pc, jpeg
  16814. Mark the frame as full range.
  16815. @end table
  16816. @item color_primaries
  16817. Set the color primaries.
  16818. Available values are:
  16819. @table @samp
  16820. @item auto
  16821. Keep the same color primaries property (default).
  16822. @item bt709
  16823. @item unknown
  16824. @item bt470m
  16825. @item bt470bg
  16826. @item smpte170m
  16827. @item smpte240m
  16828. @item film
  16829. @item bt2020
  16830. @item smpte428
  16831. @item smpte431
  16832. @item smpte432
  16833. @item jedec-p22
  16834. @end table
  16835. @item color_trc
  16836. Set the color transfer.
  16837. Available values are:
  16838. @table @samp
  16839. @item auto
  16840. Keep the same color trc property (default).
  16841. @item bt709
  16842. @item unknown
  16843. @item bt470m
  16844. @item bt470bg
  16845. @item smpte170m
  16846. @item smpte240m
  16847. @item linear
  16848. @item log100
  16849. @item log316
  16850. @item iec61966-2-4
  16851. @item bt1361e
  16852. @item iec61966-2-1
  16853. @item bt2020-10
  16854. @item bt2020-12
  16855. @item smpte2084
  16856. @item smpte428
  16857. @item arib-std-b67
  16858. @end table
  16859. @item colorspace
  16860. Set the colorspace.
  16861. Available values are:
  16862. @table @samp
  16863. @item auto
  16864. Keep the same colorspace property (default).
  16865. @item gbr
  16866. @item bt709
  16867. @item unknown
  16868. @item fcc
  16869. @item bt470bg
  16870. @item smpte170m
  16871. @item smpte240m
  16872. @item ycgco
  16873. @item bt2020nc
  16874. @item bt2020c
  16875. @item smpte2085
  16876. @item chroma-derived-nc
  16877. @item chroma-derived-c
  16878. @item ictcp
  16879. @end table
  16880. @item chroma_location
  16881. Set the chroma sample location.
  16882. Available values are:
  16883. @table @samp
  16884. @item auto
  16885. Keep the same chroma location (default).
  16886. @item unspecified, unknown
  16887. @item left
  16888. @item center
  16889. @item topleft
  16890. @item top
  16891. @item bottomleft
  16892. @item bottom
  16893. @end table
  16894. @end table
  16895. @section sharpen_npp
  16896. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  16897. border control.
  16898. The following additional options are accepted:
  16899. @table @option
  16900. @item border_type
  16901. Type of sampling to be used ad frame borders. One of the following:
  16902. @table @option
  16903. @item replicate
  16904. Replicate pixel values.
  16905. @end table
  16906. @end table
  16907. @section shear
  16908. Apply shear transform to input video.
  16909. This filter supports the following options:
  16910. @table @option
  16911. @item shx
  16912. Shear factor in X-direction. Default value is 0.
  16913. Allowed range is from -2 to 2.
  16914. @item shy
  16915. Shear factor in Y-direction. Default value is 0.
  16916. Allowed range is from -2 to 2.
  16917. @item fillcolor, c
  16918. Set the color used to fill the output area not covered by the transformed
  16919. video. For the general syntax of this option, check the
  16920. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16921. If the special value "none" is selected then no
  16922. background is printed (useful for example if the background is never shown).
  16923. Default value is "black".
  16924. @item interp
  16925. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16926. @end table
  16927. @subsection Commands
  16928. This filter supports the all above options as @ref{commands}.
  16929. @section showinfo
  16930. Show a line containing various information for each input video frame.
  16931. The input video is not modified.
  16932. This filter supports the following options:
  16933. @table @option
  16934. @item checksum
  16935. Calculate checksums of each plane. By default enabled.
  16936. @item udu_sei_as_ascii
  16937. Try to print user data unregistered SEI as ascii character when possible,
  16938. in hex format otherwise.
  16939. @end table
  16940. The shown line contains a sequence of key/value pairs of the form
  16941. @var{key}:@var{value}.
  16942. The following values are shown in the output:
  16943. @table @option
  16944. @item n
  16945. The (sequential) number of the input frame, starting from 0.
  16946. @item pts
  16947. The Presentation TimeStamp of the input frame, expressed as a number of
  16948. time base units. The time base unit depends on the filter input pad.
  16949. @item pts_time
  16950. The Presentation TimeStamp of the input frame, expressed as a number of
  16951. seconds.
  16952. @item fmt
  16953. The pixel format name.
  16954. @item sar
  16955. The sample aspect ratio of the input frame, expressed in the form
  16956. @var{num}/@var{den}.
  16957. @item s
  16958. The size of the input frame. For the syntax of this option, check the
  16959. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16960. @item i
  16961. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16962. for bottom field first).
  16963. @item iskey
  16964. This is 1 if the frame is a key frame, 0 otherwise.
  16965. @item type
  16966. The picture type of the input frame ("I" for an I-frame, "P" for a
  16967. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16968. Also refer to the documentation of the @code{AVPictureType} enum and of
  16969. the @code{av_get_picture_type_char} function defined in
  16970. @file{libavutil/avutil.h}.
  16971. @item checksum
  16972. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16973. @item plane_checksum
  16974. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16975. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16976. @item mean
  16977. The mean value of pixels in each plane of the input frame, expressed in the form
  16978. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16979. @item stdev
  16980. The standard deviation of pixel values in each plane of the input frame, expressed
  16981. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16982. @end table
  16983. @section showpalette
  16984. Displays the 256 colors palette of each frame. This filter is only relevant for
  16985. @var{pal8} pixel format frames.
  16986. It accepts the following option:
  16987. @table @option
  16988. @item s
  16989. Set the size of the box used to represent one palette color entry. Default is
  16990. @code{30} (for a @code{30x30} pixel box).
  16991. @end table
  16992. @section shuffleframes
  16993. Reorder and/or duplicate and/or drop video frames.
  16994. It accepts the following parameters:
  16995. @table @option
  16996. @item mapping
  16997. Set the destination indexes of input frames.
  16998. This is space or '|' separated list of indexes that maps input frames to output
  16999. frames. Number of indexes also sets maximal value that each index may have.
  17000. '-1' index have special meaning and that is to drop frame.
  17001. @end table
  17002. The first frame has the index 0. The default is to keep the input unchanged.
  17003. @subsection Examples
  17004. @itemize
  17005. @item
  17006. Swap second and third frame of every three frames of the input:
  17007. @example
  17008. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  17009. @end example
  17010. @item
  17011. Swap 10th and 1st frame of every ten frames of the input:
  17012. @example
  17013. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  17014. @end example
  17015. @end itemize
  17016. @section shufflepixels
  17017. Reorder pixels in video frames.
  17018. This filter accepts the following options:
  17019. @table @option
  17020. @item direction, d
  17021. Set shuffle direction. Can be forward or inverse direction.
  17022. Default direction is forward.
  17023. @item mode, m
  17024. Set shuffle mode. Can be horizontal, vertical or block mode.
  17025. @item width, w
  17026. @item height, h
  17027. Set shuffle block_size. In case of horizontal shuffle mode only width
  17028. part of size is used, and in case of vertical shuffle mode only height
  17029. part of size is used.
  17030. @item seed, s
  17031. Set random seed used with shuffling pixels. Mainly useful to set to be able
  17032. to reverse filtering process to get original input.
  17033. For example, to reverse forward shuffle you need to use same parameters
  17034. and exact same seed and to set direction to inverse.
  17035. @end table
  17036. @section shuffleplanes
  17037. Reorder and/or duplicate video planes.
  17038. It accepts the following parameters:
  17039. @table @option
  17040. @item map0
  17041. The index of the input plane to be used as the first output plane.
  17042. @item map1
  17043. The index of the input plane to be used as the second output plane.
  17044. @item map2
  17045. The index of the input plane to be used as the third output plane.
  17046. @item map3
  17047. The index of the input plane to be used as the fourth output plane.
  17048. @end table
  17049. The first plane has the index 0. The default is to keep the input unchanged.
  17050. @subsection Examples
  17051. @itemize
  17052. @item
  17053. Swap the second and third planes of the input:
  17054. @example
  17055. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  17056. @end example
  17057. @end itemize
  17058. @anchor{signalstats}
  17059. @section signalstats
  17060. Evaluate various visual metrics that assist in determining issues associated
  17061. with the digitization of analog video media.
  17062. By default the filter will log these metadata values:
  17063. @table @option
  17064. @item YMIN
  17065. Display the minimal Y value contained within the input frame. Expressed in
  17066. range of [0-255].
  17067. @item YLOW
  17068. Display the Y value at the 10% percentile within the input frame. Expressed in
  17069. range of [0-255].
  17070. @item YAVG
  17071. Display the average Y value within the input frame. Expressed in range of
  17072. [0-255].
  17073. @item YHIGH
  17074. Display the Y value at the 90% percentile within the input frame. Expressed in
  17075. range of [0-255].
  17076. @item YMAX
  17077. Display the maximum Y value contained within the input frame. Expressed in
  17078. range of [0-255].
  17079. @item UMIN
  17080. Display the minimal U value contained within the input frame. Expressed in
  17081. range of [0-255].
  17082. @item ULOW
  17083. Display the U value at the 10% percentile within the input frame. Expressed in
  17084. range of [0-255].
  17085. @item UAVG
  17086. Display the average U value within the input frame. Expressed in range of
  17087. [0-255].
  17088. @item UHIGH
  17089. Display the U value at the 90% percentile within the input frame. Expressed in
  17090. range of [0-255].
  17091. @item UMAX
  17092. Display the maximum U value contained within the input frame. Expressed in
  17093. range of [0-255].
  17094. @item VMIN
  17095. Display the minimal V value contained within the input frame. Expressed in
  17096. range of [0-255].
  17097. @item VLOW
  17098. Display the V value at the 10% percentile within the input frame. Expressed in
  17099. range of [0-255].
  17100. @item VAVG
  17101. Display the average V value within the input frame. Expressed in range of
  17102. [0-255].
  17103. @item VHIGH
  17104. Display the V value at the 90% percentile within the input frame. Expressed in
  17105. range of [0-255].
  17106. @item VMAX
  17107. Display the maximum V value contained within the input frame. Expressed in
  17108. range of [0-255].
  17109. @item SATMIN
  17110. Display the minimal saturation value contained within the input frame.
  17111. Expressed in range of [0-~181.02].
  17112. @item SATLOW
  17113. Display the saturation value at the 10% percentile within the input frame.
  17114. Expressed in range of [0-~181.02].
  17115. @item SATAVG
  17116. Display the average saturation value within the input frame. Expressed in range
  17117. of [0-~181.02].
  17118. @item SATHIGH
  17119. Display the saturation value at the 90% percentile within the input frame.
  17120. Expressed in range of [0-~181.02].
  17121. @item SATMAX
  17122. Display the maximum saturation value contained within the input frame.
  17123. Expressed in range of [0-~181.02].
  17124. @item HUEMED
  17125. Display the median value for hue within the input frame. Expressed in range of
  17126. [0-360].
  17127. @item HUEAVG
  17128. Display the average value for hue within the input frame. Expressed in range of
  17129. [0-360].
  17130. @item YDIF
  17131. Display the average of sample value difference between all values of the Y
  17132. plane in the current frame and corresponding values of the previous input frame.
  17133. Expressed in range of [0-255].
  17134. @item UDIF
  17135. Display the average of sample value difference between all values of the U
  17136. plane in the current frame and corresponding values of the previous input frame.
  17137. Expressed in range of [0-255].
  17138. @item VDIF
  17139. Display the average of sample value difference between all values of the V
  17140. plane in the current frame and corresponding values of the previous input frame.
  17141. Expressed in range of [0-255].
  17142. @item YBITDEPTH
  17143. Display bit depth of Y plane in current frame.
  17144. Expressed in range of [0-16].
  17145. @item UBITDEPTH
  17146. Display bit depth of U plane in current frame.
  17147. Expressed in range of [0-16].
  17148. @item VBITDEPTH
  17149. Display bit depth of V plane in current frame.
  17150. Expressed in range of [0-16].
  17151. @end table
  17152. The filter accepts the following options:
  17153. @table @option
  17154. @item stat
  17155. @item out
  17156. @option{stat} specify an additional form of image analysis.
  17157. @option{out} output video with the specified type of pixel highlighted.
  17158. Both options accept the following values:
  17159. @table @samp
  17160. @item tout
  17161. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  17162. unlike the neighboring pixels of the same field. Examples of temporal outliers
  17163. include the results of video dropouts, head clogs, or tape tracking issues.
  17164. @item vrep
  17165. Identify @var{vertical line repetition}. Vertical line repetition includes
  17166. similar rows of pixels within a frame. In born-digital video vertical line
  17167. repetition is common, but this pattern is uncommon in video digitized from an
  17168. analog source. When it occurs in video that results from the digitization of an
  17169. analog source it can indicate concealment from a dropout compensator.
  17170. @item brng
  17171. Identify pixels that fall outside of legal broadcast range.
  17172. @end table
  17173. @item color, c
  17174. Set the highlight color for the @option{out} option. The default color is
  17175. yellow.
  17176. @end table
  17177. @subsection Examples
  17178. @itemize
  17179. @item
  17180. Output data of various video metrics:
  17181. @example
  17182. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  17183. @end example
  17184. @item
  17185. Output specific data about the minimum and maximum values of the Y plane per frame:
  17186. @example
  17187. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  17188. @end example
  17189. @item
  17190. Playback video while highlighting pixels that are outside of broadcast range in red.
  17191. @example
  17192. ffplay example.mov -vf signalstats="out=brng:color=red"
  17193. @end example
  17194. @item
  17195. Playback video with signalstats metadata drawn over the frame.
  17196. @example
  17197. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  17198. @end example
  17199. The contents of signalstat_drawtext.txt used in the command are:
  17200. @example
  17201. time %@{pts:hms@}
  17202. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  17203. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  17204. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  17205. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  17206. @end example
  17207. @end itemize
  17208. @anchor{signature}
  17209. @section signature
  17210. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  17211. input. In this case the matching between the inputs can be calculated additionally.
  17212. The filter always passes through the first input. The signature of each stream can
  17213. be written into a file.
  17214. It accepts the following options:
  17215. @table @option
  17216. @item detectmode
  17217. Enable or disable the matching process.
  17218. Available values are:
  17219. @table @samp
  17220. @item off
  17221. Disable the calculation of a matching (default).
  17222. @item full
  17223. Calculate the matching for the whole video and output whether the whole video
  17224. matches or only parts.
  17225. @item fast
  17226. Calculate only until a matching is found or the video ends. Should be faster in
  17227. some cases.
  17228. @end table
  17229. @item nb_inputs
  17230. Set the number of inputs. The option value must be a non negative integer.
  17231. Default value is 1.
  17232. @item filename
  17233. Set the path to which the output is written. If there is more than one input,
  17234. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  17235. integer), that will be replaced with the input number. If no filename is
  17236. specified, no output will be written. This is the default.
  17237. @item format
  17238. Choose the output format.
  17239. Available values are:
  17240. @table @samp
  17241. @item binary
  17242. Use the specified binary representation (default).
  17243. @item xml
  17244. Use the specified xml representation.
  17245. @end table
  17246. @item th_d
  17247. Set threshold to detect one word as similar. The option value must be an integer
  17248. greater than zero. The default value is 9000.
  17249. @item th_dc
  17250. Set threshold to detect all words as similar. The option value must be an integer
  17251. greater than zero. The default value is 60000.
  17252. @item th_xh
  17253. Set threshold to detect frames as similar. The option value must be an integer
  17254. greater than zero. The default value is 116.
  17255. @item th_di
  17256. Set the minimum length of a sequence in frames to recognize it as matching
  17257. sequence. The option value must be a non negative integer value.
  17258. The default value is 0.
  17259. @item th_it
  17260. Set the minimum relation, that matching frames to all frames must have.
  17261. The option value must be a double value between 0 and 1. The default value is 0.5.
  17262. @end table
  17263. @subsection Examples
  17264. @itemize
  17265. @item
  17266. To calculate the signature of an input video and store it in signature.bin:
  17267. @example
  17268. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  17269. @end example
  17270. @item
  17271. To detect whether two videos match and store the signatures in XML format in
  17272. signature0.xml and signature1.xml:
  17273. @example
  17274. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  17275. @end example
  17276. @end itemize
  17277. @anchor{siti}
  17278. @section siti
  17279. Calculate Spatial Information (SI) and Temporal Information (TI) scores for a video,
  17280. as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment methods
  17281. for multimedia applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
  17282. Note that this is a legacy implementation that corresponds to a superseded recommendation.
  17283. Refer to ITU-T Rec. P.910 (07/22) for the latest version: @url{https://www.itu.int/rec/T-REC-P.910-202207-I/en}
  17284. It accepts the following option:
  17285. @table @option
  17286. @item print_summary
  17287. If set to 1, Summary statistics will be printed to the console. Default 0.
  17288. @end table
  17289. @subsection Examples
  17290. @itemize
  17291. @item
  17292. To calculate SI/TI metrics and print summary:
  17293. @example
  17294. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  17295. @end example
  17296. @end itemize
  17297. @anchor{smartblur}
  17298. @section smartblur
  17299. Blur the input video without impacting the outlines.
  17300. It accepts the following options:
  17301. @table @option
  17302. @item luma_radius, lr
  17303. Set the luma radius. The option value must be a float number in
  17304. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17305. used to blur the image (slower if larger). Default value is 1.0.
  17306. @item luma_strength, ls
  17307. Set the luma strength. The option value must be a float number
  17308. in the range [-1.0,1.0] that configures the blurring. A value included
  17309. in [0.0,1.0] will blur the image whereas a value included in
  17310. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  17311. @item luma_threshold, lt
  17312. Set the luma threshold used as a coefficient to determine
  17313. whether a pixel should be blurred or not. The option value must be an
  17314. integer in the range [-30,30]. A value of 0 will filter all the image,
  17315. a value included in [0,30] will filter flat areas and a value included
  17316. in [-30,0] will filter edges. Default value is 0.
  17317. @item chroma_radius, cr
  17318. Set the chroma radius. The option value must be a float number in
  17319. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17320. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  17321. @item chroma_strength, cs
  17322. Set the chroma strength. The option value must be a float number
  17323. in the range [-1.0,1.0] that configures the blurring. A value included
  17324. in [0.0,1.0] will blur the image whereas a value included in
  17325. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  17326. @item chroma_threshold, ct
  17327. Set the chroma threshold used as a coefficient to determine
  17328. whether a pixel should be blurred or not. The option value must be an
  17329. integer in the range [-30,30]. A value of 0 will filter all the image,
  17330. a value included in [0,30] will filter flat areas and a value included
  17331. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  17332. @item alpha_radius, ar
  17333. Set the alpha radius. The option value must be a float number in
  17334. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17335. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  17336. @item alpha_strength, as
  17337. Set the alpha strength. The option value must be a float number
  17338. in the range [-1.0,1.0] that configures the blurring. A value included
  17339. in [0.0,1.0] will blur the image whereas a value included in
  17340. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  17341. @item alpha_threshold, at
  17342. Set the alpha threshold used as a coefficient to determine
  17343. whether a pixel should be blurred or not. The option value must be an
  17344. integer in the range [-30,30]. A value of 0 will filter all the image,
  17345. a value included in [0,30] will filter flat areas and a value included
  17346. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  17347. @end table
  17348. If a chroma or alpha option is not explicitly set, the corresponding luma value
  17349. is set.
  17350. @section sobel
  17351. Apply sobel operator to input video stream.
  17352. The filter accepts the following option:
  17353. @table @option
  17354. @item planes
  17355. Set which planes will be processed, unprocessed planes will be copied.
  17356. By default value 0xf, all planes will be processed.
  17357. @item scale
  17358. Set value which will be multiplied with filtered result.
  17359. @item delta
  17360. Set value which will be added to filtered result.
  17361. @end table
  17362. @subsection Commands
  17363. This filter supports the all above options as @ref{commands}.
  17364. @anchor{spp}
  17365. @section spp
  17366. Apply a simple postprocessing filter that compresses and decompresses the image
  17367. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  17368. and average the results.
  17369. The filter accepts the following options:
  17370. @table @option
  17371. @item quality
  17372. Set quality. This option defines the number of levels for averaging. It accepts
  17373. an integer in the range 0-6. If set to @code{0}, the filter will have no
  17374. effect. A value of @code{6} means the higher quality. For each increment of
  17375. that value the speed drops by a factor of approximately 2. Default value is
  17376. @code{3}.
  17377. @item qp
  17378. Force a constant quantization parameter. If not set, the filter will use the QP
  17379. from the video stream (if available).
  17380. @item mode
  17381. Set thresholding mode. Available modes are:
  17382. @table @samp
  17383. @item hard
  17384. Set hard thresholding (default).
  17385. @item soft
  17386. Set soft thresholding (better de-ringing effect, but likely blurrier).
  17387. @end table
  17388. @item use_bframe_qp
  17389. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  17390. option may cause flicker since the B-Frames have often larger QP. Default is
  17391. @code{0} (not enabled).
  17392. @end table
  17393. @subsection Commands
  17394. This filter supports the following commands:
  17395. @table @option
  17396. @item quality, level
  17397. Set quality level. The value @code{max} can be used to set the maximum level,
  17398. currently @code{6}.
  17399. @end table
  17400. @anchor{sr}
  17401. @section sr
  17402. Scale the input by applying one of the super-resolution methods based on
  17403. convolutional neural networks. Supported models:
  17404. @itemize
  17405. @item
  17406. Super-Resolution Convolutional Neural Network model (SRCNN).
  17407. See @url{https://arxiv.org/abs/1501.00092}.
  17408. @item
  17409. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  17410. See @url{https://arxiv.org/abs/1609.05158}.
  17411. @end itemize
  17412. Training scripts as well as scripts for model file (.pb) saving can be found at
  17413. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  17414. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  17415. The filter accepts the following options:
  17416. @table @option
  17417. @item dnn_backend
  17418. Specify which DNN backend to use for model loading and execution. This option accepts
  17419. the following values:
  17420. @table @samp
  17421. @item tensorflow
  17422. TensorFlow backend. To enable this backend you
  17423. need to install the TensorFlow for C library (see
  17424. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  17425. @code{--enable-libtensorflow}
  17426. @end table
  17427. @item model
  17428. Set path to model file specifying network architecture and its parameters.
  17429. Note that different backends use different file formats. TensorFlow, OpenVINO backend
  17430. can load files for only its format.
  17431. @item scale_factor
  17432. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  17433. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  17434. input upscaled using bicubic upscaling with proper scale factor.
  17435. @end table
  17436. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  17437. @section ssim
  17438. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  17439. This filter takes in input two input videos, the first input is
  17440. considered the "main" source and is passed unchanged to the
  17441. output. The second input is used as a "reference" video for computing
  17442. the SSIM.
  17443. Both video inputs must have the same resolution and pixel format for
  17444. this filter to work correctly. Also it assumes that both inputs
  17445. have the same number of frames, which are compared one by one.
  17446. The filter stores the calculated SSIM of each frame.
  17447. The description of the accepted parameters follows.
  17448. @table @option
  17449. @item stats_file, f
  17450. If specified the filter will use the named file to save the SSIM of
  17451. each individual frame. When filename equals "-" the data is sent to
  17452. standard output.
  17453. @end table
  17454. The file printed if @var{stats_file} is selected, contains a sequence of
  17455. key/value pairs of the form @var{key}:@var{value} for each compared
  17456. couple of frames.
  17457. A description of each shown parameter follows:
  17458. @table @option
  17459. @item n
  17460. sequential number of the input frame, starting from 1
  17461. @item Y, U, V, R, G, B
  17462. SSIM of the compared frames for the component specified by the suffix.
  17463. @item All
  17464. SSIM of the compared frames for the whole frame.
  17465. @item dB
  17466. Same as above but in dB representation.
  17467. @end table
  17468. This filter also supports the @ref{framesync} options.
  17469. @subsection Examples
  17470. @itemize
  17471. @item
  17472. For example:
  17473. @example
  17474. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  17475. [main][ref] ssim="stats_file=stats.log" [out]
  17476. @end example
  17477. On this example the input file being processed is compared with the
  17478. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  17479. is stored in @file{stats.log}.
  17480. @item
  17481. Another example with both psnr and ssim at same time:
  17482. @example
  17483. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  17484. @end example
  17485. @item
  17486. Another example with different containers:
  17487. @example
  17488. ffmpeg -i main.mpg -i ref.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]ssim" -f null -
  17489. @end example
  17490. @end itemize
  17491. @section stereo3d
  17492. Convert between different stereoscopic image formats.
  17493. The filters accept the following options:
  17494. @table @option
  17495. @item in
  17496. Set stereoscopic image format of input.
  17497. Available values for input image formats are:
  17498. @table @samp
  17499. @item sbsl
  17500. side by side parallel (left eye left, right eye right)
  17501. @item sbsr
  17502. side by side crosseye (right eye left, left eye right)
  17503. @item sbs2l
  17504. side by side parallel with half width resolution
  17505. (left eye left, right eye right)
  17506. @item sbs2r
  17507. side by side crosseye with half width resolution
  17508. (right eye left, left eye right)
  17509. @item abl
  17510. @item tbl
  17511. above-below (left eye above, right eye below)
  17512. @item abr
  17513. @item tbr
  17514. above-below (right eye above, left eye below)
  17515. @item ab2l
  17516. @item tb2l
  17517. above-below with half height resolution
  17518. (left eye above, right eye below)
  17519. @item ab2r
  17520. @item tb2r
  17521. above-below with half height resolution
  17522. (right eye above, left eye below)
  17523. @item al
  17524. alternating frames (left eye first, right eye second)
  17525. @item ar
  17526. alternating frames (right eye first, left eye second)
  17527. @item irl
  17528. interleaved rows (left eye has top row, right eye starts on next row)
  17529. @item irr
  17530. interleaved rows (right eye has top row, left eye starts on next row)
  17531. @item icl
  17532. interleaved columns, left eye first
  17533. @item icr
  17534. interleaved columns, right eye first
  17535. Default value is @samp{sbsl}.
  17536. @end table
  17537. @item out
  17538. Set stereoscopic image format of output.
  17539. @table @samp
  17540. @item sbsl
  17541. side by side parallel (left eye left, right eye right)
  17542. @item sbsr
  17543. side by side crosseye (right eye left, left eye right)
  17544. @item sbs2l
  17545. side by side parallel with half width resolution
  17546. (left eye left, right eye right)
  17547. @item sbs2r
  17548. side by side crosseye with half width resolution
  17549. (right eye left, left eye right)
  17550. @item abl
  17551. @item tbl
  17552. above-below (left eye above, right eye below)
  17553. @item abr
  17554. @item tbr
  17555. above-below (right eye above, left eye below)
  17556. @item ab2l
  17557. @item tb2l
  17558. above-below with half height resolution
  17559. (left eye above, right eye below)
  17560. @item ab2r
  17561. @item tb2r
  17562. above-below with half height resolution
  17563. (right eye above, left eye below)
  17564. @item al
  17565. alternating frames (left eye first, right eye second)
  17566. @item ar
  17567. alternating frames (right eye first, left eye second)
  17568. @item irl
  17569. interleaved rows (left eye has top row, right eye starts on next row)
  17570. @item irr
  17571. interleaved rows (right eye has top row, left eye starts on next row)
  17572. @item arbg
  17573. anaglyph red/blue gray
  17574. (red filter on left eye, blue filter on right eye)
  17575. @item argg
  17576. anaglyph red/green gray
  17577. (red filter on left eye, green filter on right eye)
  17578. @item arcg
  17579. anaglyph red/cyan gray
  17580. (red filter on left eye, cyan filter on right eye)
  17581. @item arch
  17582. anaglyph red/cyan half colored
  17583. (red filter on left eye, cyan filter on right eye)
  17584. @item arcc
  17585. anaglyph red/cyan color
  17586. (red filter on left eye, cyan filter on right eye)
  17587. @item arcd
  17588. anaglyph red/cyan color optimized with the least squares projection of dubois
  17589. (red filter on left eye, cyan filter on right eye)
  17590. @item agmg
  17591. anaglyph green/magenta gray
  17592. (green filter on left eye, magenta filter on right eye)
  17593. @item agmh
  17594. anaglyph green/magenta half colored
  17595. (green filter on left eye, magenta filter on right eye)
  17596. @item agmc
  17597. anaglyph green/magenta colored
  17598. (green filter on left eye, magenta filter on right eye)
  17599. @item agmd
  17600. anaglyph green/magenta color optimized with the least squares projection of dubois
  17601. (green filter on left eye, magenta filter on right eye)
  17602. @item aybg
  17603. anaglyph yellow/blue gray
  17604. (yellow filter on left eye, blue filter on right eye)
  17605. @item aybh
  17606. anaglyph yellow/blue half colored
  17607. (yellow filter on left eye, blue filter on right eye)
  17608. @item aybc
  17609. anaglyph yellow/blue colored
  17610. (yellow filter on left eye, blue filter on right eye)
  17611. @item aybd
  17612. anaglyph yellow/blue color optimized with the least squares projection of dubois
  17613. (yellow filter on left eye, blue filter on right eye)
  17614. @item ml
  17615. mono output (left eye only)
  17616. @item mr
  17617. mono output (right eye only)
  17618. @item chl
  17619. checkerboard, left eye first
  17620. @item chr
  17621. checkerboard, right eye first
  17622. @item icl
  17623. interleaved columns, left eye first
  17624. @item icr
  17625. interleaved columns, right eye first
  17626. @item hdmi
  17627. HDMI frame pack
  17628. @end table
  17629. Default value is @samp{arcd}.
  17630. @end table
  17631. @subsection Examples
  17632. @itemize
  17633. @item
  17634. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  17635. @example
  17636. stereo3d=sbsl:aybd
  17637. @end example
  17638. @item
  17639. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  17640. @example
  17641. stereo3d=abl:sbsr
  17642. @end example
  17643. @end itemize
  17644. @section streamselect, astreamselect
  17645. Select video or audio streams.
  17646. The filter accepts the following options:
  17647. @table @option
  17648. @item inputs
  17649. Set number of inputs. Default is 2.
  17650. @item map
  17651. Set input indexes to remap to outputs.
  17652. @end table
  17653. @subsection Commands
  17654. The @code{streamselect} and @code{astreamselect} filter supports the following
  17655. commands:
  17656. @table @option
  17657. @item map
  17658. Set input indexes to remap to outputs.
  17659. @end table
  17660. @subsection Examples
  17661. @itemize
  17662. @item
  17663. Select first 5 seconds 1st stream and rest of time 2nd stream:
  17664. @example
  17665. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  17666. @end example
  17667. @item
  17668. Same as above, but for audio:
  17669. @example
  17670. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  17671. @end example
  17672. @end itemize
  17673. @anchor{subtitles}
  17674. @section subtitles
  17675. Draw subtitles on top of input video using the libass library.
  17676. To enable compilation of this filter you need to configure FFmpeg with
  17677. @code{--enable-libass}. This filter also requires a build with libavcodec and
  17678. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  17679. Alpha) subtitles format.
  17680. The filter accepts the following options:
  17681. @table @option
  17682. @item filename, f
  17683. Set the filename of the subtitle file to read. It must be specified.
  17684. @item original_size
  17685. Specify the size of the original video, the video for which the ASS file
  17686. was composed. For the syntax of this option, check the
  17687. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17688. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  17689. correctly scale the fonts if the aspect ratio has been changed.
  17690. @item fontsdir
  17691. Set a directory path containing fonts that can be used by the filter.
  17692. These fonts will be used in addition to whatever the font provider uses.
  17693. @item alpha
  17694. Process alpha channel, by default alpha channel is untouched.
  17695. @item charenc
  17696. Set subtitles input character encoding. @code{subtitles} filter only. Only
  17697. useful if not UTF-8.
  17698. @item stream_index, si
  17699. Set subtitles stream index. @code{subtitles} filter only.
  17700. @item force_style
  17701. Override default style or script info parameters of the subtitles. It accepts a
  17702. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  17703. @item wrap_unicode
  17704. Break lines according to the Unicode Line Breaking Algorithm. Availability requires
  17705. at least libass release 0.17.0 (or LIBASS_VERSION 0x01600010), @emph{and} libass must
  17706. have been built with libunibreak.
  17707. The option is enabled by default except for native ASS.
  17708. @end table
  17709. If the first key is not specified, it is assumed that the first value
  17710. specifies the @option{filename}.
  17711. For example, to render the file @file{sub.srt} on top of the input
  17712. video, use the command:
  17713. @example
  17714. subtitles=sub.srt
  17715. @end example
  17716. which is equivalent to:
  17717. @example
  17718. subtitles=filename=sub.srt
  17719. @end example
  17720. To render the default subtitles stream from file @file{video.mkv}, use:
  17721. @example
  17722. subtitles=video.mkv
  17723. @end example
  17724. To render the second subtitles stream from that file, use:
  17725. @example
  17726. subtitles=video.mkv:si=1
  17727. @end example
  17728. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  17729. @code{DejaVu Serif}, use:
  17730. @example
  17731. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  17732. @end example
  17733. @section super2xsai
  17734. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  17735. Interpolate) pixel art scaling algorithm.
  17736. Useful for enlarging pixel art images without reducing sharpness.
  17737. @section swaprect
  17738. Swap two rectangular objects in video.
  17739. This filter accepts the following options:
  17740. @table @option
  17741. @item w
  17742. Set object width.
  17743. @item h
  17744. Set object height.
  17745. @item x1
  17746. Set 1st rect x coordinate.
  17747. @item y1
  17748. Set 1st rect y coordinate.
  17749. @item x2
  17750. Set 2nd rect x coordinate.
  17751. @item y2
  17752. Set 2nd rect y coordinate.
  17753. All expressions are evaluated once for each frame.
  17754. @end table
  17755. The all options are expressions containing the following constants:
  17756. @table @option
  17757. @item w
  17758. @item h
  17759. The input width and height.
  17760. @item a
  17761. same as @var{w} / @var{h}
  17762. @item sar
  17763. input sample aspect ratio
  17764. @item dar
  17765. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  17766. @item n
  17767. The number of the input frame, starting from 0.
  17768. @item t
  17769. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  17770. @item pos
  17771. the position in the file of the input frame, NAN if unknown; deprecated,
  17772. do not use
  17773. @end table
  17774. @subsection Commands
  17775. This filter supports the all above options as @ref{commands}.
  17776. @section swapuv
  17777. Swap U & V plane.
  17778. @section tblend
  17779. Blend successive video frames.
  17780. See @ref{blend}
  17781. @section telecine
  17782. Apply telecine process to the video.
  17783. This filter accepts the following options:
  17784. @table @option
  17785. @item first_field
  17786. @table @samp
  17787. @item top, t
  17788. top field first
  17789. @item bottom, b
  17790. bottom field first
  17791. The default value is @code{top}.
  17792. @end table
  17793. @item pattern
  17794. A string of numbers representing the pulldown pattern you wish to apply.
  17795. The default value is @code{23}.
  17796. @end table
  17797. @example
  17798. Some typical patterns:
  17799. NTSC output (30i):
  17800. 27.5p: 32222
  17801. 24p: 23 (classic)
  17802. 24p: 2332 (preferred)
  17803. 20p: 33
  17804. 18p: 334
  17805. 16p: 3444
  17806. PAL output (25i):
  17807. 27.5p: 12222
  17808. 24p: 222222222223 ("Euro pulldown")
  17809. 16.67p: 33
  17810. 16p: 33333334
  17811. @end example
  17812. @section thistogram
  17813. Compute and draw a color distribution histogram for the input video across time.
  17814. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  17815. at certain time, this filter shows also past histograms of number of frames defined
  17816. by @code{width} option.
  17817. The computed histogram is a representation of the color component
  17818. distribution in an image.
  17819. The filter accepts the following options:
  17820. @table @option
  17821. @item width, w
  17822. Set width of single color component output. Default value is @code{0}.
  17823. Value of @code{0} means width will be picked from input video.
  17824. This also set number of passed histograms to keep.
  17825. Allowed range is [0, 8192].
  17826. @item display_mode, d
  17827. Set display mode.
  17828. It accepts the following values:
  17829. @table @samp
  17830. @item stack
  17831. Per color component graphs are placed below each other.
  17832. @item parade
  17833. Per color component graphs are placed side by side.
  17834. @item overlay
  17835. Presents information identical to that in the @code{parade}, except
  17836. that the graphs representing color components are superimposed directly
  17837. over one another.
  17838. @end table
  17839. Default is @code{stack}.
  17840. @item levels_mode, m
  17841. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  17842. Default is @code{linear}.
  17843. @item components, c
  17844. Set what color components to display.
  17845. Default is @code{7}.
  17846. @item bgopacity, b
  17847. Set background opacity. Default is @code{0.9}.
  17848. @item envelope, e
  17849. Show envelope. Default is disabled.
  17850. @item ecolor, ec
  17851. Set envelope color. Default is @code{gold}.
  17852. @item slide
  17853. Set slide mode.
  17854. Available values for slide is:
  17855. @table @samp
  17856. @item frame
  17857. Draw new frame when right border is reached.
  17858. @item replace
  17859. Replace old columns with new ones.
  17860. @item scroll
  17861. Scroll from right to left.
  17862. @item rscroll
  17863. Scroll from left to right.
  17864. @item picture
  17865. Draw single picture.
  17866. @end table
  17867. Default is @code{replace}.
  17868. @end table
  17869. @section threshold
  17870. Apply threshold effect to video stream.
  17871. This filter needs four video streams to perform thresholding.
  17872. First stream is stream we are filtering.
  17873. Second stream is holding threshold values, third stream is holding min values,
  17874. and last, fourth stream is holding max values.
  17875. The filter accepts the following option:
  17876. @table @option
  17877. @item planes
  17878. Set which planes will be processed, unprocessed planes will be copied.
  17879. By default value 0xf, all planes will be processed.
  17880. @end table
  17881. For example if first stream pixel's component value is less then threshold value
  17882. of pixel component from 2nd threshold stream, third stream value will picked,
  17883. otherwise fourth stream pixel component value will be picked.
  17884. Using color source filter one can perform various types of thresholding:
  17885. @subsection Commands
  17886. This filter supports the all options as @ref{commands}.
  17887. @subsection Examples
  17888. @itemize
  17889. @item
  17890. Binary threshold, using gray color as threshold:
  17891. @example
  17892. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17893. @end example
  17894. @item
  17895. Inverted binary threshold, using gray color as threshold:
  17896. @example
  17897. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17898. @end example
  17899. @item
  17900. Truncate binary threshold, using gray color as threshold:
  17901. @example
  17902. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17903. @end example
  17904. @item
  17905. Threshold to zero, using gray color as threshold:
  17906. @example
  17907. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17908. @end example
  17909. @item
  17910. Inverted threshold to zero, using gray color as threshold:
  17911. @example
  17912. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17913. @end example
  17914. @end itemize
  17915. @section thumbnail
  17916. Select the most representative frame in a given sequence of consecutive frames.
  17917. The filter accepts the following options:
  17918. @table @option
  17919. @item n
  17920. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17921. will pick one of them, and then handle the next batch of @var{n} frames until
  17922. the end. Default is @code{100}.
  17923. @item log
  17924. Set the log level to display picked frame stats.
  17925. Default is @code{info}.
  17926. @end table
  17927. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17928. value will result in a higher memory usage, so a high value is not recommended.
  17929. @subsection Examples
  17930. @itemize
  17931. @item
  17932. Extract one picture each 50 frames:
  17933. @example
  17934. thumbnail=50
  17935. @end example
  17936. @item
  17937. Complete example of a thumbnail creation with @command{ffmpeg}:
  17938. @example
  17939. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17940. @end example
  17941. @end itemize
  17942. @anchor{tile}
  17943. @section tile
  17944. Tile several successive frames together.
  17945. The @ref{untile} filter can do the reverse.
  17946. The filter accepts the following options:
  17947. @table @option
  17948. @item layout
  17949. Set the grid size in the form @code{COLUMNSxROWS}. Range is up to UINT_MAX cells.
  17950. Default is @code{6x5}.
  17951. @item nb_frames
  17952. Set the maximum number of frames to render in the given area. It must be less
  17953. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17954. the area will be used.
  17955. @item margin
  17956. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17957. @item padding
  17958. Set the inner border thickness (i.e. the number of pixels between frames). For
  17959. more advanced padding options (such as having different values for the edges),
  17960. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17961. @item color
  17962. Specify the color of the unused area. For the syntax of this option, check the
  17963. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17964. The default value of @var{color} is "black".
  17965. @item overlap
  17966. Set the number of frames to overlap when tiling several successive frames together.
  17967. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17968. @item init_padding
  17969. Set the number of frames to initially be empty before displaying first output frame.
  17970. This controls how soon will one get first output frame.
  17971. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17972. @end table
  17973. @subsection Examples
  17974. @itemize
  17975. @item
  17976. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17977. @example
  17978. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17979. @end example
  17980. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17981. duplicating each output frame to accommodate the originally detected frame
  17982. rate.
  17983. @item
  17984. Display @code{5} pictures in an area of @code{3x2} frames,
  17985. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17986. mixed flat and named options:
  17987. @example
  17988. tile=3x2:nb_frames=5:padding=7:margin=2
  17989. @end example
  17990. @end itemize
  17991. @section tiltandshift
  17992. Apply tilt-and-shift effect.
  17993. What happens when you invert time and space?
  17994. Normally a video is composed of several frames that represent a different
  17995. instant of time and shows a scene that evolves in the space captured by the
  17996. frame. This filter is the antipode of that concept, taking inspiration from
  17997. tilt and shift photography.
  17998. A filtered frame contains the whole timeline of events composing the sequence,
  17999. and this is obtained by placing a slice of pixels from each frame into a single
  18000. one. However, since there are no infinite-width frames, this is done up the
  18001. width of the input frame, and a video is recomposed by shifting away one
  18002. column for each subsequent frame. In order to map space to time, the filter
  18003. tilts each input frame as well, so that motion is preserved. This is accomplished
  18004. by progressively selecting a different column from each input frame.
  18005. The end result is a sort of inverted parallax, so that far away objects move
  18006. much faster that the ones in the front. The ideal conditions for this video
  18007. effect are when there is either very little motion and the backgroud is static,
  18008. or when there is a lot of motion and a very wide depth of field (e.g. wide
  18009. panorama, while moving on a train).
  18010. The filter accepts the following parameters:
  18011. @table @option
  18012. @item tilt
  18013. Tilt video while shifting (default). When unset, video will be sliding a
  18014. static image, composed of the first column of each frame.
  18015. @item start
  18016. What to do at the start of filtering (see below).
  18017. @item end
  18018. What to do at the end of filtering (see below).
  18019. @item hold
  18020. How many columns should pass through before start of filtering.
  18021. @item pad
  18022. How many columns should be inserted before end of filtering.
  18023. @end table
  18024. Normally the filter shifts and tilts from the very first frame, and stops when
  18025. the last one is received. However, before filtering starts, normal video may
  18026. be preseved, so that the effect is slowly shifted in its place. Similarly,
  18027. the last video frame may be reconstructed at the end. Alternatively it is
  18028. possible to just start and end with black.
  18029. @table @samp
  18030. @item none
  18031. Filtering starts immediately and ends when the last frame is received.
  18032. @item frame
  18033. The first frames or the very last frame are kept intact during processing.
  18034. @item black
  18035. Black is padded at the beginning or at the end of filtering.
  18036. @end table
  18037. @section tinterlace
  18038. Perform various types of temporal field interlacing.
  18039. Frames are counted starting from 1, so the first input frame is
  18040. considered odd.
  18041. The filter accepts the following options:
  18042. @table @option
  18043. @item mode
  18044. Specify the mode of the interlacing. This option can also be specified
  18045. as a value alone. See below for a list of values for this option.
  18046. Available values are:
  18047. @table @samp
  18048. @item merge, 0
  18049. Move odd frames into the upper field, even into the lower field,
  18050. generating a double height frame at half frame rate.
  18051. @example
  18052. ------> time
  18053. Input:
  18054. Frame 1 Frame 2 Frame 3 Frame 4
  18055. 11111 22222 33333 44444
  18056. 11111 22222 33333 44444
  18057. 11111 22222 33333 44444
  18058. 11111 22222 33333 44444
  18059. Output:
  18060. 11111 33333
  18061. 22222 44444
  18062. 11111 33333
  18063. 22222 44444
  18064. 11111 33333
  18065. 22222 44444
  18066. 11111 33333
  18067. 22222 44444
  18068. @end example
  18069. @item drop_even, 1
  18070. Only output odd frames, even frames are dropped, generating a frame with
  18071. unchanged height at half frame rate.
  18072. @example
  18073. ------> time
  18074. Input:
  18075. Frame 1 Frame 2 Frame 3 Frame 4
  18076. 11111 22222 33333 44444
  18077. 11111 22222 33333 44444
  18078. 11111 22222 33333 44444
  18079. 11111 22222 33333 44444
  18080. Output:
  18081. 11111 33333
  18082. 11111 33333
  18083. 11111 33333
  18084. 11111 33333
  18085. @end example
  18086. @item drop_odd, 2
  18087. Only output even frames, odd frames are dropped, generating a frame with
  18088. unchanged height at half frame rate.
  18089. @example
  18090. ------> time
  18091. Input:
  18092. Frame 1 Frame 2 Frame 3 Frame 4
  18093. 11111 22222 33333 44444
  18094. 11111 22222 33333 44444
  18095. 11111 22222 33333 44444
  18096. 11111 22222 33333 44444
  18097. Output:
  18098. 22222 44444
  18099. 22222 44444
  18100. 22222 44444
  18101. 22222 44444
  18102. @end example
  18103. @item pad, 3
  18104. Expand each frame to full height, but pad alternate lines with black,
  18105. generating a frame with double height at the same input frame rate.
  18106. @example
  18107. ------> time
  18108. Input:
  18109. Frame 1 Frame 2 Frame 3 Frame 4
  18110. 11111 22222 33333 44444
  18111. 11111 22222 33333 44444
  18112. 11111 22222 33333 44444
  18113. 11111 22222 33333 44444
  18114. Output:
  18115. 11111 ..... 33333 .....
  18116. ..... 22222 ..... 44444
  18117. 11111 ..... 33333 .....
  18118. ..... 22222 ..... 44444
  18119. 11111 ..... 33333 .....
  18120. ..... 22222 ..... 44444
  18121. 11111 ..... 33333 .....
  18122. ..... 22222 ..... 44444
  18123. @end example
  18124. @item interleave_top, 4
  18125. Interleave the upper field from odd frames with the lower field from
  18126. even frames, generating a frame with unchanged height at half frame rate.
  18127. @example
  18128. ------> time
  18129. Input:
  18130. Frame 1 Frame 2 Frame 3 Frame 4
  18131. 11111<- 22222 33333<- 44444
  18132. 11111 22222<- 33333 44444<-
  18133. 11111<- 22222 33333<- 44444
  18134. 11111 22222<- 33333 44444<-
  18135. Output:
  18136. 11111 33333
  18137. 22222 44444
  18138. 11111 33333
  18139. 22222 44444
  18140. @end example
  18141. @item interleave_bottom, 5
  18142. Interleave the lower field from odd frames with the upper field from
  18143. even frames, generating a frame with unchanged height at half frame rate.
  18144. @example
  18145. ------> time
  18146. Input:
  18147. Frame 1 Frame 2 Frame 3 Frame 4
  18148. 11111 22222<- 33333 44444<-
  18149. 11111<- 22222 33333<- 44444
  18150. 11111 22222<- 33333 44444<-
  18151. 11111<- 22222 33333<- 44444
  18152. Output:
  18153. 22222 44444
  18154. 11111 33333
  18155. 22222 44444
  18156. 11111 33333
  18157. @end example
  18158. @item interlacex2, 6
  18159. Double frame rate with unchanged height. Frames are inserted each
  18160. containing the second temporal field from the previous input frame and
  18161. the first temporal field from the next input frame. This mode relies on
  18162. the top_field_first flag. Useful for interlaced video displays with no
  18163. field synchronisation.
  18164. @example
  18165. ------> time
  18166. Input:
  18167. Frame 1 Frame 2 Frame 3 Frame 4
  18168. 11111 22222 33333 44444
  18169. 11111 22222 33333 44444
  18170. 11111 22222 33333 44444
  18171. 11111 22222 33333 44444
  18172. Output:
  18173. 11111 22222 22222 33333 33333 44444 44444
  18174. 11111 11111 22222 22222 33333 33333 44444
  18175. 11111 22222 22222 33333 33333 44444 44444
  18176. 11111 11111 22222 22222 33333 33333 44444
  18177. @end example
  18178. @item mergex2, 7
  18179. Move odd frames into the upper field, even into the lower field,
  18180. generating a double height frame at same frame rate.
  18181. @example
  18182. ------> time
  18183. Input:
  18184. Frame 1 Frame 2 Frame 3 Frame 4
  18185. 11111 22222 33333 44444
  18186. 11111 22222 33333 44444
  18187. 11111 22222 33333 44444
  18188. 11111 22222 33333 44444
  18189. Output:
  18190. 11111 33333 33333 55555
  18191. 22222 22222 44444 44444
  18192. 11111 33333 33333 55555
  18193. 22222 22222 44444 44444
  18194. 11111 33333 33333 55555
  18195. 22222 22222 44444 44444
  18196. 11111 33333 33333 55555
  18197. 22222 22222 44444 44444
  18198. @end example
  18199. @end table
  18200. Numeric values are deprecated but are accepted for backward
  18201. compatibility reasons.
  18202. Default mode is @code{merge}.
  18203. @item flags
  18204. Specify flags influencing the filter process.
  18205. Available value for @var{flags} is:
  18206. @table @option
  18207. @item low_pass_filter, vlpf
  18208. Enable linear vertical low-pass filtering in the filter.
  18209. Vertical low-pass filtering is required when creating an interlaced
  18210. destination from a progressive source which contains high-frequency
  18211. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  18212. patterning.
  18213. @item complex_filter, cvlpf
  18214. Enable complex vertical low-pass filtering.
  18215. This will slightly less reduce interlace 'twitter' and Moire
  18216. patterning but better retain detail and subjective sharpness impression.
  18217. @item bypass_il
  18218. Bypass already interlaced frames, only adjust the frame rate.
  18219. @end table
  18220. Vertical low-pass filtering and bypassing already interlaced frames can only be
  18221. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  18222. @end table
  18223. @section tmedian
  18224. Pick median pixels from several successive input video frames.
  18225. The filter accepts the following options:
  18226. @table @option
  18227. @item radius
  18228. Set radius of median filter.
  18229. Default is 1. Allowed range is from 1 to 127.
  18230. @item planes
  18231. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18232. @item percentile
  18233. Set median percentile. Default value is @code{0.5}.
  18234. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18235. minimum values, and @code{1} maximum values.
  18236. @end table
  18237. @subsection Commands
  18238. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  18239. @section tmidequalizer
  18240. Apply Temporal Midway Video Equalization effect.
  18241. Midway Video Equalization adjusts a sequence of video frames to have the same
  18242. histograms, while maintaining their dynamics as much as possible. It's
  18243. useful for e.g. matching exposures from a video frames sequence.
  18244. This filter accepts the following option:
  18245. @table @option
  18246. @item radius
  18247. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  18248. @item sigma
  18249. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  18250. Setting this option to 0 effectively does nothing.
  18251. @item planes
  18252. Set which planes to process. Default is @code{15}, which is all available planes.
  18253. @end table
  18254. @section tmix
  18255. Mix successive video frames.
  18256. A description of the accepted options follows.
  18257. @table @option
  18258. @item frames
  18259. The number of successive frames to mix. If unspecified, it defaults to 3.
  18260. @item weights
  18261. Specify weight of each input video frame.
  18262. Each weight is separated by space. If number of weights is smaller than
  18263. number of @var{frames} last specified weight will be used for all remaining
  18264. unset weights.
  18265. @item scale
  18266. Specify scale, if it is set it will be multiplied with sum
  18267. of each weight multiplied with pixel values to give final destination
  18268. pixel value. By default @var{scale} is auto scaled to sum of weights.
  18269. @item planes
  18270. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  18271. @end table
  18272. @subsection Examples
  18273. @itemize
  18274. @item
  18275. Average 7 successive frames:
  18276. @example
  18277. tmix=frames=7:weights="1 1 1 1 1 1 1"
  18278. @end example
  18279. @item
  18280. Apply simple temporal convolution:
  18281. @example
  18282. tmix=frames=3:weights="-1 3 -1"
  18283. @end example
  18284. @item
  18285. Similar as above but only showing temporal differences:
  18286. @example
  18287. tmix=frames=3:weights="-1 2 -1":scale=1
  18288. @end example
  18289. @end itemize
  18290. @subsection Commands
  18291. This filter supports the following commands:
  18292. @table @option
  18293. @item weights
  18294. @item scale
  18295. @item planes
  18296. Syntax is same as option with same name.
  18297. @end table
  18298. @anchor{tonemap}
  18299. @section tonemap
  18300. Tone map colors from different dynamic ranges.
  18301. This filter expects data in single precision floating point, as it needs to
  18302. operate on (and can output) out-of-range values. Another filter, such as
  18303. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  18304. The tonemapping algorithms implemented only work on linear light, so input
  18305. data should be linearized beforehand (and possibly correctly tagged).
  18306. @example
  18307. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  18308. @end example
  18309. @subsection Options
  18310. The filter accepts the following options.
  18311. @table @option
  18312. @item tonemap
  18313. Set the tone map algorithm to use.
  18314. Possible values are:
  18315. @table @var
  18316. @item none
  18317. Do not apply any tone map, only desaturate overbright pixels.
  18318. @item clip
  18319. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  18320. in-range values, while distorting out-of-range values.
  18321. @item linear
  18322. Stretch the entire reference gamut to a linear multiple of the display.
  18323. @item gamma
  18324. Fit a logarithmic transfer between the tone curves.
  18325. @item reinhard
  18326. Preserve overall image brightness with a simple curve, using nonlinear
  18327. contrast, which results in flattening details and degrading color accuracy.
  18328. @item hable
  18329. Preserve both dark and bright details better than @var{reinhard}, at the cost
  18330. of slightly darkening everything. Use it when detail preservation is more
  18331. important than color and brightness accuracy.
  18332. @item mobius
  18333. Smoothly map out-of-range values, while retaining contrast and colors for
  18334. in-range material as much as possible. Use it when color accuracy is more
  18335. important than detail preservation.
  18336. @end table
  18337. Default is none.
  18338. @item param
  18339. Tune the tone mapping algorithm.
  18340. This affects the following algorithms:
  18341. @table @var
  18342. @item none
  18343. Ignored.
  18344. @item linear
  18345. Specifies the scale factor to use while stretching.
  18346. Default to 1.0.
  18347. @item gamma
  18348. Specifies the exponent of the function.
  18349. Default to 1.8.
  18350. @item clip
  18351. Specify an extra linear coefficient to multiply into the signal before clipping.
  18352. Default to 1.0.
  18353. @item reinhard
  18354. Specify the local contrast coefficient at the display peak.
  18355. Default to 0.5, which means that in-gamut values will be about half as bright
  18356. as when clipping.
  18357. @item hable
  18358. Ignored.
  18359. @item mobius
  18360. Specify the transition point from linear to mobius transform. Every value
  18361. below this point is guaranteed to be mapped 1:1. The higher the value, the
  18362. more accurate the result will be, at the cost of losing bright details.
  18363. Default to 0.3, which due to the steep initial slope still preserves in-range
  18364. colors fairly accurately.
  18365. @end table
  18366. @item desat
  18367. Apply desaturation for highlights that exceed this level of brightness. The
  18368. higher the parameter, the more color information will be preserved. This
  18369. setting helps prevent unnaturally blown-out colors for super-highlights, by
  18370. (smoothly) turning into white instead. This makes images feel more natural,
  18371. at the cost of reducing information about out-of-range colors.
  18372. The default of 2.0 is somewhat conservative and will mostly just apply to
  18373. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  18374. This option works only if the input frame has a supported color tag.
  18375. @item peak
  18376. Override signal/nominal/reference peak with this value. Useful when the
  18377. embedded peak information in display metadata is not reliable or when tone
  18378. mapping from a lower range to a higher range.
  18379. @end table
  18380. @section tpad
  18381. Temporarily pad video frames.
  18382. The filter accepts the following options:
  18383. @table @option
  18384. @item start
  18385. Specify number of delay frames before input video stream. Default is 0.
  18386. @item stop
  18387. Specify number of padding frames after input video stream.
  18388. Set to -1 to pad indefinitely. Default is 0.
  18389. @item start_mode
  18390. Set kind of frames added to beginning of stream.
  18391. Can be either @var{add} or @var{clone}.
  18392. With @var{add} frames of solid-color are added.
  18393. With @var{clone} frames are clones of first frame.
  18394. Default is @var{add}.
  18395. @item stop_mode
  18396. Set kind of frames added to end of stream.
  18397. Can be either @var{add} or @var{clone}.
  18398. With @var{add} frames of solid-color are added.
  18399. With @var{clone} frames are clones of last frame.
  18400. Default is @var{add}.
  18401. @item start_duration, stop_duration
  18402. Specify the duration of the start/stop delay. See
  18403. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18404. for the accepted syntax.
  18405. These options override @var{start} and @var{stop}. Default is 0.
  18406. @item color
  18407. Specify the color of the padded area. For the syntax of this option,
  18408. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  18409. manual,ffmpeg-utils}.
  18410. The default value of @var{color} is "black".
  18411. @end table
  18412. @anchor{transpose}
  18413. @section transpose
  18414. Transpose rows with columns in the input video and optionally flip it.
  18415. It accepts the following parameters:
  18416. @table @option
  18417. @item dir
  18418. Specify the transposition direction.
  18419. Can assume the following values:
  18420. @table @samp
  18421. @item 0, 4, cclock_flip
  18422. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  18423. @example
  18424. L.R L.l
  18425. . . -> . .
  18426. l.r R.r
  18427. @end example
  18428. @item 1, 5, clock
  18429. Rotate by 90 degrees clockwise, that is:
  18430. @example
  18431. L.R l.L
  18432. . . -> . .
  18433. l.r r.R
  18434. @end example
  18435. @item 2, 6, cclock
  18436. Rotate by 90 degrees counterclockwise, that is:
  18437. @example
  18438. L.R R.r
  18439. . . -> . .
  18440. l.r L.l
  18441. @end example
  18442. @item 3, 7, clock_flip
  18443. Rotate by 90 degrees clockwise and vertically flip, that is:
  18444. @example
  18445. L.R r.R
  18446. . . -> . .
  18447. l.r l.L
  18448. @end example
  18449. @end table
  18450. For values between 4-7, the transposition is only done if the input
  18451. video geometry is portrait and not landscape. These values are
  18452. deprecated, the @code{passthrough} option should be used instead.
  18453. Numerical values are deprecated, and should be dropped in favor of
  18454. symbolic constants.
  18455. @item passthrough
  18456. Do not apply the transposition if the input geometry matches the one
  18457. specified by the specified value. It accepts the following values:
  18458. @table @samp
  18459. @item none
  18460. Always apply transposition.
  18461. @item portrait
  18462. Preserve portrait geometry (when @var{height} >= @var{width}).
  18463. @item landscape
  18464. Preserve landscape geometry (when @var{width} >= @var{height}).
  18465. @end table
  18466. Default value is @code{none}.
  18467. @end table
  18468. For example to rotate by 90 degrees clockwise and preserve portrait
  18469. layout:
  18470. @example
  18471. transpose=dir=1:passthrough=portrait
  18472. @end example
  18473. The command above can also be specified as:
  18474. @example
  18475. transpose=1:portrait
  18476. @end example
  18477. @section transpose_npp
  18478. Transpose rows with columns in the input video and optionally flip it.
  18479. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  18480. It accepts the following parameters:
  18481. @table @option
  18482. @item dir
  18483. Specify the transposition direction.
  18484. Can assume the following values:
  18485. @table @samp
  18486. @item cclock_flip
  18487. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  18488. @item clock
  18489. Rotate by 90 degrees clockwise.
  18490. @item cclock
  18491. Rotate by 90 degrees counterclockwise.
  18492. @item clock_flip
  18493. Rotate by 90 degrees clockwise and vertically flip.
  18494. @end table
  18495. @item passthrough
  18496. Do not apply the transposition if the input geometry matches the one
  18497. specified by the specified value. It accepts the following values:
  18498. @table @samp
  18499. @item none
  18500. Always apply transposition. (default)
  18501. @item portrait
  18502. Preserve portrait geometry (when @var{height} >= @var{width}).
  18503. @item landscape
  18504. Preserve landscape geometry (when @var{width} >= @var{height}).
  18505. @end table
  18506. @end table
  18507. @section trim
  18508. Trim the input so that the output contains one continuous subpart of the input.
  18509. It accepts the following parameters:
  18510. @table @option
  18511. @item start
  18512. Specify the time of the start of the kept section, i.e. the frame with the
  18513. timestamp @var{start} will be the first frame in the output.
  18514. @item end
  18515. Specify the time of the first frame that will be dropped, i.e. the frame
  18516. immediately preceding the one with the timestamp @var{end} will be the last
  18517. frame in the output.
  18518. @item start_pts
  18519. This is the same as @var{start}, except this option sets the start timestamp
  18520. in timebase units instead of seconds.
  18521. @item end_pts
  18522. This is the same as @var{end}, except this option sets the end timestamp
  18523. in timebase units instead of seconds.
  18524. @item duration
  18525. The maximum duration of the output in seconds.
  18526. @item start_frame
  18527. The number of the first frame that should be passed to the output.
  18528. @item end_frame
  18529. The number of the first frame that should be dropped.
  18530. @end table
  18531. @option{start}, @option{end}, and @option{duration} are expressed as time
  18532. duration specifications; see
  18533. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18534. for the accepted syntax.
  18535. Note that the first two sets of the start/end options and the @option{duration}
  18536. option look at the frame timestamp, while the _frame variants simply count the
  18537. frames that pass through the filter. Also note that this filter does not modify
  18538. the timestamps. If you wish for the output timestamps to start at zero, insert a
  18539. setpts filter after the trim filter.
  18540. If multiple start or end options are set, this filter tries to be greedy and
  18541. keep all the frames that match at least one of the specified constraints. To keep
  18542. only the part that matches all the constraints at once, chain multiple trim
  18543. filters.
  18544. The defaults are such that all the input is kept. So it is possible to set e.g.
  18545. just the end values to keep everything before the specified time.
  18546. Examples:
  18547. @itemize
  18548. @item
  18549. Drop everything except the second minute of input:
  18550. @example
  18551. ffmpeg -i INPUT -vf trim=60:120
  18552. @end example
  18553. @item
  18554. Keep only the first second:
  18555. @example
  18556. ffmpeg -i INPUT -vf trim=duration=1
  18557. @end example
  18558. @end itemize
  18559. @section unpremultiply
  18560. Apply alpha unpremultiply effect to input video stream using first plane
  18561. of second stream as alpha.
  18562. Both streams must have same dimensions and same pixel format.
  18563. The filter accepts the following option:
  18564. @table @option
  18565. @item planes
  18566. Set which planes will be processed, unprocessed planes will be copied.
  18567. By default value 0xf, all planes will be processed.
  18568. If the format has 1 or 2 components, then luma is bit 0.
  18569. If the format has 3 or 4 components:
  18570. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  18571. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  18572. If present, the alpha channel is always the last bit.
  18573. @item inplace
  18574. Do not require 2nd input for processing, instead use alpha plane from input stream.
  18575. @end table
  18576. @anchor{unsharp}
  18577. @section unsharp
  18578. Sharpen or blur the input video.
  18579. It accepts the following parameters:
  18580. @table @option
  18581. @item luma_msize_x, lx
  18582. Set the luma matrix horizontal size. It must be an odd integer between
  18583. 3 and 23. The default value is 5.
  18584. @item luma_msize_y, ly
  18585. Set the luma matrix vertical size. It must be an odd integer between 3
  18586. and 23. The default value is 5.
  18587. @item luma_amount, la
  18588. Set the luma effect strength. It must be a floating point number, reasonable
  18589. values lay between -1.5 and 1.5.
  18590. Negative values will blur the input video, while positive values will
  18591. sharpen it, a value of zero will disable the effect.
  18592. Default value is 1.0.
  18593. @item chroma_msize_x, cx
  18594. Set the chroma matrix horizontal size. It must be an odd integer
  18595. between 3 and 23. The default value is 5.
  18596. @item chroma_msize_y, cy
  18597. Set the chroma matrix vertical size. It must be an odd integer
  18598. between 3 and 23. The default value is 5.
  18599. @item chroma_amount, ca
  18600. Set the chroma effect strength. It must be a floating point number, reasonable
  18601. values lay between -1.5 and 1.5.
  18602. Negative values will blur the input video, while positive values will
  18603. sharpen it, a value of zero will disable the effect.
  18604. Default value is 0.0.
  18605. @item alpha_msize_x, ax
  18606. Set the alpha matrix horizontal size. It must be an odd integer
  18607. between 3 and 23. The default value is 5.
  18608. @item alpha_msize_y, ay
  18609. Set the alpha matrix vertical size. It must be an odd integer
  18610. between 3 and 23. The default value is 5.
  18611. @item alpha_amount, aa
  18612. Set the alpha effect strength. It must be a floating point number, reasonable
  18613. values lay between -1.5 and 1.5.
  18614. Negative values will blur the input video, while positive values will
  18615. sharpen it, a value of zero will disable the effect.
  18616. Default value is 0.0.
  18617. @end table
  18618. All parameters are optional and default to the equivalent of the
  18619. string '5:5:1.0:5:5:0.0'.
  18620. @subsection Examples
  18621. @itemize
  18622. @item
  18623. Apply strong luma sharpen effect:
  18624. @example
  18625. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  18626. @end example
  18627. @item
  18628. Apply a strong blur of both luma and chroma parameters:
  18629. @example
  18630. unsharp=7:7:-2:7:7:-2
  18631. @end example
  18632. @end itemize
  18633. @anchor{untile}
  18634. @section untile
  18635. Decompose a video made of tiled images into the individual images.
  18636. The frame rate of the output video is the frame rate of the input video
  18637. multiplied by the number of tiles.
  18638. This filter does the reverse of @ref{tile}.
  18639. The filter accepts the following options:
  18640. @table @option
  18641. @item layout
  18642. Set the grid size (i.e. the number of lines and columns). For the syntax of
  18643. this option, check the
  18644. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18645. @end table
  18646. @subsection Examples
  18647. @itemize
  18648. @item
  18649. Produce a 1-second video from a still image file made of 25 frames stacked
  18650. vertically, like an analogic film reel:
  18651. @example
  18652. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  18653. @end example
  18654. @end itemize
  18655. @section uspp
  18656. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  18657. the image at several (or - in the case of @option{quality} level @code{8} - all)
  18658. shifts and average the results.
  18659. The way this differs from the behavior of spp is that uspp actually encodes &
  18660. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  18661. DCT similar to MJPEG.
  18662. This filter is not available in ffmpeg versions between 5.0 and 6.0.
  18663. The filter accepts the following options:
  18664. @table @option
  18665. @item quality
  18666. Set quality. This option defines the number of levels for averaging. It accepts
  18667. an integer in the range 0-8. If set to @code{0}, the filter will have no
  18668. effect. A value of @code{8} means the higher quality. For each increment of
  18669. that value the speed drops by a factor of approximately 2. Default value is
  18670. @code{3}.
  18671. @item qp
  18672. Force a constant quantization parameter. If not set, the filter will use the QP
  18673. from the video stream (if available).
  18674. @item codec
  18675. Use specified codec instead of snow.
  18676. @end table
  18677. @section v360
  18678. Convert 360 videos between various formats.
  18679. The filter accepts the following options:
  18680. @table @option
  18681. @item input
  18682. @item output
  18683. Set format of the input/output video.
  18684. Available formats:
  18685. @table @samp
  18686. @item e
  18687. @item equirect
  18688. Equirectangular projection.
  18689. @item c3x2
  18690. @item c6x1
  18691. @item c1x6
  18692. Cubemap with 3x2/6x1/1x6 layout.
  18693. Format specific options:
  18694. @table @option
  18695. @item in_pad
  18696. @item out_pad
  18697. Set padding proportion for the input/output cubemap. Values in decimals.
  18698. Example values:
  18699. @table @samp
  18700. @item 0
  18701. No padding.
  18702. @item 0.01
  18703. 1% of face is padding. For example, with 1920x1280 resolution face size would be 640x640 and padding would be 3 pixels from each side. (640 * 0.01 = 6 pixels)
  18704. @end table
  18705. Default value is @b{@samp{0}}.
  18706. Maximum value is @b{@samp{0.1}}.
  18707. @item fin_pad
  18708. @item fout_pad
  18709. Set fixed padding for the input/output cubemap. Values in pixels.
  18710. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  18711. @item in_forder
  18712. @item out_forder
  18713. Set order of faces for the input/output cubemap. Choose one direction for each position.
  18714. Designation of directions:
  18715. @table @samp
  18716. @item r
  18717. right
  18718. @item l
  18719. left
  18720. @item u
  18721. up
  18722. @item d
  18723. down
  18724. @item f
  18725. forward
  18726. @item b
  18727. back
  18728. @end table
  18729. Default value is @b{@samp{rludfb}}.
  18730. @item in_frot
  18731. @item out_frot
  18732. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  18733. Designation of angles:
  18734. @table @samp
  18735. @item 0
  18736. 0 degrees clockwise
  18737. @item 1
  18738. 90 degrees clockwise
  18739. @item 2
  18740. 180 degrees clockwise
  18741. @item 3
  18742. 270 degrees clockwise
  18743. @end table
  18744. Default value is @b{@samp{000000}}.
  18745. @end table
  18746. @item eac
  18747. Equi-Angular Cubemap.
  18748. @item flat
  18749. @item gnomonic
  18750. @item rectilinear
  18751. Regular video.
  18752. Format specific options:
  18753. @table @option
  18754. @item h_fov
  18755. @item v_fov
  18756. @item d_fov
  18757. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18758. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18759. @item ih_fov
  18760. @item iv_fov
  18761. @item id_fov
  18762. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18763. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18764. @end table
  18765. @item dfisheye
  18766. Dual fisheye.
  18767. Format specific options:
  18768. @table @option
  18769. @item h_fov
  18770. @item v_fov
  18771. @item d_fov
  18772. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18773. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18774. @item ih_fov
  18775. @item iv_fov
  18776. @item id_fov
  18777. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18778. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18779. @end table
  18780. @item barrel
  18781. @item fb
  18782. @item barrelsplit
  18783. Facebook's 360 formats.
  18784. @item sg
  18785. Stereographic format.
  18786. Format specific options:
  18787. @table @option
  18788. @item h_fov
  18789. @item v_fov
  18790. @item d_fov
  18791. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18792. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18793. @item ih_fov
  18794. @item iv_fov
  18795. @item id_fov
  18796. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18797. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18798. @end table
  18799. @item mercator
  18800. Mercator format.
  18801. @item ball
  18802. Ball format, gives significant distortion toward the back.
  18803. @item hammer
  18804. Hammer-Aitoff map projection format.
  18805. @item sinusoidal
  18806. Sinusoidal map projection format.
  18807. @item fisheye
  18808. Fisheye projection.
  18809. Format specific options:
  18810. @table @option
  18811. @item h_fov
  18812. @item v_fov
  18813. @item d_fov
  18814. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18815. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18816. @item ih_fov
  18817. @item iv_fov
  18818. @item id_fov
  18819. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18820. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18821. @end table
  18822. @item pannini
  18823. Pannini projection.
  18824. Format specific options:
  18825. @table @option
  18826. @item h_fov
  18827. Set output pannini parameter.
  18828. @item ih_fov
  18829. Set input pannini parameter.
  18830. @end table
  18831. @item cylindrical
  18832. Cylindrical projection.
  18833. Format specific options:
  18834. @table @option
  18835. @item h_fov
  18836. @item v_fov
  18837. @item d_fov
  18838. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18839. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18840. @item ih_fov
  18841. @item iv_fov
  18842. @item id_fov
  18843. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18844. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18845. @end table
  18846. @item perspective
  18847. Perspective projection. @i{(output only)}
  18848. Format specific options:
  18849. @table @option
  18850. @item v_fov
  18851. Set perspective parameter.
  18852. @end table
  18853. @item tetrahedron
  18854. Tetrahedron projection.
  18855. @item tsp
  18856. Truncated square pyramid projection.
  18857. @item he
  18858. @item hequirect
  18859. Half equirectangular projection.
  18860. @item equisolid
  18861. Equisolid format.
  18862. Format specific options:
  18863. @table @option
  18864. @item h_fov
  18865. @item v_fov
  18866. @item d_fov
  18867. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18868. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18869. @item ih_fov
  18870. @item iv_fov
  18871. @item id_fov
  18872. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18873. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18874. @end table
  18875. @item og
  18876. Orthographic format.
  18877. Format specific options:
  18878. @table @option
  18879. @item h_fov
  18880. @item v_fov
  18881. @item d_fov
  18882. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18883. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18884. @item ih_fov
  18885. @item iv_fov
  18886. @item id_fov
  18887. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18888. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18889. @end table
  18890. @item octahedron
  18891. Octahedron projection.
  18892. @item cylindricalea
  18893. Cylindrical Equal Area projection.
  18894. @end table
  18895. @item interp
  18896. Set interpolation method.@*
  18897. @i{Note: more complex interpolation methods require much more memory to run.}
  18898. Available methods:
  18899. @table @samp
  18900. @item near
  18901. @item nearest
  18902. Nearest neighbour.
  18903. @item line
  18904. @item linear
  18905. Bilinear interpolation.
  18906. @item lagrange9
  18907. Lagrange9 interpolation.
  18908. @item cube
  18909. @item cubic
  18910. Bicubic interpolation.
  18911. @item lanc
  18912. @item lanczos
  18913. Lanczos interpolation.
  18914. @item sp16
  18915. @item spline16
  18916. Spline16 interpolation.
  18917. @item gauss
  18918. @item gaussian
  18919. Gaussian interpolation.
  18920. @item mitchell
  18921. Mitchell interpolation.
  18922. @end table
  18923. Default value is @b{@samp{line}}.
  18924. @item w
  18925. @item h
  18926. Set the output video resolution.
  18927. Default resolution depends on formats.
  18928. @item in_stereo
  18929. @item out_stereo
  18930. Set the input/output stereo format.
  18931. @table @samp
  18932. @item 2d
  18933. 2D mono
  18934. @item sbs
  18935. Side by side
  18936. @item tb
  18937. Top bottom
  18938. @end table
  18939. Default value is @b{@samp{2d}} for input and output format.
  18940. @item yaw
  18941. @item pitch
  18942. @item roll
  18943. Set rotation for the output video. Values in degrees.
  18944. @item rorder
  18945. Set rotation order for the output video. Choose one item for each position.
  18946. @table @samp
  18947. @item y, Y
  18948. yaw
  18949. @item p, P
  18950. pitch
  18951. @item r, R
  18952. roll
  18953. @end table
  18954. Default value is @b{@samp{ypr}}.
  18955. @item h_flip
  18956. @item v_flip
  18957. @item d_flip
  18958. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18959. @item ih_flip
  18960. @item iv_flip
  18961. Set if input video is flipped horizontally/vertically. Boolean values.
  18962. @item in_trans
  18963. Set if input video is transposed. Boolean value, by default disabled.
  18964. @item out_trans
  18965. Set if output video needs to be transposed. Boolean value, by default disabled.
  18966. @item h_offset
  18967. @item v_offset
  18968. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18969. Allowed range is from -1 to 1.
  18970. @item alpha_mask
  18971. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18972. @item reset_rot
  18973. Reset rotation of output video. Boolean value, by default disabled.
  18974. @end table
  18975. @subsection Examples
  18976. @itemize
  18977. @item
  18978. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18979. @example
  18980. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18981. @end example
  18982. @item
  18983. Extract back view of Equi-Angular Cubemap:
  18984. @example
  18985. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18986. @end example
  18987. @item
  18988. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18989. @example
  18990. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18991. @end example
  18992. @end itemize
  18993. @subsection Commands
  18994. This filter supports subset of above options as @ref{commands}.
  18995. @section vaguedenoiser
  18996. Apply a wavelet based denoiser.
  18997. It transforms each frame from the video input into the wavelet domain,
  18998. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18999. the obtained coefficients. It does an inverse wavelet transform after.
  19000. Due to wavelet properties, it should give a nice smoothed result, and
  19001. reduced noise, without blurring picture features.
  19002. This filter accepts the following options:
  19003. @table @option
  19004. @item threshold
  19005. The filtering strength. The higher, the more filtered the video will be.
  19006. Hard thresholding can use a higher threshold than soft thresholding
  19007. before the video looks overfiltered. Default value is 2.
  19008. @item method
  19009. The filtering method the filter will use.
  19010. It accepts the following values:
  19011. @table @samp
  19012. @item hard
  19013. All values under the threshold will be zeroed.
  19014. @item soft
  19015. All values under the threshold will be zeroed. All values above will be
  19016. reduced by the threshold.
  19017. @item garrote
  19018. Scales or nullifies coefficients - intermediary between (more) soft and
  19019. (less) hard thresholding.
  19020. @end table
  19021. Default is garrote.
  19022. @item nsteps
  19023. Number of times, the wavelet will decompose the picture. Picture can't
  19024. be decomposed beyond a particular point (typically, 8 for a 640x480
  19025. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  19026. @item percent
  19027. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  19028. @item planes
  19029. A list of the planes to process. By default all planes are processed.
  19030. @item type
  19031. The threshold type the filter will use.
  19032. It accepts the following values:
  19033. @table @samp
  19034. @item universal
  19035. Threshold used is same for all decompositions.
  19036. @item bayes
  19037. Threshold used depends also on each decomposition coefficients.
  19038. @end table
  19039. Default is universal.
  19040. @end table
  19041. @section varblur
  19042. Apply variable blur filter by using 2nd video stream to set blur radius.
  19043. The 2nd stream must have the same dimensions.
  19044. This filter accepts the following options:
  19045. @table @option
  19046. @item min_r
  19047. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  19048. @item max_r
  19049. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  19050. @item planes
  19051. Set which planes to process. By default, all are used.
  19052. @end table
  19053. The @code{varblur} filter also supports the @ref{framesync} options.
  19054. @subsection Commands
  19055. This filter supports all the above options as @ref{commands}.
  19056. @section vectorscope
  19057. Display 2 color component values in the two dimensional graph (which is called
  19058. a vectorscope).
  19059. This filter accepts the following options:
  19060. @table @option
  19061. @item mode, m
  19062. Set vectorscope mode.
  19063. It accepts the following values:
  19064. @table @samp
  19065. @item gray
  19066. @item tint
  19067. Gray values are displayed on graph, higher brightness means more pixels have
  19068. same component color value on location in graph. This is the default mode.
  19069. @item color
  19070. Gray values are displayed on graph. Surrounding pixels values which are not
  19071. present in video frame are drawn in gradient of 2 color components which are
  19072. set by option @code{x} and @code{y}. The 3rd color component is static.
  19073. @item color2
  19074. Actual color components values present in video frame are displayed on graph.
  19075. @item color3
  19076. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  19077. on graph increases value of another color component, which is luminance by
  19078. default values of @code{x} and @code{y}.
  19079. @item color4
  19080. Actual colors present in video frame are displayed on graph. If two different
  19081. colors map to same position on graph then color with higher value of component
  19082. not present in graph is picked.
  19083. @item color5
  19084. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  19085. component picked from radial gradient.
  19086. @end table
  19087. @item x
  19088. Set which color component will be represented on X-axis. Default is @code{1}.
  19089. @item y
  19090. Set which color component will be represented on Y-axis. Default is @code{2}.
  19091. @item intensity, i
  19092. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  19093. of color component which represents frequency of (X, Y) location in graph.
  19094. @item envelope, e
  19095. @table @samp
  19096. @item none
  19097. No envelope, this is default.
  19098. @item instant
  19099. Instant envelope, even darkest single pixel will be clearly highlighted.
  19100. @item peak
  19101. Hold maximum and minimum values presented in graph over time. This way you
  19102. can still spot out of range values without constantly looking at vectorscope.
  19103. @item peak+instant
  19104. Peak and instant envelope combined together.
  19105. @end table
  19106. @item graticule, g
  19107. Set what kind of graticule to draw.
  19108. @table @samp
  19109. @item none
  19110. @item green
  19111. @item color
  19112. @item invert
  19113. @end table
  19114. @item opacity, o
  19115. Set graticule opacity.
  19116. @item flags, f
  19117. Set graticule flags.
  19118. @table @samp
  19119. @item white
  19120. Draw graticule for white point.
  19121. @item black
  19122. Draw graticule for black point.
  19123. @item name
  19124. Draw color points short names.
  19125. @end table
  19126. @item bgopacity, b
  19127. Set background opacity.
  19128. @item lthreshold, l
  19129. Set low threshold for color component not represented on X or Y axis.
  19130. Values lower than this value will be ignored. Default is 0.
  19131. Note this value is multiplied with actual max possible value one pixel component
  19132. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  19133. is 0.1 * 255 = 25.
  19134. @item hthreshold, h
  19135. Set high threshold for color component not represented on X or Y axis.
  19136. Values higher than this value will be ignored. Default is 1.
  19137. Note this value is multiplied with actual max possible value one pixel component
  19138. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  19139. is 0.9 * 255 = 230.
  19140. @item colorspace, c
  19141. Set what kind of colorspace to use when drawing graticule.
  19142. @table @samp
  19143. @item auto
  19144. @item 601
  19145. @item 709
  19146. @end table
  19147. Default is auto.
  19148. @item tint0, t0
  19149. @item tint1, t1
  19150. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  19151. This means no tint, and output will remain gray.
  19152. @end table
  19153. @anchor{vidstabdetect}
  19154. @section vidstabdetect
  19155. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  19156. @ref{vidstabtransform} for pass 2.
  19157. This filter generates a file with relative translation and rotation
  19158. transform information about subsequent frames, which is then used by
  19159. the @ref{vidstabtransform} filter.
  19160. To enable compilation of this filter you need to configure FFmpeg with
  19161. @code{--enable-libvidstab}.
  19162. This filter accepts the following options:
  19163. @table @option
  19164. @item result
  19165. Set the path to the file used to write the transforms information.
  19166. Default value is @file{transforms.trf}.
  19167. @item shakiness
  19168. Set how shaky the video is and how quick the camera is. It accepts an
  19169. integer in the range 1-10, a value of 1 means little shakiness, a
  19170. value of 10 means strong shakiness. Default value is 5.
  19171. @item accuracy
  19172. Set the accuracy of the detection process. It must be a value in the
  19173. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  19174. accuracy. Default value is 15.
  19175. @item stepsize
  19176. Set stepsize of the search process. The region around minimum is
  19177. scanned with 1 pixel resolution. Default value is 6.
  19178. @item mincontrast
  19179. Set minimum contrast. Below this value a local measurement field is
  19180. discarded. Must be a floating point value in the range 0-1. Default
  19181. value is 0.3.
  19182. @item tripod
  19183. Set reference frame number for tripod mode.
  19184. If enabled, the motion of the frames is compared to a reference frame
  19185. in the filtered stream, identified by the specified number. The idea
  19186. is to compensate all movements in a more-or-less static scene and keep
  19187. the camera view absolutely still.
  19188. If set to 0, it is disabled. The frames are counted starting from 1.
  19189. @item show
  19190. Show fields and transforms in the resulting frames. It accepts an
  19191. integer in the range 0-2. Default value is 0, which disables any
  19192. visualization.
  19193. @item fileformat
  19194. Format for the transforms data file to be written.
  19195. Acceptable values are
  19196. @table @samp
  19197. @item ascii
  19198. Human-readable plain text
  19199. @item binary
  19200. Binary format, roughly 40% smaller than @code{ascii}. (@emph{default})
  19201. @end table
  19202. @end table
  19203. @subsection Examples
  19204. @itemize
  19205. @item
  19206. Use default values:
  19207. @example
  19208. vidstabdetect
  19209. @end example
  19210. @item
  19211. Analyze strongly shaky movie and put the results in file
  19212. @file{mytransforms.trf}:
  19213. @example
  19214. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  19215. @end example
  19216. @item
  19217. Visualize the result of internal transformations in the resulting
  19218. video:
  19219. @example
  19220. vidstabdetect=show=1
  19221. @end example
  19222. @item
  19223. Analyze a video with medium shakiness using @command{ffmpeg}:
  19224. @example
  19225. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  19226. @end example
  19227. @end itemize
  19228. @anchor{vidstabtransform}
  19229. @section vidstabtransform
  19230. Video stabilization/deshaking: pass 2 of 2,
  19231. see @ref{vidstabdetect} for pass 1.
  19232. Read a file with transform information for each frame and
  19233. apply/compensate them. Together with the @ref{vidstabdetect}
  19234. filter this can be used to deshake videos. See also
  19235. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  19236. the @ref{unsharp} filter, see below.
  19237. To enable compilation of this filter you need to configure FFmpeg with
  19238. @code{--enable-libvidstab}.
  19239. @subsection Options
  19240. @table @option
  19241. @item input
  19242. Set path to the file used to read the transforms. Default value is
  19243. @file{transforms.trf}.
  19244. @item smoothing
  19245. Set the number of frames (value*2 + 1) used for lowpass filtering the
  19246. camera movements. Default value is 10.
  19247. For example a number of 10 means that 21 frames are used (10 in the
  19248. past and 10 in the future) to smoothen the motion in the video. A
  19249. larger value leads to a smoother video, but limits the acceleration of
  19250. the camera (pan/tilt movements). 0 is a special case where a static
  19251. camera is simulated.
  19252. @item optalgo
  19253. Set the camera path optimization algorithm.
  19254. Accepted values are:
  19255. @table @samp
  19256. @item gauss
  19257. gaussian kernel low-pass filter on camera motion (default)
  19258. @item avg
  19259. averaging on transformations
  19260. @end table
  19261. @item maxshift
  19262. Set maximal number of pixels to translate frames. Default value is -1,
  19263. meaning no limit.
  19264. @item maxangle
  19265. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  19266. value is -1, meaning no limit.
  19267. @item crop
  19268. Specify how to deal with borders that may be visible due to movement
  19269. compensation.
  19270. Available values are:
  19271. @table @samp
  19272. @item keep
  19273. keep image information from previous frame (default)
  19274. @item black
  19275. fill the border black
  19276. @end table
  19277. @item invert
  19278. Invert transforms if set to 1. Default value is 0.
  19279. @item relative
  19280. Consider transforms as relative to previous frame if set to 1,
  19281. absolute if set to 0. Default value is 0.
  19282. @item zoom
  19283. Set percentage to zoom. A positive value will result in a zoom-in
  19284. effect, a negative value in a zoom-out effect. Default value is 0 (no
  19285. zoom).
  19286. @item optzoom
  19287. Set optimal zooming to avoid borders.
  19288. Accepted values are:
  19289. @table @samp
  19290. @item 0
  19291. disabled
  19292. @item 1
  19293. optimal static zoom value is determined (only very strong movements
  19294. will lead to visible borders) (default)
  19295. @item 2
  19296. optimal adaptive zoom value is determined (no borders will be
  19297. visible), see @option{zoomspeed}
  19298. @end table
  19299. Note that the value given at zoom is added to the one calculated here.
  19300. @item zoomspeed
  19301. Set percent to zoom maximally each frame (enabled when
  19302. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  19303. 0.25.
  19304. @item interpol
  19305. Specify type of interpolation.
  19306. Available values are:
  19307. @table @samp
  19308. @item no
  19309. no interpolation
  19310. @item linear
  19311. linear only horizontal
  19312. @item bilinear
  19313. linear in both directions (default)
  19314. @item bicubic
  19315. cubic in both directions (slow)
  19316. @end table
  19317. @item tripod
  19318. Enable virtual tripod mode if set to 1, which is equivalent to
  19319. @code{relative=0:smoothing=0}. Default value is 0.
  19320. Use also @code{tripod} option of @ref{vidstabdetect}.
  19321. @item debug
  19322. Increase log verbosity if set to 1. Also the detected global motions
  19323. are written to the temporary file @file{global_motions.trf}. Default
  19324. value is 0.
  19325. @end table
  19326. @subsection Examples
  19327. @itemize
  19328. @item
  19329. Use @command{ffmpeg} for a typical stabilization with default values:
  19330. @example
  19331. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  19332. @end example
  19333. Note the use of the @ref{unsharp} filter which is always recommended.
  19334. @item
  19335. Zoom in a bit more and load transform data from a given file:
  19336. @example
  19337. vidstabtransform=zoom=5:input="mytransforms.trf"
  19338. @end example
  19339. @item
  19340. Smoothen the video even more:
  19341. @example
  19342. vidstabtransform=smoothing=30
  19343. @end example
  19344. @end itemize
  19345. @section vflip
  19346. Flip the input video vertically.
  19347. For example, to vertically flip a video with @command{ffmpeg}:
  19348. @example
  19349. ffmpeg -i in.avi -vf "vflip" out.avi
  19350. @end example
  19351. @section vfrdet
  19352. Detect variable frame rate video.
  19353. This filter tries to detect if the input is variable or constant frame rate.
  19354. At end it will output number of frames detected as having variable delta pts,
  19355. and ones with constant delta pts.
  19356. If there was frames with variable delta, than it will also show min, max and
  19357. average delta encountered.
  19358. @section vibrance
  19359. Boost or alter saturation.
  19360. The filter accepts the following options:
  19361. @table @option
  19362. @item intensity
  19363. Set strength of boost if positive value or strength of alter if negative value.
  19364. Default is 0. Allowed range is from -2 to 2.
  19365. @item rbal
  19366. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  19367. @item gbal
  19368. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  19369. @item bbal
  19370. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  19371. @item rlum
  19372. Set the red luma coefficient.
  19373. @item glum
  19374. Set the green luma coefficient.
  19375. @item blum
  19376. Set the blue luma coefficient.
  19377. @item alternate
  19378. If @code{intensity} is negative and this is set to 1, colors will change,
  19379. otherwise colors will be less saturated, more towards gray.
  19380. @end table
  19381. @subsection Commands
  19382. This filter supports the all above options as @ref{commands}.
  19383. @section vif
  19384. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  19385. This filter takes two input videos.
  19386. Both input videos must have the same resolution and pixel format for
  19387. this filter to work correctly. Also it assumes that both inputs
  19388. have the same number of frames, which are compared one by one.
  19389. The obtained average VIF score is printed through the logging system.
  19390. The filter stores the calculated VIF score of each frame.
  19391. This filter also supports the @ref{framesync} options.
  19392. In the below example the input file @file{main.mpg} being processed is compared
  19393. with the reference file @file{ref.mpg}.
  19394. @example
  19395. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  19396. @end example
  19397. @anchor{vignette}
  19398. @section vignette
  19399. Make or reverse a natural vignetting effect.
  19400. The filter accepts the following options:
  19401. @table @option
  19402. @item angle, a
  19403. Set lens angle expression as a number of radians.
  19404. The value is clipped in the @code{[0,PI/2]} range.
  19405. Default value: @code{"PI/5"}
  19406. @item x0
  19407. @item y0
  19408. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  19409. by default.
  19410. @item mode
  19411. Set forward/backward mode.
  19412. Available modes are:
  19413. @table @samp
  19414. @item forward
  19415. The larger the distance from the central point, the darker the image becomes.
  19416. @item backward
  19417. The larger the distance from the central point, the brighter the image becomes.
  19418. This can be used to reverse a vignette effect, though there is no automatic
  19419. detection to extract the lens @option{angle} and other settings (yet). It can
  19420. also be used to create a burning effect.
  19421. @end table
  19422. Default value is @samp{forward}.
  19423. @item eval
  19424. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  19425. It accepts the following values:
  19426. @table @samp
  19427. @item init
  19428. Evaluate expressions only once during the filter initialization.
  19429. @item frame
  19430. Evaluate expressions for each incoming frame. This is way slower than the
  19431. @samp{init} mode since it requires all the scalers to be re-computed, but it
  19432. allows advanced dynamic expressions.
  19433. @end table
  19434. Default value is @samp{init}.
  19435. @item dither
  19436. Set dithering to reduce the circular banding effects. Default is @code{1}
  19437. (enabled).
  19438. @item aspect
  19439. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  19440. Setting this value to the SAR of the input will make a rectangular vignetting
  19441. following the dimensions of the video.
  19442. Default is @code{1/1}.
  19443. @end table
  19444. @subsection Expressions
  19445. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  19446. following parameters.
  19447. @table @option
  19448. @item w
  19449. @item h
  19450. input width and height
  19451. @item n
  19452. the number of input frame, starting from 0
  19453. @item pts
  19454. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  19455. @var{TB} units, NAN if undefined
  19456. @item r
  19457. frame rate of the input video, NAN if the input frame rate is unknown
  19458. @item t
  19459. the PTS (Presentation TimeStamp) of the filtered video frame,
  19460. expressed in seconds, NAN if undefined
  19461. @item tb
  19462. time base of the input video
  19463. @end table
  19464. @subsection Examples
  19465. @itemize
  19466. @item
  19467. Apply simple strong vignetting effect:
  19468. @example
  19469. vignette=PI/4
  19470. @end example
  19471. @item
  19472. Make a flickering vignetting:
  19473. @example
  19474. vignette='PI/4+random(1)*PI/50':eval=frame
  19475. @end example
  19476. @end itemize
  19477. @section vmafmotion
  19478. Obtain the average VMAF motion score of a video.
  19479. It is one of the component metrics of VMAF.
  19480. The obtained average motion score is printed through the logging system.
  19481. The filter accepts the following options:
  19482. @table @option
  19483. @item stats_file
  19484. If specified, the filter will use the named file to save the motion score of
  19485. each frame with respect to the previous frame.
  19486. When filename equals "-" the data is sent to standard output.
  19487. @end table
  19488. Example:
  19489. @example
  19490. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  19491. @end example
  19492. @anchor{vstack}
  19493. @section vstack
  19494. Stack input videos vertically.
  19495. All streams must be of same pixel format and of same width.
  19496. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  19497. to create same output.
  19498. The filter accepts the following options:
  19499. @table @option
  19500. @item inputs
  19501. Set number of input streams. Default is 2.
  19502. @item shortest
  19503. If set to 1, force the output to terminate when the shortest input
  19504. terminates. Default value is 0.
  19505. @end table
  19506. @section w3fdif
  19507. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  19508. Deinterlacing Filter").
  19509. Based on the process described by Martin Weston for BBC R&D, and
  19510. implemented based on the de-interlace algorithm written by Jim
  19511. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  19512. uses filter coefficients calculated by BBC R&D.
  19513. This filter uses field-dominance information in frame to decide which
  19514. of each pair of fields to place first in the output.
  19515. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  19516. There are two sets of filter coefficients, so called "simple"
  19517. and "complex". Which set of filter coefficients is used can
  19518. be set by passing an optional parameter:
  19519. @table @option
  19520. @item filter
  19521. Set the interlacing filter coefficients. Accepts one of the following values:
  19522. @table @samp
  19523. @item simple
  19524. Simple filter coefficient set.
  19525. @item complex
  19526. More-complex filter coefficient set.
  19527. @end table
  19528. Default value is @samp{complex}.
  19529. @item mode
  19530. The interlacing mode to adopt. It accepts one of the following values:
  19531. @table @option
  19532. @item frame
  19533. Output one frame for each frame.
  19534. @item field
  19535. Output one frame for each field.
  19536. @end table
  19537. The default value is @code{field}.
  19538. @item parity
  19539. The picture field parity assumed for the input interlaced video. It accepts one
  19540. of the following values:
  19541. @table @option
  19542. @item tff
  19543. Assume the top field is first.
  19544. @item bff
  19545. Assume the bottom field is first.
  19546. @item auto
  19547. Enable automatic detection of field parity.
  19548. @end table
  19549. The default value is @code{auto}.
  19550. If the interlacing is unknown or the decoder does not export this information,
  19551. top field first will be assumed.
  19552. @item deint
  19553. Specify which frames to deinterlace. Accepts one of the following values:
  19554. @table @samp
  19555. @item all
  19556. Deinterlace all frames,
  19557. @item interlaced
  19558. Only deinterlace frames marked as interlaced.
  19559. @end table
  19560. Default value is @samp{all}.
  19561. @end table
  19562. @subsection Commands
  19563. This filter supports same @ref{commands} as options.
  19564. @section waveform
  19565. Video waveform monitor.
  19566. The waveform monitor plots color component intensity. By default luma
  19567. only. Each column of the waveform corresponds to a column of pixels in the
  19568. source video.
  19569. It accepts the following options:
  19570. @table @option
  19571. @item mode, m
  19572. Can be either @code{row}, or @code{column}. Default is @code{column}.
  19573. In row mode, the graph on the left side represents color component value 0 and
  19574. the right side represents value = 255. In column mode, the top side represents
  19575. color component value = 0 and bottom side represents value = 255.
  19576. @item intensity, i
  19577. Set intensity. Smaller values are useful to find out how many values of the same
  19578. luminance are distributed across input rows/columns.
  19579. Default value is @code{0.04}. Allowed range is [0, 1].
  19580. @item mirror, r
  19581. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  19582. In mirrored mode, higher values will be represented on the left
  19583. side for @code{row} mode and at the top for @code{column} mode. Default is
  19584. @code{1} (mirrored).
  19585. @item display, d
  19586. Set display mode.
  19587. It accepts the following values:
  19588. @table @samp
  19589. @item overlay
  19590. Presents information identical to that in the @code{parade}, except
  19591. that the graphs representing color components are superimposed directly
  19592. over one another.
  19593. This display mode makes it easier to spot relative differences or similarities
  19594. in overlapping areas of the color components that are supposed to be identical,
  19595. such as neutral whites, grays, or blacks.
  19596. @item stack
  19597. Display separate graph for the color components side by side in
  19598. @code{row} mode or one below the other in @code{column} mode.
  19599. @item parade
  19600. Display separate graph for the color components side by side in
  19601. @code{column} mode or one below the other in @code{row} mode.
  19602. Using this display mode makes it easy to spot color casts in the highlights
  19603. and shadows of an image, by comparing the contours of the top and the bottom
  19604. graphs of each waveform. Since whites, grays, and blacks are characterized
  19605. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  19606. should display three waveforms of roughly equal width/height. If not, the
  19607. correction is easy to perform by making level adjustments the three waveforms.
  19608. @end table
  19609. Default is @code{stack}.
  19610. @item components, c
  19611. Set which color components to display. Default is 1, which means only luma
  19612. or red color component if input is in RGB colorspace. If is set for example to
  19613. 7 it will display all 3 (if) available color components.
  19614. @item envelope, e
  19615. @table @samp
  19616. @item none
  19617. No envelope, this is default.
  19618. @item instant
  19619. Instant envelope, minimum and maximum values presented in graph will be easily
  19620. visible even with small @code{step} value.
  19621. @item peak
  19622. Hold minimum and maximum values presented in graph across time. This way you
  19623. can still spot out of range values without constantly looking at waveforms.
  19624. @item peak+instant
  19625. Peak and instant envelope combined together.
  19626. @end table
  19627. @item filter, f
  19628. @table @samp
  19629. @item lowpass
  19630. No filtering, this is default.
  19631. @item flat
  19632. Luma and chroma combined together.
  19633. @item aflat
  19634. Similar as above, but shows difference between blue and red chroma.
  19635. @item xflat
  19636. Similar as above, but use different colors.
  19637. @item yflat
  19638. Similar as above, but again with different colors.
  19639. @item chroma
  19640. Displays only chroma.
  19641. @item color
  19642. Displays actual color value on waveform.
  19643. @item acolor
  19644. Similar as above, but with luma showing frequency of chroma values.
  19645. @end table
  19646. @item graticule, g
  19647. Set which graticule to display.
  19648. @table @samp
  19649. @item none
  19650. Do not display graticule.
  19651. @item green
  19652. Display green graticule showing legal broadcast ranges.
  19653. @item orange
  19654. Display orange graticule showing legal broadcast ranges.
  19655. @item invert
  19656. Display invert graticule showing legal broadcast ranges.
  19657. @end table
  19658. @item opacity, o
  19659. Set graticule opacity.
  19660. @item flags, fl
  19661. Set graticule flags.
  19662. @table @samp
  19663. @item numbers
  19664. Draw numbers above lines. By default enabled.
  19665. @item dots
  19666. Draw dots instead of lines.
  19667. @end table
  19668. @item scale, s
  19669. Set scale used for displaying graticule.
  19670. @table @samp
  19671. @item digital
  19672. @item millivolts
  19673. @item ire
  19674. @end table
  19675. Default is digital.
  19676. @item bgopacity, b
  19677. Set background opacity.
  19678. @item tint0, t0
  19679. @item tint1, t1
  19680. Set tint for output.
  19681. Only used with lowpass filter and when display is not overlay and input
  19682. pixel formats are not RGB.
  19683. @item fitmode, fm
  19684. Set sample aspect ratio of video output frames.
  19685. Can be used to configure waveform so it is not
  19686. streched too much in one of directions.
  19687. @table @samp
  19688. @item none
  19689. Set sample aspect ration to 1/1.
  19690. @item size
  19691. Set sample aspect ratio to match input size of video
  19692. @end table
  19693. Default is @samp{none}.
  19694. @item input
  19695. Set input formats for filter to pick from.
  19696. Can be @samp{all}, for selecting from all available formats,
  19697. or @samp{first}, for selecting first available format.
  19698. Default is @samp{first}.
  19699. @end table
  19700. @section weave, doubleweave
  19701. The @code{weave} takes a field-based video input and join
  19702. each two sequential fields into single frame, producing a new double
  19703. height clip with half the frame rate and half the frame count.
  19704. The @code{doubleweave} works same as @code{weave} but without
  19705. halving frame rate and frame count.
  19706. It accepts the following option:
  19707. @table @option
  19708. @item first_field
  19709. Set first field. Available values are:
  19710. @table @samp
  19711. @item top, t
  19712. Set the frame as top-field-first.
  19713. @item bottom, b
  19714. Set the frame as bottom-field-first.
  19715. @end table
  19716. @end table
  19717. @subsection Examples
  19718. @itemize
  19719. @item
  19720. Interlace video using @ref{select} and @ref{separatefields} filter:
  19721. @example
  19722. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  19723. @end example
  19724. @end itemize
  19725. @section xbr
  19726. Apply the xBR high-quality magnification filter which is designed for pixel
  19727. art. It follows a set of edge-detection rules, see
  19728. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  19729. It accepts the following option:
  19730. @table @option
  19731. @item n
  19732. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  19733. @code{3xBR} and @code{4} for @code{4xBR}.
  19734. Default is @code{3}.
  19735. @end table
  19736. @section xcorrelate
  19737. Apply normalized cross-correlation between first and second input video stream.
  19738. Second input video stream dimensions must be lower than first input video stream.
  19739. The filter accepts the following options:
  19740. @table @option
  19741. @item planes
  19742. Set which planes to process.
  19743. @item secondary
  19744. Set which secondary video frames will be processed from second input video stream,
  19745. can be @var{first} or @var{all}. Default is @var{all}.
  19746. @end table
  19747. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  19748. @section xfade
  19749. Apply cross fade from one input video stream to another input video stream.
  19750. The cross fade is applied for specified duration.
  19751. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  19752. frame rate and timebase.
  19753. The filter accepts the following options:
  19754. @table @option
  19755. @item transition
  19756. Set one of available transition effects:
  19757. @table @samp
  19758. @item custom
  19759. @item fade
  19760. @item wipeleft
  19761. @item wiperight
  19762. @item wipeup
  19763. @item wipedown
  19764. @item slideleft
  19765. @item slideright
  19766. @item slideup
  19767. @item slidedown
  19768. @item circlecrop
  19769. @item rectcrop
  19770. @item distance
  19771. @item fadeblack
  19772. @item fadewhite
  19773. @item radial
  19774. @item smoothleft
  19775. @item smoothright
  19776. @item smoothup
  19777. @item smoothdown
  19778. @item circleopen
  19779. @item circleclose
  19780. @item vertopen
  19781. @item vertclose
  19782. @item horzopen
  19783. @item horzclose
  19784. @item dissolve
  19785. @item pixelize
  19786. @item diagtl
  19787. @item diagtr
  19788. @item diagbl
  19789. @item diagbr
  19790. @item hlslice
  19791. @item hrslice
  19792. @item vuslice
  19793. @item vdslice
  19794. @item hblur
  19795. @item fadegrays
  19796. @item wipetl
  19797. @item wipetr
  19798. @item wipebl
  19799. @item wipebr
  19800. @item squeezeh
  19801. @item squeezev
  19802. @item zoomin
  19803. @item fadefast
  19804. @item fadeslow
  19805. @item hlwind
  19806. @item hrwind
  19807. @item vuwind
  19808. @item vdwind
  19809. @item coverleft
  19810. @item coverright
  19811. @item coverup
  19812. @item coverdown
  19813. @item revealleft
  19814. @item revealright
  19815. @item revealup
  19816. @item revealdown
  19817. @end table
  19818. Default transition effect is fade.
  19819. @item duration
  19820. Set cross fade duration in seconds.
  19821. Range is 0 to 60 seconds.
  19822. Default duration is 1 second.
  19823. @item offset
  19824. Set cross fade start relative to first input stream in seconds.
  19825. Default offset is 0.
  19826. @item expr
  19827. Set expression for custom transition effect.
  19828. The expressions can use the following variables and functions:
  19829. @table @option
  19830. @item X
  19831. @item Y
  19832. The coordinates of the current sample.
  19833. @item W
  19834. @item H
  19835. The width and height of the image.
  19836. @item P
  19837. Progress of transition effect.
  19838. @item PLANE
  19839. Currently processed plane.
  19840. @item A
  19841. Return value of first input at current location and plane.
  19842. @item B
  19843. Return value of second input at current location and plane.
  19844. @item a0(x, y)
  19845. @item a1(x, y)
  19846. @item a2(x, y)
  19847. @item a3(x, y)
  19848. Return the value of the pixel at location (@var{x},@var{y}) of the
  19849. first/second/third/fourth component of first input.
  19850. @item b0(x, y)
  19851. @item b1(x, y)
  19852. @item b2(x, y)
  19853. @item b3(x, y)
  19854. Return the value of the pixel at location (@var{x},@var{y}) of the
  19855. first/second/third/fourth component of second input.
  19856. @end table
  19857. @end table
  19858. @subsection Examples
  19859. @itemize
  19860. @item
  19861. Cross fade from one input video to another input video, with fade transition and duration of transition
  19862. of 2 seconds starting at offset of 5 seconds:
  19863. @example
  19864. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  19865. @end example
  19866. @end itemize
  19867. @section xmedian
  19868. Pick median pixels from several input videos.
  19869. The filter accepts the following options:
  19870. @table @option
  19871. @item inputs
  19872. Set number of inputs.
  19873. Default is 3. Allowed range is from 3 to 255.
  19874. If number of inputs is even number, than result will be mean value between two median values.
  19875. @item planes
  19876. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  19877. @item percentile
  19878. Set median percentile. Default value is @code{0.5}.
  19879. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  19880. minimum values, and @code{1} maximum values.
  19881. @end table
  19882. @subsection Commands
  19883. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  19884. @anchor{xpsnr}
  19885. @section xpsnr
  19886. Obtain the average (across all input frames) and minimum (across all color plane averages)
  19887. eXtended Perceptually weighted peak Signal-to-Noise Ratio (XPSNR) between two input videos.
  19888. The XPSNR is a low-complexity psychovisually motivated distortion measurement algorithm for
  19889. assessing the difference between two video streams or images. This is especially useful for
  19890. objectively quantifying the distortions caused by video and image codecs, as an alternative
  19891. to a formal subjective test. The logarithmic XPSNR output values are in a similar range as
  19892. those of traditional @ref{psnr} assessments but better reflect human impressions of visual
  19893. coding quality. More details on the XPSNR measure, which essentially represents a blockwise
  19894. weighted variant of the PSNR measure, can be found in the following freely available papers:
  19895. @itemize
  19896. @item
  19897. C. R. Helmrich, M. Siekmann, S. Becker, S. Bosse, D. Marpe, and T. Wiegand, "XPSNR: A
  19898. Low-Complexity Extension of the Perceptually Weighted Peak Signal-to-Noise Ratio for
  19899. High-Resolution Video Quality Assessment," in Proc. IEEE Int. Conf. Acoustics, Speech,
  19900. Sig. Process. (ICASSP), virt./online, May 2020. @url{www.ecodis.de/xpsnr.htm}
  19901. @item
  19902. C. R. Helmrich, S. Bosse, H. Schwarz, D. Marpe, and T. Wiegand, "A Study of the
  19903. Extended Perceptually Weighted Peak Signal-to-Noise Ratio (XPSNR) for Video Compression
  19904. with Different Resolutions and Bit Depths," ITU Journal: ICT Discoveries, vol. 3, no.
  19905. 1, pp. 65 - 72, May 2020. @url{http://handle.itu.int/11.1002/pub/8153d78b-en}
  19906. @end itemize
  19907. When publishing the results of XPSNR assessments obtained using, e.g., this FFmpeg filter, a
  19908. reference to the above papers as a means of documentation is strongly encouraged. The filter
  19909. requires two input videos. The first input is considered a (usually not distorted) reference
  19910. source and is passed unchanged to the output, whereas the second input is a (distorted) test
  19911. signal. Except for the bit depth, these two video inputs must have the same pixel format. In
  19912. addition, for best performance, both compared input videos should be in YCbCr color format.
  19913. The obtained overall XPSNR values mentioned above are printed through the logging system. In
  19914. case of input with multiple color planes, we suggest reporting of the minimum XPSNR average.
  19915. The following parameter, which behaves like the one for the @ref{psnr} filter, is accepted:
  19916. @table @option
  19917. @item stats_file, f
  19918. If specified, the filter will use the named file to save the XPSNR value of each individual
  19919. frame and color plane. When the file name equals "-", that data is sent to standard output.
  19920. @end table
  19921. This filter also supports the @ref{framesync} options.
  19922. @subsection Examples
  19923. @itemize
  19924. @item
  19925. XPSNR analysis of two 1080p HD videos, ref_source.yuv and test_video.yuv, both at 24 frames
  19926. per second, with color format 4:2:0, bit depth 8, and output of a logfile named "xpsnr.log":
  19927. @example
  19928. ffmpeg -s 1920x1080 -framerate 24 -pix_fmt yuv420p -i ref_source.yuv -s 1920x1080 -framerate
  19929. 24 -pix_fmt yuv420p -i test_video.yuv -lavfi xpsnr="stats_file=xpsnr.log" -f null -
  19930. @end example
  19931. @item
  19932. XPSNR analysis of two 2160p UHD videos, ref_source.yuv with bit depth 8 and test_video.yuv
  19933. with bit depth 10, both at 60 frames per second with color format 4:2:0, no logfile output:
  19934. @example
  19935. ffmpeg -s 3840x2160 -framerate 60 -pix_fmt yuv420p -i ref_source.yuv -s 3840x2160 -framerate
  19936. 60 -pix_fmt yuv420p10le -i test_video.yuv -lavfi xpsnr="stats_file=-" -f null -
  19937. @end example
  19938. @end itemize
  19939. @anchor{xstack}
  19940. @section xstack
  19941. Stack video inputs into custom layout.
  19942. All streams must be of same pixel format.
  19943. The filter accepts the following options:
  19944. @table @option
  19945. @item inputs
  19946. Set number of input streams. Default is 2.
  19947. @item layout
  19948. Specify layout of inputs.
  19949. This option requires the desired layout configuration to be explicitly set by the user.
  19950. This sets position of each video input in output. Each input
  19951. is separated by '|'.
  19952. The first number represents the column, and the second number represents the row.
  19953. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  19954. where X is video input from which to take width or height.
  19955. Multiple values can be used when separated by '+'. In such
  19956. case values are summed together.
  19957. Note that if inputs are of different sizes gaps may appear, as not all of
  19958. the output video frame will be filled. Similarly, videos can overlap each
  19959. other if their position doesn't leave enough space for the full frame of
  19960. adjoining videos.
  19961. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  19962. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  19963. the user. Either @code{grid} or @code{layout} can be specified at a time.
  19964. Specifying both will result in an error.
  19965. @item grid
  19966. Specify a fixed size grid of inputs.
  19967. This option is used to create a fixed size grid of the input streams. Set the
  19968. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  19969. input streams and they will be arranged as a grid with @code{ROWS} rows and
  19970. @code{COLUMNS} columns. When using this option, each input stream within a row
  19971. must have the same height and all the rows must have the same width.
  19972. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  19973. set to @code{ROWS * COLUMNS}.
  19974. For 2 inputs, a default grid of @code{2x1} (equivalent to
  19975. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  19976. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  19977. Specifying both will result in an error.
  19978. @item shortest
  19979. If set to 1, force the output to terminate when the shortest input
  19980. terminates. Default value is 0.
  19981. @item fill
  19982. If set to valid color, all unused pixels will be filled with that color.
  19983. By default fill is set to none, so it is disabled.
  19984. @end table
  19985. @subsection Examples
  19986. @itemize
  19987. @item
  19988. Display 4 inputs into 2x2 grid.
  19989. Layout:
  19990. @example
  19991. input1(0, 0) | input3(w0, 0)
  19992. input2(0, h0) | input4(w0, h0)
  19993. @end example
  19994. @example
  19995. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  19996. @end example
  19997. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19998. @item
  19999. Display 4 inputs into 1x4 grid.
  20000. Layout:
  20001. @example
  20002. input1(0, 0)
  20003. input2(0, h0)
  20004. input3(0, h0+h1)
  20005. input4(0, h0+h1+h2)
  20006. @end example
  20007. @example
  20008. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  20009. @end example
  20010. Note that if inputs are of different widths, unused space will appear.
  20011. @item
  20012. Display 9 inputs into 3x3 grid.
  20013. Layout:
  20014. @example
  20015. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  20016. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  20017. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  20018. @end example
  20019. @example
  20020. xstack=inputs=9:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0|w0_h0+h1|w0+w3_0|w0+w3_h0|w0+w3_h0+h1
  20021. @end example
  20022. Note that if inputs are of different sizes, gaps or overlaps may occur.
  20023. @item
  20024. Display 16 inputs into 4x4 grid.
  20025. Layout:
  20026. @example
  20027. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  20028. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  20029. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  20030. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  20031. @end example
  20032. @example
  20033. xstack=inputs=16:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2|w0_0|w0_h0|w0_h0+h1|w0_h0+h1+h2|w0+w4_0|
  20034. w0+w4_h0|w0+w4_h0+h1|w0+w4_h0+h1+h2|w0+w4+w8_0|w0+w4+w8_h0|w0+w4+w8_h0+h1|w0+w4+w8_h0+h1+h2
  20035. @end example
  20036. Note that if inputs are of different sizes, gaps or overlaps may occur.
  20037. @end itemize
  20038. @anchor{yadif}
  20039. @section yadif
  20040. Deinterlace the input video ("yadif" means "yet another deinterlacing
  20041. filter").
  20042. It accepts the following parameters:
  20043. @table @option
  20044. @item mode
  20045. The interlacing mode to adopt. It accepts one of the following values:
  20046. @table @option
  20047. @item 0, send_frame
  20048. Output one frame for each frame.
  20049. @item 1, send_field
  20050. Output one frame for each field.
  20051. @item 2, send_frame_nospatial
  20052. Like @code{send_frame}, but it skips the spatial interlacing check.
  20053. @item 3, send_field_nospatial
  20054. Like @code{send_field}, but it skips the spatial interlacing check.
  20055. @end table
  20056. The default value is @code{send_frame}.
  20057. @item parity
  20058. The picture field parity assumed for the input interlaced video. It accepts one
  20059. of the following values:
  20060. @table @option
  20061. @item 0, tff
  20062. Assume the top field is first.
  20063. @item 1, bff
  20064. Assume the bottom field is first.
  20065. @item -1, auto
  20066. Enable automatic detection of field parity.
  20067. @end table
  20068. The default value is @code{auto}.
  20069. If the interlacing is unknown or the decoder does not export this information,
  20070. top field first will be assumed.
  20071. @item deint
  20072. Specify which frames to deinterlace. Accepts one of the following
  20073. values:
  20074. @table @option
  20075. @item 0, all
  20076. Deinterlace all frames.
  20077. @item 1, interlaced
  20078. Only deinterlace frames marked as interlaced.
  20079. @end table
  20080. The default value is @code{all}.
  20081. @end table
  20082. @section yadif_cuda
  20083. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  20084. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  20085. and/or nvenc.
  20086. It accepts the following parameters:
  20087. @table @option
  20088. @item mode
  20089. The interlacing mode to adopt. It accepts one of the following values:
  20090. @table @option
  20091. @item 0, send_frame
  20092. Output one frame for each frame.
  20093. @item 1, send_field
  20094. Output one frame for each field.
  20095. @item 2, send_frame_nospatial
  20096. Like @code{send_frame}, but it skips the spatial interlacing check.
  20097. @item 3, send_field_nospatial
  20098. Like @code{send_field}, but it skips the spatial interlacing check.
  20099. @end table
  20100. The default value is @code{send_frame}.
  20101. @item parity
  20102. The picture field parity assumed for the input interlaced video. It accepts one
  20103. of the following values:
  20104. @table @option
  20105. @item 0, tff
  20106. Assume the top field is first.
  20107. @item 1, bff
  20108. Assume the bottom field is first.
  20109. @item -1, auto
  20110. Enable automatic detection of field parity.
  20111. @end table
  20112. The default value is @code{auto}.
  20113. If the interlacing is unknown or the decoder does not export this information,
  20114. top field first will be assumed.
  20115. @item deint
  20116. Specify which frames to deinterlace. Accepts one of the following
  20117. values:
  20118. @table @option
  20119. @item 0, all
  20120. Deinterlace all frames.
  20121. @item 1, interlaced
  20122. Only deinterlace frames marked as interlaced.
  20123. @end table
  20124. The default value is @code{all}.
  20125. @end table
  20126. @section yaepblur
  20127. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  20128. The algorithm is described in
  20129. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  20130. It accepts the following parameters:
  20131. @table @option
  20132. @item radius, r
  20133. Set the window radius. Default value is 3.
  20134. @item planes, p
  20135. Set which planes to filter. Default is only the first plane.
  20136. @item sigma, s
  20137. Set blur strength. Default value is 128.
  20138. @end table
  20139. @subsection Commands
  20140. This filter supports same @ref{commands} as options.
  20141. @section zoompan
  20142. Apply Zoom & Pan effect.
  20143. This filter accepts the following options:
  20144. @table @option
  20145. @item zoom, z
  20146. Set the zoom expression. Range is 1-10. Default is 1.
  20147. @item x
  20148. @item y
  20149. Set the x and y expression. Default is 0.
  20150. @item d
  20151. Set the duration expression in number of frames.
  20152. This sets for how many number of frames effect will last for
  20153. single input image. Default is 90.
  20154. @item s
  20155. Set the output image size, default is 'hd720'.
  20156. @item fps
  20157. Set the output frame rate, default is '25'.
  20158. @end table
  20159. Each expression can contain the following constants:
  20160. @table @option
  20161. @item in_w, iw
  20162. Input width.
  20163. @item in_h, ih
  20164. Input height.
  20165. @item out_w, ow
  20166. Output width.
  20167. @item out_h, oh
  20168. Output height.
  20169. @item in
  20170. Input frame count.
  20171. @item on
  20172. Output frame count.
  20173. @item in_time, it
  20174. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  20175. @item out_time, time, ot
  20176. The output timestamp expressed in seconds.
  20177. @item x
  20178. @item y
  20179. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  20180. for current input frame.
  20181. @item px
  20182. @item py
  20183. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  20184. not yet such frame (first input frame).
  20185. @item zoom
  20186. Last calculated zoom from 'z' expression for current input frame.
  20187. @item pzoom
  20188. Last calculated zoom of last output frame of previous input frame.
  20189. @item duration
  20190. Number of output frames for current input frame. Calculated from 'd' expression
  20191. for each input frame.
  20192. @item pduration
  20193. number of output frames created for previous input frame
  20194. @item a
  20195. Rational number: input width / input height
  20196. @item sar
  20197. sample aspect ratio
  20198. @item dar
  20199. display aspect ratio
  20200. @end table
  20201. @subsection Examples
  20202. @itemize
  20203. @item
  20204. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  20205. @example
  20206. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='if(gte(zoom,1.5),x,x+1/a)':y='if(gte(zoom,1.5),y,y+1)':s=640x360
  20207. @end example
  20208. @item
  20209. Zoom in up to 1.5x and pan always at center of picture:
  20210. @example
  20211. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20212. @end example
  20213. @item
  20214. Same as above but without pausing:
  20215. @example
  20216. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20217. @end example
  20218. @item
  20219. Zoom in 2x into center of picture only for the first second of the input video:
  20220. @example
  20221. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20222. @end example
  20223. @end itemize
  20224. @anchor{zscale}
  20225. @section zscale
  20226. Scale (resize) the input video, using the z.lib library:
  20227. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  20228. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  20229. The zscale filter forces the output display aspect ratio to be the same
  20230. as the input, by changing the output sample aspect ratio.
  20231. If the input image format is different from the format requested by
  20232. the next filter, the zscale filter will convert the input to the
  20233. requested format.
  20234. @subsection Options
  20235. The filter accepts the following options.
  20236. @table @option
  20237. @item width, w
  20238. @item height, h
  20239. Set the output video dimension expression. Default value is the input
  20240. dimension.
  20241. If the @var{width} or @var{w} value is 0, the input width is used for
  20242. the output. If the @var{height} or @var{h} value is 0, the input height
  20243. is used for the output.
  20244. If one and only one of the values is -n with n >= 1, the zscale filter
  20245. will use a value that maintains the aspect ratio of the input image,
  20246. calculated from the other specified dimension. After that it will,
  20247. however, make sure that the calculated dimension is divisible by n and
  20248. adjust the value if necessary.
  20249. If both values are -n with n >= 1, the behavior will be identical to
  20250. both values being set to 0 as previously detailed.
  20251. See below for the list of accepted constants for use in the dimension
  20252. expression.
  20253. @item size, s
  20254. Set the video size. For the syntax of this option, check the
  20255. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20256. @item dither, d
  20257. Set the dither type.
  20258. Possible values are:
  20259. @table @var
  20260. @item none
  20261. @item ordered
  20262. @item random
  20263. @item error_diffusion
  20264. @end table
  20265. Default is none.
  20266. @item filter, f
  20267. Set the resize filter type.
  20268. Possible values are:
  20269. @table @var
  20270. @item point
  20271. @item bilinear
  20272. @item bicubic
  20273. @item spline16
  20274. @item spline36
  20275. @item lanczos
  20276. @end table
  20277. Default is bilinear.
  20278. @item range, r
  20279. Set the color range.
  20280. Possible values are:
  20281. @table @var
  20282. @item input
  20283. @item limited
  20284. @item full
  20285. @end table
  20286. Default is same as input.
  20287. @item primaries, p
  20288. Set the color primaries.
  20289. Possible values are:
  20290. @table @var
  20291. @item input
  20292. @item 709
  20293. @item unspecified
  20294. @item 170m
  20295. @item 240m
  20296. @item 2020
  20297. @end table
  20298. Default is same as input.
  20299. @item transfer, t
  20300. Set the transfer characteristics.
  20301. Possible values are:
  20302. @table @var
  20303. @item input
  20304. @item 709
  20305. @item unspecified
  20306. @item 601
  20307. @item linear
  20308. @item 2020_10
  20309. @item 2020_12
  20310. @item smpte2084
  20311. @item iec61966-2-1
  20312. @item arib-std-b67
  20313. @end table
  20314. Default is same as input.
  20315. @item matrix, m
  20316. Set the colorspace matrix.
  20317. Possible value are:
  20318. @table @var
  20319. @item input
  20320. @item 709
  20321. @item unspecified
  20322. @item 470bg
  20323. @item 170m
  20324. @item 2020_ncl
  20325. @item 2020_cl
  20326. @end table
  20327. Default is same as input.
  20328. @item rangein, rin
  20329. Set the input color range.
  20330. Possible values are:
  20331. @table @var
  20332. @item input
  20333. @item limited
  20334. @item full
  20335. @end table
  20336. Default is same as input.
  20337. @item primariesin, pin
  20338. Set the input color primaries.
  20339. Possible values are:
  20340. @table @var
  20341. @item input
  20342. @item 709
  20343. @item unspecified
  20344. @item 170m
  20345. @item 240m
  20346. @item 2020
  20347. @end table
  20348. Default is same as input.
  20349. @item transferin, tin
  20350. Set the input transfer characteristics.
  20351. Possible values are:
  20352. @table @var
  20353. @item input
  20354. @item 709
  20355. @item unspecified
  20356. @item 601
  20357. @item linear
  20358. @item 2020_10
  20359. @item 2020_12
  20360. @end table
  20361. Default is same as input.
  20362. @item matrixin, min
  20363. Set the input colorspace matrix.
  20364. Possible value are:
  20365. @table @var
  20366. @item input
  20367. @item 709
  20368. @item unspecified
  20369. @item 470bg
  20370. @item 170m
  20371. @item 2020_ncl
  20372. @item 2020_cl
  20373. @end table
  20374. @item chromal, c
  20375. Set the output chroma location.
  20376. Possible values are:
  20377. @table @var
  20378. @item input
  20379. @item left
  20380. @item center
  20381. @item topleft
  20382. @item top
  20383. @item bottomleft
  20384. @item bottom
  20385. @end table
  20386. @item chromalin, cin
  20387. Set the input chroma location.
  20388. Possible values are:
  20389. @table @var
  20390. @item input
  20391. @item left
  20392. @item center
  20393. @item topleft
  20394. @item top
  20395. @item bottomleft
  20396. @item bottom
  20397. @end table
  20398. @item npl
  20399. Set the nominal peak luminance.
  20400. @item param_a
  20401. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  20402. filter taps for lanczos.
  20403. @item param_b
  20404. Parameter B for scaling filters. Parameter "c" for bicubic.
  20405. @end table
  20406. The values of the @option{w} and @option{h} options are expressions
  20407. containing the following constants:
  20408. @table @var
  20409. @item in_w
  20410. @item in_h
  20411. The input width and height
  20412. @item iw
  20413. @item ih
  20414. These are the same as @var{in_w} and @var{in_h}.
  20415. @item out_w
  20416. @item out_h
  20417. The output (scaled) width and height
  20418. @item ow
  20419. @item oh
  20420. These are the same as @var{out_w} and @var{out_h}
  20421. @item a
  20422. The same as @var{iw} / @var{ih}
  20423. @item sar
  20424. input sample aspect ratio
  20425. @item dar
  20426. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  20427. @item hsub
  20428. @item vsub
  20429. horizontal and vertical input chroma subsample values. For example for the
  20430. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20431. @item ohsub
  20432. @item ovsub
  20433. horizontal and vertical output chroma subsample values. For example for the
  20434. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20435. @end table
  20436. @subsection Commands
  20437. This filter supports the following commands:
  20438. @table @option
  20439. @item width, w
  20440. @item height, h
  20441. Set the output video dimension expression.
  20442. The command accepts the same syntax of the corresponding option.
  20443. If the specified expression is not valid, it is kept at its current
  20444. value.
  20445. @end table
  20446. @c man end VIDEO FILTERS
  20447. @chapter OpenCL Video Filters
  20448. @c man begin OPENCL VIDEO FILTERS
  20449. Below is a description of the currently available OpenCL video filters.
  20450. To enable compilation of these filters you need to configure FFmpeg with
  20451. @code{--enable-opencl}.
  20452. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20453. @table @option
  20454. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  20455. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  20456. given device parameters.
  20457. @item -filter_hw_device @var{name}
  20458. Pass the hardware device called @var{name} to all filters in any filter graph.
  20459. @end table
  20460. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20461. @itemize
  20462. @item
  20463. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  20464. @example
  20465. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  20466. @end example
  20467. @end itemize
  20468. Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  20469. @section avgblur_opencl
  20470. Apply average blur filter.
  20471. The filter accepts the following options:
  20472. @table @option
  20473. @item sizeX
  20474. Set horizontal radius size.
  20475. Range is @code{[1, 1024]} and default value is @code{1}.
  20476. @item planes
  20477. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20478. @item sizeY
  20479. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  20480. @end table
  20481. @subsection Example
  20482. @itemize
  20483. @item
  20484. Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  20485. @example
  20486. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  20487. @end example
  20488. @end itemize
  20489. @section boxblur_opencl
  20490. Apply a boxblur algorithm to the input video.
  20491. It accepts the following parameters:
  20492. @table @option
  20493. @item luma_radius, lr
  20494. @item luma_power, lp
  20495. @item chroma_radius, cr
  20496. @item chroma_power, cp
  20497. @item alpha_radius, ar
  20498. @item alpha_power, ap
  20499. @end table
  20500. A description of the accepted options follows.
  20501. @table @option
  20502. @item luma_radius, lr
  20503. @item chroma_radius, cr
  20504. @item alpha_radius, ar
  20505. Set an expression for the box radius in pixels used for blurring the
  20506. corresponding input plane.
  20507. The radius value must be a non-negative number, and must not be
  20508. greater than the value of the expression @code{min(w,h)/2} for the
  20509. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  20510. planes.
  20511. Default value for @option{luma_radius} is "2". If not specified,
  20512. @option{chroma_radius} and @option{alpha_radius} default to the
  20513. corresponding value set for @option{luma_radius}.
  20514. The expressions can contain the following constants:
  20515. @table @option
  20516. @item w
  20517. @item h
  20518. The input width and height in pixels.
  20519. @item cw
  20520. @item ch
  20521. The input chroma image width and height in pixels.
  20522. @item hsub
  20523. @item vsub
  20524. The horizontal and vertical chroma subsample values. For example, for the
  20525. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  20526. @end table
  20527. @item luma_power, lp
  20528. @item chroma_power, cp
  20529. @item alpha_power, ap
  20530. Specify how many times the boxblur filter is applied to the
  20531. corresponding plane.
  20532. Default value for @option{luma_power} is 2. If not specified,
  20533. @option{chroma_power} and @option{alpha_power} default to the
  20534. corresponding value set for @option{luma_power}.
  20535. A value of 0 will disable the effect.
  20536. @end table
  20537. @subsection Examples
  20538. Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
  20539. @itemize
  20540. @item
  20541. Apply a boxblur filter with the luma, chroma, and alpha radius
  20542. set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
  20543. @example
  20544. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  20545. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  20546. @end example
  20547. @item
  20548. Apply a boxblur filter with luma radius set to 2, luma_power to 1, chroma_radius to 4, chroma_power to 5, alpha_radius to 3 and alpha_power to 7.
  20549. For the luma plane, a 2x2 box radius will be run once.
  20550. For the chroma plane, a 4x4 box radius will be run 5 times.
  20551. For the alpha plane, a 3x3 box radius will be run 7 times.
  20552. @example
  20553. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  20554. @end example
  20555. @end itemize
  20556. @section colorkey_opencl
  20557. RGB colorspace color keying.
  20558. The filter accepts the following options:
  20559. @table @option
  20560. @item color
  20561. The color which will be replaced with transparency.
  20562. @item similarity
  20563. Similarity percentage with the key color.
  20564. 0.01 matches only the exact key color, while 1.0 matches everything.
  20565. @item blend
  20566. Blend percentage.
  20567. 0.0 makes pixels either fully transparent, or not transparent at all.
  20568. Higher values result in semi-transparent pixels, with a higher transparency
  20569. the more similar the pixels color is to the key color.
  20570. @end table
  20571. @subsection Examples
  20572. @itemize
  20573. @item
  20574. Make every semi-green pixel in the input transparent with some slight blending:
  20575. @example
  20576. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  20577. @end example
  20578. @end itemize
  20579. @section convolution_opencl
  20580. Apply convolution of 3x3, 5x5, 7x7 matrix.
  20581. The filter accepts the following options:
  20582. @table @option
  20583. @item 0m
  20584. @item 1m
  20585. @item 2m
  20586. @item 3m
  20587. Set matrix for each plane.
  20588. Matrix is sequence of 9, 25 or 49 signed numbers.
  20589. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  20590. @item 0rdiv
  20591. @item 1rdiv
  20592. @item 2rdiv
  20593. @item 3rdiv
  20594. Set multiplier for calculated value for each plane.
  20595. If unset or 0, it will be sum of all matrix elements.
  20596. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  20597. @item 0bias
  20598. @item 1bias
  20599. @item 2bias
  20600. @item 3bias
  20601. Set bias for each plane. This value is added to the result of the multiplication.
  20602. Useful for making the overall image brighter or darker.
  20603. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  20604. @end table
  20605. @subsection Examples
  20606. @itemize
  20607. @item
  20608. Apply sharpen:
  20609. @example
  20610. -i INPUT -vf "hwupload, convolution_opencl=0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0, hwdownload" OUTPUT
  20611. @end example
  20612. @item
  20613. Apply blur:
  20614. @example
  20615. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9, hwdownload" OUTPUT
  20616. @end example
  20617. @item
  20618. Apply edge enhance:
  20619. @example
  20620. -i INPUT -vf "hwupload, convolution_opencl=0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128, hwdownload" OUTPUT
  20621. @end example
  20622. @item
  20623. Apply edge detect:
  20624. @example
  20625. -i INPUT -vf "hwupload, convolution_opencl=0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128, hwdownload" OUTPUT
  20626. @end example
  20627. @item
  20628. Apply laplacian edge detector which includes diagonals:
  20629. @example
  20630. -i INPUT -vf "hwupload, convolution_opencl=1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0, hwdownload" OUTPUT
  20631. @end example
  20632. @item
  20633. Apply emboss:
  20634. @example
  20635. -i INPUT -vf "hwupload, convolution_opencl=-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2, hwdownload" OUTPUT
  20636. @end example
  20637. @end itemize
  20638. @section erosion_opencl
  20639. Apply erosion effect to the video.
  20640. This filter replaces the pixel by the local(3x3) minimum.
  20641. It accepts the following options:
  20642. @table @option
  20643. @item threshold0
  20644. @item threshold1
  20645. @item threshold2
  20646. @item threshold3
  20647. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20648. If @code{0}, plane will remain unchanged.
  20649. @item coordinates
  20650. Flag which specifies the pixel to refer to.
  20651. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20652. Flags to local 3x3 coordinates region centered on @code{x}:
  20653. 1 2 3
  20654. 4 x 5
  20655. 6 7 8
  20656. @end table
  20657. @subsection Example
  20658. @itemize
  20659. @item
  20660. Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.
  20661. @example
  20662. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20663. @end example
  20664. @end itemize
  20665. @section deshake_opencl
  20666. Feature-point based video stabilization filter.
  20667. The filter accepts the following options:
  20668. @table @option
  20669. @item tripod
  20670. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  20671. @item debug
  20672. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  20673. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  20674. Viewing point matches in the output video is only supported for RGB input.
  20675. Defaults to @code{0}.
  20676. @item adaptive_crop
  20677. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  20678. Defaults to @code{1}.
  20679. @item refine_features
  20680. Whether or not feature points should be refined at a sub-pixel level.
  20681. This can be turned off for a slight performance gain at the cost of precision.
  20682. Defaults to @code{1}.
  20683. @item smooth_strength
  20684. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  20685. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  20686. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  20687. Defaults to @code{0.0}.
  20688. @item smooth_window_multiplier
  20689. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  20690. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  20691. Acceptable values range from @code{0.1} to @code{10.0}.
  20692. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  20693. potentially improving smoothness, but also increase latency and memory usage.
  20694. Defaults to @code{2.0}.
  20695. @end table
  20696. @subsection Examples
  20697. @itemize
  20698. @item
  20699. Stabilize a video with a fixed, medium smoothing strength:
  20700. @example
  20701. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  20702. @end example
  20703. @item
  20704. Stabilize a video with debugging (both in console and in rendered video):
  20705. @example
  20706. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  20707. @end example
  20708. @end itemize
  20709. @section dilation_opencl
  20710. Apply dilation effect to the video.
  20711. This filter replaces the pixel by the local(3x3) maximum.
  20712. It accepts the following options:
  20713. @table @option
  20714. @item threshold0
  20715. @item threshold1
  20716. @item threshold2
  20717. @item threshold3
  20718. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20719. If @code{0}, plane will remain unchanged.
  20720. @item coordinates
  20721. Flag which specifies the pixel to refer to.
  20722. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20723. Flags to local 3x3 coordinates region centered on @code{x}:
  20724. 1 2 3
  20725. 4 x 5
  20726. 6 7 8
  20727. @end table
  20728. @subsection Example
  20729. @itemize
  20730. @item
  20731. Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
  20732. @example
  20733. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20734. @end example
  20735. @end itemize
  20736. @anchor{nlmeans_opencl}
  20737. @section nlmeans_opencl
  20738. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  20739. @section overlay_opencl
  20740. Overlay one video on top of another.
  20741. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20742. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  20743. The filter accepts the following options:
  20744. @table @option
  20745. @item x
  20746. Set the x coordinate of the overlaid video on the main video.
  20747. Default value is @code{0}.
  20748. @item y
  20749. Set the y coordinate of the overlaid video on the main video.
  20750. Default value is @code{0}.
  20751. @end table
  20752. @subsection Examples
  20753. @itemize
  20754. @item
  20755. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  20756. @example
  20757. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20758. @end example
  20759. @item
  20760. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20761. @example
  20762. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20763. @end example
  20764. @end itemize
  20765. @section pad_opencl
  20766. Add paddings to the input image, and place the original input at the
  20767. provided @var{x}, @var{y} coordinates.
  20768. It accepts the following options:
  20769. @table @option
  20770. @item width, w
  20771. @item height, h
  20772. Specify an expression for the size of the output image with the
  20773. paddings added. If the value for @var{width} or @var{height} is 0, the
  20774. corresponding input size is used for the output.
  20775. The @var{width} expression can reference the value set by the
  20776. @var{height} expression, and vice versa.
  20777. The default value of @var{width} and @var{height} is 0.
  20778. @item x
  20779. @item y
  20780. Specify the offsets to place the input image at within the padded area,
  20781. with respect to the top/left border of the output image.
  20782. The @var{x} expression can reference the value set by the @var{y}
  20783. expression, and vice versa.
  20784. The default value of @var{x} and @var{y} is 0.
  20785. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  20786. so the input image is centered on the padded area.
  20787. @item color
  20788. Specify the color of the padded area. For the syntax of this option,
  20789. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20790. manual,ffmpeg-utils}.
  20791. @item aspect
  20792. Pad to an aspect instead to a resolution.
  20793. @end table
  20794. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  20795. options are expressions containing the following constants:
  20796. @table @option
  20797. @item in_w
  20798. @item in_h
  20799. The input video width and height.
  20800. @item iw
  20801. @item ih
  20802. These are the same as @var{in_w} and @var{in_h}.
  20803. @item out_w
  20804. @item out_h
  20805. The output width and height (the size of the padded area), as
  20806. specified by the @var{width} and @var{height} expressions.
  20807. @item ow
  20808. @item oh
  20809. These are the same as @var{out_w} and @var{out_h}.
  20810. @item x
  20811. @item y
  20812. The x and y offsets as specified by the @var{x} and @var{y}
  20813. expressions, or NAN if not yet specified.
  20814. @item a
  20815. same as @var{iw} / @var{ih}
  20816. @item sar
  20817. input sample aspect ratio
  20818. @item dar
  20819. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  20820. @end table
  20821. @section prewitt_opencl
  20822. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  20823. The filter accepts the following option:
  20824. @table @option
  20825. @item planes
  20826. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20827. @item scale
  20828. Set value which will be multiplied with filtered result.
  20829. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20830. @item delta
  20831. Set value which will be added to filtered result.
  20832. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20833. @end table
  20834. @subsection Example
  20835. @itemize
  20836. @item
  20837. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  20838. @example
  20839. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20840. @end example
  20841. @end itemize
  20842. @anchor{program_opencl}
  20843. @section program_opencl
  20844. Filter video using an OpenCL program.
  20845. @table @option
  20846. @item source
  20847. OpenCL program source file.
  20848. @item kernel
  20849. Kernel name in program.
  20850. @item inputs
  20851. Number of inputs to the filter. Defaults to 1.
  20852. @item size, s
  20853. Size of output frames. Defaults to the same as the first input.
  20854. @end table
  20855. The @code{program_opencl} filter also supports the @ref{framesync} options.
  20856. The program source file must contain a kernel function with the given name,
  20857. which will be run once for each plane of the output. Each run on a plane
  20858. gets enqueued as a separate 2D global NDRange with one work-item for each
  20859. pixel to be generated. The global ID offset for each work-item is therefore
  20860. the coordinates of a pixel in the destination image.
  20861. The kernel function needs to take the following arguments:
  20862. @itemize
  20863. @item
  20864. Destination image, @var{__write_only image2d_t}.
  20865. This image will become the output; the kernel should write all of it.
  20866. @item
  20867. Frame index, @var{unsigned int}.
  20868. This is a counter starting from zero and increasing by one for each frame.
  20869. @item
  20870. Source images, @var{__read_only image2d_t}.
  20871. These are the most recent images on each input. The kernel may read from
  20872. them to generate the output, but they can't be written to.
  20873. @end itemize
  20874. Example programs:
  20875. @itemize
  20876. @item
  20877. Copy the input to the output (output must be the same size as the input).
  20878. @verbatim
  20879. __kernel void copy(__write_only image2d_t destination,
  20880. unsigned int index,
  20881. __read_only image2d_t source)
  20882. {
  20883. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  20884. int2 location = (int2)(get_global_id(0), get_global_id(1));
  20885. float4 value = read_imagef(source, sampler, location);
  20886. write_imagef(destination, location, value);
  20887. }
  20888. @end verbatim
  20889. @item
  20890. Apply a simple transformation, rotating the input by an amount increasing
  20891. with the index counter. Pixel values are linearly interpolated by the
  20892. sampler, and the output need not have the same dimensions as the input.
  20893. @verbatim
  20894. __kernel void rotate_image(__write_only image2d_t dst,
  20895. unsigned int index,
  20896. __read_only image2d_t src)
  20897. {
  20898. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20899. CLK_FILTER_LINEAR);
  20900. float angle = (float)index / 100.0f;
  20901. float2 dst_dim = convert_float2(get_image_dim(dst));
  20902. float2 src_dim = convert_float2(get_image_dim(src));
  20903. float2 dst_cen = dst_dim / 2.0f;
  20904. float2 src_cen = src_dim / 2.0f;
  20905. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20906. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  20907. float2 src_pos = {
  20908. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  20909. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  20910. };
  20911. src_pos = src_pos * src_dim / dst_dim;
  20912. float2 src_loc = src_pos + src_cen;
  20913. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  20914. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  20915. write_imagef(dst, dst_loc, 0.5f);
  20916. else
  20917. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  20918. }
  20919. @end verbatim
  20920. @item
  20921. Blend two inputs together, with the amount of each input used varying
  20922. with the index counter.
  20923. @verbatim
  20924. __kernel void blend_images(__write_only image2d_t dst,
  20925. unsigned int index,
  20926. __read_only image2d_t src1,
  20927. __read_only image2d_t src2)
  20928. {
  20929. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20930. CLK_FILTER_LINEAR);
  20931. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  20932. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20933. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  20934. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  20935. float4 val1 = read_imagef(src1, sampler, src1_loc);
  20936. float4 val2 = read_imagef(src2, sampler, src2_loc);
  20937. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  20938. }
  20939. @end verbatim
  20940. @end itemize
  20941. @section remap_opencl
  20942. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  20943. Destination pixel at position (X, Y) will be picked from source (x, y) position
  20944. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  20945. value for pixel will be used for destination pixel.
  20946. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  20947. will have Xmap/Ymap video stream dimensions.
  20948. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  20949. @table @option
  20950. @item interp
  20951. Specify interpolation used for remapping of pixels.
  20952. Allowed values are @code{near} and @code{linear}.
  20953. Default value is @code{linear}.
  20954. @item fill
  20955. Specify the color of the unmapped pixels. For the syntax of this option,
  20956. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20957. manual,ffmpeg-utils}. Default color is @code{black}.
  20958. @end table
  20959. @section roberts_opencl
  20960. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  20961. The filter accepts the following option:
  20962. @table @option
  20963. @item planes
  20964. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20965. @item scale
  20966. Set value which will be multiplied with filtered result.
  20967. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20968. @item delta
  20969. Set value which will be added to filtered result.
  20970. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20971. @end table
  20972. @subsection Example
  20973. @itemize
  20974. @item
  20975. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  20976. @example
  20977. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20978. @end example
  20979. @end itemize
  20980. @section sobel_opencl
  20981. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  20982. The filter accepts the following option:
  20983. @table @option
  20984. @item planes
  20985. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20986. @item scale
  20987. Set value which will be multiplied with filtered result.
  20988. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20989. @item delta
  20990. Set value which will be added to filtered result.
  20991. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20992. @end table
  20993. @subsection Example
  20994. @itemize
  20995. @item
  20996. Apply sobel operator with scale set to 2 and delta set to 10
  20997. @example
  20998. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20999. @end example
  21000. @end itemize
  21001. @section tonemap_opencl
  21002. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  21003. It accepts the following parameters:
  21004. @table @option
  21005. @item tonemap
  21006. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  21007. @item param
  21008. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  21009. @item desat
  21010. Apply desaturation for highlights that exceed this level of brightness. The
  21011. higher the parameter, the more color information will be preserved. This
  21012. setting helps prevent unnaturally blown-out colors for super-highlights, by
  21013. (smoothly) turning into white instead. This makes images feel more natural,
  21014. at the cost of reducing information about out-of-range colors.
  21015. The default value is 0.5, and the algorithm here is a little different from
  21016. the cpu version tonemap currently. A setting of 0.0 disables this option.
  21017. @item threshold
  21018. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  21019. is used to detect whether the scene has changed or not. If the distance between
  21020. the current frame average brightness and the current running average exceeds
  21021. a threshold value, we would re-calculate scene average and peak brightness.
  21022. The default value is 0.2.
  21023. @item format
  21024. Specify the output pixel format.
  21025. Currently supported formats are:
  21026. @table @var
  21027. @item p010
  21028. @item nv12
  21029. @end table
  21030. @item range, r
  21031. Set the output color range.
  21032. Possible values are:
  21033. @table @var
  21034. @item tv/mpeg
  21035. @item pc/jpeg
  21036. @end table
  21037. Default is same as input.
  21038. @item primaries, p
  21039. Set the output color primaries.
  21040. Possible values are:
  21041. @table @var
  21042. @item bt709
  21043. @item bt2020
  21044. @end table
  21045. Default is same as input.
  21046. @item transfer, t
  21047. Set the output transfer characteristics.
  21048. Possible values are:
  21049. @table @var
  21050. @item bt709
  21051. @item bt2020
  21052. @end table
  21053. Default is bt709.
  21054. @item matrix, m
  21055. Set the output colorspace matrix.
  21056. Possible value are:
  21057. @table @var
  21058. @item bt709
  21059. @item bt2020
  21060. @end table
  21061. Default is same as input.
  21062. @end table
  21063. @subsection Example
  21064. @itemize
  21065. @item
  21066. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  21067. @example
  21068. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  21069. @end example
  21070. @end itemize
  21071. @section unsharp_opencl
  21072. Sharpen or blur the input video.
  21073. It accepts the following parameters:
  21074. @table @option
  21075. @item luma_msize_x, lx
  21076. Set the luma matrix horizontal size.
  21077. Range is @code{[1, 23]} and default value is @code{5}.
  21078. @item luma_msize_y, ly
  21079. Set the luma matrix vertical size.
  21080. Range is @code{[1, 23]} and default value is @code{5}.
  21081. @item luma_amount, la
  21082. Set the luma effect strength.
  21083. Range is @code{[-10, 10]} and default value is @code{1.0}.
  21084. Negative values will blur the input video, while positive values will
  21085. sharpen it, a value of zero will disable the effect.
  21086. @item chroma_msize_x, cx
  21087. Set the chroma matrix horizontal size.
  21088. Range is @code{[1, 23]} and default value is @code{5}.
  21089. @item chroma_msize_y, cy
  21090. Set the chroma matrix vertical size.
  21091. Range is @code{[1, 23]} and default value is @code{5}.
  21092. @item chroma_amount, ca
  21093. Set the chroma effect strength.
  21094. Range is @code{[-10, 10]} and default value is @code{0.0}.
  21095. Negative values will blur the input video, while positive values will
  21096. sharpen it, a value of zero will disable the effect.
  21097. @end table
  21098. All parameters are optional and default to the equivalent of the
  21099. string '5:5:1.0:5:5:0.0'.
  21100. @subsection Examples
  21101. @itemize
  21102. @item
  21103. Apply strong luma sharpen effect:
  21104. @example
  21105. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  21106. @end example
  21107. @item
  21108. Apply a strong blur of both luma and chroma parameters:
  21109. @example
  21110. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  21111. @end example
  21112. @end itemize
  21113. @section xfade_opencl
  21114. Cross fade two videos with custom transition effect by using OpenCL.
  21115. It accepts the following options:
  21116. @table @option
  21117. @item transition
  21118. Set one of possible transition effects.
  21119. @table @option
  21120. @item custom
  21121. Select custom transition effect, the actual transition description
  21122. will be picked from source and kernel options.
  21123. @item fade
  21124. @item wipeleft
  21125. @item wiperight
  21126. @item wipeup
  21127. @item wipedown
  21128. @item slideleft
  21129. @item slideright
  21130. @item slideup
  21131. @item slidedown
  21132. Default transition is fade.
  21133. @end table
  21134. @item source
  21135. OpenCL program source file for custom transition.
  21136. @item kernel
  21137. Set name of kernel to use for custom transition from program source file.
  21138. @item duration
  21139. Set duration of video transition.
  21140. @item offset
  21141. Set time of start of transition relative to first video.
  21142. @end table
  21143. The program source file must contain a kernel function with the given name,
  21144. which will be run once for each plane of the output. Each run on a plane
  21145. gets enqueued as a separate 2D global NDRange with one work-item for each
  21146. pixel to be generated. The global ID offset for each work-item is therefore
  21147. the coordinates of a pixel in the destination image.
  21148. The kernel function needs to take the following arguments:
  21149. @itemize
  21150. @item
  21151. Destination image, @var{__write_only image2d_t}.
  21152. This image will become the output; the kernel should write all of it.
  21153. @item
  21154. First Source image, @var{__read_only image2d_t}.
  21155. Second Source image, @var{__read_only image2d_t}.
  21156. These are the most recent images on each input. The kernel may read from
  21157. them to generate the output, but they can't be written to.
  21158. @item
  21159. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  21160. @end itemize
  21161. Example programs:
  21162. @itemize
  21163. @item
  21164. Apply dots curtain transition effect:
  21165. @verbatim
  21166. __kernel void blend_images(__write_only image2d_t dst,
  21167. __read_only image2d_t src1,
  21168. __read_only image2d_t src2,
  21169. float progress)
  21170. {
  21171. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21172. CLK_FILTER_LINEAR);
  21173. int2 p = (int2)(get_global_id(0), get_global_id(1));
  21174. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  21175. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  21176. rp = rp / dim;
  21177. float2 dots = (float2)(20.0, 20.0);
  21178. float2 center = (float2)(0,0);
  21179. float2 unused;
  21180. float4 val1 = read_imagef(src1, sampler, p);
  21181. float4 val2 = read_imagef(src2, sampler, p);
  21182. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  21183. write_imagef(dst, p, next ? val1 : val2);
  21184. }
  21185. @end verbatim
  21186. @end itemize
  21187. @c man end OPENCL VIDEO FILTERS
  21188. @chapter VAAPI Video Filters
  21189. @c man begin VAAPI VIDEO FILTERS
  21190. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  21191. To enable compilation of these filters you need to configure FFmpeg with
  21192. @code{--enable-vaapi}.
  21193. To use vaapi filters, you need to setup the vaapi device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/VAAPI}
  21194. @section overlay_vaapi
  21195. Overlay one video on the top of another.
  21196. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21197. The filter accepts the following options:
  21198. @table @option
  21199. @item x
  21200. @item y
  21201. Set expressions for the x and y coordinates of the overlaid video
  21202. on the main video.
  21203. Default value is "0" for both expressions.
  21204. @item w
  21205. @item h
  21206. Set expressions for the width and height the overlaid video
  21207. on the main video.
  21208. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  21209. The expressions can contain the following parameters:
  21210. @table @option
  21211. @item main_w, W
  21212. @item main_h, H
  21213. The main input width and height.
  21214. @item overlay_iw
  21215. @item overlay_ih
  21216. The overlay input width and height.
  21217. @item overlay_w, w
  21218. @item overlay_h, h
  21219. The overlay output width and height.
  21220. @item overlay_x, x
  21221. @item overlay_y, y
  21222. Position of the overlay layer inside of main
  21223. @end table
  21224. @item alpha
  21225. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  21226. Higher value means lower transparency.
  21227. Default value is @code{1.0}.
  21228. @item eof_action
  21229. See @ref{framesync}.
  21230. @item shortest
  21231. See @ref{framesync}.
  21232. @item repeatlast
  21233. See @ref{framesync}.
  21234. @end table
  21235. This filter also supports the @ref{framesync} options.
  21236. @subsection Examples
  21237. @itemize
  21238. @item
  21239. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  21240. @example
  21241. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  21242. @end example
  21243. @item
  21244. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  21245. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  21246. @example
  21247. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_vaapi=x=200:y=100:w=400:h=300:alpha=1.0, hwdownload, format=nv12" OUTPUT
  21248. @end example
  21249. @end itemize
  21250. @section tonemap_vaapi
  21251. Perform HDR-to-SDR or HDR-to-HDR tone-mapping.
  21252. It currently only accepts HDR10 as input.
  21253. It accepts the following parameters:
  21254. @table @option
  21255. @item format
  21256. Specify the output pixel format.
  21257. Default is nv12 for HDR-to-SDR tone-mapping and p010 for HDR-to-HDR
  21258. tone-mapping.
  21259. @item primaries, p
  21260. Set the output color primaries.
  21261. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21262. tone-mapping.
  21263. @item transfer, t
  21264. Set the output transfer characteristics.
  21265. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21266. tone-mapping.
  21267. @item matrix, m
  21268. Set the output colorspace matrix.
  21269. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21270. tone-mapping.
  21271. @item display
  21272. Set the output mastering display colour volume. It is given by a '|'-separated
  21273. list of two values, two values are space separated. It set display primaries
  21274. x & y in G, B, R order, then white point x & y, the nominal minimum & maximum
  21275. display luminances.
  21276. HDR-to-HDR tone-mapping will be performed when this option is set.
  21277. @item light
  21278. Set the output content light level information. It accepts 2 space-separated
  21279. values, the first input is the maximum light level and the second input is
  21280. the maximum average light level.
  21281. It is ignored for HDR-to-SDR tone-mapping, and optional for HDR-to-HDR
  21282. tone-mapping.
  21283. @end table
  21284. @subsection Example
  21285. @itemize
  21286. @item
  21287. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  21288. @example
  21289. tonemap_vaapi=format=p010:t=bt2020-10
  21290. @end example
  21291. @item
  21292. Convert HDR video to HDR video
  21293. @example
  21294. tonemap_vaapi=display=7500\ 3000|34000\ 16000|13250\ 34500|15635\ 16450|500\ 10000000
  21295. @end example
  21296. @end itemize
  21297. @section hstack_vaapi
  21298. Stack input videos horizontally.
  21299. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  21300. have different height, this filter will scale down/up each input stream while
  21301. keeping the original aspect.
  21302. It accepts the following options:
  21303. @table @option
  21304. @item inputs
  21305. See @ref{hstack}.
  21306. @item shortest
  21307. See @ref{hstack}.
  21308. @item height
  21309. Set height of output. If set to 0, this filter will set height of output to
  21310. height of the first input stream. Default value is 0.
  21311. @end table
  21312. @section vstack_vaapi
  21313. Stack input videos vertically.
  21314. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  21315. have different width, this filter will scale down/up each input stream while
  21316. keeping the original aspect.
  21317. It accepts the following options:
  21318. @table @option
  21319. @item inputs
  21320. See @ref{vstack}.
  21321. @item shortest
  21322. See @ref{vstack}.
  21323. @item width
  21324. Set width of output. If set to 0, this filter will set width of output to
  21325. width of the first input stream. Default value is 0.
  21326. @end table
  21327. @section xstack_vaapi
  21328. Stack video inputs into custom layout.
  21329. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  21330. have different size, this filter will scale down/up each input stream to the
  21331. given output size, or the size of the first input stream.
  21332. It accepts the following options:
  21333. @table @option
  21334. @item inputs
  21335. See @ref{xstack}.
  21336. @item shortest
  21337. See @ref{xstack}.
  21338. @item layout
  21339. See @ref{xstack}.
  21340. Moreover, this permits the user to supply output size for each input stream.
  21341. @example
  21342. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21343. @end example
  21344. @item grid
  21345. See @ref{xstack}.
  21346. @item grid_tile_size
  21347. Set output size for each input stream when @option{grid} is set. If this option
  21348. is not set, this filter will set output size by default to the size of the
  21349. first input stream. For the syntax of this option, check the
  21350. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21351. @item fill
  21352. See @ref{xstack}.
  21353. @end table
  21354. @section pad_vaapi
  21355. Add paddings to the input image, and place the original input at the
  21356. provided @var{x}, @var{y} coordinates.
  21357. It accepts the following options:
  21358. @table @option
  21359. @item width, w
  21360. @item height, h
  21361. Specify an expression for the size of the output image with the
  21362. paddings added. If the value for @var{width} or @var{height} is 0, the
  21363. corresponding input size is used for the output.
  21364. The @var{width} expression can reference the value set by the
  21365. @var{height} expression, and vice versa.
  21366. The default value of @var{width} and @var{height} is 0.
  21367. @item x
  21368. @item y
  21369. Specify the offsets to place the input image at within the padded area,
  21370. with respect to the top/left border of the output image.
  21371. The @var{x} expression can reference the value set by the @var{y}
  21372. expression, and vice versa.
  21373. The default value of @var{x} and @var{y} is 0.
  21374. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  21375. so the input image is centered on the padded area.
  21376. @item color
  21377. Specify the color of the padded area. For the syntax of this option,
  21378. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21379. manual,ffmpeg-utils}.
  21380. @item aspect
  21381. Pad to an aspect instead to a resolution.
  21382. @end table
  21383. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  21384. options are expressions containing the following constants:
  21385. @table @option
  21386. @item in_w
  21387. @item in_h
  21388. The input video width and height.
  21389. @item iw
  21390. @item ih
  21391. These are the same as @var{in_w} and @var{in_h}.
  21392. @item out_w
  21393. @item out_h
  21394. The output width and height (the size of the padded area), as
  21395. specified by the @var{width} and @var{height} expressions.
  21396. @item ow
  21397. @item oh
  21398. These are the same as @var{out_w} and @var{out_h}.
  21399. @item x
  21400. @item y
  21401. The x and y offsets as specified by the @var{x} and @var{y}
  21402. expressions, or NAN if not yet specified.
  21403. @item a
  21404. same as @var{iw} / @var{ih}
  21405. @item sar
  21406. input sample aspect ratio
  21407. @item dar
  21408. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  21409. @end table
  21410. @section drawbox_vaapi
  21411. Draw a colored box on the input image.
  21412. It accepts the following parameters:
  21413. @table @option
  21414. @item x
  21415. @item y
  21416. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  21417. @item width, w
  21418. @item height, h
  21419. The expressions which specify the width and height of the box; if 0 they are interpreted as
  21420. the input width and height. It defaults to 0.
  21421. @item color, c
  21422. Specify the color of the box to write. For the general syntax of this option,
  21423. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21424. @item thickness, t
  21425. The expression which sets the thickness of the box edge.
  21426. A value of @code{fill} will create a filled box. Default value is @code{3}.
  21427. See below for the list of accepted constants.
  21428. @item replace
  21429. With value @code{1}, the pixels of the painted box will overwrite the video's color and alpha pixels.
  21430. Default is @code{0}, which composites the box onto the input video.
  21431. @end table
  21432. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  21433. following constants:
  21434. @table @option
  21435. @item in_h, ih
  21436. @item in_w, iw
  21437. The input width and height.
  21438. @item x
  21439. @item y
  21440. The x and y offset coordinates where the box is drawn.
  21441. @item w
  21442. @item h
  21443. The width and height of the drawn box.
  21444. @item t
  21445. The thickness of the drawn box.
  21446. @end table
  21447. @subsection Examples
  21448. @itemize
  21449. @item
  21450. Draw a black box around the edge of the input image:
  21451. @example
  21452. drawbox
  21453. @end example
  21454. @item
  21455. Draw a box with color red and an opacity of 50%:
  21456. @example
  21457. drawbox=10:20:200:60:red@@0.5
  21458. @end example
  21459. The previous example can be specified as:
  21460. @example
  21461. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  21462. @end example
  21463. @item
  21464. Fill the box with pink color:
  21465. @example
  21466. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  21467. @end example
  21468. @item
  21469. Draw a 2-pixel red 2.40:1 mask:
  21470. @example
  21471. 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
  21472. @end example
  21473. @end itemize
  21474. @c man end VAAPI VIDEO FILTERS
  21475. @chapter Vulkan Video Filters
  21476. @c man begin VULKAN VIDEO FILTERS
  21477. Below is a description of the currently available Vulkan video filters.
  21478. To enable compilation of these filters you need to configure FFmpeg with
  21479. @code{--enable-vulkan} and either @code{--enable-libglslang} or @code{--enable-libshaderc}.
  21480. Running Vulkan filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  21481. @table @option
  21482. @item -init_hw_device vulkan[=@var{name}][:@var{device}[,@var{key=value}...]]
  21483. Initialise a new hardware device of type @var{vulkan} called @var{name}, using the
  21484. given device parameters and options in @var{key=value}. The following options
  21485. are supported:
  21486. @table @option
  21487. @item debug
  21488. Switches validation layers on if set to 1.
  21489. @item linear_images
  21490. Allocates linear images. Does not apply to decoding.
  21491. @item disable_multiplane
  21492. Disables multiplane images. Does not apply to decoding.
  21493. @end table
  21494. @item -filter_hw_device @var{name}
  21495. Pass the hardware device called @var{name} to all filters in any filter graph.
  21496. @end table
  21497. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  21498. @itemize
  21499. @item
  21500. Example of choosing the first device and running nlmeans_vulkan filter with default parameters on it.
  21501. @example
  21502. -init_hw_device vulkan=vk:0 -filter_hw_device vk -i INPUT -vf "hwupload,nlmeans_vulkan,hwdownload" OUTPUT
  21503. @end example
  21504. @end itemize
  21505. As Vulkan filters are not able to access frame data in normal memory, all frame data needs to be uploaded (@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded (@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a frame with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it is usually necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
  21506. @section avgblur_vulkan
  21507. Apply an average blur filter, implemented on the GPU using Vulkan.
  21508. The filter accepts the following options:
  21509. @table @option
  21510. @item sizeX
  21511. Set horizontal radius size.
  21512. Range is @code{[1, 32]} and default value is @code{3}.
  21513. @item sizeY
  21514. Set vertical radius size. Range is @code{[1, 32]} and default value is @code{3}.
  21515. @item planes
  21516. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21517. @end table
  21518. @section blend_vulkan
  21519. Blend two Vulkan frames into each other.
  21520. The @code{blend} filter takes two input streams and outputs one
  21521. stream, the first input is the "top" layer and second input is
  21522. "bottom" layer. By default, the output terminates when the longest input terminates.
  21523. A description of the accepted options follows.
  21524. @table @option
  21525. @item c0_mode
  21526. @item c1_mode
  21527. @item c2_mode
  21528. @item c3_mode
  21529. @item all_mode
  21530. Set blend mode for specific pixel component or all pixel components in case
  21531. of @var{all_mode}. Default value is @code{normal}.
  21532. Available values for component modes are:
  21533. @table @samp
  21534. @item normal
  21535. @item multiply
  21536. @end table
  21537. @end table
  21538. @section bwdif_vulkan
  21539. Deinterlacer using @ref{bwdif}, the "Bob Weaver Deinterlacing Filter" algorithm, implemented
  21540. on the GPU using Vulkan.
  21541. It accepts the following parameters:
  21542. @table @option
  21543. @item mode
  21544. The interlacing mode to adopt. It accepts one of the following values:
  21545. @table @option
  21546. @item 0, send_frame
  21547. Output one frame for each frame.
  21548. @item 1, send_field
  21549. Output one frame for each field.
  21550. @end table
  21551. The default value is @code{send_field}.
  21552. @item parity
  21553. The picture field parity assumed for the input interlaced video. It accepts one
  21554. of the following values:
  21555. @table @option
  21556. @item 0, tff
  21557. Assume the top field is first.
  21558. @item 1, bff
  21559. Assume the bottom field is first.
  21560. @item -1, auto
  21561. Enable automatic detection of field parity.
  21562. @end table
  21563. The default value is @code{auto}.
  21564. If the interlacing is unknown or the decoder does not export this information,
  21565. top field first will be assumed.
  21566. @item deint
  21567. Specify which frames to deinterlace. Accepts one of the following
  21568. values:
  21569. @table @option
  21570. @item 0, all
  21571. Deinterlace all frames.
  21572. @item 1, interlaced
  21573. Only deinterlace frames marked as interlaced.
  21574. @end table
  21575. The default value is @code{all}.
  21576. @end table
  21577. @section chromaber_vulkan
  21578. Apply an effect that emulates chromatic aberration. Works best with RGB inputs,
  21579. but provides a similar effect with YCbCr inputs too.
  21580. @table @option
  21581. @item dist_x
  21582. Horizontal displacement multiplier. Each chroma pixel's position will be multiplied
  21583. by this amount, starting from the center of the image. Default is @code{0}.
  21584. @item dist_y
  21585. Similarly, this sets the vertical displacement multiplier. Default is @code{0}.
  21586. @end table
  21587. @section color_vulkan
  21588. Video source that creates a Vulkan frame of a solid color.
  21589. Useful for benchmarking, or overlaying.
  21590. It accepts the following parameters:
  21591. @table @option
  21592. @item color
  21593. The color to use. Either a name, or a hexadecimal value.
  21594. The default value is @code{black}.
  21595. @item size
  21596. The size of the output frame. Default value is @code{1920x1080}.
  21597. @item rate
  21598. The framerate to output at. Default value is @code{60} frames per second.
  21599. @item duration
  21600. The video duration. Default value is @code{-0.000001}.
  21601. @item sar
  21602. The video signal aspect ratio. Default value is @code{1/1}.
  21603. @item format
  21604. The pixel format of the output Vulkan frames. Default value is @code{yuv444p}.
  21605. @item out_range
  21606. Set the output YCbCr sample range.
  21607. This allows the autodetected value to be overridden as well as allows forcing
  21608. a specific value used for the output and encoder. If not specified, the
  21609. range depends on the pixel format. Possible values:
  21610. @table @samp
  21611. @item auto/unknown
  21612. Choose automatically.
  21613. @item jpeg/full/pc
  21614. Set full range (0-255 in case of 8-bit luma).
  21615. @item mpeg/limited/tv
  21616. Set "MPEG" range (16-235 in case of 8-bit luma).
  21617. @end table
  21618. @end table
  21619. @section vflip_vulkan
  21620. Flips an image vertically.
  21621. @section hflip_vulkan
  21622. Flips an image horizontally.
  21623. @section flip_vulkan
  21624. Flips an image along both the vertical and horizontal axis.
  21625. @section gblur_vulkan
  21626. Apply Gaussian blur filter on Vulkan frames.
  21627. The filter accepts the following options:
  21628. @table @option
  21629. @item sigma
  21630. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  21631. @item sigmaV
  21632. Set vertical sigma, if negative it will be same as @code{sigma}.
  21633. Default is @code{-1}.
  21634. @item planes
  21635. Set which planes to filter. By default all planes are filtered.
  21636. @item size
  21637. Set the kernel size along the horizontal axis. Default is @code{19}.
  21638. @item sizeV
  21639. Set the kernel size along the vertical axis. Default is @code{0},
  21640. which sets to use the same value as @var{size}.
  21641. @end table
  21642. @section nlmeans_vulkan
  21643. Denoise frames using Non-Local Means algorithm, implemented on the GPU using
  21644. Vulkan.
  21645. Supports more pixel formats than @ref{nlmeans} or @ref{nlmeans_opencl}, including
  21646. alpha channel support.
  21647. The filter accepts the following options.
  21648. @table @option
  21649. @item s
  21650. Set denoising strength for all components. Default is 1.0. Must be in range [1.0, 100.0].
  21651. @item p
  21652. Set patch size for all planes. Default is 7. Must be odd number in range [0, 99].
  21653. @item r
  21654. Set research size. Default is 15. Must be odd number in range [0, 99].
  21655. @item t
  21656. Set parallelism. Default is 36. Must be a number in the range [1, 168].
  21657. Larger values may speed up processing, at the cost of more VRAM.
  21658. Lower values will slow it down, reducing VRAM usage.
  21659. Only supported on GPUs with atomic float operations (RDNA3+, Ampere+).
  21660. @item s0
  21661. @item s1
  21662. @item s2
  21663. @item s3
  21664. Set denoising strength for a specific component. Default is @var{1}, equal to @option{s}.
  21665. Must be odd number in range [1, 100].
  21666. @item p0
  21667. @item p1
  21668. @item p2
  21669. @item p3
  21670. Set patch size for a specific component. Default is @var{7}, equal to @option{p}.
  21671. Must be odd number in range [0, 99].
  21672. @end table
  21673. @section overlay_vulkan
  21674. Overlay one video on top of another.
  21675. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21676. This filter requires all inputs to use the same pixel format. So, format conversion may be needed.
  21677. The filter accepts the following options:
  21678. @table @option
  21679. @item x
  21680. Set the x coordinate of the overlaid video on the main video.
  21681. Default value is @code{0}.
  21682. @item y
  21683. Set the y coordinate of the overlaid video on the main video.
  21684. Default value is @code{0}.
  21685. @end table
  21686. @section transpose_vt
  21687. Transpose rows with columns in the input video and optionally flip it.
  21688. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21689. It accepts the following parameters:
  21690. @table @option
  21691. @item dir
  21692. Specify the transposition direction.
  21693. Can assume the following values:
  21694. @table @samp
  21695. @item cclock_flip
  21696. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21697. @item clock
  21698. Rotate by 90 degrees clockwise.
  21699. @item cclock
  21700. Rotate by 90 degrees counterclockwise.
  21701. @item clock_flip
  21702. Rotate by 90 degrees clockwise and vertically flip.
  21703. @item hflip
  21704. Flip the input video horizontally.
  21705. @item vflip
  21706. Flip the input video vertically.
  21707. @end table
  21708. @item passthrough
  21709. Do not apply the transposition if the input geometry matches the one
  21710. specified by the specified value. It accepts the following values:
  21711. @table @samp
  21712. @item none
  21713. Always apply transposition. (default)
  21714. @item portrait
  21715. Preserve portrait geometry (when @var{height} >= @var{width}).
  21716. @item landscape
  21717. Preserve landscape geometry (when @var{width} >= @var{height}).
  21718. @end table
  21719. @end table
  21720. @section transpose_vulkan
  21721. Transpose rows with columns in the input video and optionally flip it.
  21722. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21723. It accepts the following parameters:
  21724. @table @option
  21725. @item dir
  21726. Specify the transposition direction.
  21727. Can assume the following values:
  21728. @table @samp
  21729. @item cclock_flip
  21730. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21731. @item clock
  21732. Rotate by 90 degrees clockwise.
  21733. @item cclock
  21734. Rotate by 90 degrees counterclockwise.
  21735. @item clock_flip
  21736. Rotate by 90 degrees clockwise and vertically flip.
  21737. @end table
  21738. @item passthrough
  21739. Do not apply the transposition if the input geometry matches the one
  21740. specified by the specified value. It accepts the following values:
  21741. @table @samp
  21742. @item none
  21743. Always apply transposition. (default)
  21744. @item portrait
  21745. Preserve portrait geometry (when @var{height} >= @var{width}).
  21746. @item landscape
  21747. Preserve landscape geometry (when @var{width} >= @var{height}).
  21748. @end table
  21749. @end table
  21750. @c man end VULKAN VIDEO FILTERS
  21751. @chapter QSV Video Filters
  21752. @c man begin QSV VIDEO FILTERS
  21753. Below is a description of the currently available QSV video filters.
  21754. To enable compilation of these filters you need to configure FFmpeg with
  21755. @code{--enable-libmfx} or @code{--enable-libvpl}.
  21756. To use QSV filters, you need to setup the QSV device correctly. For more information, please read @url{https://trac.ffmpeg.org/wiki/Hardware/QuickSync}
  21757. @section hstack_qsv
  21758. Stack input videos horizontally.
  21759. This is the QSV variant of the @ref{hstack} filter, each input stream may
  21760. have different height, this filter will scale down/up each input stream while
  21761. keeping the original aspect.
  21762. It accepts the following options:
  21763. @table @option
  21764. @item inputs
  21765. See @ref{hstack}.
  21766. @item shortest
  21767. See @ref{hstack}.
  21768. @item height
  21769. Set height of output. If set to 0, this filter will set height of output to
  21770. height of the first input stream. Default value is 0.
  21771. @end table
  21772. @section vstack_qsv
  21773. Stack input videos vertically.
  21774. This is the QSV variant of the @ref{vstack} filter, each input stream may
  21775. have different width, this filter will scale down/up each input stream while
  21776. keeping the original aspect.
  21777. It accepts the following options:
  21778. @table @option
  21779. @item inputs
  21780. See @ref{vstack}.
  21781. @item shortest
  21782. See @ref{vstack}.
  21783. @item width
  21784. Set width of output. If set to 0, this filter will set width of output to
  21785. width of the first input stream. Default value is 0.
  21786. @end table
  21787. @section xstack_qsv
  21788. Stack video inputs into custom layout.
  21789. This is the QSV variant of the @ref{xstack} filter.
  21790. It accepts the following options:
  21791. @table @option
  21792. @item inputs
  21793. See @ref{xstack}.
  21794. @item shortest
  21795. See @ref{xstack}.
  21796. @item layout
  21797. See @ref{xstack}.
  21798. Moreover, this permits the user to supply output size for each input stream.
  21799. @example
  21800. xstack_qsv=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21801. @end example
  21802. @item grid
  21803. See @ref{xstack}.
  21804. @item grid_tile_size
  21805. Set output size for each input stream when @option{grid} is set. If this option
  21806. is not set, this filter will set output size by default to the size of the
  21807. first input stream. For the syntax of this option, check the
  21808. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21809. @item fill
  21810. See @ref{xstack}.
  21811. @end table
  21812. @c man end QSV VIDEO FILTERS
  21813. @chapter Video Sources
  21814. @c man begin VIDEO SOURCES
  21815. Below is a description of the currently available video sources.
  21816. @section buffer
  21817. Buffer video frames, and make them available to the filter chain.
  21818. This source is mainly intended for a programmatic use, in particular
  21819. through the interface defined in @file{libavfilter/buffersrc.h}.
  21820. It accepts the following parameters:
  21821. @table @option
  21822. @item video_size
  21823. Specify the size (width and height) of the buffered video frames. For the
  21824. syntax of this option, check the
  21825. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21826. @item width
  21827. The input video width.
  21828. @item height
  21829. The input video height.
  21830. @item pix_fmt
  21831. A string representing the pixel format of the buffered video frames.
  21832. It may be a number corresponding to a pixel format, or a pixel format
  21833. name.
  21834. @item time_base
  21835. Specify the timebase assumed by the timestamps of the buffered frames.
  21836. @item frame_rate
  21837. Specify the frame rate expected for the video stream.
  21838. @item colorspace
  21839. A string representing the color space of the buffered video frames.
  21840. It may be a number corresponding to a color space, or a color space
  21841. name.
  21842. @item range
  21843. A string representing the color range of the buffered video frames.
  21844. It may be a number corresponding to a color range, or a color range
  21845. name.
  21846. @item pixel_aspect, sar
  21847. The sample (pixel) aspect ratio of the input video.
  21848. @item hw_frames_ctx
  21849. When using a hardware pixel format, this should be a reference to an
  21850. AVHWFramesContext describing input frames.
  21851. @end table
  21852. For example:
  21853. @example
  21854. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  21855. @end example
  21856. will instruct the source to accept video frames with size 320x240 and
  21857. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  21858. square pixels (1:1 sample aspect ratio).
  21859. Since the pixel format with name "yuv410p" corresponds to the number 6
  21860. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  21861. this example corresponds to:
  21862. @example
  21863. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  21864. @end example
  21865. Alternatively, the options can be specified as a flat string, but this
  21866. syntax is deprecated:
  21867. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  21868. @section cellauto
  21869. Create a pattern generated by an elementary cellular automaton.
  21870. The initial state of the cellular automaton can be defined through the
  21871. @option{filename} and @option{pattern} options. If such options are
  21872. not specified an initial state is created randomly.
  21873. At each new frame a new row in the video is filled with the result of
  21874. the cellular automaton next generation. The behavior when the whole
  21875. frame is filled is defined by the @option{scroll} option.
  21876. This source accepts the following options:
  21877. @table @option
  21878. @item filename, f
  21879. Read the initial cellular automaton state, i.e. the starting row, from
  21880. the specified file.
  21881. In the file, each non-whitespace character is considered an alive
  21882. cell, a newline will terminate the row, and further characters in the
  21883. file will be ignored.
  21884. @item pattern, p
  21885. Read the initial cellular automaton state, i.e. the starting row, from
  21886. the specified string.
  21887. Each non-whitespace character in the string is considered an alive
  21888. cell, a newline will terminate the row, and further characters in the
  21889. string will be ignored.
  21890. @item rate, r
  21891. Set the video rate, that is the number of frames generated per second.
  21892. Default is 25.
  21893. @item random_fill_ratio, ratio
  21894. Set the random fill ratio for the initial cellular automaton row. It
  21895. is a floating point number value ranging from 0 to 1, defaults to
  21896. 1/PHI.
  21897. This option is ignored when a file or a pattern is specified.
  21898. @item random_seed, seed
  21899. Set the seed for filling randomly the initial row, must be an integer
  21900. included between 0 and UINT32_MAX. If not specified, or if explicitly
  21901. set to -1, the filter will try to use a good random seed on a best
  21902. effort basis.
  21903. @item rule
  21904. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  21905. Default value is 110.
  21906. @item size, s
  21907. Set the size of the output video. For the syntax of this option, check the
  21908. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21909. If @option{filename} or @option{pattern} is specified, the size is set
  21910. by default to the width of the specified initial state row, and the
  21911. height is set to @var{width} * PHI.
  21912. If @option{size} is set, it must contain the width of the specified
  21913. pattern string, and the specified pattern will be centered in the
  21914. larger row.
  21915. If a filename or a pattern string is not specified, the size value
  21916. defaults to "320x518" (used for a randomly generated initial state).
  21917. @item scroll
  21918. If set to 1, scroll the output upward when all the rows in the output
  21919. have been already filled. If set to 0, the new generated row will be
  21920. written over the top row just after the bottom row is filled.
  21921. Defaults to 1.
  21922. @item start_full, full
  21923. If set to 1, completely fill the output with generated rows before
  21924. outputting the first frame.
  21925. This is the default behavior, for disabling set the value to 0.
  21926. @item stitch
  21927. If set to 1, stitch the left and right row edges together.
  21928. This is the default behavior, for disabling set the value to 0.
  21929. @end table
  21930. @subsection Examples
  21931. @itemize
  21932. @item
  21933. Read the initial state from @file{pattern}, and specify an output of
  21934. size 200x400.
  21935. @example
  21936. cellauto=f=pattern:s=200x400
  21937. @end example
  21938. @item
  21939. Generate a random initial row with a width of 200 cells, with a fill
  21940. ratio of 2/3:
  21941. @example
  21942. cellauto=ratio=2/3:s=200x200
  21943. @end example
  21944. @item
  21945. Create a pattern generated by rule 18 starting by a single alive cell
  21946. centered on an initial row with width 100:
  21947. @example
  21948. cellauto=p=@@:s=100x400:full=0:rule=18
  21949. @end example
  21950. @item
  21951. Specify a more elaborated initial pattern:
  21952. @example
  21953. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  21954. @end example
  21955. @end itemize
  21956. @anchor{coreimagesrc}
  21957. @section coreimagesrc
  21958. Video source generated on GPU using Apple's CoreImage API on OSX.
  21959. This video source is a specialized version of the @ref{coreimage} video filter.
  21960. Use a core image generator at the beginning of the applied filterchain to
  21961. generate the content.
  21962. The coreimagesrc video source accepts the following options:
  21963. @table @option
  21964. @item list_generators
  21965. List all available generators along with all their respective options as well as
  21966. possible minimum and maximum values along with the default values.
  21967. @example
  21968. list_generators=true
  21969. @end example
  21970. @item size, s
  21971. Specify the size of the sourced video. For the syntax of this option, check the
  21972. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21973. The default value is @code{320x240}.
  21974. @item rate, r
  21975. Specify the frame rate of the sourced video, as the number of frames
  21976. generated per second. It has to be a string in the format
  21977. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21978. number or a valid video frame rate abbreviation. The default value is
  21979. "25".
  21980. @item sar
  21981. Set the sample aspect ratio of the sourced video.
  21982. @item duration, d
  21983. Set the duration of the sourced video. See
  21984. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21985. for the accepted syntax.
  21986. If not specified, or the expressed duration is negative, the video is
  21987. supposed to be generated forever.
  21988. @end table
  21989. Additionally, all options of the @ref{coreimage} video filter are accepted.
  21990. A complete filterchain can be used for further processing of the
  21991. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  21992. and examples for details.
  21993. @subsection Examples
  21994. @itemize
  21995. @item
  21996. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  21997. given as complete and escaped command-line for Apple's standard bash shell:
  21998. @example
  21999. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  22000. @end example
  22001. This example is equivalent to the QRCode example of @ref{coreimage} without the
  22002. need for a nullsrc video source.
  22003. @end itemize
  22004. @section ddagrab
  22005. Captures the Windows Desktop via Desktop Duplication API.
  22006. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  22007. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  22008. software processing.
  22009. It accepts the following options:
  22010. @table @option
  22011. @item output_idx
  22012. DXGI Output Index to capture.
  22013. Usually corresponds to the index Windows has given the screen minus one,
  22014. so it's starting at 0.
  22015. Defaults to output 0.
  22016. @item draw_mouse
  22017. Whether to draw the mouse cursor.
  22018. Defaults to true.
  22019. Only affects hardware cursors. If a game or application renders its own cursor,
  22020. it'll always be captured.
  22021. @item framerate
  22022. Maximum framerate at which the desktop will be captured - the interval between
  22023. successive frames will not be smaller than the inverse of the framerate. When
  22024. @var{dup_frames} is true (the default) and the desktop is not being updated
  22025. often enough, the filter will duplicate a previous frame. Note that there is no
  22026. background buffering going on, so when the filter is not polled often enough
  22027. then the actual inter-frame interval may be significantly larger.
  22028. Defaults to 30 FPS.
  22029. @item video_size
  22030. Specify the size of the captured video.
  22031. Defaults to the full size of the screen.
  22032. Cropped from the bottom/right if smaller than screen size.
  22033. @item offset_x
  22034. Horizontal offset of the captured video.
  22035. @item offset_y
  22036. Vertical offset of the captured video.
  22037. @item output_fmt
  22038. Desired filter output format.
  22039. Defaults to 8 Bit BGRA.
  22040. It accepts the following values:
  22041. @table @samp
  22042. @item auto
  22043. Passes all supported output formats to DDA and returns what DDA decides to use.
  22044. @item 8bit
  22045. @item bgra
  22046. 8 Bit formats always work, and DDA will convert to them if necessary.
  22047. @item 10bit
  22048. @item x2bgr10
  22049. Filter initialization will fail if 10 bit format is requested but unavailable.
  22050. @end table
  22051. @item dup_frames
  22052. When this option is set to true (the default), the filter will duplicate frames
  22053. when the desktop has not been updated in order to maintain approximately
  22054. constant target framerate. When this option is set to false, the filter will
  22055. wait for the desktop to be updated (inter-frame intervals may vary significantly
  22056. in this case).
  22057. @end table
  22058. @subsection Examples
  22059. Capture primary screen and encode using nvenc:
  22060. @example
  22061. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  22062. @end example
  22063. You can also skip the lavfi device and directly use the filter.
  22064. Also demonstrates downloading the frame and encoding with libx264.
  22065. Explicit output format specification is required in this case:
  22066. @example
  22067. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  22068. @end example
  22069. If you want to capture only a subsection of the desktop, this can be achieved
  22070. by specifying a smaller size and its offsets into the screen:
  22071. @example
  22072. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  22073. @end example
  22074. @section gradients
  22075. Generate several gradients.
  22076. @table @option
  22077. @item size, s
  22078. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22079. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22080. @item rate, r
  22081. Set frame rate, expressed as number of frames per second. Default
  22082. value is "25".
  22083. @item c0, c1, c2, c3, c4, c5, c6, c7
  22084. Set 8 colors. Default values for colors is to pick random one.
  22085. @item x0, y0, y0, y1
  22086. Set gradient line source and destination points. If negative or out of range, random ones
  22087. are picked.
  22088. @item nb_colors, n
  22089. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  22090. @item seed
  22091. Set seed for picking gradient line points.
  22092. @item duration, d
  22093. Set the duration of the sourced video. See
  22094. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22095. for the accepted syntax.
  22096. If not specified, or the expressed duration is negative, the video is
  22097. supposed to be generated forever.
  22098. @item speed
  22099. Set speed of gradients rotation.
  22100. @item type, t
  22101. Set type of gradients.
  22102. Available values are:
  22103. @table @samp
  22104. @item linear
  22105. @item radial
  22106. @item circular
  22107. @item spiral
  22108. @item square
  22109. @end table
  22110. Default type is @var{linear}.
  22111. @end table
  22112. @subsection Commands
  22113. This source supports the some above options as @ref{commands}.
  22114. @section mandelbrot
  22115. Generate a Mandelbrot set fractal, and progressively zoom towards the
  22116. point specified with @var{start_x} and @var{start_y}.
  22117. This source accepts the following options:
  22118. @table @option
  22119. @item end_pts
  22120. Set the terminal pts value. Default value is 400.
  22121. @item end_scale
  22122. Set the terminal scale value.
  22123. Must be a floating point value. Default value is 0.3.
  22124. @item inner
  22125. Set the inner coloring mode, that is the algorithm used to draw the
  22126. Mandelbrot fractal internal region.
  22127. It shall assume one of the following values:
  22128. @table @option
  22129. @item black
  22130. Set black mode.
  22131. @item convergence
  22132. Show time until convergence.
  22133. @item mincol
  22134. Set color based on point closest to the origin of the iterations.
  22135. @item period
  22136. Set period mode.
  22137. @end table
  22138. Default value is @var{mincol}.
  22139. @item bailout
  22140. Set the bailout value. Default value is 10.0.
  22141. @item maxiter
  22142. Set the maximum of iterations performed by the rendering
  22143. algorithm. Default value is 7189.
  22144. @item outer
  22145. Set outer coloring mode.
  22146. It shall assume one of following values:
  22147. @table @option
  22148. @item iteration_count
  22149. Set iteration count mode.
  22150. @item normalized_iteration_count
  22151. set normalized iteration count mode.
  22152. @end table
  22153. Default value is @var{normalized_iteration_count}.
  22154. @item rate, r
  22155. Set frame rate, expressed as number of frames per second. Default
  22156. value is "25".
  22157. @item size, s
  22158. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22159. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22160. @item start_scale
  22161. Set the initial scale value. Default value is 3.0.
  22162. @item start_x
  22163. Set the initial x position. Must be a floating point value between
  22164. -100 and 100. Default value is -0.743643887037158704752191506114774.
  22165. @item start_y
  22166. Set the initial y position. Must be a floating point value between
  22167. -100 and 100. Default value is -0.131825904205311970493132056385139.
  22168. @end table
  22169. @section mptestsrc
  22170. Generate various test patterns, as generated by the MPlayer test filter.
  22171. The size of the generated video is fixed, and is 256x256.
  22172. This source is useful in particular for testing encoding features.
  22173. This source accepts the following options:
  22174. @table @option
  22175. @item rate, r
  22176. Specify the frame rate of the sourced video, as the number of frames
  22177. generated per second. It has to be a string in the format
  22178. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22179. number or a valid video frame rate abbreviation. The default value is
  22180. "25".
  22181. @item duration, d
  22182. Set the duration of the sourced video. See
  22183. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22184. for the accepted syntax.
  22185. If not specified, or the expressed duration is negative, the video is
  22186. supposed to be generated forever.
  22187. @item test, t
  22188. Set the number or the name of the test to perform. Supported tests are:
  22189. @table @option
  22190. @item dc_luma
  22191. @item dc_chroma
  22192. @item freq_luma
  22193. @item freq_chroma
  22194. @item amp_luma
  22195. @item amp_chroma
  22196. @item cbp
  22197. @item mv
  22198. @item ring1
  22199. @item ring2
  22200. @item all
  22201. @item max_frames, m
  22202. Set the maximum number of frames generated for each test, default value is 30.
  22203. @end table
  22204. Default value is "all", which will cycle through the list of all tests.
  22205. @end table
  22206. Some examples:
  22207. @example
  22208. mptestsrc=t=dc_luma
  22209. @end example
  22210. will generate a "dc_luma" test pattern.
  22211. @section frei0r_src
  22212. Provide a frei0r source.
  22213. To enable compilation of this filter you need to install the frei0r
  22214. header and configure FFmpeg with @code{--enable-frei0r}.
  22215. This source accepts the following parameters:
  22216. @table @option
  22217. @item size
  22218. The size of the video to generate. For the syntax of this option, check the
  22219. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22220. @item framerate
  22221. The framerate of the generated video. It may be a string of the form
  22222. @var{num}/@var{den} or a frame rate abbreviation.
  22223. @item filter_name
  22224. The name to the frei0r source to load. For more information regarding frei0r and
  22225. how to set the parameters, read the @ref{frei0r} section in the video filters
  22226. documentation.
  22227. @item filter_params
  22228. A '|'-separated list of parameters to pass to the frei0r source.
  22229. @end table
  22230. For example, to generate a frei0r partik0l source with size 200x200
  22231. and frame rate 10 which is overlaid on the overlay filter main input:
  22232. @example
  22233. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  22234. @end example
  22235. @section life
  22236. Generate a life pattern.
  22237. This source is based on a generalization of John Conway's life game.
  22238. The sourced input represents a life grid, each pixel represents a cell
  22239. which can be in one of two possible states, alive or dead. Every cell
  22240. interacts with its eight neighbours, which are the cells that are
  22241. horizontally, vertically, or diagonally adjacent.
  22242. At each interaction the grid evolves according to the adopted rule,
  22243. which specifies the number of neighbor alive cells which will make a
  22244. cell stay alive or born. The @option{rule} option allows one to specify
  22245. the rule to adopt.
  22246. This source accepts the following options:
  22247. @table @option
  22248. @item filename, f
  22249. Set the file from which to read the initial grid state. In the file,
  22250. each non-whitespace character is considered an alive cell, and newline
  22251. is used to delimit the end of each row.
  22252. If this option is not specified, the initial grid is generated
  22253. randomly.
  22254. @item rate, r
  22255. Set the video rate, that is the number of frames generated per second.
  22256. Default is 25.
  22257. @item random_fill_ratio, ratio
  22258. Set the random fill ratio for the initial random grid. It is a
  22259. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  22260. It is ignored when a file is specified.
  22261. @item random_seed, seed
  22262. Set the seed for filling the initial random grid, must be an integer
  22263. included between 0 and UINT32_MAX. If not specified, or if explicitly
  22264. set to -1, the filter will try to use a good random seed on a best
  22265. effort basis.
  22266. @item rule
  22267. Set the life rule.
  22268. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  22269. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  22270. @var{NS} specifies the number of alive neighbor cells which make a
  22271. live cell stay alive, and @var{NB} the number of alive neighbor cells
  22272. which make a dead cell to become alive (i.e. to "born").
  22273. "s" and "b" can be used in place of "S" and "B", respectively.
  22274. Alternatively a rule can be specified by an 18-bits integer. The 9
  22275. high order bits are used to encode the next cell state if it is alive
  22276. for each number of neighbor alive cells, the low order bits specify
  22277. the rule for "borning" new cells. Higher order bits encode for an
  22278. higher number of neighbor cells.
  22279. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  22280. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  22281. Default value is "S23/B3", which is the original Conway's game of life
  22282. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  22283. cells, and will born a new cell if there are three alive cells around
  22284. a dead cell.
  22285. @item size, s
  22286. Set the size of the output video. For the syntax of this option, check the
  22287. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22288. If @option{filename} is specified, the size is set by default to the
  22289. same size of the input file. If @option{size} is set, it must contain
  22290. the size specified in the input file, and the initial grid defined in
  22291. that file is centered in the larger resulting area.
  22292. If a filename is not specified, the size value defaults to "320x240"
  22293. (used for a randomly generated initial grid).
  22294. @item stitch
  22295. If set to 1, stitch the left and right grid edges together, and the
  22296. top and bottom edges also. Defaults to 1.
  22297. @item mold
  22298. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  22299. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  22300. value from 0 to 255.
  22301. @item life_color
  22302. Set the color of living (or new born) cells.
  22303. @item death_color
  22304. Set the color of dead cells. If @option{mold} is set, this is the first color
  22305. used to represent a dead cell.
  22306. @item mold_color
  22307. Set mold color, for definitely dead and moldy cells.
  22308. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  22309. ffmpeg-utils manual,ffmpeg-utils}.
  22310. @end table
  22311. @subsection Examples
  22312. @itemize
  22313. @item
  22314. Read a grid from @file{pattern}, and center it on a grid of size
  22315. 300x300 pixels:
  22316. @example
  22317. life=f=pattern:s=300x300
  22318. @end example
  22319. @item
  22320. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  22321. @example
  22322. life=ratio=2/3:s=200x200
  22323. @end example
  22324. @item
  22325. Specify a custom rule for evolving a randomly generated grid:
  22326. @example
  22327. life=rule=S14/B34
  22328. @end example
  22329. @item
  22330. Full example with slow death effect (mold) using @command{ffplay}:
  22331. @example
  22332. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  22333. @end example
  22334. @end itemize
  22335. @section perlin
  22336. Generate Perlin noise.
  22337. Perlin noise is a kind of noise with local continuity in space. This
  22338. can be used to generate patterns with continuity in space and time,
  22339. e.g. to simulate smoke, fluids, or terrain.
  22340. In case more than one octave is specified through the @option{octaves}
  22341. option, Perlin noise is generated as a sum of components, each one
  22342. with doubled frequency. In this case the @option{persistence} option
  22343. specify the ratio of the amplitude with respect to the previous
  22344. component. More octave components enable to specify more high
  22345. frequency details in the generated noise (e.g. small size variations
  22346. due to boulders in a generated terrain).
  22347. @subsection Options
  22348. @table @option
  22349. @item size, s
  22350. Specify the size (width and height) of the buffered video frames. For the
  22351. syntax of this option, check the
  22352. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22353. Default value is @code{320x240}.
  22354. @item rate, r
  22355. Specify the frame rate expected for the video stream, expressed as a
  22356. number of frames per second. Default value is @code{25}.
  22357. @item octaves
  22358. Specify the total number of components making up the noise, each one
  22359. with doubled frequency. Default value is @code{1}.
  22360. @item persistence
  22361. Set the ratio used to compute the amplitude of the next octave
  22362. component with respect to the previous component amplitude. Default
  22363. value is @code{1}.
  22364. @item xscale
  22365. @item yscale
  22366. Define a scale factor used to multiple the x, y coordinates. This can
  22367. be useful to define an effect with a pattern stretched along the x or
  22368. y axis. Default value is @code{1}.
  22369. @item tscale
  22370. Define a scale factor used to multiple the time coordinate. This can
  22371. be useful to change the time variation speed. Default value is @code{1}.
  22372. @item random_mode
  22373. Set random mode used to compute initial pattern.
  22374. Supported values are:
  22375. @table @option
  22376. @item random
  22377. Compute and use random seed.
  22378. @item ken
  22379. Use the predefined initial pattern defined by Ken Perlin in the
  22380. original article, can be useful to compare the output with other
  22381. sources.
  22382. @item seed
  22383. Use the value specified by @option{random_seed} option.
  22384. @end table
  22385. Default value is @code{random}.
  22386. @item random_seed, seed
  22387. When @option{random_mode} is set to @var{random_seed}, use this value
  22388. to compute the initial pattern. Default value is @code{0}.
  22389. @end table
  22390. @subsection Examples
  22391. @itemize
  22392. @item
  22393. Generate single component:
  22394. @example
  22395. perlin
  22396. @end example
  22397. @item
  22398. Use Perlin noise with 7 components, each one with a halved contribution
  22399. to total amplitude:
  22400. @example
  22401. perlin=octaves=7:persistence=0.5
  22402. @end example
  22403. @item
  22404. Chain Perlin noise with the @ref{lutyuv} to generate a black&white
  22405. effect:
  22406. @example
  22407. perlin=octaves=3:tscale=0.3,lutyuv=y='if(lt(val\,128)\,255\,0)'
  22408. @end example
  22409. @item
  22410. Stretch noise along the y axis, and convert gray level to red-only
  22411. signal:
  22412. @example
  22413. perlin=octaves=7:tscale=0.4:yscale=0.3,lutrgb=r=val:b=0:g=0
  22414. @end example
  22415. @end itemize
  22416. @section qrencodesrc
  22417. Generate a QR code using the libqrencode library (see
  22418. @url{https://fukuchi.org/works/qrencode/}).
  22419. To enable the compilation of this source, you need to configure FFmpeg with
  22420. @code{--enable-libqrencode}.
  22421. The QR code is generated from the provided text or text pattern. The
  22422. corresponding QR code is scaled and put in the video output according to the
  22423. specified output size options.
  22424. In case no text is specified, the QR code is not generated, but an empty colored
  22425. output is returned instead.
  22426. This source accepts the following options:
  22427. @table @option
  22428. @item qrcode_width, q
  22429. @item padded_qrcode_width, Q
  22430. Specify an expression for the width of the rendered QR code, with and without
  22431. padding. The @var{qrcode_width} expression can reference the value set by the
  22432. @var{padded_qrcode_width} expression, and vice versa.
  22433. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  22434. there is no padding.
  22435. These expressions are evaluated only once, when initializing the source.
  22436. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  22437. Note that some of the constants are missing for the source (for example the
  22438. @var{x} or @var{t} or ¸@var{n}), since they only makes sense when evaluating the
  22439. expression for each frame rather than at initialization time.
  22440. @item rate, r
  22441. Specify the frame rate of the sourced video, as the number of frames
  22442. generated per second. It has to be a string in the format
  22443. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22444. number or a valid video frame rate abbreviation. The default value is
  22445. "25".
  22446. @item case_sensitive, cs
  22447. Instruct libqrencode to use case sensitive encoding. This is enabled by
  22448. default. This can be disabled to reduce the QR encoding size.
  22449. @item level, l
  22450. Specify the QR encoding error correction level. With an higher correction level,
  22451. the encoding size will increase but the code will be more robust to corruption.
  22452. Lower level is @var{L}.
  22453. It accepts the following values:
  22454. @table @samp
  22455. @item L
  22456. @item M
  22457. @item Q
  22458. @item H
  22459. @end table
  22460. @item expansion
  22461. Select how the input text is expanded. Can be either @code{none}, or
  22462. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  22463. section for details.
  22464. @item text
  22465. @item textfile
  22466. Define the text to be rendered. In case neither is specified, no QR is encoded
  22467. (just an empty colored frame).
  22468. In case expansion is enabled, the text is treated as a text template, using the
  22469. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  22470. Text expansion} section for details.
  22471. @item background_color, bc
  22472. @item foreground_color, fc
  22473. Set the QR code and background color. The default value of
  22474. @var{foreground_color} is "black", the default value of @var{background_color}
  22475. is "white".
  22476. For the syntax of the color options, check the @ref{color syntax,,"Color"
  22477. section in the ffmpeg-utils manual,ffmpeg-utils}.
  22478. @end table
  22479. @subsection Examples
  22480. @itemize
  22481. @item
  22482. Generate a QR code encoding the specified text with the default size:
  22483. @example
  22484. qrencodesrc=text=www.ffmpeg.org
  22485. @end example
  22486. @item
  22487. Same as below, but select blue on pink colors:
  22488. @example
  22489. qrencodesrc=text=www.ffmpeg.org:bc=pink:fc=blue
  22490. @end example
  22491. @item
  22492. Generate a QR code with width of 200 pixels and padding, making the padded width
  22493. 4/3 of the QR code width:
  22494. @example
  22495. qrencodesrc=text=www.ffmpeg.org:q=200:Q=4/3*q
  22496. @end example
  22497. @item
  22498. Generate a QR code with padded width of 200 pixels and padding, making the QR
  22499. code width 3/4 of the padded width:
  22500. @example
  22501. qrencodesrc=text=www.ffmpeg.org:Q=200:q=3/4*Q
  22502. @end example
  22503. @item
  22504. Generate a QR code encoding the frame number:
  22505. @example
  22506. qrencodesrc=text=%@{n@}
  22507. @end example
  22508. @item
  22509. Generate a QR code encoding the GMT timestamp:
  22510. @example
  22511. qrencodesrc=text=%@{gmtime@}
  22512. @end example
  22513. @item
  22514. Generate a QR code encoding the timestamp expressed as a float:
  22515. @example
  22516. qrencodesrc=text=%@{pts@}
  22517. @end example
  22518. @end itemize
  22519. @anchor{allrgb}
  22520. @anchor{allyuv}
  22521. @anchor{color}
  22522. @anchor{colorchart}
  22523. @anchor{colorspectrum}
  22524. @anchor{haldclutsrc}
  22525. @anchor{nullsrc}
  22526. @anchor{pal75bars}
  22527. @anchor{pal100bars}
  22528. @anchor{rgbtestsrc}
  22529. @anchor{smptebars}
  22530. @anchor{smptehdbars}
  22531. @anchor{testsrc}
  22532. @anchor{testsrc2}
  22533. @anchor{yuvtestsrc}
  22534. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  22535. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  22536. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  22537. The @code{color} source provides an uniformly colored input.
  22538. The @code{colorchart} source provides a colors checker chart.
  22539. The @code{colorspectrum} source provides a color spectrum input.
  22540. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  22541. @ref{haldclut} filter.
  22542. The @code{nullsrc} source returns unprocessed video frames. It is
  22543. mainly useful to be employed in analysis / debugging tools, or as the
  22544. source for filters which ignore the input data.
  22545. The @code{pal75bars} source generates a color bars pattern, based on
  22546. EBU PAL recommendations with 75% color levels.
  22547. The @code{pal100bars} source generates a color bars pattern, based on
  22548. EBU PAL recommendations with 100% color levels.
  22549. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  22550. detecting RGB vs BGR issues. You should see a red, green and blue
  22551. stripe from top to bottom.
  22552. The @code{smptebars} source generates a color bars pattern, based on
  22553. the SMPTE Engineering Guideline EG 1-1990.
  22554. The @code{smptehdbars} source generates a color bars pattern, based on
  22555. the SMPTE RP 219-2002.
  22556. The @code{testsrc} source generates a test video pattern, showing a
  22557. color pattern, a scrolling gradient and a timestamp. This is mainly
  22558. intended for testing purposes.
  22559. The @code{testsrc2} source is similar to testsrc, but supports more
  22560. pixel formats instead of just @code{rgb24}. This allows using it as an
  22561. input for other tests without requiring a format conversion.
  22562. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  22563. see a y, cb and cr stripe from top to bottom.
  22564. The sources accept the following parameters:
  22565. @table @option
  22566. @item level
  22567. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  22568. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  22569. pixels to be used as identity matrix for 3D lookup tables. Each component is
  22570. coded on a @code{1/(N*N)} scale.
  22571. @item color, c
  22572. Specify the color of the source, only available in the @code{color}
  22573. source. For the syntax of this option, check the
  22574. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22575. @item size, s
  22576. Specify the size of the sourced video. For the syntax of this option, check the
  22577. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22578. The default value is @code{320x240}.
  22579. This option is not available with the @code{allrgb}, @code{allyuv}, and
  22580. @code{haldclutsrc} filters.
  22581. @item rate, r
  22582. Specify the frame rate of the sourced video, as the number of frames
  22583. generated per second. It has to be a string in the format
  22584. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22585. number or a valid video frame rate abbreviation. The default value is
  22586. "25".
  22587. @item duration, d
  22588. Set the duration of the sourced video. See
  22589. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22590. for the accepted syntax.
  22591. If not specified, or the expressed duration is negative, the video is
  22592. supposed to be generated forever.
  22593. Since the frame rate is used as time base, all frames including the last one
  22594. will have their full duration. If the specified duration is not a multiple
  22595. of the frame duration, it will be rounded up.
  22596. @item sar
  22597. Set the sample aspect ratio of the sourced video.
  22598. @item alpha
  22599. Specify the alpha (opacity) of the background, only available in the
  22600. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  22601. 255 (fully opaque, the default).
  22602. @item decimals, n
  22603. Set the number of decimals to show in the timestamp, only available in the
  22604. @code{testsrc} source.
  22605. The displayed timestamp value will correspond to the original
  22606. timestamp value multiplied by the power of 10 of the specified
  22607. value. Default value is 0.
  22608. @item type
  22609. Set the type of the color spectrum, only available in the
  22610. @code{colorspectrum} source. Can be one of the following:
  22611. @table @samp
  22612. @item black
  22613. @item white
  22614. @item all
  22615. @end table
  22616. @item patch_size
  22617. Set patch size of single color patch, only available in the
  22618. @code{colorchart} source. Default is @code{64x64}.
  22619. @item preset
  22620. Set colorchecker colors preset, only available in the
  22621. @code{colorchart} source.
  22622. Available values are:
  22623. @table @samp
  22624. @item reference
  22625. @item skintones
  22626. @end table
  22627. Default value is @code{reference}.
  22628. @end table
  22629. @subsection Examples
  22630. @itemize
  22631. @item
  22632. Generate a video with a duration of 5.3 seconds, with size
  22633. 176x144 and a frame rate of 10 frames per second:
  22634. @example
  22635. testsrc=duration=5.3:size=qcif:rate=10
  22636. @end example
  22637. @item
  22638. The following graph description will generate a red source
  22639. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  22640. frames per second:
  22641. @example
  22642. color=c=red@@0.2:s=qcif:r=10
  22643. @end example
  22644. @item
  22645. If the input content is to be ignored, @code{nullsrc} can be used. The
  22646. following command generates noise in the luma plane by employing
  22647. the @code{geq} filter:
  22648. @example
  22649. nullsrc=s=256x256, geq=random(1)*255:128:128
  22650. @end example
  22651. @end itemize
  22652. @subsection Commands
  22653. The @code{color} source supports the following commands:
  22654. @table @option
  22655. @item c, color
  22656. Set the color of the created image. Accepts the same syntax of the
  22657. corresponding @option{color} option.
  22658. @end table
  22659. @section openclsrc
  22660. Generate video using an OpenCL program.
  22661. @table @option
  22662. @item source
  22663. OpenCL program source file.
  22664. @item kernel
  22665. Kernel name in program.
  22666. @item size, s
  22667. Size of frames to generate. This must be set.
  22668. @item format
  22669. Pixel format to use for the generated frames. This must be set.
  22670. @item rate, r
  22671. Number of frames generated every second. Default value is '25'.
  22672. @end table
  22673. For details of how the program loading works, see the @ref{program_opencl}
  22674. filter.
  22675. Example programs:
  22676. @itemize
  22677. @item
  22678. Generate a colour ramp by setting pixel values from the position of the pixel
  22679. in the output image. (Note that this will work with all pixel formats, but
  22680. the generated output will not be the same.)
  22681. @verbatim
  22682. __kernel void ramp(__write_only image2d_t dst,
  22683. unsigned int index)
  22684. {
  22685. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22686. float4 val;
  22687. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  22688. write_imagef(dst, loc, val);
  22689. }
  22690. @end verbatim
  22691. @item
  22692. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  22693. @verbatim
  22694. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  22695. unsigned int index)
  22696. {
  22697. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22698. float4 value = 0.0f;
  22699. int x = loc.x + index;
  22700. int y = loc.y + index;
  22701. while (x > 0 || y > 0) {
  22702. if (x % 3 == 1 && y % 3 == 1) {
  22703. value = 1.0f;
  22704. break;
  22705. }
  22706. x /= 3;
  22707. y /= 3;
  22708. }
  22709. write_imagef(dst, loc, value);
  22710. }
  22711. @end verbatim
  22712. @end itemize
  22713. @section sierpinski
  22714. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  22715. This source accepts the following options:
  22716. @table @option
  22717. @item size, s
  22718. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22719. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22720. @item rate, r
  22721. Set frame rate, expressed as number of frames per second. Default
  22722. value is "25".
  22723. @item seed
  22724. Set seed which is used for random panning.
  22725. @item jump
  22726. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  22727. @item type
  22728. Set fractal type, can be default @code{carpet} or @code{triangle}.
  22729. @end table
  22730. @section zoneplate
  22731. Generate a zoneplate test video pattern.
  22732. This source accepts the following options:
  22733. @table @option
  22734. @item size, s
  22735. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22736. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "320x240".
  22737. @item rate, r
  22738. Set frame rate, expressed as number of frames per second. Default
  22739. value is "25".
  22740. @item duration, d
  22741. Set the duration of the sourced video. See
  22742. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22743. for the accepted syntax.
  22744. If not specified, or the expressed duration is negative, the video is
  22745. supposed to be generated forever.
  22746. @item sar
  22747. Set the sample aspect ratio of the sourced video.
  22748. @item precision
  22749. Set precision in bits for look-up table for sine calculations. Default value is 10.
  22750. Allowed range is from 4 to 16.
  22751. @item xo
  22752. Set horizontal axis offset for output signal. Default value is 0.
  22753. @item yo
  22754. Set vertical axis offset for output signal. Default value is 0.
  22755. @item to
  22756. Set time axis offset for output signal. Default value is 0.
  22757. @item k0
  22758. Set 0-order, constant added to signal phase. Default value is 0.
  22759. @item kx
  22760. Set 1-order, phase factor multiplier for horizontal axis. Default value is 0.
  22761. @item ky
  22762. Set 1-order, phase factor multiplier for vertical axis. Default value is 0.
  22763. @item kt
  22764. Set 1-order, phase factor multiplier for time axis. Default value is 0.
  22765. @item kxt, kyt, kxy
  22766. Set phase factor multipliers for combination of spatial and temporal axis.
  22767. Default value is 0.
  22768. @item kx2
  22769. Set 2-order, phase factor multiplier for horizontal axis. Default value is 0.
  22770. @item ky2
  22771. Set 2-order, phase factor multiplier for vertical axis. Default value is 0.
  22772. @item kt2
  22773. Set 2-order, phase factor multiplier for time axis. Default value is 0.
  22774. @item ku
  22775. Set the constant added to final phase to produce chroma-blue component of signal.
  22776. Default value is 0.
  22777. @item kv
  22778. Set the constant added to final phase to produce chroma-red component of signal.
  22779. Default value is 0.
  22780. @end table
  22781. @subsection Commands
  22782. This source supports the some above options as @ref{commands}.
  22783. @subsection Examples
  22784. @itemize
  22785. @item
  22786. Generate horizontal color sine sweep:
  22787. @example
  22788. zoneplate=ku=512:kv=0:kt2=0:kx2=256:s=wvga:xo=-426:kt=11
  22789. @end example
  22790. @item
  22791. Generate vertical color sine sweep:
  22792. @example
  22793. zoneplate=ku=512:kv=0:kt2=0:ky2=156:s=wvga:yo=-240:kt=11
  22794. @end example
  22795. @item
  22796. Generate circular zone-plate:
  22797. @example
  22798. zoneplate=ku=512:kv=100:kt2=0:ky2=256:kx2=556:s=wvga:yo=0:kt=11
  22799. @end example
  22800. @end itemize
  22801. @c man end VIDEO SOURCES
  22802. @chapter Video Sinks
  22803. @c man begin VIDEO SINKS
  22804. Below is a description of the currently available video sinks.
  22805. @section buffersink
  22806. Buffer video frames, and make them available to the end of the filter
  22807. graph.
  22808. This sink is mainly intended for programmatic use, in particular
  22809. through the interface defined in @file{libavfilter/buffersink.h}
  22810. or the options system.
  22811. It accepts a pointer to an AVBufferSinkContext structure, which
  22812. defines the incoming buffers' formats, to be passed as the opaque
  22813. parameter to @code{avfilter_init_filter} for initialization.
  22814. @section nullsink
  22815. Null video sink: do absolutely nothing with the input video. It is
  22816. mainly useful as a template and for use in analysis / debugging
  22817. tools.
  22818. @c man end VIDEO SINKS
  22819. @chapter Multimedia Filters
  22820. @c man begin MULTIMEDIA FILTERS
  22821. Below is a description of the currently available multimedia filters.
  22822. @section a3dscope
  22823. Convert input audio to 3d scope video output.
  22824. The filter accepts the following options:
  22825. @table @option
  22826. @item rate, r
  22827. Set frame rate, expressed as number of frames per second. Default
  22828. value is "25".
  22829. @item size, s
  22830. Specify the video size for the output. For the syntax of this option, check the
  22831. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22832. Default value is @code{hd720}.
  22833. @item fov
  22834. Set the camera field of view. Default is 90 degrees.
  22835. Allowed range is from 40 to 150.
  22836. @item roll
  22837. Set the camera roll.
  22838. @item pitch
  22839. Set the camera pitch.
  22840. @item yaw
  22841. Set the camera yaw.
  22842. @item xzoom
  22843. Set the camera zoom on X-axis.
  22844. @item yzoom
  22845. Set the camera zoom on Y-axis.
  22846. @item zzoom
  22847. Set the camera zoom on Z-axis.
  22848. @item xpos
  22849. Set the camera position on X-axis.
  22850. @item ypos
  22851. Set the camera position on Y-axis.
  22852. @item zpos
  22853. Set the camera position on Z-axis.
  22854. @item length
  22855. Set the length of displayed audio waves in number of frames.
  22856. @end table
  22857. @subsection Commands
  22858. Filter supports the some above options as @ref{commands}.
  22859. @section abitscope
  22860. Convert input audio to a video output, displaying the audio bit scope.
  22861. The filter accepts the following options:
  22862. @table @option
  22863. @item rate, r
  22864. Set frame rate, expressed as number of frames per second. Default
  22865. value is "25".
  22866. @item size, s
  22867. Specify the video size for the output. For the syntax of this option, check the
  22868. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22869. Default value is @code{1024x256}.
  22870. @item colors
  22871. Specify list of colors separated by space or by '|' which will be used to
  22872. draw channels. Unrecognized or missing colors will be replaced
  22873. by white color.
  22874. @item mode, m
  22875. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  22876. @end table
  22877. @section adrawgraph
  22878. Draw a graph using input audio metadata.
  22879. See @ref{drawgraph}
  22880. @section agraphmonitor
  22881. See @ref{graphmonitor}.
  22882. @section ahistogram
  22883. Convert input audio to a video output, displaying the volume histogram.
  22884. The filter accepts the following options:
  22885. @table @option
  22886. @item dmode
  22887. Specify how histogram is calculated.
  22888. It accepts the following values:
  22889. @table @samp
  22890. @item single
  22891. Use single histogram for all channels.
  22892. @item separate
  22893. Use separate histogram for each channel.
  22894. @end table
  22895. Default is @code{single}.
  22896. @item rate, r
  22897. Set frame rate, expressed as number of frames per second. Default
  22898. value is "25".
  22899. @item size, s
  22900. Specify the video size for the output. For the syntax of this option, check the
  22901. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22902. Default value is @code{hd720}.
  22903. @item scale
  22904. Set display scale.
  22905. It accepts the following values:
  22906. @table @samp
  22907. @item log
  22908. logarithmic
  22909. @item sqrt
  22910. square root
  22911. @item cbrt
  22912. cubic root
  22913. @item lin
  22914. linear
  22915. @item rlog
  22916. reverse logarithmic
  22917. @end table
  22918. Default is @code{log}.
  22919. @item ascale
  22920. Set amplitude scale.
  22921. It accepts the following values:
  22922. @table @samp
  22923. @item log
  22924. logarithmic
  22925. @item lin
  22926. linear
  22927. @end table
  22928. Default is @code{log}.
  22929. @item acount
  22930. Set how much frames to accumulate in histogram.
  22931. Default is 1. Setting this to -1 accumulates all frames.
  22932. @item rheight
  22933. Set histogram ratio of window height.
  22934. @item slide
  22935. Set sonogram sliding.
  22936. It accepts the following values:
  22937. @table @samp
  22938. @item replace
  22939. replace old rows with new ones.
  22940. @item scroll
  22941. scroll from top to bottom.
  22942. @end table
  22943. Default is @code{replace}.
  22944. @item hmode
  22945. Set histogram mode.
  22946. It accepts the following values:
  22947. @table @samp
  22948. @item abs
  22949. Use absolute values of samples.
  22950. @item sign
  22951. Use untouched values of samples.
  22952. @end table
  22953. Default is @code{abs}.
  22954. @end table
  22955. @section aphasemeter
  22956. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  22957. representing mean phase of current audio frame. A video output can also be produced and is
  22958. enabled by default. The audio is passed through as first output.
  22959. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  22960. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  22961. and @code{1} means channels are in phase.
  22962. The filter accepts the following options, all related to its video output:
  22963. @table @option
  22964. @item rate, r
  22965. Set the output frame rate. Default value is @code{25}.
  22966. @item size, s
  22967. Set the video size for the output. For the syntax of this option, check the
  22968. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22969. Default value is @code{800x400}.
  22970. @item rc
  22971. @item gc
  22972. @item bc
  22973. Specify the red, green, blue contrast. Default values are @code{2},
  22974. @code{7} and @code{1}.
  22975. Allowed range is @code{[0, 255]}.
  22976. @item mpc
  22977. Set color which will be used for drawing median phase. If color is
  22978. @code{none} which is default, no median phase value will be drawn.
  22979. @item video
  22980. Enable video output. Default is enabled.
  22981. @end table
  22982. @subsection phasing detection
  22983. The filter also detects out of phase and mono sequences in stereo streams.
  22984. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  22985. The filter accepts the following options for this detection:
  22986. @table @option
  22987. @item phasing
  22988. Enable mono and out of phase detection. Default is disabled.
  22989. @item tolerance, t
  22990. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  22991. Allowed range is @code{[0, 1]}.
  22992. @item angle, a
  22993. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  22994. Allowed range is @code{[90, 180]}.
  22995. @item duration, d
  22996. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  22997. @end table
  22998. @subsection Examples
  22999. @itemize
  23000. @item
  23001. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  23002. @example
  23003. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  23004. @end example
  23005. @end itemize
  23006. @section avectorscope
  23007. Convert input audio to a video output, representing the audio vector
  23008. scope.
  23009. The filter is used to measure the difference between channels of stereo
  23010. audio stream. A monaural signal, consisting of identical left and right
  23011. signal, results in straight vertical line. Any stereo separation is visible
  23012. as a deviation from this line, creating a Lissajous figure.
  23013. If the straight (or deviation from it) but horizontal line appears this
  23014. indicates that the left and right channels are out of phase.
  23015. The filter accepts the following options:
  23016. @table @option
  23017. @item mode, m
  23018. Set the vectorscope mode.
  23019. Available values are:
  23020. @table @samp
  23021. @item lissajous
  23022. Lissajous rotated by 45 degrees.
  23023. @item lissajous_xy
  23024. Same as above but not rotated.
  23025. @item polar
  23026. Shape resembling half of circle.
  23027. @end table
  23028. Default value is @samp{lissajous}.
  23029. @item size, s
  23030. Set the video size for the output. For the syntax of this option, check the
  23031. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23032. Default value is @code{400x400}.
  23033. @item rate, r
  23034. Set the output frame rate. Default value is @code{25}.
  23035. @item rc
  23036. @item gc
  23037. @item bc
  23038. @item ac
  23039. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  23040. @code{160}, @code{80} and @code{255}.
  23041. Allowed range is @code{[0, 255]}.
  23042. @item rf
  23043. @item gf
  23044. @item bf
  23045. @item af
  23046. Specify the red, green, blue and alpha fade. Default values are @code{15},
  23047. @code{10}, @code{5} and @code{5}.
  23048. Allowed range is @code{[0, 255]}.
  23049. @item zoom
  23050. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  23051. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  23052. @item draw
  23053. Set the vectorscope drawing mode.
  23054. Available values are:
  23055. @table @samp
  23056. @item dot
  23057. Draw dot for each sample.
  23058. @item line
  23059. Draw line between previous and current sample.
  23060. @item aaline
  23061. Draw anti-aliased line between previous and current sample.
  23062. @end table
  23063. Default value is @samp{dot}.
  23064. @item scale
  23065. Specify amplitude scale of audio samples.
  23066. Available values are:
  23067. @table @samp
  23068. @item lin
  23069. Linear.
  23070. @item sqrt
  23071. Square root.
  23072. @item cbrt
  23073. Cubic root.
  23074. @item log
  23075. Logarithmic.
  23076. @end table
  23077. @item swap
  23078. Swap left channel axis with right channel axis.
  23079. @item mirror
  23080. Mirror axis.
  23081. @table @samp
  23082. @item none
  23083. No mirror.
  23084. @item x
  23085. Mirror only x axis.
  23086. @item y
  23087. Mirror only y axis.
  23088. @item xy
  23089. Mirror both axis.
  23090. @end table
  23091. @end table
  23092. @subsection Examples
  23093. @itemize
  23094. @item
  23095. Complete example using @command{ffplay}:
  23096. @example
  23097. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  23098. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  23099. @end example
  23100. @end itemize
  23101. @subsection Commands
  23102. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  23103. @section bench, abench
  23104. Benchmark part of a filtergraph.
  23105. The filter accepts the following options:
  23106. @table @option
  23107. @item action
  23108. Start or stop a timer.
  23109. Available values are:
  23110. @table @samp
  23111. @item start
  23112. Get the current time, set it as frame metadata (using the key
  23113. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  23114. @item stop
  23115. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  23116. the input frame metadata to get the time difference. Time difference, average,
  23117. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  23118. @code{min}) are then printed. The timestamps are expressed in seconds.
  23119. @end table
  23120. @end table
  23121. @subsection Examples
  23122. @itemize
  23123. @item
  23124. Benchmark @ref{selectivecolor} filter:
  23125. @example
  23126. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  23127. @end example
  23128. @end itemize
  23129. @section concat
  23130. Concatenate audio and video streams, joining them together one after the
  23131. other.
  23132. The filter works on segments of synchronized video and audio streams. All
  23133. segments must have the same number of streams of each type, and that will
  23134. also be the number of streams at output.
  23135. The filter accepts the following options:
  23136. @table @option
  23137. @item n
  23138. Set the number of segments. Default is 2.
  23139. @item v
  23140. Set the number of output video streams, that is also the number of video
  23141. streams in each segment. Default is 1.
  23142. @item a
  23143. Set the number of output audio streams, that is also the number of audio
  23144. streams in each segment. Default is 0.
  23145. @item unsafe
  23146. Activate unsafe mode: do not fail if segments have a different format.
  23147. @end table
  23148. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  23149. @var{a} audio outputs.
  23150. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  23151. segment, in the same order as the outputs, then the inputs for the second
  23152. segment, etc.
  23153. Related streams do not always have exactly the same duration, for various
  23154. reasons including codec frame size or sloppy authoring. For that reason,
  23155. related synchronized streams (e.g. a video and its audio track) should be
  23156. concatenated at once. The concat filter will use the duration of the longest
  23157. stream in each segment (except the last one), and if necessary pad shorter
  23158. audio streams with silence.
  23159. For this filter to work correctly, all segments must start at timestamp 0.
  23160. All corresponding streams must have the same parameters in all segments; the
  23161. filtering system will automatically select a common pixel format for video
  23162. streams, and a common sample format, sample rate and channel layout for
  23163. audio streams, but other settings, such as resolution, must be converted
  23164. explicitly by the user.
  23165. Different frame rates are acceptable but will result in variable frame rate
  23166. at output; be sure to configure the output file to handle it.
  23167. @subsection Examples
  23168. @itemize
  23169. @item
  23170. Concatenate an opening, an episode and an ending, all in bilingual version
  23171. (video in stream 0, audio in streams 1 and 2):
  23172. @example
  23173. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  23174. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  23175. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  23176. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  23177. @end example
  23178. @item
  23179. Concatenate two parts, handling audio and video separately, using the
  23180. (a)movie sources, and adjusting the resolution:
  23181. @example
  23182. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  23183. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  23184. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  23185. @end example
  23186. Note that a desync will happen at the stitch if the audio and video streams
  23187. do not have exactly the same duration in the first file.
  23188. @end itemize
  23189. @subsection Commands
  23190. This filter supports the following commands:
  23191. @table @option
  23192. @item next
  23193. Close the current segment and step to the next one
  23194. @end table
  23195. @anchor{ebur128}
  23196. @section ebur128
  23197. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  23198. level. By default, it logs a message at a frequency of 10Hz with the
  23199. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  23200. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  23201. The filter can only analyze streams which have
  23202. sample format is double-precision floating point. The input stream will be converted to
  23203. this specification, if needed. Users may need to insert aformat and/or aresample filters
  23204. after this filter to obtain the original parameters.
  23205. The filter also has a video output (see the @var{video} option) with a real
  23206. time graph to observe the loudness evolution. The graphic contains the logged
  23207. message mentioned above, so it is not printed anymore when this option is set,
  23208. unless the verbose logging is set. The main graphing area contains the
  23209. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  23210. the momentary loudness (400 milliseconds), but can optionally be configured
  23211. to instead display short-term loudness (see @var{gauge}).
  23212. The green area marks a +/- 1LU target range around the target loudness
  23213. (-23LUFS by default, unless modified through @var{target}).
  23214. More information about the Loudness Recommendation EBU R128 on
  23215. @url{http://tech.ebu.ch/loudness}.
  23216. The filter accepts the following options:
  23217. @table @option
  23218. @item video
  23219. Activate the video output. The audio stream is passed unchanged whether this
  23220. option is set or no. The video stream will be the first output stream if
  23221. activated. Default is @code{0}.
  23222. @item size
  23223. Set the video size. This option is for video only. For the syntax of this
  23224. option, check the
  23225. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23226. Default and minimum resolution is @code{640x480}.
  23227. @item meter
  23228. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  23229. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  23230. other integer value between this range is allowed.
  23231. @item metadata
  23232. Set metadata injection. If set to @code{1}, the audio input will be segmented
  23233. into 100ms output frames, each of them containing various loudness information
  23234. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  23235. Default is @code{0}.
  23236. @item framelog
  23237. Force the frame logging level.
  23238. Available values are:
  23239. @table @samp
  23240. @item quiet
  23241. logging disabled
  23242. @item info
  23243. information logging level
  23244. @item verbose
  23245. verbose logging level
  23246. @end table
  23247. By default, the logging level is set to @var{info}. If the @option{video} or
  23248. the @option{metadata} options are set, it switches to @var{verbose}.
  23249. @item peak
  23250. Set peak mode(s).
  23251. Available modes can be cumulated (the option is a @code{flag} type). Possible
  23252. values are:
  23253. @table @samp
  23254. @item none
  23255. Disable any peak mode (default).
  23256. @item sample
  23257. Enable sample-peak mode.
  23258. Simple peak mode looking for the higher sample value. It logs a message
  23259. for sample-peak (identified by @code{SPK}).
  23260. @item true
  23261. Enable true-peak mode.
  23262. If enabled, the peak lookup is done on an over-sampled version of the input
  23263. stream for better peak accuracy. It logs a message for true-peak.
  23264. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  23265. This mode requires a build with @code{libswresample}.
  23266. @end table
  23267. @item dualmono
  23268. Treat mono input files as "dual mono". If a mono file is intended for playback
  23269. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  23270. If set to @code{true}, this option will compensate for this effect.
  23271. Multi-channel input files are not affected by this option.
  23272. @item panlaw
  23273. Set a specific pan law to be used for the measurement of dual mono files.
  23274. This parameter is optional, and has a default value of -3.01dB.
  23275. @item target
  23276. Set a specific target level (in LUFS) used as relative zero in the visualization.
  23277. This parameter is optional and has a default value of -23LUFS as specified
  23278. by EBU R128. However, material published online may prefer a level of -16LUFS
  23279. (e.g. for use with podcasts or video platforms).
  23280. @item gauge
  23281. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  23282. @code{shortterm}. By default the momentary value will be used, but in certain
  23283. scenarios it may be more useful to observe the short term value instead (e.g.
  23284. live mixing).
  23285. @item scale
  23286. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  23287. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  23288. video output, not the summary or continuous log output.
  23289. @item integrated
  23290. Read-only exported value for measured integrated loudness, in LUFS.
  23291. @item range
  23292. Read-only exported value for measured loudness range, in LU.
  23293. @item lra_low
  23294. Read-only exported value for measured LRA low, in LUFS.
  23295. @item lra_high
  23296. Read-only exported value for measured LRA high, in LUFS.
  23297. @item sample_peak
  23298. Read-only exported value for measured sample peak, in dBFS.
  23299. @item true_peak
  23300. Read-only exported value for measured true peak, in dBFS.
  23301. @end table
  23302. @subsection Examples
  23303. @itemize
  23304. @item
  23305. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  23306. @example
  23307. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  23308. @end example
  23309. @item
  23310. Run an analysis with @command{ffmpeg}:
  23311. @example
  23312. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  23313. @end example
  23314. @end itemize
  23315. @section interleave, ainterleave
  23316. Temporally interleave frames from several inputs.
  23317. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  23318. These filters read frames from several inputs and send the oldest
  23319. queued frame to the output.
  23320. Input streams must have well defined, monotonically increasing frame
  23321. timestamp values.
  23322. In order to submit one frame to output, these filters need to enqueue
  23323. at least one frame for each input, so they cannot work in case one
  23324. input is not yet terminated and will not receive incoming frames.
  23325. For example consider the case when one input is a @code{select} filter
  23326. which always drops input frames. The @code{interleave} filter will keep
  23327. reading from that input, but it will never be able to send new frames
  23328. to output until the input sends an end-of-stream signal.
  23329. Also, depending on inputs synchronization, the filters will drop
  23330. frames in case one input receives more frames than the other ones, and
  23331. the queue is already filled.
  23332. These filters accept the following options:
  23333. @table @option
  23334. @item nb_inputs, n
  23335. Set the number of different inputs, it is 2 by default.
  23336. @item duration
  23337. How to determine the end-of-stream.
  23338. @table @option
  23339. @item longest
  23340. The duration of the longest input. (default)
  23341. @item shortest
  23342. The duration of the shortest input.
  23343. @item first
  23344. The duration of the first input.
  23345. @end table
  23346. @end table
  23347. @subsection Examples
  23348. @itemize
  23349. @item
  23350. Interleave frames belonging to different streams using @command{ffmpeg}:
  23351. @example
  23352. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  23353. @end example
  23354. @item
  23355. Add flickering blur effect:
  23356. @example
  23357. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  23358. @end example
  23359. @end itemize
  23360. @section latency, alatency
  23361. Measure filtering latency.
  23362. Report previous filter filtering latency, delay in number of audio samples for audio filters
  23363. or number of video frames for video filters.
  23364. On end of input stream, filter will report min and max measured latency for previous running filter
  23365. in filtergraph.
  23366. @section metadata, ametadata
  23367. Manipulate frame metadata.
  23368. This filter accepts the following options:
  23369. @table @option
  23370. @item mode
  23371. Set mode of operation of the filter.
  23372. Can be one of the following:
  23373. @table @samp
  23374. @item select
  23375. If both @code{value} and @code{key} is set, select frames
  23376. which have such metadata. If only @code{key} is set, select
  23377. every frame that has such key in metadata.
  23378. @item add
  23379. Add new metadata @code{key} and @code{value}. If key is already available
  23380. do nothing.
  23381. @item modify
  23382. Modify value of already present key.
  23383. @item delete
  23384. If @code{value} is set, delete only keys that have such value.
  23385. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  23386. the frame.
  23387. @item print
  23388. Print key and its value if metadata was found. If @code{key} is not set print all
  23389. metadata values available in frame.
  23390. @end table
  23391. @item key
  23392. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  23393. @item value
  23394. Set metadata value which will be used. This option is mandatory for
  23395. @code{modify} and @code{add} mode.
  23396. @item function
  23397. Which function to use when comparing metadata value and @code{value}.
  23398. Can be one of following:
  23399. @table @samp
  23400. @item same_str
  23401. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  23402. @item starts_with
  23403. Values are interpreted as strings, returns true if metadata value starts with
  23404. the @code{value} option string.
  23405. @item less
  23406. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  23407. @item equal
  23408. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  23409. @item greater
  23410. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  23411. @item expr
  23412. Values are interpreted as floats, returns true if expression from option @code{expr}
  23413. evaluates to true.
  23414. @item ends_with
  23415. Values are interpreted as strings, returns true if metadata value ends with
  23416. the @code{value} option string.
  23417. @end table
  23418. @item expr
  23419. Set expression which is used when @code{function} is set to @code{expr}.
  23420. The expression is evaluated through the eval API and can contain the following
  23421. constants:
  23422. @table @option
  23423. @item VALUE1, FRAMEVAL
  23424. Float representation of @code{value} from metadata key.
  23425. @item VALUE2, USERVAL
  23426. Float representation of @code{value} as supplied by user in @code{value} option.
  23427. @end table
  23428. @item file
  23429. If specified in @code{print} mode, output is written to the named file. Instead of
  23430. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  23431. for standard output. If @code{file} option is not set, output is written to the log
  23432. with AV_LOG_INFO loglevel.
  23433. @item direct
  23434. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  23435. @end table
  23436. @subsection Examples
  23437. @itemize
  23438. @item
  23439. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  23440. between 0 and 1.
  23441. @example
  23442. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  23443. @end example
  23444. @item
  23445. Print silencedetect output to file @file{metadata.txt}.
  23446. @example
  23447. silencedetect,ametadata=mode=print:file=metadata.txt
  23448. @end example
  23449. @item
  23450. Direct all metadata to a pipe with file descriptor 4.
  23451. @example
  23452. metadata=mode=print:file='pipe\:4'
  23453. @end example
  23454. @end itemize
  23455. @section perms, aperms
  23456. Set read/write permissions for the output frames.
  23457. These filters are mainly aimed at developers to test direct path in the
  23458. following filter in the filtergraph.
  23459. The filters accept the following options:
  23460. @table @option
  23461. @item mode
  23462. Select the permissions mode.
  23463. It accepts the following values:
  23464. @table @samp
  23465. @item none
  23466. Do nothing. This is the default.
  23467. @item ro
  23468. Set all the output frames read-only.
  23469. @item rw
  23470. Set all the output frames directly writable.
  23471. @item toggle
  23472. Make the frame read-only if writable, and writable if read-only.
  23473. @item random
  23474. Set each output frame read-only or writable randomly.
  23475. @end table
  23476. @item seed
  23477. Set the seed for the @var{random} mode, must be an integer included between
  23478. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  23479. @code{-1}, the filter will try to use a good random seed on a best effort
  23480. basis.
  23481. @end table
  23482. Note: in case of auto-inserted filter between the permission filter and the
  23483. following one, the permission might not be received as expected in that
  23484. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  23485. perms/aperms filter can avoid this problem.
  23486. @section realtime, arealtime
  23487. Slow down filtering to match real time approximately.
  23488. These filters will pause the filtering for a variable amount of time to
  23489. match the output rate with the input timestamps.
  23490. They are similar to the @option{re} option to @code{ffmpeg}.
  23491. They accept the following options:
  23492. @table @option
  23493. @item limit
  23494. Time limit for the pauses. Any pause longer than that will be considered
  23495. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  23496. @item speed
  23497. Speed factor for processing. The value must be a float larger than zero.
  23498. Values larger than 1.0 will result in faster than realtime processing,
  23499. smaller will slow processing down. The @var{limit} is automatically adapted
  23500. accordingly. Default is 1.0.
  23501. A processing speed faster than what is possible without these filters cannot
  23502. be achieved.
  23503. @end table
  23504. @subsection Commands
  23505. Both filters supports the all above options as @ref{commands}.
  23506. @section segment, asegment
  23507. Split single input stream into multiple streams.
  23508. This filter does opposite of concat filters.
  23509. @code{segment} works on video frames, @code{asegment} on audio samples.
  23510. This filter accepts the following options:
  23511. @table @option
  23512. @item timestamps
  23513. Timestamps of output segments separated by '|'. The first segment will run
  23514. from the beginning of the input stream. The last segment will run until
  23515. the end of the input stream
  23516. @item frames, samples
  23517. Exact frame/sample count to split the segments.
  23518. @end table
  23519. In all cases, prefixing an each segment with '+' will make it relative to the
  23520. previous segment.
  23521. @subsection Examples
  23522. @itemize
  23523. @item
  23524. Split input audio stream into three output audio streams, starting at start of input audio stream
  23525. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  23526. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  23527. @example
  23528. asegment=timestamps="60|150"
  23529. @end example
  23530. @end itemize
  23531. @anchor{select}
  23532. @section select, aselect
  23533. Select frames to pass in output.
  23534. This filter accepts the following options:
  23535. @table @option
  23536. @item expr, e
  23537. Set expression, which is evaluated for each input frame.
  23538. If the expression is evaluated to zero, the frame is discarded.
  23539. If the evaluation result is negative or NaN, the frame is sent to the
  23540. first output; otherwise it is sent to the output with index
  23541. @code{ceil(val)-1}, assuming that the input index starts from 0.
  23542. For example a value of @code{1.2} corresponds to the output with index
  23543. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  23544. @item outputs, n
  23545. Set the number of outputs. The output to which to send the selected
  23546. frame is based on the result of the evaluation. Default value is 1.
  23547. @end table
  23548. The expression can contain the following constants:
  23549. @table @option
  23550. @item n
  23551. The (sequential) number of the filtered frame, starting from 0.
  23552. @item selected_n
  23553. The (sequential) number of the selected frame, starting from 0.
  23554. @item prev_selected_n
  23555. The sequential number of the last selected frame. It's NAN if undefined.
  23556. @item TB
  23557. The timebase of the input timestamps.
  23558. @item pts
  23559. The PTS (Presentation TimeStamp) of the filtered frame,
  23560. expressed in @var{TB} units. It's NAN if undefined.
  23561. @item t
  23562. The PTS of the filtered frame,
  23563. expressed in seconds. It's NAN if undefined.
  23564. @item prev_pts
  23565. The PTS of the previously filtered frame. It's NAN if undefined.
  23566. @item prev_selected_pts
  23567. The PTS of the last previously filtered frame. It's NAN if undefined.
  23568. @item prev_selected_t
  23569. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  23570. @item start_pts
  23571. The first PTS in the stream which is not NAN. It remains NAN if not found.
  23572. @item start_t
  23573. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  23574. @item pict_type @emph{(video only)}
  23575. The type of the filtered frame. It can assume one of the following
  23576. values:
  23577. @table @option
  23578. @item I
  23579. @item P
  23580. @item B
  23581. @item S
  23582. @item SI
  23583. @item SP
  23584. @item BI
  23585. @end table
  23586. @item interlace_type @emph{(video only)}
  23587. The frame interlace type. It can assume one of the following values:
  23588. @table @option
  23589. @item PROGRESSIVE
  23590. The frame is progressive (not interlaced).
  23591. @item TOPFIRST
  23592. The frame is top-field-first.
  23593. @item BOTTOMFIRST
  23594. The frame is bottom-field-first.
  23595. @end table
  23596. @item consumed_sample_n @emph{(audio only)}
  23597. the number of selected samples before the current frame
  23598. @item samples_n @emph{(audio only)}
  23599. the number of samples in the current frame
  23600. @item sample_rate @emph{(audio only)}
  23601. the input sample rate
  23602. @item key
  23603. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  23604. @item pos
  23605. the position in the file of the filtered frame, -1 if the information
  23606. is not available (e.g. for synthetic video); deprecated, do not use
  23607. @item scene @emph{(video only)}
  23608. value between 0 and 1 to indicate a new scene; a low value reflects a low
  23609. probability for the current frame to introduce a new scene, while a higher
  23610. value means the current frame is more likely to be one (see the example below)
  23611. @item concatdec_select
  23612. The concat demuxer can select only part of a concat input file by setting an
  23613. inpoint and an outpoint, but the output packets may not be entirely contained
  23614. in the selected interval. By using this variable, it is possible to skip frames
  23615. generated by the concat demuxer which are not exactly contained in the selected
  23616. interval.
  23617. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  23618. and the @var{lavf.concat.duration} packet metadata values which are also
  23619. present in the decoded frames.
  23620. The @var{concatdec_select} variable is -1 if the frame pts is at least
  23621. start_time and either the duration metadata is missing or the frame pts is less
  23622. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  23623. missing.
  23624. That basically means that an input frame is selected if its pts is within the
  23625. interval set by the concat demuxer.
  23626. @item iw @emph{(video only)}
  23627. Represents the width of the input video frame.
  23628. @item ih @emph{(video only)}
  23629. Represents the height of the input video frame.
  23630. @item view @emph{(video only)}
  23631. View ID for multi-view video.
  23632. @end table
  23633. The default value of the select expression is "1".
  23634. @subsection Examples
  23635. @itemize
  23636. @item
  23637. Select all frames in input:
  23638. @example
  23639. select
  23640. @end example
  23641. The example above is the same as:
  23642. @example
  23643. select=1
  23644. @end example
  23645. @item
  23646. Skip all frames:
  23647. @example
  23648. select=0
  23649. @end example
  23650. @item
  23651. Select only I-frames:
  23652. @example
  23653. select='eq(pict_type\,I)'
  23654. @end example
  23655. @item
  23656. Select one frame every 100:
  23657. @example
  23658. select='not(mod(n\,100))'
  23659. @end example
  23660. @item
  23661. Select only frames contained in the 10-20 time interval:
  23662. @example
  23663. select=between(t\,10\,20)
  23664. @end example
  23665. @item
  23666. Select only I-frames contained in the 10-20 time interval:
  23667. @example
  23668. select=between(t\,10\,20)*eq(pict_type\,I)
  23669. @end example
  23670. @item
  23671. Select frames with a minimum distance of 10 seconds:
  23672. @example
  23673. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  23674. @end example
  23675. @item
  23676. Use aselect to select only audio frames with samples number > 100:
  23677. @example
  23678. aselect='gt(samples_n\,100)'
  23679. @end example
  23680. @item
  23681. Create a mosaic of the first scenes:
  23682. @example
  23683. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  23684. @end example
  23685. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  23686. choice.
  23687. @item
  23688. Send even and odd frames to separate outputs, and compose them:
  23689. @example
  23690. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  23691. @end example
  23692. @item
  23693. Select useful frames from an ffconcat file which is using inpoints and
  23694. outpoints but where the source files are not intra frame only.
  23695. @example
  23696. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  23697. @end example
  23698. @end itemize
  23699. @section sendcmd, asendcmd
  23700. Send commands to filters in the filtergraph.
  23701. These filters read commands to be sent to other filters in the
  23702. filtergraph.
  23703. @code{sendcmd} must be inserted between two video filters,
  23704. @code{asendcmd} must be inserted between two audio filters, but apart
  23705. from that they act the same way.
  23706. The specification of commands can be provided in the filter arguments
  23707. with the @var{commands} option, or in a file specified by the
  23708. @var{filename} option.
  23709. These filters accept the following options:
  23710. @table @option
  23711. @item commands, c
  23712. Set the commands to be read and sent to the other filters.
  23713. @item filename, f
  23714. Set the filename of the commands to be read and sent to the other
  23715. filters.
  23716. @end table
  23717. @subsection Commands syntax
  23718. A commands description consists of a sequence of interval
  23719. specifications, comprising a list of commands to be executed when a
  23720. particular event related to that interval occurs. The occurring event
  23721. is typically the current frame time entering or leaving a given time
  23722. interval.
  23723. An interval is specified by the following syntax:
  23724. @example
  23725. @var{START}[-@var{END}] @var{COMMANDS};
  23726. @end example
  23727. The time interval is specified by the @var{START} and @var{END} times.
  23728. @var{END} is optional and defaults to the maximum time.
  23729. The current frame time is considered within the specified interval if
  23730. it is included in the interval [@var{START}, @var{END}), that is when
  23731. the time is greater or equal to @var{START} and is lesser than
  23732. @var{END}.
  23733. @var{COMMANDS} consists of a sequence of one or more command
  23734. specifications, separated by ",", relating to that interval. The
  23735. syntax of a command specification is given by:
  23736. @example
  23737. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  23738. @end example
  23739. @var{FLAGS} is optional and specifies the type of events relating to
  23740. the time interval which enable sending the specified command, and must
  23741. be a non-null sequence of identifier flags separated by "+" or "|" and
  23742. enclosed between "[" and "]".
  23743. The following flags are recognized:
  23744. @table @option
  23745. @item enter
  23746. The command is sent when the current frame timestamp enters the
  23747. specified interval. In other words, the command is sent when the
  23748. previous frame timestamp was not in the given interval, and the
  23749. current is.
  23750. @item leave
  23751. The command is sent when the current frame timestamp leaves the
  23752. specified interval. In other words, the command is sent when the
  23753. previous frame timestamp was in the given interval, and the
  23754. current is not.
  23755. @item expr
  23756. The command @var{ARG} is interpreted as expression and result of
  23757. expression is passed as @var{ARG}.
  23758. The expression is evaluated through the eval API and can contain the following
  23759. constants:
  23760. @table @option
  23761. @item POS
  23762. Original position in the file of the frame, or undefined if undefined
  23763. for the current frame. Deprecated, do not use.
  23764. @item PTS
  23765. The presentation timestamp in input.
  23766. @item N
  23767. The count of the input frame for video or audio, starting from 0.
  23768. @item T
  23769. The time in seconds of the current frame.
  23770. @item TS
  23771. The start time in seconds of the current command interval.
  23772. @item TE
  23773. The end time in seconds of the current command interval.
  23774. @item TI
  23775. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  23776. @item W
  23777. The video frame width.
  23778. @item H
  23779. The video frame height.
  23780. @end table
  23781. @end table
  23782. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  23783. assumed.
  23784. @var{TARGET} specifies the target of the command, usually the name of
  23785. the filter class or a specific filter instance name.
  23786. @var{COMMAND} specifies the name of the command for the target filter.
  23787. @var{ARG} is optional and specifies the optional list of argument for
  23788. the given @var{COMMAND}.
  23789. Between one interval specification and another, whitespaces, or
  23790. sequences of characters starting with @code{#} until the end of line,
  23791. are ignored and can be used to annotate comments.
  23792. A simplified BNF description of the commands specification syntax
  23793. follows:
  23794. @example
  23795. @var{COMMAND_FLAG} ::= "enter" | "leave"
  23796. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  23797. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  23798. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  23799. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  23800. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  23801. @end example
  23802. @subsection Examples
  23803. @itemize
  23804. @item
  23805. Specify audio tempo change at second 4:
  23806. @example
  23807. asendcmd=c='4.0 atempo tempo 1.5',atempo
  23808. @end example
  23809. @item
  23810. Target a specific filter instance:
  23811. @example
  23812. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  23813. @end example
  23814. @item
  23815. Specify a list of drawtext and hue commands in a file.
  23816. @example
  23817. # show text in the interval 5-10
  23818. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  23819. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  23820. # desaturate the image in the interval 15-20
  23821. 15.0-20.0 [enter] hue s 0,
  23822. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  23823. [leave] hue s 1,
  23824. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  23825. # apply an exponential saturation fade-out effect, starting from time 25
  23826. 25 [enter] hue s exp(25-t)
  23827. @end example
  23828. A filtergraph allowing to read and process the above command list
  23829. stored in a file @file{test.cmd}, can be specified with:
  23830. @example
  23831. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  23832. @end example
  23833. @end itemize
  23834. @anchor{setpts}
  23835. @section setpts, asetpts
  23836. Change the PTS (presentation timestamp) of the input frames.
  23837. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  23838. This filter accepts the following options:
  23839. @table @option
  23840. @item expr
  23841. The expression which is evaluated for each frame to construct its timestamp.
  23842. @end table
  23843. The expression is evaluated through the eval API and can contain the following
  23844. constants:
  23845. @table @option
  23846. @item FRAME_RATE, FR
  23847. frame rate, only defined for constant frame-rate video
  23848. @item PTS
  23849. The presentation timestamp in input
  23850. @item N
  23851. The count of the input frame for video or the number of consumed samples,
  23852. not including the current frame for audio, starting from 0.
  23853. @item NB_CONSUMED_SAMPLES
  23854. The number of consumed samples, not including the current frame (only
  23855. audio)
  23856. @item NB_SAMPLES, S
  23857. The number of samples in the current frame (only audio)
  23858. @item SAMPLE_RATE, SR
  23859. The audio sample rate.
  23860. @item STARTPTS
  23861. The PTS of the first frame.
  23862. @item STARTT
  23863. the time in seconds of the first frame
  23864. @item INTERLACED
  23865. State whether the current frame is interlaced.
  23866. @item T
  23867. the time in seconds of the current frame
  23868. @item POS
  23869. original position in the file of the frame, or undefined if undefined
  23870. for the current frame; deprecated, do not use
  23871. @item PREV_INPTS
  23872. The previous input PTS.
  23873. @item PREV_INT
  23874. previous input time in seconds
  23875. @item PREV_OUTPTS
  23876. The previous output PTS.
  23877. @item PREV_OUTT
  23878. previous output time in seconds
  23879. @item RTCTIME
  23880. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  23881. instead.
  23882. @item RTCSTART
  23883. The wallclock (RTC) time at the start of the movie in microseconds.
  23884. @item TB
  23885. The timebase of the input timestamps.
  23886. @item T_CHANGE
  23887. Time of the first frame after command was applied or time of the first frame if no commands.
  23888. @end table
  23889. @subsection Examples
  23890. @itemize
  23891. @item
  23892. Start counting PTS from zero
  23893. @example
  23894. setpts=PTS-STARTPTS
  23895. @end example
  23896. @item
  23897. Apply fast motion effect:
  23898. @example
  23899. setpts=0.5*PTS
  23900. @end example
  23901. @item
  23902. Apply slow motion effect:
  23903. @example
  23904. setpts=2.0*PTS
  23905. @end example
  23906. @item
  23907. Set fixed rate of 25 frames per second:
  23908. @example
  23909. setpts=N/(25*TB)
  23910. @end example
  23911. @item
  23912. Apply a random jitter effect of +/-100 TB units:
  23913. @example
  23914. setpts=PTS+randomi(0, -100\,100)
  23915. @end example
  23916. @item
  23917. Set fixed rate 25 fps with some jitter:
  23918. @example
  23919. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  23920. @end example
  23921. @item
  23922. Apply an offset of 10 seconds to the input PTS:
  23923. @example
  23924. setpts=PTS+10/TB
  23925. @end example
  23926. @item
  23927. Generate timestamps from a "live source" and rebase onto the current timebase:
  23928. @example
  23929. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  23930. @end example
  23931. @item
  23932. Generate timestamps by counting samples:
  23933. @example
  23934. asetpts=N/SR/TB
  23935. @end example
  23936. @end itemize
  23937. @subsection Commands
  23938. Both filters support all above options as @ref{commands}.
  23939. @section setrange
  23940. Force color range for the output video frame.
  23941. The @code{setrange} filter marks the color range property for the
  23942. output frames. It does not change the input frame, but only sets the
  23943. corresponding property, which affects how the frame is treated by
  23944. following filters.
  23945. The filter accepts the following options:
  23946. @table @option
  23947. @item range
  23948. Available values are:
  23949. @table @samp
  23950. @item auto
  23951. Keep the same color range property.
  23952. @item unspecified, unknown
  23953. Set the color range as unspecified.
  23954. @item limited, tv, mpeg
  23955. Set the color range as limited.
  23956. @item full, pc, jpeg
  23957. Set the color range as full.
  23958. @end table
  23959. @end table
  23960. @section settb, asettb
  23961. Set the timebase to use for the output frames timestamps.
  23962. It is mainly useful for testing timebase configuration.
  23963. It accepts the following parameters:
  23964. @table @option
  23965. @item expr, tb
  23966. The expression which is evaluated into the output timebase.
  23967. @end table
  23968. The value for @option{tb} is an arithmetic expression representing a
  23969. rational. The expression can contain the constants "AVTB" (the default
  23970. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  23971. audio only). Default value is "intb".
  23972. @subsection Examples
  23973. @itemize
  23974. @item
  23975. Set the timebase to 1/25:
  23976. @example
  23977. settb=expr=1/25
  23978. @end example
  23979. @item
  23980. Set the timebase to 1/10:
  23981. @example
  23982. settb=expr=0.1
  23983. @end example
  23984. @item
  23985. Set the timebase to 1001/1000:
  23986. @example
  23987. settb=1+0.001
  23988. @end example
  23989. @item
  23990. Set the timebase to 2*intb:
  23991. @example
  23992. settb=2*intb
  23993. @end example
  23994. @item
  23995. Set the default timebase value:
  23996. @example
  23997. settb=AVTB
  23998. @end example
  23999. @end itemize
  24000. @section showcqt
  24001. Convert input audio to a video output representing frequency spectrum
  24002. logarithmically using Brown-Puckette constant Q transform algorithm with
  24003. direct frequency domain coefficient calculation (but the transform itself
  24004. is not really constant Q, instead the Q factor is actually variable/clamped),
  24005. with musical tone scale, from E0 to D#10.
  24006. The filter accepts the following options:
  24007. @table @option
  24008. @item size, s
  24009. Specify the video size for the output. It must be even. For the syntax of this option,
  24010. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24011. Default value is @code{1920x1080}.
  24012. @item fps, rate, r
  24013. Set the output frame rate. Default value is @code{25}.
  24014. @item bar_h
  24015. Set the bargraph height. It must be even. Default value is @code{-1} which
  24016. computes the bargraph height automatically.
  24017. @item axis_h
  24018. Set the axis height. It must be even. Default value is @code{-1} which computes
  24019. the axis height automatically.
  24020. @item sono_h
  24021. Set the sonogram height. It must be even. Default value is @code{-1} which
  24022. computes the sonogram height automatically.
  24023. @item fullhd
  24024. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  24025. instead. Default value is @code{1}.
  24026. @item sono_v, volume
  24027. Specify the sonogram volume expression. It can contain variables:
  24028. @table @option
  24029. @item bar_v
  24030. the @var{bar_v} evaluated expression
  24031. @item frequency, freq, f
  24032. the frequency where it is evaluated
  24033. @item timeclamp, tc
  24034. the value of @var{timeclamp} option
  24035. @end table
  24036. and functions:
  24037. @table @option
  24038. @item a_weighting(f)
  24039. A-weighting of equal loudness
  24040. @item b_weighting(f)
  24041. B-weighting of equal loudness
  24042. @item c_weighting(f)
  24043. C-weighting of equal loudness.
  24044. @end table
  24045. Default value is @code{16}.
  24046. @item bar_v, volume2
  24047. Specify the bargraph volume expression. It can contain variables:
  24048. @table @option
  24049. @item sono_v
  24050. the @var{sono_v} evaluated expression
  24051. @item frequency, freq, f
  24052. the frequency where it is evaluated
  24053. @item timeclamp, tc
  24054. the value of @var{timeclamp} option
  24055. @end table
  24056. and functions:
  24057. @table @option
  24058. @item a_weighting(f)
  24059. A-weighting of equal loudness
  24060. @item b_weighting(f)
  24061. B-weighting of equal loudness
  24062. @item c_weighting(f)
  24063. C-weighting of equal loudness.
  24064. @end table
  24065. Default value is @code{sono_v}.
  24066. @item sono_g, gamma
  24067. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  24068. higher gamma makes the spectrum having more range. Default value is @code{3}.
  24069. Acceptable range is @code{[1, 7]}.
  24070. @item bar_g, gamma2
  24071. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  24072. @code{[1, 7]}.
  24073. @item bar_t
  24074. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  24075. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  24076. @item timeclamp, tc
  24077. Specify the transform timeclamp. At low frequency, there is trade-off between
  24078. accuracy in time domain and frequency domain. If timeclamp is lower,
  24079. event in time domain is represented more accurately (such as fast bass drum),
  24080. otherwise event in frequency domain is represented more accurately
  24081. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  24082. @item attack
  24083. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  24084. limits future samples by applying asymmetric windowing in time domain, useful
  24085. when low latency is required. Accepted range is @code{[0, 1]}.
  24086. @item basefreq
  24087. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  24088. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  24089. @item endfreq
  24090. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  24091. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  24092. @item coeffclamp
  24093. This option is deprecated and ignored.
  24094. @item tlength
  24095. Specify the transform length in time domain. Use this option to control accuracy
  24096. trade-off between time domain and frequency domain at every frequency sample.
  24097. It can contain variables:
  24098. @table @option
  24099. @item frequency, freq, f
  24100. the frequency where it is evaluated
  24101. @item timeclamp, tc
  24102. the value of @var{timeclamp} option.
  24103. @end table
  24104. Default value is @code{384*tc/(384+tc*f)}.
  24105. @item count
  24106. Specify the transform count for every video frame. Default value is @code{6}.
  24107. Acceptable range is @code{[1, 30]}.
  24108. @item fcount
  24109. Specify the transform count for every single pixel. Default value is @code{0},
  24110. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  24111. @item fontfile
  24112. Specify font file for use with freetype to draw the axis. If not specified,
  24113. use embedded font. Note that drawing with font file or embedded font is not
  24114. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  24115. option instead.
  24116. @item font
  24117. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  24118. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  24119. escaping.
  24120. @item fontcolor
  24121. Specify font color expression. This is arithmetic expression that should return
  24122. integer value 0xRRGGBB. It can contain variables:
  24123. @table @option
  24124. @item frequency, freq, f
  24125. the frequency where it is evaluated
  24126. @item timeclamp, tc
  24127. the value of @var{timeclamp} option
  24128. @end table
  24129. and functions:
  24130. @table @option
  24131. @item midi(f)
  24132. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  24133. @item r(x), g(x), b(x)
  24134. red, green, and blue value of intensity x.
  24135. @end table
  24136. Default value is @code{st(0, (midi(f)-59.5)/12);
  24137. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  24138. r(1-ld(1)) + b(ld(1))}.
  24139. @item axisfile
  24140. Specify image file to draw the axis. This option override @var{fontfile} and
  24141. @var{fontcolor} option.
  24142. @item axis, text
  24143. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  24144. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  24145. Default value is @code{1}.
  24146. @item csp
  24147. Set colorspace. The accepted values are:
  24148. @table @samp
  24149. @item unspecified
  24150. Unspecified (default)
  24151. @item bt709
  24152. BT.709
  24153. @item fcc
  24154. FCC
  24155. @item bt470bg
  24156. BT.470BG or BT.601-6 625
  24157. @item smpte170m
  24158. SMPTE-170M or BT.601-6 525
  24159. @item smpte240m
  24160. SMPTE-240M
  24161. @item bt2020ncl
  24162. BT.2020 with non-constant luminance
  24163. @end table
  24164. @item cscheme
  24165. Set spectrogram color scheme. This is list of floating point values with format
  24166. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  24167. The default is @code{1|0.5|0|0|0.5|1}.
  24168. @end table
  24169. @subsection Examples
  24170. @itemize
  24171. @item
  24172. Playing audio while showing the spectrum:
  24173. @example
  24174. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  24175. @end example
  24176. @item
  24177. Same as above, but with frame rate 30 fps:
  24178. @example
  24179. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  24180. @end example
  24181. @item
  24182. Playing at 1280x720:
  24183. @example
  24184. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  24185. @end example
  24186. @item
  24187. Disable sonogram display:
  24188. @example
  24189. sono_h=0
  24190. @end example
  24191. @item
  24192. A1 and its harmonics: A1, A2, (near)E3, A3:
  24193. @example
  24194. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  24195. asplit[a][out1]; [a] showcqt [out0]'
  24196. @end example
  24197. @item
  24198. Same as above, but with more accuracy in frequency domain:
  24199. @example
  24200. ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
  24201. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  24202. @end example
  24203. @item
  24204. Custom volume:
  24205. @example
  24206. bar_v=10:sono_v=bar_v*a_weighting(f)
  24207. @end example
  24208. @item
  24209. Custom gamma, now spectrum is linear to the amplitude.
  24210. @example
  24211. bar_g=2:sono_g=2
  24212. @end example
  24213. @item
  24214. Custom tlength equation:
  24215. @example
  24216. tc=0.33:tlength='st(0,0.17); 384*tc / (384 / ld(0) + tc*f /(1-ld(0))) + 384*tc / (tc*f / ld(0) + 384 /(1-ld(0)))'
  24217. @end example
  24218. @item
  24219. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  24220. @example
  24221. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  24222. @end example
  24223. @item
  24224. Custom font using fontconfig:
  24225. @example
  24226. font='Courier New,Monospace,mono|bold'
  24227. @end example
  24228. @item
  24229. Custom frequency range with custom axis using image file:
  24230. @example
  24231. axisfile=myaxis.png:basefreq=40:endfreq=10000
  24232. @end example
  24233. @end itemize
  24234. @section showcwt
  24235. Convert input audio to video output representing frequency spectrum
  24236. using Continuous Wavelet Transform and Morlet wavelet.
  24237. The filter accepts the following options:
  24238. @table @option
  24239. @item size, s
  24240. Specify the video size for the output. For the syntax of this option,
  24241. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24242. Default value is @code{640x512}.
  24243. @item rate, r
  24244. Set the output frame rate. Default value is @code{25}.
  24245. @item scale
  24246. Set the frequency scale used. Allowed values are:
  24247. @table @option
  24248. @item linear
  24249. @item log
  24250. @item bark
  24251. @item mel
  24252. @item erbs
  24253. @item sqrt
  24254. @item cbrt
  24255. @item qdrt
  24256. @item fm
  24257. @end table
  24258. Default value is @code{linear}.
  24259. @item iscale
  24260. Set the intensity scale used. Allowed values are:
  24261. @table @option
  24262. @item linear
  24263. @item log
  24264. @item sqrt
  24265. @item cbrt
  24266. @item qdrt
  24267. @end table
  24268. Default value is @code{log}.
  24269. @item min
  24270. Set the minimum frequency that will be used in output.
  24271. Default is @code{20} Hz.
  24272. @item max
  24273. Set the maximum frequency that will be used in output.
  24274. Default is @code{20000} Hz. The real frequency upper limit
  24275. depends on input audio's sample rate and such will be enforced
  24276. on this value when it is set to value greater than Nyquist frequency.
  24277. @item imin
  24278. Set the minimum intensity that will be used in output.
  24279. @item imax
  24280. Set the maximum intensity that will be used in output.
  24281. @item logb
  24282. Set the logarithmic basis for brightness strength when
  24283. mapping calculated magnitude values to pixel values.
  24284. Allowed range is from @code{0} to @code{1}.
  24285. Default value is @code{0.0001}.
  24286. @item deviation
  24287. Set the frequency deviation.
  24288. Lower values than @code{1} are more frequency oriented,
  24289. while higher values than @code{1} are more time oriented.
  24290. Allowed range is from @code{0} to @code{10}.
  24291. Default value is @code{1}.
  24292. @item pps
  24293. Set the number of pixel output per each second in one row.
  24294. Allowed range is from @code{1} to @code{1024}.
  24295. Default value is @code{64}.
  24296. @item mode
  24297. Set the output visual mode. Allowed values are:
  24298. @table @option
  24299. @item magnitude
  24300. Show magnitude.
  24301. @item phase
  24302. Show only phase.
  24303. @item magphase
  24304. Show combination of magnitude and phase.
  24305. Magnitude is mapped to brightness and phase to color.
  24306. @item channel
  24307. Show unique color per channel magnitude.
  24308. @item stereo
  24309. Show unique color per stereo difference.
  24310. @end table
  24311. Default value is @code{magnitude}.
  24312. @item slide
  24313. Set the output slide method. Allowed values are:
  24314. @table @option
  24315. @item replace
  24316. @item scroll
  24317. @item frame
  24318. @end table
  24319. @item direction
  24320. Set the direction method for output slide method. Allowed values are:
  24321. @table @option
  24322. @item lr
  24323. Direction from left to right.
  24324. @item rl
  24325. Direction from right to left.
  24326. @item ud
  24327. Direction from up to down.
  24328. @item du
  24329. Direction from down to up.
  24330. @end table
  24331. @item bar
  24332. Set the ratio of bargraph display to display size. Default is 0.
  24333. @item rotation
  24334. Set color rotation, must be in [-1.0, 1.0] range.
  24335. Default value is @code{0}.
  24336. @end table
  24337. @section showfreqs
  24338. Convert input audio to video output representing the audio power spectrum.
  24339. Audio amplitude is on Y-axis while frequency is on X-axis.
  24340. The filter accepts the following options:
  24341. @table @option
  24342. @item size, s
  24343. Specify size of video. For the syntax of this option, check the
  24344. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24345. Default is @code{1024x512}.
  24346. @item rate, r
  24347. Set video rate. Default is @code{25}.
  24348. @item mode
  24349. Set display mode.
  24350. This set how each frequency bin will be represented.
  24351. It accepts the following values:
  24352. @table @samp
  24353. @item line
  24354. @item bar
  24355. @item dot
  24356. @end table
  24357. Default is @code{bar}.
  24358. @item ascale
  24359. Set amplitude scale.
  24360. It accepts the following values:
  24361. @table @samp
  24362. @item lin
  24363. Linear scale.
  24364. @item sqrt
  24365. Square root scale.
  24366. @item cbrt
  24367. Cubic root scale.
  24368. @item log
  24369. Logarithmic scale.
  24370. @end table
  24371. Default is @code{log}.
  24372. @item fscale
  24373. Set frequency scale.
  24374. It accepts the following values:
  24375. @table @samp
  24376. @item lin
  24377. Linear scale.
  24378. @item log
  24379. Logarithmic scale.
  24380. @item rlog
  24381. Reverse logarithmic scale.
  24382. @end table
  24383. Default is @code{lin}.
  24384. @item win_size
  24385. Set window size. Allowed range is from 16 to 65536.
  24386. Default is @code{2048}
  24387. @item win_func
  24388. Set windowing function.
  24389. It accepts the following values:
  24390. @table @samp
  24391. @item rect
  24392. @item bartlett
  24393. @item hanning
  24394. @item hamming
  24395. @item blackman
  24396. @item welch
  24397. @item flattop
  24398. @item bharris
  24399. @item bnuttall
  24400. @item bhann
  24401. @item sine
  24402. @item nuttall
  24403. @item lanczos
  24404. @item gauss
  24405. @item tukey
  24406. @item dolph
  24407. @item cauchy
  24408. @item parzen
  24409. @item poisson
  24410. @item bohman
  24411. @item kaiser
  24412. @end table
  24413. Default is @code{hanning}.
  24414. @item overlap
  24415. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  24416. which means optimal overlap for selected window function will be picked.
  24417. @item averaging
  24418. Set time averaging. Setting this to 0 will display current maximal peaks.
  24419. Default is @code{1}, which means time averaging is disabled.
  24420. @item colors
  24421. Specify list of colors separated by space or by '|' which will be used to
  24422. draw channel frequencies. Unrecognized or missing colors will be replaced
  24423. by white color.
  24424. @item cmode
  24425. Set channel display mode.
  24426. It accepts the following values:
  24427. @table @samp
  24428. @item combined
  24429. @item separate
  24430. @end table
  24431. Default is @code{combined}.
  24432. @item minamp
  24433. Set minimum amplitude used in @code{log} amplitude scaler.
  24434. @item data
  24435. Set data display mode.
  24436. It accepts the following values:
  24437. @table @samp
  24438. @item magnitude
  24439. @item phase
  24440. @item delay
  24441. @end table
  24442. Default is @code{magnitude}.
  24443. @item channels
  24444. Set channels to use when processing audio. By default all are processed.
  24445. @end table
  24446. @section showspatial
  24447. Convert stereo input audio to a video output, representing the spatial relationship
  24448. between two channels.
  24449. The filter accepts the following options:
  24450. @table @option
  24451. @item size, s
  24452. Specify the video size for the output. For the syntax of this option, check the
  24453. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24454. Default value is @code{512x512}.
  24455. @item win_size
  24456. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  24457. @item win_func
  24458. Set window function.
  24459. It accepts the following values:
  24460. @table @samp
  24461. @item rect
  24462. @item bartlett
  24463. @item hann
  24464. @item hanning
  24465. @item hamming
  24466. @item blackman
  24467. @item welch
  24468. @item flattop
  24469. @item bharris
  24470. @item bnuttall
  24471. @item bhann
  24472. @item sine
  24473. @item nuttall
  24474. @item lanczos
  24475. @item gauss
  24476. @item tukey
  24477. @item dolph
  24478. @item cauchy
  24479. @item parzen
  24480. @item poisson
  24481. @item bohman
  24482. @item kaiser
  24483. @end table
  24484. Default value is @code{hann}.
  24485. @item rate, r
  24486. Set output framerate.
  24487. @end table
  24488. @anchor{showspectrum}
  24489. @section showspectrum
  24490. Convert input audio to a video output, representing the audio frequency
  24491. spectrum.
  24492. The filter accepts the following options:
  24493. @table @option
  24494. @item size, s
  24495. Specify the video size for the output. For the syntax of this option, check the
  24496. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24497. Default value is @code{640x512}.
  24498. @item slide
  24499. Specify how the spectrum should slide along the window.
  24500. It accepts the following values:
  24501. @table @samp
  24502. @item replace
  24503. the samples start again on the left when they reach the right
  24504. @item scroll
  24505. the samples scroll from right to left
  24506. @item fullframe
  24507. frames are only produced when the samples reach the right
  24508. @item rscroll
  24509. the samples scroll from left to right
  24510. @item lreplace
  24511. the samples start again on the right when they reach the left
  24512. @end table
  24513. Default value is @code{replace}.
  24514. @item mode
  24515. Specify display mode.
  24516. It accepts the following values:
  24517. @table @samp
  24518. @item combined
  24519. all channels are displayed in the same row
  24520. @item separate
  24521. all channels are displayed in separate rows
  24522. @end table
  24523. Default value is @samp{combined}.
  24524. @item color
  24525. Specify display color mode.
  24526. It accepts the following values:
  24527. @table @samp
  24528. @item channel
  24529. each channel is displayed in a separate color
  24530. @item intensity
  24531. each channel is displayed using the same color scheme
  24532. @item rainbow
  24533. each channel is displayed using the rainbow color scheme
  24534. @item moreland
  24535. each channel is displayed using the moreland color scheme
  24536. @item nebulae
  24537. each channel is displayed using the nebulae color scheme
  24538. @item fire
  24539. each channel is displayed using the fire color scheme
  24540. @item fiery
  24541. each channel is displayed using the fiery color scheme
  24542. @item fruit
  24543. each channel is displayed using the fruit color scheme
  24544. @item cool
  24545. each channel is displayed using the cool color scheme
  24546. @item magma
  24547. each channel is displayed using the magma color scheme
  24548. @item green
  24549. each channel is displayed using the green color scheme
  24550. @item viridis
  24551. each channel is displayed using the viridis color scheme
  24552. @item plasma
  24553. each channel is displayed using the plasma color scheme
  24554. @item cividis
  24555. each channel is displayed using the cividis color scheme
  24556. @item terrain
  24557. each channel is displayed using the terrain color scheme
  24558. @end table
  24559. Default value is @samp{channel}.
  24560. @item scale
  24561. Specify scale used for calculating intensity color values.
  24562. It accepts the following values:
  24563. @table @samp
  24564. @item lin
  24565. linear
  24566. @item sqrt
  24567. square root, default
  24568. @item cbrt
  24569. cubic root
  24570. @item log
  24571. logarithmic
  24572. @item 4thrt
  24573. 4th root
  24574. @item 5thrt
  24575. 5th root
  24576. @end table
  24577. Default value is @samp{sqrt}.
  24578. @item fscale
  24579. Specify frequency scale.
  24580. It accepts the following values:
  24581. @table @samp
  24582. @item lin
  24583. linear
  24584. @item log
  24585. logarithmic
  24586. @end table
  24587. Default value is @samp{lin}.
  24588. @item saturation
  24589. Set saturation modifier for displayed colors. Negative values provide
  24590. alternative color scheme. @code{0} is no saturation at all.
  24591. Saturation must be in [-10.0, 10.0] range.
  24592. Default value is @code{1}.
  24593. @item win_func
  24594. Set window function.
  24595. It accepts the following values:
  24596. @table @samp
  24597. @item rect
  24598. @item bartlett
  24599. @item hann
  24600. @item hanning
  24601. @item hamming
  24602. @item blackman
  24603. @item welch
  24604. @item flattop
  24605. @item bharris
  24606. @item bnuttall
  24607. @item bhann
  24608. @item sine
  24609. @item nuttall
  24610. @item lanczos
  24611. @item gauss
  24612. @item tukey
  24613. @item dolph
  24614. @item cauchy
  24615. @item parzen
  24616. @item poisson
  24617. @item bohman
  24618. @item kaiser
  24619. @end table
  24620. Default value is @code{hann}.
  24621. @item orientation
  24622. Set orientation of time vs frequency axis. Can be @code{vertical} or
  24623. @code{horizontal}. Default is @code{vertical}.
  24624. @item overlap
  24625. Set ratio of overlap window. Default value is @code{0}.
  24626. When value is @code{1} overlap is set to recommended size for specific
  24627. window function currently used.
  24628. @item gain
  24629. Set scale gain for calculating intensity color values.
  24630. Default value is @code{1}.
  24631. @item data
  24632. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  24633. or unwrapped phase: @code{uphase}.
  24634. @item rotation
  24635. Set color rotation, must be in [-1.0, 1.0] range.
  24636. Default value is @code{0}.
  24637. @item start
  24638. Set start frequency from which to display spectrogram. Default is @code{0}.
  24639. @item stop
  24640. Set stop frequency to which to display spectrogram. Default is @code{0}.
  24641. @item fps
  24642. Set upper frame rate limit. Default is @code{auto}, unlimited.
  24643. @item legend
  24644. Draw time and frequency axes and legends. Default is disabled.
  24645. @item drange
  24646. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  24647. Allowed range is from 10 to 200.
  24648. @item limit
  24649. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  24650. Allowed range is from -100 to 100.
  24651. @item opacity
  24652. Set opacity strength when using pixel format output with alpha component.
  24653. @end table
  24654. The usage is very similar to the showwaves filter; see the examples in that
  24655. section.
  24656. @subsection Examples
  24657. @itemize
  24658. @item
  24659. Large window with logarithmic color scaling:
  24660. @example
  24661. showspectrum=s=1280x480:scale=log
  24662. @end example
  24663. @item
  24664. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  24665. @example
  24666. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  24667. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  24668. @end example
  24669. @end itemize
  24670. @section showspectrumpic
  24671. Convert input audio to a single video frame, representing the audio frequency
  24672. spectrum.
  24673. The filter accepts the following options:
  24674. @table @option
  24675. @item size, s
  24676. Specify the video size for the output. For the syntax of this option, check the
  24677. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24678. Default value is @code{4096x2048}.
  24679. @item mode
  24680. Specify display mode.
  24681. It accepts the following values:
  24682. @table @samp
  24683. @item combined
  24684. all channels are displayed in the same row
  24685. @item separate
  24686. all channels are displayed in separate rows
  24687. @end table
  24688. Default value is @samp{combined}.
  24689. @item color
  24690. Specify display color mode.
  24691. It accepts the following values:
  24692. @table @samp
  24693. @item channel
  24694. each channel is displayed in a separate color
  24695. @item intensity
  24696. each channel is displayed using the same color scheme
  24697. @item rainbow
  24698. each channel is displayed using the rainbow color scheme
  24699. @item moreland
  24700. each channel is displayed using the moreland color scheme
  24701. @item nebulae
  24702. each channel is displayed using the nebulae color scheme
  24703. @item fire
  24704. each channel is displayed using the fire color scheme
  24705. @item fiery
  24706. each channel is displayed using the fiery color scheme
  24707. @item fruit
  24708. each channel is displayed using the fruit color scheme
  24709. @item cool
  24710. each channel is displayed using the cool color scheme
  24711. @item magma
  24712. each channel is displayed using the magma color scheme
  24713. @item green
  24714. each channel is displayed using the green color scheme
  24715. @item viridis
  24716. each channel is displayed using the viridis color scheme
  24717. @item plasma
  24718. each channel is displayed using the plasma color scheme
  24719. @item cividis
  24720. each channel is displayed using the cividis color scheme
  24721. @item terrain
  24722. each channel is displayed using the terrain color scheme
  24723. @end table
  24724. Default value is @samp{intensity}.
  24725. @item scale
  24726. Specify scale used for calculating intensity color values.
  24727. It accepts the following values:
  24728. @table @samp
  24729. @item lin
  24730. linear
  24731. @item sqrt
  24732. square root, default
  24733. @item cbrt
  24734. cubic root
  24735. @item log
  24736. logarithmic
  24737. @item 4thrt
  24738. 4th root
  24739. @item 5thrt
  24740. 5th root
  24741. @end table
  24742. Default value is @samp{log}.
  24743. @item fscale
  24744. Specify frequency scale.
  24745. It accepts the following values:
  24746. @table @samp
  24747. @item lin
  24748. linear
  24749. @item log
  24750. logarithmic
  24751. @end table
  24752. Default value is @samp{lin}.
  24753. @item saturation
  24754. Set saturation modifier for displayed colors. Negative values provide
  24755. alternative color scheme. @code{0} is no saturation at all.
  24756. Saturation must be in [-10.0, 10.0] range.
  24757. Default value is @code{1}.
  24758. @item win_func
  24759. Set window function.
  24760. It accepts the following values:
  24761. @table @samp
  24762. @item rect
  24763. @item bartlett
  24764. @item hann
  24765. @item hanning
  24766. @item hamming
  24767. @item blackman
  24768. @item welch
  24769. @item flattop
  24770. @item bharris
  24771. @item bnuttall
  24772. @item bhann
  24773. @item sine
  24774. @item nuttall
  24775. @item lanczos
  24776. @item gauss
  24777. @item tukey
  24778. @item dolph
  24779. @item cauchy
  24780. @item parzen
  24781. @item poisson
  24782. @item bohman
  24783. @item kaiser
  24784. @end table
  24785. Default value is @code{hann}.
  24786. @item orientation
  24787. Set orientation of time vs frequency axis. Can be @code{vertical} or
  24788. @code{horizontal}. Default is @code{vertical}.
  24789. @item gain
  24790. Set scale gain for calculating intensity color values.
  24791. Default value is @code{1}.
  24792. @item legend
  24793. Draw time and frequency axes and legends. Default is enabled.
  24794. @item rotation
  24795. Set color rotation, must be in [-1.0, 1.0] range.
  24796. Default value is @code{0}.
  24797. @item start
  24798. Set start frequency from which to display spectrogram. Default is @code{0}.
  24799. @item stop
  24800. Set stop frequency to which to display spectrogram. Default is @code{0}.
  24801. @item drange
  24802. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  24803. Allowed range is from 10 to 200.
  24804. @item limit
  24805. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  24806. Allowed range is from -100 to 100.
  24807. @item opacity
  24808. Set opacity strength when using pixel format output with alpha component.
  24809. @end table
  24810. @subsection Examples
  24811. @itemize
  24812. @item
  24813. Extract an audio spectrogram of a whole audio track
  24814. in a 1024x1024 picture using @command{ffmpeg}:
  24815. @example
  24816. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  24817. @end example
  24818. @end itemize
  24819. @section showvolume
  24820. Convert input audio volume to a video output.
  24821. The filter accepts the following options:
  24822. @table @option
  24823. @item rate, r
  24824. Set video rate.
  24825. @item b
  24826. Set border width, allowed range is [0, 5]. Default is 1.
  24827. @item w
  24828. Set channel width, allowed range is [80, 8192]. Default is 400.
  24829. @item h
  24830. Set channel height, allowed range is [1, 900]. Default is 20.
  24831. @item f
  24832. Set fade, allowed range is [0, 1]. Default is 0.95.
  24833. @item c
  24834. Set volume color expression.
  24835. The expression can use the following variables:
  24836. @table @option
  24837. @item VOLUME
  24838. Current max volume of channel in dB.
  24839. @item PEAK
  24840. Current peak.
  24841. @item CHANNEL
  24842. Current channel number, starting from 0.
  24843. @end table
  24844. @item t
  24845. If set, displays channel names. Default is enabled.
  24846. @item v
  24847. If set, displays volume values. Default is enabled.
  24848. @item o
  24849. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  24850. default is @code{h}.
  24851. @item s
  24852. Set step size, allowed range is [0, 5]. Default is 0, which means
  24853. step is disabled.
  24854. @item p
  24855. Set background opacity, allowed range is [0, 1]. Default is 0.
  24856. @item m
  24857. Set metering mode, can be peak: @code{p} or rms: @code{r},
  24858. default is @code{p}.
  24859. @item ds
  24860. Set display scale, can be linear: @code{lin} or log: @code{log},
  24861. default is @code{lin}.
  24862. @item dm
  24863. In second.
  24864. If set to > 0., display a line for the max level
  24865. in the previous seconds.
  24866. default is disabled: @code{0.}
  24867. @item dmc
  24868. The color of the max line. Use when @code{dm} option is set to > 0.
  24869. default is: @code{orange}
  24870. @end table
  24871. @section showwaves
  24872. Convert input audio to a video output, representing the samples waves.
  24873. The filter accepts the following options:
  24874. @table @option
  24875. @item size, s
  24876. Specify the video size for the output. For the syntax of this option, check the
  24877. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24878. Default value is @code{600x240}.
  24879. @item mode
  24880. Set display mode.
  24881. Available values are:
  24882. @table @samp
  24883. @item point
  24884. Draw a point for each sample.
  24885. @item line
  24886. Draw a vertical line for each sample.
  24887. @item p2p
  24888. Draw a point for each sample and a line between them.
  24889. @item cline
  24890. Draw a centered vertical line for each sample.
  24891. @end table
  24892. Default value is @code{point}.
  24893. @item n
  24894. Set the number of samples which are printed on the same column. A
  24895. larger value will decrease the frame rate. Must be a positive
  24896. integer. This option can be set only if the value for @var{rate}
  24897. is not explicitly specified.
  24898. @item rate, r
  24899. Set the (approximate) output frame rate. This is done by setting the
  24900. option @var{n}. Default value is "25".
  24901. @item split_channels
  24902. Set if channels should be drawn separately or overlap. Default value is 0.
  24903. @item colors
  24904. Set colors separated by '|' which are going to be used for drawing of each channel.
  24905. @item scale
  24906. Set amplitude scale.
  24907. Available values are:
  24908. @table @samp
  24909. @item lin
  24910. Linear.
  24911. @item log
  24912. Logarithmic.
  24913. @item sqrt
  24914. Square root.
  24915. @item cbrt
  24916. Cubic root.
  24917. @end table
  24918. Default is linear.
  24919. @item draw
  24920. Set the draw mode. This is mostly useful to set for high @var{n}.
  24921. Available values are:
  24922. @table @samp
  24923. @item scale
  24924. Scale pixel values for each drawn sample.
  24925. @item full
  24926. Draw every sample directly.
  24927. @end table
  24928. Default value is @code{scale}.
  24929. @end table
  24930. @subsection Examples
  24931. @itemize
  24932. @item
  24933. Output the input file audio and the corresponding video representation
  24934. at the same time:
  24935. @example
  24936. amovie=a.mp3,asplit[out0],showwaves[out1]
  24937. @end example
  24938. @item
  24939. Create a synthetic signal and show it with showwaves, forcing a
  24940. frame rate of 30 frames per second:
  24941. @example
  24942. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  24943. @end example
  24944. @end itemize
  24945. @section showwavespic
  24946. Convert input audio to a single video frame, representing the samples waves.
  24947. The filter accepts the following options:
  24948. @table @option
  24949. @item size, s
  24950. Specify the video size for the output. For the syntax of this option, check the
  24951. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24952. Default value is @code{600x240}.
  24953. @item split_channels
  24954. Set if channels should be drawn separately or overlap. Default value is 0.
  24955. @item colors
  24956. Set colors separated by '|' which are going to be used for drawing of each channel.
  24957. @item scale
  24958. Set amplitude scale.
  24959. Available values are:
  24960. @table @samp
  24961. @item lin
  24962. Linear.
  24963. @item log
  24964. Logarithmic.
  24965. @item sqrt
  24966. Square root.
  24967. @item cbrt
  24968. Cubic root.
  24969. @end table
  24970. Default is linear.
  24971. @item draw
  24972. Set the draw mode.
  24973. Available values are:
  24974. @table @samp
  24975. @item scale
  24976. Scale pixel values for each drawn sample.
  24977. @item full
  24978. Draw every sample directly.
  24979. @end table
  24980. Default value is @code{scale}.
  24981. @item filter
  24982. Set the filter mode.
  24983. Available values are:
  24984. @table @samp
  24985. @item average
  24986. Use average samples values for each drawn sample.
  24987. @item peak
  24988. Use peak samples values for each drawn sample.
  24989. @end table
  24990. Default value is @code{average}.
  24991. @end table
  24992. @subsection Examples
  24993. @itemize
  24994. @item
  24995. Extract a channel split representation of the wave form of a whole audio track
  24996. in a 1024x800 picture using @command{ffmpeg}:
  24997. @example
  24998. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  24999. @end example
  25000. @end itemize
  25001. @section sidedata, asidedata
  25002. Delete frame side data, or select frames based on it.
  25003. This filter accepts the following options:
  25004. @table @option
  25005. @item mode
  25006. Set mode of operation of the filter.
  25007. Can be one of the following:
  25008. @table @samp
  25009. @item select
  25010. Select every frame with side data of @code{type}.
  25011. @item delete
  25012. Delete side data of @code{type}. If @code{type} is not set, delete all side
  25013. data in the frame.
  25014. @end table
  25015. @item type
  25016. Set side data type used with all modes. Must be set for @code{select} mode. For
  25017. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  25018. in @file{libavutil/frame.h}. For example, to choose
  25019. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  25020. @end table
  25021. @section spectrumsynth
  25022. Synthesize audio from 2 input video spectrums, first input stream represents
  25023. magnitude across time and second represents phase across time.
  25024. The filter will transform from frequency domain as displayed in videos back
  25025. to time domain as presented in audio output.
  25026. This filter is primarily created for reversing processed @ref{showspectrum}
  25027. filter outputs, but can synthesize sound from other spectrograms too.
  25028. But in such case results are going to be poor if the phase data is not
  25029. available, because in such cases phase data need to be recreated, usually
  25030. it's just recreated from random noise.
  25031. For best results use gray only output (@code{channel} color mode in
  25032. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  25033. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  25034. @code{data} option. Inputs videos should generally use @code{fullframe}
  25035. slide mode as that saves resources needed for decoding video.
  25036. The filter accepts the following options:
  25037. @table @option
  25038. @item sample_rate
  25039. Specify sample rate of output audio, the sample rate of audio from which
  25040. spectrum was generated may differ.
  25041. @item channels
  25042. Set number of channels represented in input video spectrums.
  25043. @item scale
  25044. Set scale which was used when generating magnitude input spectrum.
  25045. Can be @code{lin} or @code{log}. Default is @code{log}.
  25046. @item slide
  25047. Set slide which was used when generating inputs spectrums.
  25048. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  25049. Default is @code{fullframe}.
  25050. @item win_func
  25051. Set window function used for resynthesis.
  25052. @item overlap
  25053. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  25054. which means optimal overlap for selected window function will be picked.
  25055. @item orientation
  25056. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  25057. Default is @code{vertical}.
  25058. @end table
  25059. @subsection Examples
  25060. @itemize
  25061. @item
  25062. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  25063. then resynthesize videos back to audio with spectrumsynth:
  25064. @example
  25065. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=log:overlap=0.875:color=channel:slide=fullframe:data=magnitude -an -c:v rawvideo magnitude.nut
  25066. ffmpeg -i input.flac -lavfi showspectrum=mode=separate:scale=lin:overlap=0.875:color=channel:slide=fullframe:data=phase -an -c:v rawvideo phase.nut
  25067. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  25068. @end example
  25069. @end itemize
  25070. @section split, asplit
  25071. Split input into several identical outputs.
  25072. @code{asplit} works with audio input, @code{split} with video.
  25073. The filter accepts a single parameter which specifies the number of outputs. If
  25074. unspecified, it defaults to 2.
  25075. @subsection Examples
  25076. @itemize
  25077. @item
  25078. Create two separate outputs from the same input:
  25079. @example
  25080. [in] split [out0][out1]
  25081. @end example
  25082. @item
  25083. To create 3 or more outputs, you need to specify the number of
  25084. outputs, like in:
  25085. @example
  25086. [in] asplit=3 [out0][out1][out2]
  25087. @end example
  25088. @item
  25089. Create two separate outputs from the same input, one cropped and
  25090. one padded:
  25091. @example
  25092. [in] split [splitout1][splitout2];
  25093. [splitout1] crop=100:100:0:0 [cropout];
  25094. [splitout2] pad=200:200:100:100 [padout];
  25095. @end example
  25096. @item
  25097. Create 5 copies of the input audio with @command{ffmpeg}:
  25098. @example
  25099. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  25100. @end example
  25101. @end itemize
  25102. @section zmq, azmq
  25103. Receive commands sent through a libzmq client, and forward them to
  25104. filters in the filtergraph.
  25105. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  25106. must be inserted between two video filters, @code{azmq} between two
  25107. audio filters. Both are capable to send messages to any filter type.
  25108. To enable these filters you need to install the libzmq library and
  25109. headers and configure FFmpeg with @code{--enable-libzmq}.
  25110. For more information about libzmq see:
  25111. @url{http://www.zeromq.org/}
  25112. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  25113. receives messages sent through a network interface defined by the
  25114. @option{bind_address} (or the abbreviation "@option{b}") option.
  25115. Default value of this option is @file{tcp://localhost:5555}. You may
  25116. want to alter this value to your needs, but do not forget to escape any
  25117. ':' signs (see @ref{filtergraph escaping}).
  25118. The received message must be in the form:
  25119. @example
  25120. @var{TARGET} @var{COMMAND} [@var{ARG}]
  25121. @end example
  25122. @var{TARGET} specifies the target of the command, usually the name of
  25123. the filter class or a specific filter instance name. The default
  25124. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  25125. but you can override this by using the @samp{filter_name@@id} syntax
  25126. (see @ref{Filtergraph syntax}).
  25127. @var{COMMAND} specifies the name of the command for the target filter.
  25128. @var{ARG} is optional and specifies the optional argument list for the
  25129. given @var{COMMAND}.
  25130. Upon reception, the message is processed and the corresponding command
  25131. is injected into the filtergraph. Depending on the result, the filter
  25132. will send a reply to the client, adopting the format:
  25133. @example
  25134. @var{ERROR_CODE} @var{ERROR_REASON}
  25135. @var{MESSAGE}
  25136. @end example
  25137. @var{MESSAGE} is optional.
  25138. @subsection Examples
  25139. Look at @file{tools/zmqsend} for an example of a zmq client which can
  25140. be used to send commands processed by these filters.
  25141. Consider the following filtergraph generated by @command{ffplay}.
  25142. In this example the last overlay filter has an instance name. All other
  25143. filters will have default instance names.
  25144. @example
  25145. ffplay -dumpgraph 1 -f lavfi "
  25146. color=s=100x100:c=red [l];
  25147. color=s=100x100:c=blue [r];
  25148. nullsrc=s=200x100, zmq [bg];
  25149. [bg][l] overlay [bg+l];
  25150. [bg+l][r] overlay@@my=x=100 "
  25151. @end example
  25152. To change the color of the left side of the video, the following
  25153. command can be used:
  25154. @example
  25155. echo Parsed_color_0 c yellow | tools/zmqsend
  25156. @end example
  25157. To change the right side:
  25158. @example
  25159. echo Parsed_color_1 c pink | tools/zmqsend
  25160. @end example
  25161. To change the position of the right side:
  25162. @example
  25163. echo overlay@@my x 150 | tools/zmqsend
  25164. @end example
  25165. @c man end MULTIMEDIA FILTERS
  25166. @chapter Multimedia Sources
  25167. @c man begin MULTIMEDIA SOURCES
  25168. Below is a description of the currently available multimedia sources.
  25169. @section amovie
  25170. This is the same as @ref{movie} source, except it selects an audio
  25171. stream by default.
  25172. @section avsynctest
  25173. Generate an Audio/Video Sync Test.
  25174. Generated stream periodically shows flash video frame and emits beep in audio.
  25175. Useful to inspect A/V sync issues.
  25176. It accepts the following options:
  25177. @table @option
  25178. @item size, s
  25179. Set output video size. Default value is @code{hd720}.
  25180. @item framerate, fr
  25181. Set output video frame rate. Default value is @code{30}.
  25182. @item samplerate, sr
  25183. Set output audio sample rate. Default value is @code{44100}.
  25184. @item amplitude, a
  25185. Set output audio beep amplitude. Default value is @code{0.7}.
  25186. @item period, p
  25187. Set output audio beep period in seconds. Default value is @code{3}.
  25188. @item delay, dl
  25189. Set output video flash delay in number of frames. Default value is @code{0}.
  25190. @item cycle, c
  25191. Enable cycling of video delays, by default is disabled.
  25192. @item duration, d
  25193. Set stream output duration. By default duration is unlimited.
  25194. @item fg, bg, ag
  25195. Set foreground/background/additional color.
  25196. @end table
  25197. @subsection Commands
  25198. This source supports the some above options as @ref{commands}.
  25199. @anchor{movie}
  25200. @section movie
  25201. Read audio and/or video stream(s) from a movie container.
  25202. It accepts the following parameters:
  25203. @table @option
  25204. @item filename
  25205. The name of the resource to read (not necessarily a file; it can also be a
  25206. device or a stream accessed through some protocol).
  25207. @item format_name, f
  25208. Specifies the format assumed for the movie to read, and can be either
  25209. the name of a container or an input device. If not specified, the
  25210. format is guessed from @var{movie_name} or by probing.
  25211. @item seek_point, sp
  25212. Specifies the seek point in seconds. The frames will be output
  25213. starting from this seek point. The parameter is evaluated with
  25214. @code{av_strtod}, so the numerical value may be suffixed by an IS
  25215. postfix. The default value is "0".
  25216. @item streams, s
  25217. Specifies the streams to read. Several streams can be specified,
  25218. separated by "+". The source will then have as many outputs, in the
  25219. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  25220. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  25221. respectively the default (best suited) video and audio stream. Default
  25222. is "dv", or "da" if the filter is called as "amovie".
  25223. @item stream_index, si
  25224. Specifies the index of the video stream to read. If the value is -1,
  25225. the most suitable video stream will be automatically selected. The default
  25226. value is "-1". Deprecated. If the filter is called "amovie", it will select
  25227. audio instead of video.
  25228. @item loop
  25229. Specifies how many times to read the stream in sequence.
  25230. If the value is 0, the stream will be looped infinitely.
  25231. Default value is "1".
  25232. Note that when the movie is looped the source timestamps are not
  25233. changed, so it will generate non monotonically increasing timestamps.
  25234. @item discontinuity
  25235. Specifies the time difference between frames above which the point is
  25236. considered a timestamp discontinuity which is removed by adjusting the later
  25237. timestamps.
  25238. @item dec_threads
  25239. Specifies the number of threads for decoding
  25240. @item format_opts
  25241. Specify format options for the opened file. Format options can be specified
  25242. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  25243. shows how to add protocol_whitelist and protocol_blacklist options:
  25244. @example
  25245. ffplay -f lavfi
  25246. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  25247. @end example
  25248. @end table
  25249. It allows overlaying a second video on top of the main input of
  25250. a filtergraph, as shown in this graph:
  25251. @example
  25252. input -----------> deltapts0 --> overlay --> output
  25253. ^
  25254. |
  25255. movie --> scale--> deltapts1 -------+
  25256. @end example
  25257. @subsection Examples
  25258. @itemize
  25259. @item
  25260. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  25261. on top of the input labelled "in":
  25262. @example
  25263. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25264. [in] setpts=PTS-STARTPTS [main];
  25265. [main][over] overlay=16:16 [out]
  25266. @end example
  25267. @item
  25268. Read from a video4linux2 device, and overlay it on top of the input
  25269. labelled "in":
  25270. @example
  25271. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25272. [in] setpts=PTS-STARTPTS [main];
  25273. [main][over] overlay=16:16 [out]
  25274. @end example
  25275. @item
  25276. Read the first video stream and the audio stream with id 0x81 from
  25277. dvd.vob; the video is connected to the pad named "video" and the audio is
  25278. connected to the pad named "audio":
  25279. @example
  25280. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  25281. @end example
  25282. @end itemize
  25283. @subsection Commands
  25284. Both movie and amovie support the following commands:
  25285. @table @option
  25286. @item seek
  25287. Perform seek using "av_seek_frame".
  25288. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  25289. @itemize
  25290. @item
  25291. @var{stream_index}: If stream_index is -1, a default
  25292. stream is selected, and @var{timestamp} is automatically converted
  25293. from AV_TIME_BASE units to the stream specific time_base.
  25294. @item
  25295. @var{timestamp}: Timestamp in AVStream.time_base units
  25296. or, if no stream is specified, in AV_TIME_BASE units.
  25297. @item
  25298. @var{flags}: Flags which select direction and seeking mode.
  25299. @end itemize
  25300. @item get_duration
  25301. Get movie duration in AV_TIME_BASE units.
  25302. @end table
  25303. @c man end MULTIMEDIA SOURCES