filters.texi 904 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638
  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 readability.
  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 through 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 through 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 custom 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 bitplanenoise
  6656. Show and measure bit plane noise.
  6657. The filter accepts the following options:
  6658. @table @option
  6659. @item bitplane
  6660. Set which plane to analyze. Default is @code{1}.
  6661. @item filter
  6662. Filter out noisy pixels from @code{bitplane} set above.
  6663. Default is disabled.
  6664. @end table
  6665. @section blackdetect, blackdetect_vulkan
  6666. Detect video intervals that are (almost) completely black. Can be
  6667. useful to detect chapter transitions, commercials, or invalid
  6668. recordings.
  6669. The filter outputs its detection analysis to both the log as well as
  6670. frame metadata. If a black segment of at least the specified minimum
  6671. duration is found, a line with the start and end timestamps as well
  6672. as duration is printed to the log with level @code{info}. In addition,
  6673. a log line with level @code{debug} is printed per frame showing the
  6674. black amount detected for that frame.
  6675. The filter also attaches metadata to the first frame of a black
  6676. segment with key @code{lavfi.black_start} and to the first frame
  6677. after the black segment ends with key @code{lavfi.black_end}. The
  6678. value is the frame's timestamp. This metadata is added regardless
  6679. of the minimum duration specified.
  6680. The filter accepts the following options:
  6681. @table @option
  6682. @item black_min_duration, d
  6683. Set the minimum detected black duration expressed in seconds. It must
  6684. be a non-negative floating point number.
  6685. Default value is 2.0.
  6686. @item picture_black_ratio_th, pic_th
  6687. Set the threshold for considering a picture "black".
  6688. Express the minimum value for the ratio:
  6689. @example
  6690. @var{nb_black_pixels} / @var{nb_pixels}
  6691. @end example
  6692. for which a picture is considered black.
  6693. Default value is 0.98.
  6694. @item pixel_black_th, pix_th
  6695. Set the threshold for considering a pixel "black".
  6696. The threshold expresses the maximum pixel luma value for which a
  6697. pixel is considered "black". The provided value is scaled according to
  6698. the following equation:
  6699. @example
  6700. @var{absolute_threshold} = @var{luma_minimum_value} + @var{pixel_black_th} * @var{luma_range_size}
  6701. @end example
  6702. @var{luma_range_size} and @var{luma_minimum_value} depend on
  6703. the input video format, the range is [0-255] for YUV full-range
  6704. formats and [16-235] for YUV non full-range formats.
  6705. Default value is 0.10.
  6706. @item alpha
  6707. If true, check the alpha channel instead of the luma channel. Detects frames
  6708. which are (almost) transparent, instead of frames which are almost black.
  6709. Default value is disabled.
  6710. @end table
  6711. The following example sets the maximum pixel threshold to the minimum
  6712. value, and detects only black intervals of 2 or more seconds:
  6713. @example
  6714. blackdetect=d=2:pix_th=0.00
  6715. @end example
  6716. @section blackframe
  6717. Detect frames that are (almost) completely black. Can be useful to
  6718. detect chapter transitions or commercials. Output lines consist of
  6719. the frame number of the detected frame, the percentage of blackness,
  6720. the position in the file if known or -1 and the timestamp in seconds.
  6721. In order to display the output lines, you need to set the loglevel at
  6722. least to the AV_LOG_INFO value.
  6723. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6724. The value represents the percentage of pixels in the picture that
  6725. are below the threshold value.
  6726. It accepts the following parameters:
  6727. @table @option
  6728. @item amount
  6729. The percentage of the pixels that have to be below the threshold; it defaults to
  6730. @code{98}.
  6731. @item threshold, thresh
  6732. The threshold below which a pixel value is considered black; it defaults to
  6733. @code{32}.
  6734. @end table
  6735. @anchor{blend}
  6736. @section blend
  6737. Blend two video frames into each other.
  6738. The @code{blend} filter takes two input streams and outputs one
  6739. stream, the first input is the "top" layer and second input is
  6740. "bottom" layer. By default, the output terminates when the longest input terminates.
  6741. The @code{tblend} (time blend) filter takes two consecutive frames
  6742. from one single stream, and outputs the result obtained by blending
  6743. the new frame on top of the old frame.
  6744. A description of the accepted options follows.
  6745. @table @option
  6746. @item c0_mode
  6747. @item c1_mode
  6748. @item c2_mode
  6749. @item c3_mode
  6750. @item all_mode
  6751. Set blend mode for specific pixel component or all pixel components in case
  6752. of @var{all_mode}. Default value is @code{normal}.
  6753. Available values for component modes are:
  6754. @table @samp
  6755. @item addition
  6756. @item and
  6757. @item average
  6758. @item bleach
  6759. @item burn
  6760. @item darken
  6761. @item difference
  6762. @item divide
  6763. @item dodge
  6764. @item exclusion
  6765. @item extremity
  6766. @item freeze
  6767. @item geometric
  6768. @item glow
  6769. @item grainextract
  6770. @item grainmerge
  6771. @item hardlight
  6772. @item hardmix
  6773. @item hardoverlay
  6774. @item harmonic
  6775. @item heat
  6776. @item interpolate
  6777. @item lighten
  6778. @item linearlight
  6779. @item multiply
  6780. @item multiply128
  6781. @item negation
  6782. @item normal
  6783. @item or
  6784. @item overlay
  6785. @item phoenix
  6786. @item pinlight
  6787. @item reflect
  6788. @item screen
  6789. @item softdifference
  6790. @item softlight
  6791. @item stain
  6792. @item subtract
  6793. @item vividlight
  6794. @item xor
  6795. @end table
  6796. @item c0_opacity
  6797. @item c1_opacity
  6798. @item c2_opacity
  6799. @item c3_opacity
  6800. @item all_opacity
  6801. Set blend opacity for specific pixel component or all pixel components in case
  6802. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6803. @item c0_expr
  6804. @item c1_expr
  6805. @item c2_expr
  6806. @item c3_expr
  6807. @item all_expr
  6808. Set blend expression for specific pixel component or all pixel components in case
  6809. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6810. The expressions can use the following variables:
  6811. @table @option
  6812. @item N
  6813. The sequential number of the filtered frame, starting from @code{0}.
  6814. @item X
  6815. @item Y
  6816. the coordinates of the current sample
  6817. @item W
  6818. @item H
  6819. the width and height of currently filtered plane
  6820. @item SW
  6821. @item SH
  6822. Width and height scale for the plane being filtered. It is the
  6823. ratio between the dimensions of the current plane to the luma plane,
  6824. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6825. the luma plane and @code{0.5,0.5} for the chroma planes.
  6826. @item T
  6827. Time of the current frame, expressed in seconds.
  6828. @item TOP, A
  6829. Value of pixel component at current location for first video frame (top layer).
  6830. @item BOTTOM, B
  6831. Value of pixel component at current location for second video frame (bottom layer).
  6832. @end table
  6833. @end table
  6834. The @code{blend} filter also supports the @ref{framesync} options.
  6835. @subsection Examples
  6836. @itemize
  6837. @item
  6838. Apply transition from bottom layer to top layer in first 10 seconds:
  6839. @example
  6840. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6841. @end example
  6842. @item
  6843. Apply linear horizontal transition from top layer to bottom layer:
  6844. @example
  6845. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6846. @end example
  6847. @item
  6848. Apply 1x1 checkerboard effect:
  6849. @example
  6850. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6851. @end example
  6852. @item
  6853. Apply uncover left effect:
  6854. @example
  6855. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6856. @end example
  6857. @item
  6858. Apply uncover down effect:
  6859. @example
  6860. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6861. @end example
  6862. @item
  6863. Apply uncover up-left effect:
  6864. @example
  6865. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6866. @end example
  6867. @item
  6868. Split diagonally video and shows top and bottom layer on each side:
  6869. @example
  6870. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6871. @end example
  6872. @item
  6873. Display differences between the current and the previous frame:
  6874. @example
  6875. tblend=all_mode=grainextract
  6876. @end example
  6877. @end itemize
  6878. @subsection Commands
  6879. This filter supports same @ref{commands} as options.
  6880. @anchor{blockdetect}
  6881. @section blockdetect
  6882. Determines blockiness of frames without altering the input frames.
  6883. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6884. The filter accepts the following options:
  6885. @table @option
  6886. @item period_min
  6887. @item period_max
  6888. Set minimum and maximum values for determining pixel grids (periods).
  6889. Default values are [3,24].
  6890. @item planes
  6891. Set planes to filter. Default is first only.
  6892. @end table
  6893. @subsection Examples
  6894. @itemize
  6895. @item
  6896. Determine blockiness for the first plane and search for periods within [8,32]:
  6897. @example
  6898. blockdetect=period_min=8:period_max=32:planes=1
  6899. @end example
  6900. @end itemize
  6901. @anchor{blurdetect}
  6902. @section blurdetect
  6903. Determines blurriness of frames without altering the input frames.
  6904. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6905. Allows for a block-based abbreviation.
  6906. The filter accepts the following options:
  6907. @table @option
  6908. @item low
  6909. @item high
  6910. Set low and high threshold values used by the Canny thresholding
  6911. algorithm.
  6912. The high threshold selects the "strong" edge pixels, which are then
  6913. connected through 8-connectivity with the "weak" edge pixels selected
  6914. by the low threshold.
  6915. @var{low} and @var{high} threshold values must be chosen in the range
  6916. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6917. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6918. is @code{50/255}.
  6919. @item radius
  6920. Define the radius to search around an edge pixel for local maxima.
  6921. @item block_pct
  6922. Determine blurriness only for the most significant blocks, given in percentage.
  6923. @item block_width
  6924. 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}.
  6925. @item block_height
  6926. 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}.
  6927. @item planes
  6928. Set planes to filter. Default is first only.
  6929. @end table
  6930. @subsection Examples
  6931. @itemize
  6932. @item
  6933. Determine blur for 80% of most significant 32x32 blocks:
  6934. @example
  6935. blurdetect=block_width=32:block_height=32:block_pct=80
  6936. @end example
  6937. @end itemize
  6938. @section bm3d
  6939. Denoise frames using Block-Matching 3D algorithm.
  6940. The filter accepts the following options.
  6941. @table @option
  6942. @item sigma
  6943. Set denoising strength. Default value is 1.
  6944. Allowed range is from 0 to 999.9.
  6945. The denoising algorithm is very sensitive to sigma, so adjust it
  6946. according to the source.
  6947. @item block
  6948. Set local patch size. This sets dimensions in 2D.
  6949. @item bstep
  6950. Set sliding step for processing blocks. Default value is 4.
  6951. Allowed range is from 1 to 64.
  6952. Smaller values allows processing more reference blocks and is slower.
  6953. @item group
  6954. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6955. When set to 1, no block matching is done. Larger values allows more blocks
  6956. in single group.
  6957. Allowed range is from 1 to 256.
  6958. @item range
  6959. Set radius for search block matching. Default is 9.
  6960. Allowed range is from 1 to INT32_MAX.
  6961. @item mstep
  6962. Set step between two search locations for block matching. Default is 1.
  6963. Allowed range is from 1 to 64. Smaller is slower.
  6964. @item thmse
  6965. Set threshold of mean square error for block matching. Valid range is 0 to
  6966. INT32_MAX.
  6967. @item hdthr
  6968. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6969. Larger values results in stronger hard-thresholding filtering in frequency
  6970. domain.
  6971. @item estim
  6972. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  6973. Default is @code{basic}.
  6974. @item ref
  6975. If enabled, filter will use 2nd stream for block matching.
  6976. Default is disabled for @code{basic} value of @var{estim} option,
  6977. and always enabled if value of @var{estim} is @code{final}.
  6978. @item planes
  6979. Set planes to filter. Default is all available except alpha.
  6980. @end table
  6981. @subsection Examples
  6982. @itemize
  6983. @item
  6984. Basic filtering with bm3d:
  6985. @example
  6986. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  6987. @end example
  6988. @item
  6989. Same as above, but filtering only luma:
  6990. @example
  6991. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  6992. @end example
  6993. @item
  6994. Same as above, but with both estimation modes:
  6995. @example
  6996. 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
  6997. @end example
  6998. @item
  6999. Same as above, but prefilter with @ref{nlmeans} filter instead:
  7000. @example
  7001. 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
  7002. @end example
  7003. @end itemize
  7004. @section boxblur
  7005. Apply a boxblur algorithm to the input video.
  7006. It accepts the following parameters:
  7007. @table @option
  7008. @item luma_radius, lr
  7009. @item luma_power, lp
  7010. @item chroma_radius, cr
  7011. @item chroma_power, cp
  7012. @item alpha_radius, ar
  7013. @item alpha_power, ap
  7014. @end table
  7015. A description of the accepted options follows.
  7016. @table @option
  7017. @item luma_radius, lr
  7018. @item chroma_radius, cr
  7019. @item alpha_radius, ar
  7020. Set an expression for the box radius in pixels used for blurring the
  7021. corresponding input plane.
  7022. The radius value must be a non-negative number, and must not be
  7023. greater than the value of the expression @code{min(w,h)/2} for the
  7024. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  7025. planes.
  7026. Default value for @option{luma_radius} is "2". If not specified,
  7027. @option{chroma_radius} and @option{alpha_radius} default to the
  7028. corresponding value set for @option{luma_radius}.
  7029. The expressions can contain the following constants:
  7030. @table @option
  7031. @item w
  7032. @item h
  7033. The input width and height in pixels.
  7034. @item cw
  7035. @item ch
  7036. The input chroma image width and height in pixels.
  7037. @item hsub
  7038. @item vsub
  7039. The horizontal and vertical chroma subsample values. For example, for the
  7040. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  7041. @end table
  7042. @item luma_power, lp
  7043. @item chroma_power, cp
  7044. @item alpha_power, ap
  7045. Specify how many times the boxblur filter is applied to the
  7046. corresponding plane.
  7047. Default value for @option{luma_power} is 2. If not specified,
  7048. @option{chroma_power} and @option{alpha_power} default to the
  7049. corresponding value set for @option{luma_power}.
  7050. A value of 0 will disable the effect.
  7051. @end table
  7052. @subsection Examples
  7053. @itemize
  7054. @item
  7055. Apply a boxblur filter with the luma, chroma, and alpha radii
  7056. set to 2:
  7057. @example
  7058. boxblur=luma_radius=2:luma_power=1
  7059. boxblur=2:1
  7060. @end example
  7061. @item
  7062. Set the luma radius to 2, and alpha and chroma radius to 0:
  7063. @example
  7064. boxblur=2:1:cr=0:ar=0
  7065. @end example
  7066. @item
  7067. Set the luma and chroma radii to a fraction of the video dimension:
  7068. @example
  7069. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  7070. @end example
  7071. @end itemize
  7072. @anchor{bwdif}
  7073. @section bwdif
  7074. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  7075. Deinterlacing Filter").
  7076. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  7077. interpolation algorithms.
  7078. It accepts the following parameters:
  7079. @table @option
  7080. @item mode
  7081. The interlacing mode to adopt. It accepts one of the following values:
  7082. @table @option
  7083. @item 0, send_frame
  7084. Output one frame for each frame.
  7085. @item 1, send_field
  7086. Output one frame for each field.
  7087. @end table
  7088. The default value is @code{send_field}.
  7089. @item parity
  7090. The picture field parity assumed for the input interlaced video. It accepts one
  7091. of the following values:
  7092. @table @option
  7093. @item 0, tff
  7094. Assume the top field is first.
  7095. @item 1, bff
  7096. Assume the bottom field is first.
  7097. @item -1, auto
  7098. Enable automatic detection of field parity.
  7099. @end table
  7100. The default value is @code{auto}.
  7101. If the interlacing is unknown or the decoder does not export this information,
  7102. top field first will be assumed.
  7103. @item deint
  7104. Specify which frames to deinterlace. Accepts one of the following
  7105. values:
  7106. @table @option
  7107. @item 0, all
  7108. Deinterlace all frames.
  7109. @item 1, interlaced
  7110. Only deinterlace frames marked as interlaced.
  7111. @end table
  7112. The default value is @code{all}.
  7113. @end table
  7114. @section ccrepack
  7115. Repack CEA-708 closed captioning side data
  7116. This filter fixes various issues seen with commercial encoders
  7117. related to upstream malformed CEA-708 payloads, specifically
  7118. incorrect number of tuples (wrong cc_count for the target FPS),
  7119. and incorrect ordering of tuples (i.e. the CEA-608 tuples are not at
  7120. the first entries in the payload).
  7121. @section cas
  7122. Apply Contrast Adaptive Sharpen filter to video stream.
  7123. The filter accepts the following options:
  7124. @table @option
  7125. @item strength
  7126. Set the sharpening strength. Default value is 0.
  7127. @item planes
  7128. Set planes to filter. Default value is to filter all
  7129. planes except alpha plane.
  7130. @end table
  7131. @subsection Commands
  7132. This filter supports same @ref{commands} as options.
  7133. @section chromahold
  7134. Remove all color information for all colors except for certain one.
  7135. The filter accepts the following options:
  7136. @table @option
  7137. @item color
  7138. The color which will not be replaced with neutral chroma.
  7139. @item similarity
  7140. Similarity percentage with the above color.
  7141. 0.01 matches only the exact key color, while 1.0 matches everything.
  7142. @item blend
  7143. Blend percentage.
  7144. 0.0 makes pixels either fully gray, or not gray at all.
  7145. Higher values result in more preserved color.
  7146. @item yuv
  7147. Signals that the color passed is already in YUV instead of RGB.
  7148. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7149. This can be used to pass exact YUV values as hexadecimal numbers.
  7150. @end table
  7151. @subsection Commands
  7152. This filter supports same @ref{commands} as options.
  7153. The command accepts the same syntax of the corresponding option.
  7154. If the specified expression is not valid, it is kept at its current
  7155. value.
  7156. @anchor{chromakey}
  7157. @section chromakey
  7158. YUV colorspace color/chroma keying.
  7159. The filter accepts the following options:
  7160. @table @option
  7161. @item color
  7162. The color which will be replaced with transparency.
  7163. @item similarity
  7164. Similarity percentage with the key color.
  7165. 0.01 matches only the exact key color, while 1.0 matches everything.
  7166. @item blend
  7167. Blend percentage.
  7168. 0.0 makes pixels either fully transparent, or not transparent at all.
  7169. Higher values result in semi-transparent pixels, with a higher transparency
  7170. the more similar the pixels color is to the key color.
  7171. @item yuv
  7172. Signals that the color passed is already in YUV instead of RGB.
  7173. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7174. This can be used to pass exact YUV values as hexadecimal numbers.
  7175. @end table
  7176. @subsection Commands
  7177. This filter supports same @ref{commands} as options.
  7178. The command accepts the same syntax of the corresponding option.
  7179. If the specified expression is not valid, it is kept at its current
  7180. value.
  7181. @subsection Examples
  7182. @itemize
  7183. @item
  7184. Make every green pixel in the input image transparent:
  7185. @example
  7186. ffmpeg -i input.png -vf chromakey=green out.png
  7187. @end example
  7188. @item
  7189. Overlay a greenscreen-video on top of a static black background.
  7190. @example
  7191. 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
  7192. @end example
  7193. @end itemize
  7194. @section chromanr
  7195. Reduce chrominance noise.
  7196. The filter accepts the following options:
  7197. @table @option
  7198. @item thres
  7199. Set threshold for averaging chrominance values.
  7200. Sum of absolute difference of Y, U and V pixel components of current
  7201. pixel and neighbour pixels lower than this threshold will be used in
  7202. averaging. Luma component is left unchanged and is copied to output.
  7203. Default value is 30. Allowed range is from 1 to 200.
  7204. @item sizew
  7205. Set horizontal radius of rectangle used for averaging.
  7206. Allowed range is from 1 to 100. Default value is 5.
  7207. @item sizeh
  7208. Set vertical radius of rectangle used for averaging.
  7209. Allowed range is from 1 to 100. Default value is 5.
  7210. @item stepw
  7211. Set horizontal step when averaging. Default value is 1.
  7212. Allowed range is from 1 to 50.
  7213. Mostly useful to speed-up filtering.
  7214. @item steph
  7215. Set vertical step when averaging. Default value is 1.
  7216. Allowed range is from 1 to 50.
  7217. Mostly useful to speed-up filtering.
  7218. @item threy
  7219. Set Y threshold for averaging chrominance values.
  7220. Set finer control for max allowed difference between Y components
  7221. of current pixel and neighbour pixels.
  7222. Default value is 200. Allowed range is from 1 to 200.
  7223. @item threu
  7224. Set U threshold for averaging chrominance values.
  7225. Set finer control for max allowed difference between U components
  7226. of current pixel and neighbour pixels.
  7227. Default value is 200. Allowed range is from 1 to 200.
  7228. @item threv
  7229. Set V threshold for averaging chrominance values.
  7230. Set finer control for max allowed difference between V components
  7231. of current pixel and neighbour pixels.
  7232. Default value is 200. Allowed range is from 1 to 200.
  7233. @item distance
  7234. Set distance type used in calculations.
  7235. @table @samp
  7236. @item manhattan
  7237. Absolute difference.
  7238. @item euclidean
  7239. Difference squared.
  7240. @end table
  7241. Default distance type is manhattan.
  7242. @end table
  7243. @subsection Commands
  7244. This filter supports same @ref{commands} as options.
  7245. The command accepts the same syntax of the corresponding option.
  7246. @section chromashift
  7247. Shift chroma pixels horizontally and/or vertically.
  7248. The filter accepts the following options:
  7249. @table @option
  7250. @item cbh
  7251. Set amount to shift chroma-blue horizontally.
  7252. @item cbv
  7253. Set amount to shift chroma-blue vertically.
  7254. @item crh
  7255. Set amount to shift chroma-red horizontally.
  7256. @item crv
  7257. Set amount to shift chroma-red vertically.
  7258. @item edge
  7259. Set edge mode, can be @var{smear}, default, or @var{warp}.
  7260. @end table
  7261. @subsection Commands
  7262. This filter supports the all above options as @ref{commands}.
  7263. @section ciescope
  7264. Display CIE color diagram with pixels overlaid onto it.
  7265. The filter accepts the following options:
  7266. @table @option
  7267. @item system
  7268. Set color system.
  7269. @table @samp
  7270. @item ntsc, 470m
  7271. @item ebu, 470bg
  7272. @item smpte
  7273. @item 240m
  7274. @item apple
  7275. @item widergb
  7276. @item cie1931
  7277. @item rec709, hdtv
  7278. @item uhdtv, rec2020
  7279. @item dcip3
  7280. @end table
  7281. @item cie
  7282. Set CIE system.
  7283. @table @samp
  7284. @item xyy
  7285. @item ucs
  7286. @item luv
  7287. @end table
  7288. @item gamuts
  7289. Set what gamuts to draw.
  7290. See @code{system} option for available values.
  7291. @item size, s
  7292. Set ciescope size, by default set to 512.
  7293. @item intensity, i
  7294. Set intensity used to map input pixel values to CIE diagram.
  7295. @item contrast
  7296. Set contrast used to draw tongue colors that are out of active color system gamut.
  7297. @item corrgamma
  7298. Correct gamma displayed on scope, by default enabled.
  7299. @item showwhite
  7300. Show white point on CIE diagram, by default disabled.
  7301. @item gamma
  7302. Set input gamma. Used only with XYZ input color space.
  7303. @item fill
  7304. Fill with CIE colors. By default is enabled.
  7305. @end table
  7306. @section codecview
  7307. Visualize information exported by some codecs.
  7308. Some codecs can export information through frames using side-data or other
  7309. means. For example, some MPEG based codecs export motion vectors through the
  7310. @var{export_mvs} flag in the codec @option{flags2} option.
  7311. The filter accepts the following option:
  7312. @table @option
  7313. @item block
  7314. Display block partition structure using the luma plane.
  7315. @item mv
  7316. Set motion vectors to visualize.
  7317. Available flags for @var{mv} are:
  7318. @table @samp
  7319. @item pf
  7320. forward predicted MVs of P-frames
  7321. @item bf
  7322. forward predicted MVs of B-frames
  7323. @item bb
  7324. backward predicted MVs of B-frames
  7325. @end table
  7326. @item qp
  7327. Display quantization parameters using the chroma planes.
  7328. @item mv_type, mvt
  7329. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7330. Available flags for @var{mv_type} are:
  7331. @table @samp
  7332. @item fp
  7333. forward predicted MVs
  7334. @item bp
  7335. backward predicted MVs
  7336. @end table
  7337. @item frame_type, ft
  7338. Set frame type to visualize motion vectors of.
  7339. Available flags for @var{frame_type} are:
  7340. @table @samp
  7341. @item if
  7342. intra-coded frames (I-frames)
  7343. @item pf
  7344. predicted frames (P-frames)
  7345. @item bf
  7346. bi-directionally predicted frames (B-frames)
  7347. @end table
  7348. @end table
  7349. @subsection Examples
  7350. @itemize
  7351. @item
  7352. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7353. @example
  7354. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7355. @end example
  7356. @item
  7357. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7358. @example
  7359. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7360. @end example
  7361. @end itemize
  7362. @section colorbalance
  7363. Modify intensity of primary colors (red, green and blue) of input frames.
  7364. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7365. regions for the red-cyan, green-magenta or blue-yellow balance.
  7366. A positive adjustment value shifts the balance towards the primary color, a negative
  7367. value towards the complementary color.
  7368. The filter accepts the following options:
  7369. @table @option
  7370. @item rs
  7371. @item gs
  7372. @item bs
  7373. Adjust red, green and blue shadows (darkest pixels).
  7374. @item rm
  7375. @item gm
  7376. @item bm
  7377. Adjust red, green and blue midtones (medium pixels).
  7378. @item rh
  7379. @item gh
  7380. @item bh
  7381. Adjust red, green and blue highlights (brightest pixels).
  7382. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7383. @item pl
  7384. Preserve lightness when changing color balance. Default is disabled.
  7385. @end table
  7386. @subsection Examples
  7387. @itemize
  7388. @item
  7389. Add red color cast to shadows:
  7390. @example
  7391. colorbalance=rs=.3
  7392. @end example
  7393. @end itemize
  7394. @subsection Commands
  7395. This filter supports the all above options as @ref{commands}.
  7396. @section colorcontrast
  7397. Adjust color contrast between RGB components.
  7398. The filter accepts the following options:
  7399. @table @option
  7400. @item rc
  7401. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7402. @item gm
  7403. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7404. @item by
  7405. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7406. @item rcw
  7407. @item gmw
  7408. @item byw
  7409. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7410. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7411. @item pl
  7412. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7413. @end table
  7414. @subsection Commands
  7415. This filter supports the all above options as @ref{commands}.
  7416. @section colorcorrect
  7417. Adjust color white balance selectively for blacks and whites.
  7418. This filter operates in YUV colorspace.
  7419. The filter accepts the following options:
  7420. @table @option
  7421. @item rl
  7422. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7423. Default value is 0.
  7424. @item bl
  7425. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7426. Default value is 0.
  7427. @item rh
  7428. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7429. Default value is 0.
  7430. @item bh
  7431. Set the blue highlight spot. Allowed range is from -1.0 to 1.0.
  7432. Default value is 0.
  7433. @item saturation
  7434. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7435. Default value is 1.
  7436. @item analyze
  7437. If set to anything other than @code{manual} it will analyze every frame and use derived
  7438. parameters for filtering output frame.
  7439. Possible values are:
  7440. @table @samp
  7441. @item manual
  7442. @item average
  7443. @item minmax
  7444. @item median
  7445. @end table
  7446. Default value is @code{manual}.
  7447. @end table
  7448. @subsection Commands
  7449. This filter supports the all above options as @ref{commands}.
  7450. @section colorchannelmixer
  7451. Adjust video input frames by re-mixing color channels.
  7452. This filter modifies a color channel by adding the values associated to
  7453. the other channels of the same pixels. For example if the value to
  7454. modify is red, the output value will be:
  7455. @example
  7456. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7457. @end example
  7458. The filter accepts the following options:
  7459. @table @option
  7460. @item rr
  7461. @item rg
  7462. @item rb
  7463. @item ra
  7464. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7465. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7466. @item gr
  7467. @item gg
  7468. @item gb
  7469. @item ga
  7470. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7471. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7472. @item br
  7473. @item bg
  7474. @item bb
  7475. @item ba
  7476. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7477. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7478. @item ar
  7479. @item ag
  7480. @item ab
  7481. @item aa
  7482. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7483. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7484. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7485. @item pc
  7486. Set preserve color mode. The accepted values are:
  7487. @table @samp
  7488. @item none
  7489. Disable color preserving, this is default.
  7490. @item lum
  7491. Preserve luminance.
  7492. @item max
  7493. Preserve max value of RGB triplet.
  7494. @item avg
  7495. Preserve average value of RGB triplet.
  7496. @item sum
  7497. Preserve sum value of RGB triplet.
  7498. @item nrm
  7499. Preserve normalized value of RGB triplet.
  7500. @item pwr
  7501. Preserve power value of RGB triplet.
  7502. @end table
  7503. @item pa
  7504. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7505. Default is @code{0.0}, thus disabled.
  7506. @end table
  7507. @subsection Examples
  7508. @itemize
  7509. @item
  7510. Convert source to grayscale:
  7511. @example
  7512. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7513. @end example
  7514. @item
  7515. Simulate sepia tones:
  7516. @example
  7517. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7518. @end example
  7519. @end itemize
  7520. @subsection Commands
  7521. This filter supports the all above options as @ref{commands}.
  7522. @section colordetect
  7523. Analyze the video frames to determine the effective value range and alpha
  7524. mode.
  7525. The filter accepts the following options:
  7526. @table @option
  7527. @item mode
  7528. Set of properties to detect. Unavailable properties, such as alpha mode for
  7529. an input image without an alpha channel, will be ignored automatically.
  7530. Accepts a combination of the following flags:
  7531. @table @samp
  7532. @item color_range
  7533. Detect if the source contains luma pixels outside the limited (MPEG) range,
  7534. which indicates that this is a full range YUV source.
  7535. @item alpha_mode
  7536. Detect if the source contains color values above the alpha channel, which
  7537. indicates that the alpha channel is independent (straight), rather than
  7538. premultiplied.
  7539. @item all
  7540. Enable detection of all of the above properties. This is the default.
  7541. @end table
  7542. @end table
  7543. @section colorize
  7544. Overlay a solid color on the video stream.
  7545. The filter accepts the following options:
  7546. @table @option
  7547. @item hue
  7548. Set the color hue. Allowed range is from 0 to 360.
  7549. Default value is 0.
  7550. @item saturation
  7551. Set the color saturation. Allowed range is from 0 to 1.
  7552. Default value is 0.5.
  7553. @item lightness
  7554. Set the color lightness. Allowed range is from 0 to 1.
  7555. Default value is 0.5.
  7556. @item mix
  7557. Set the mix of source lightness. By default is set to 1.0.
  7558. Allowed range is from 0.0 to 1.0.
  7559. @end table
  7560. @subsection Commands
  7561. This filter supports the all above options as @ref{commands}.
  7562. @section colorkey
  7563. RGB colorspace color keying.
  7564. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7565. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7566. the similarity radius depends on the value of the blend option.
  7567. The filter accepts the following options:
  7568. @table @option
  7569. @item color
  7570. Set the color for which alpha will be set to 0 (full transparency).
  7571. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7572. Default is @code{black}.
  7573. @item similarity
  7574. Set the radius from the key color within which other colors also have full transparency.
  7575. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7576. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7577. around the exact key color, while 1.0 matches everything.
  7578. Default is @code{0.01}.
  7579. @item blend
  7580. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7581. 0.0 makes pixels either fully transparent or fully opaque.
  7582. Higher values result in semi-transparent pixels, with greater transparency
  7583. the more similar the pixel color is to the key color.
  7584. Range is 0.0 to 1.0. Default is @code{0.0}.
  7585. @end table
  7586. @subsection Examples
  7587. @itemize
  7588. @item
  7589. Make every green pixel in the input image transparent:
  7590. @example
  7591. ffmpeg -i input.png -vf colorkey=green out.png
  7592. @end example
  7593. @item
  7594. Overlay a greenscreen-video on top of a static background image.
  7595. @example
  7596. 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
  7597. @end example
  7598. @end itemize
  7599. @subsection Commands
  7600. This filter supports same @ref{commands} as options.
  7601. The command accepts the same syntax of the corresponding option.
  7602. If the specified expression is not valid, it is kept at its current
  7603. value.
  7604. @section colorhold
  7605. Remove all color information for all RGB colors except for certain one.
  7606. The filter accepts the following options:
  7607. @table @option
  7608. @item color
  7609. The color which will not be replaced with neutral gray.
  7610. @item similarity
  7611. Similarity percentage with the above color.
  7612. 0.01 matches only the exact key color, while 1.0 matches everything.
  7613. @item blend
  7614. Blend percentage. 0.0 makes pixels fully gray.
  7615. Higher values result in more preserved color.
  7616. @end table
  7617. @subsection Commands
  7618. This filter supports same @ref{commands} as options.
  7619. The command accepts the same syntax of the corresponding option.
  7620. If the specified expression is not valid, it is kept at its current
  7621. value.
  7622. @section colorlevels
  7623. Adjust video input frames using levels.
  7624. The filter accepts the following options:
  7625. @table @option
  7626. @item rimin
  7627. @item gimin
  7628. @item bimin
  7629. @item aimin
  7630. Adjust red, green, blue and alpha input black point.
  7631. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7632. @item rimax
  7633. @item gimax
  7634. @item bimax
  7635. @item aimax
  7636. Adjust red, green, blue and alpha input white point.
  7637. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7638. Input levels are used to lighten highlights (bright tones), darken shadows
  7639. (dark tones), change the balance of bright and dark tones.
  7640. @item romin
  7641. @item gomin
  7642. @item bomin
  7643. @item aomin
  7644. Adjust red, green, blue and alpha output black point.
  7645. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7646. @item romax
  7647. @item gomax
  7648. @item bomax
  7649. @item aomax
  7650. Adjust red, green, blue and alpha output white point.
  7651. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7652. Output levels allows manual selection of a constrained output level range.
  7653. @item preserve
  7654. Set preserve color mode. The accepted values are:
  7655. @table @samp
  7656. @item none
  7657. Disable color preserving, this is default.
  7658. @item lum
  7659. Preserve luminance.
  7660. @item max
  7661. Preserve max value of RGB triplet.
  7662. @item avg
  7663. Preserve average value of RGB triplet.
  7664. @item sum
  7665. Preserve sum value of RGB triplet.
  7666. @item nrm
  7667. Preserve normalized value of RGB triplet.
  7668. @item pwr
  7669. Preserve power value of RGB triplet.
  7670. @end table
  7671. @end table
  7672. @subsection Examples
  7673. @itemize
  7674. @item
  7675. Make video output darker:
  7676. @example
  7677. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7678. @end example
  7679. @item
  7680. Increase contrast:
  7681. @example
  7682. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7683. @end example
  7684. @item
  7685. Make video output lighter:
  7686. @example
  7687. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7688. @end example
  7689. @item
  7690. Increase brightness:
  7691. @example
  7692. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7693. @end example
  7694. @end itemize
  7695. @subsection Commands
  7696. This filter supports the all above options as @ref{commands}.
  7697. @section colormap
  7698. Apply custom color maps to video stream.
  7699. This filter needs three input video streams.
  7700. First stream is video stream that is going to be filtered out.
  7701. Second and third video stream specify color patches for source
  7702. color to target color mapping.
  7703. The filter accepts the following options:
  7704. @table @option
  7705. @item patch_size
  7706. Set the source and target video stream patch size in pixels.
  7707. @item nb_patches
  7708. Set the max number of used patches from source and target video stream.
  7709. Default value is number of patches available in additional video streams.
  7710. Max allowed number of patches is @code{64}.
  7711. @item type
  7712. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7713. Defaults is @code{absolute}.
  7714. @item kernel
  7715. Set the kernel used to measure color differences between mapped colors.
  7716. The accepted values are:
  7717. @table @samp
  7718. @item euclidean
  7719. @item weuclidean
  7720. @end table
  7721. Default is @code{euclidean}.
  7722. @end table
  7723. @section colormatrix
  7724. Convert color matrix.
  7725. The filter accepts the following options:
  7726. @table @option
  7727. @item src
  7728. @item dst
  7729. Specify the source and destination color matrix. Both values must be
  7730. specified.
  7731. The accepted values are:
  7732. @table @samp
  7733. @item bt709
  7734. BT.709
  7735. @item fcc
  7736. FCC
  7737. @item bt601
  7738. BT.601
  7739. @item bt470
  7740. BT.470
  7741. @item bt470bg
  7742. BT.470BG
  7743. @item smpte170m
  7744. SMPTE-170M
  7745. @item smpte240m
  7746. SMPTE-240M
  7747. @item bt2020
  7748. BT.2020
  7749. @end table
  7750. @end table
  7751. For example to convert from BT.601 to SMPTE-240M, use the command:
  7752. @example
  7753. colormatrix=bt601:smpte240m
  7754. @end example
  7755. @section colorspace
  7756. Convert colorspace, transfer characteristics or color primaries.
  7757. Input video needs to have an even size.
  7758. The filter accepts the following options:
  7759. @table @option
  7760. @anchor{all}
  7761. @item all
  7762. Specify all color properties at once.
  7763. The accepted values are:
  7764. @table @samp
  7765. @item bt470m
  7766. BT.470M
  7767. @item bt470bg
  7768. BT.470BG
  7769. @item bt601-6-525
  7770. BT.601-6 525
  7771. @item bt601-6-625
  7772. BT.601-6 625
  7773. @item bt709
  7774. BT.709
  7775. @item smpte170m
  7776. SMPTE-170M
  7777. @item smpte240m
  7778. SMPTE-240M
  7779. @item bt2020
  7780. BT.2020
  7781. @end table
  7782. @anchor{space}
  7783. @item space
  7784. Specify output colorspace.
  7785. The accepted values are:
  7786. @table @samp
  7787. @item bt709
  7788. BT.709
  7789. @item fcc
  7790. FCC
  7791. @item bt470bg
  7792. BT.470BG or BT.601-6 625
  7793. @item smpte170m
  7794. SMPTE-170M or BT.601-6 525
  7795. @item smpte240m
  7796. SMPTE-240M
  7797. @item ycgco
  7798. YCgCo
  7799. @item bt2020ncl
  7800. BT.2020 with non-constant luminance
  7801. @end table
  7802. @anchor{trc}
  7803. @item trc
  7804. Specify output transfer characteristics.
  7805. The accepted values are:
  7806. @table @samp
  7807. @item bt709
  7808. BT.709
  7809. @item bt470m
  7810. BT.470M
  7811. @item bt470bg
  7812. BT.470BG
  7813. @item gamma22
  7814. Constant gamma of 2.2
  7815. @item gamma28
  7816. Constant gamma of 2.8
  7817. @item smpte170m
  7818. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7819. @item smpte240m
  7820. SMPTE-240M
  7821. @item srgb
  7822. SRGB
  7823. @item iec61966-2-1
  7824. iec61966-2-1
  7825. @item iec61966-2-4
  7826. iec61966-2-4
  7827. @item xvycc
  7828. xvycc
  7829. @item bt2020-10
  7830. BT.2020 for 10-bits content
  7831. @item bt2020-12
  7832. BT.2020 for 12-bits content
  7833. @end table
  7834. @anchor{primaries}
  7835. @item primaries
  7836. Specify output color primaries.
  7837. The accepted values are:
  7838. @table @samp
  7839. @item bt709
  7840. BT.709
  7841. @item bt470m
  7842. BT.470M
  7843. @item bt470bg
  7844. BT.470BG or BT.601-6 625
  7845. @item smpte170m
  7846. SMPTE-170M or BT.601-6 525
  7847. @item smpte240m
  7848. SMPTE-240M
  7849. @item film
  7850. film
  7851. @item smpte431
  7852. SMPTE-431
  7853. @item smpte432
  7854. SMPTE-432
  7855. @item bt2020
  7856. BT.2020
  7857. @item jedec-p22
  7858. JEDEC P22 phosphors
  7859. @end table
  7860. @anchor{range}
  7861. @item range
  7862. Specify output color range.
  7863. The accepted values are:
  7864. @table @samp
  7865. @item tv
  7866. TV (restricted) range
  7867. @item mpeg
  7868. MPEG (restricted) range
  7869. @item pc
  7870. PC (full) range
  7871. @item jpeg
  7872. JPEG (full) range
  7873. @end table
  7874. @item format
  7875. Specify output color format.
  7876. The accepted values are:
  7877. @table @samp
  7878. @item yuv420p
  7879. YUV 4:2:0 planar 8-bits
  7880. @item yuv420p10
  7881. YUV 4:2:0 planar 10-bits
  7882. @item yuv420p12
  7883. YUV 4:2:0 planar 12-bits
  7884. @item yuv422p
  7885. YUV 4:2:2 planar 8-bits
  7886. @item yuv422p10
  7887. YUV 4:2:2 planar 10-bits
  7888. @item yuv422p12
  7889. YUV 4:2:2 planar 12-bits
  7890. @item yuv444p
  7891. YUV 4:4:4 planar 8-bits
  7892. @item yuv444p10
  7893. YUV 4:4:4 planar 10-bits
  7894. @item yuv444p12
  7895. YUV 4:4:4 planar 12-bits
  7896. @end table
  7897. @item fast
  7898. Do a fast conversion, which skips gamma/primary correction. This will take
  7899. significantly less CPU, but will be mathematically incorrect. To get output
  7900. compatible with that produced by the colormatrix filter, use fast=1.
  7901. @item dither
  7902. Specify dithering mode.
  7903. The accepted values are:
  7904. @table @samp
  7905. @item none
  7906. No dithering
  7907. @item fsb
  7908. Floyd-Steinberg dithering
  7909. @end table
  7910. @item wpadapt
  7911. Whitepoint adaptation mode.
  7912. The accepted values are:
  7913. @table @samp
  7914. @item bradford
  7915. Bradford whitepoint adaptation
  7916. @item vonkries
  7917. von Kries whitepoint adaptation
  7918. @item identity
  7919. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  7920. @end table
  7921. @item iall
  7922. Override all input properties at once. Same accepted values as @ref{all}.
  7923. @item ispace
  7924. Override input colorspace. Same accepted values as @ref{space}.
  7925. @item iprimaries
  7926. Override input color primaries. Same accepted values as @ref{primaries}.
  7927. @item itrc
  7928. Override input transfer characteristics. Same accepted values as @ref{trc}.
  7929. @item irange
  7930. Override input color range. Same accepted values as @ref{range}.
  7931. @end table
  7932. The filter converts the transfer characteristics, color space and color
  7933. primaries to the specified user values. The output value, if not specified,
  7934. is set to a default value based on the "all" property. If that property is
  7935. also not specified, the filter will log an error. The output color range and
  7936. format default to the same value as the input color range and format. The
  7937. input transfer characteristics, color space, color primaries and color range
  7938. should be set on the input data. If any of these are missing, the filter will
  7939. log an error and no conversion will take place.
  7940. For example to convert the input to SMPTE-240M, use the command:
  7941. @example
  7942. colorspace=smpte240m
  7943. @end example
  7944. @section colortemperature
  7945. Adjust color temperature in video to simulate variations in ambient color temperature.
  7946. The filter accepts the following options:
  7947. @table @option
  7948. @item temperature
  7949. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  7950. Default value is 6500 K.
  7951. @item mix
  7952. Set mixing with filtered output. Allowed range is from 0 to 1.
  7953. Default value is 1.
  7954. @item pl
  7955. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  7956. Default value is 0.
  7957. @end table
  7958. @subsection Commands
  7959. This filter supports same @ref{commands} as options.
  7960. @section convolution
  7961. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  7962. The filter accepts the following options:
  7963. @table @option
  7964. @item 0m
  7965. @item 1m
  7966. @item 2m
  7967. @item 3m
  7968. Set matrix for each plane.
  7969. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  7970. and from 1 to 49 odd number of signed integers in @var{row} mode.
  7971. @item 0rdiv
  7972. @item 1rdiv
  7973. @item 2rdiv
  7974. @item 3rdiv
  7975. Set multiplier for calculated value for each plane.
  7976. If unset or 0, it will be 1/sum of all matrix elements.
  7977. @item 0bias
  7978. @item 1bias
  7979. @item 2bias
  7980. @item 3bias
  7981. Set bias for each plane. This value is added to the result of the multiplication.
  7982. Useful for making the overall image brighter or darker. Default is 0.0.
  7983. @item 0mode
  7984. @item 1mode
  7985. @item 2mode
  7986. @item 3mode
  7987. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  7988. Default is @var{square}.
  7989. @end table
  7990. @subsection Commands
  7991. This filter supports the all above options as @ref{commands}.
  7992. @subsection Examples
  7993. @itemize
  7994. @item
  7995. Apply sharpen:
  7996. @example
  7997. 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"
  7998. @end example
  7999. @item
  8000. Apply blur:
  8001. @example
  8002. 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"
  8003. @end example
  8004. @item
  8005. Apply edge enhance:
  8006. @example
  8007. 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"
  8008. @end example
  8009. @item
  8010. Apply edge detect:
  8011. @example
  8012. 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"
  8013. @end example
  8014. @item
  8015. Apply laplacian edge detector which includes diagonals:
  8016. @example
  8017. 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"
  8018. @end example
  8019. @item
  8020. Apply emboss:
  8021. @example
  8022. 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"
  8023. @end example
  8024. @end itemize
  8025. @section convolve
  8026. Apply 2D convolution of video stream in frequency domain using second stream
  8027. as impulse.
  8028. The filter accepts the following options:
  8029. @table @option
  8030. @item planes
  8031. Set which planes to process.
  8032. @item impulse
  8033. Set which impulse video frames will be processed, can be @var{first}
  8034. or @var{all}. Default is @var{all}.
  8035. @end table
  8036. The @code{convolve} filter also supports the @ref{framesync} options.
  8037. @section copy
  8038. Copy the input video source unchanged to the output. This is mainly useful for
  8039. testing purposes.
  8040. @anchor{coreimage}
  8041. @section coreimage
  8042. Video filtering on GPU using Apple's CoreImage API on OSX.
  8043. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  8044. processed by video hardware. However, software-based OpenGL implementations
  8045. exist which means there is no guarantee for hardware processing. It depends on
  8046. the respective OSX.
  8047. There are many filters and image generators provided by Apple that come with a
  8048. large variety of options. The filter has to be referenced by its name along
  8049. with its options.
  8050. The coreimage filter accepts the following options:
  8051. @table @option
  8052. @item list_filters
  8053. List all available filters and generators along with all their respective
  8054. options as well as possible minimum and maximum values along with the default
  8055. values.
  8056. @example
  8057. list_filters=true
  8058. @end example
  8059. @item filter
  8060. Specify all filters by their respective name and options.
  8061. Use @var{list_filters} to determine all valid filter names and options.
  8062. Numerical options are specified by a float value and are automatically clamped
  8063. to their respective value range. Vector and color options have to be specified
  8064. by a list of space separated float values. Character escaping has to be done.
  8065. A special option name @code{default} is available to use default options for a
  8066. filter.
  8067. It is required to specify either @code{default} or at least one of the filter options.
  8068. All omitted options are used with their default values.
  8069. The syntax of the filter string is as follows:
  8070. @example
  8071. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  8072. @end example
  8073. @item output_rect
  8074. Specify a rectangle where the output of the filter chain is copied into the
  8075. input image. It is given by a list of space separated float values:
  8076. @example
  8077. output_rect=x\ y\ width\ height
  8078. @end example
  8079. If not given, the output rectangle equals the dimensions of the input image.
  8080. The output rectangle is automatically cropped at the borders of the input
  8081. image. Negative values are valid for each component.
  8082. @example
  8083. output_rect=25\ 25\ 100\ 100
  8084. @end example
  8085. @end table
  8086. Several filters can be chained for successive processing without GPU-HOST
  8087. transfers allowing for fast processing of complex filter chains.
  8088. Currently, only filters with zero (generators) or exactly one (filters) input
  8089. image and one output image are supported. Also, transition filters are not yet
  8090. usable as intended.
  8091. Some filters generate output images with additional padding depending on the
  8092. respective filter kernel. The padding is automatically removed to ensure the
  8093. filter output has the same size as the input image.
  8094. For image generators, the size of the output image is determined by the
  8095. previous output image of the filter chain or the input image of the whole
  8096. filterchain, respectively. The generators do not use the pixel information of
  8097. this image to generate their output. However, the generated output is
  8098. blended onto this image, resulting in partial or complete coverage of the
  8099. output image.
  8100. The @ref{coreimagesrc} video source can be used for generating input images
  8101. which are directly fed into the filter chain. By using it, providing input
  8102. images by another video source or an input video is not required.
  8103. @subsection Examples
  8104. @itemize
  8105. @item
  8106. List all filters available:
  8107. @example
  8108. coreimage=list_filters=true
  8109. @end example
  8110. @item
  8111. Use the CIBoxBlur filter with default options to blur an image:
  8112. @example
  8113. coreimage=filter=CIBoxBlur@@default
  8114. @end example
  8115. @item
  8116. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  8117. its center at 100x100 and a radius of 50 pixels:
  8118. @example
  8119. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  8120. @end example
  8121. @item
  8122. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  8123. given as complete and escaped command-line for Apple's standard bash shell:
  8124. @example
  8125. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  8126. @end example
  8127. @end itemize
  8128. @section corr
  8129. Obtain the correlation between two input videos.
  8130. This filter takes two input videos.
  8131. Both input videos must have the same resolution and pixel format for
  8132. this filter to work correctly. Also it assumes that both inputs
  8133. have the same number of frames, which are compared one by one.
  8134. The obtained per component, average, min and max correlation is printed through
  8135. the logging system.
  8136. The filter stores the calculated correlation of each frame in frame metadata.
  8137. This filter also supports the @ref{framesync} options.
  8138. In the below example the input file @file{main.mpg} being processed is compared
  8139. with the reference file @file{ref.mpg}.
  8140. @example
  8141. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  8142. @end example
  8143. @section cover_rect
  8144. Cover a rectangular object
  8145. It accepts the following options:
  8146. @table @option
  8147. @item cover
  8148. Filepath of the optional cover image, needs to be in yuv420.
  8149. @item mode
  8150. Set covering mode.
  8151. It accepts the following values:
  8152. @table @samp
  8153. @item cover
  8154. cover it by the supplied image
  8155. @item blur
  8156. cover it by interpolating the surrounding pixels
  8157. @end table
  8158. Default value is @var{blur}.
  8159. @end table
  8160. @subsection Examples
  8161. @itemize
  8162. @item
  8163. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8164. @example
  8165. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8166. @end example
  8167. @end itemize
  8168. @section crop
  8169. Crop the input video to given dimensions.
  8170. It accepts the following parameters:
  8171. @table @option
  8172. @item w, out_w
  8173. The width of the output video. It defaults to @code{iw}.
  8174. This expression is evaluated only once during the filter
  8175. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  8176. @item h, out_h
  8177. The height of the output video. It defaults to @code{ih}.
  8178. This expression is evaluated only once during the filter
  8179. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  8180. @item x
  8181. The horizontal position, in the input video, of the left edge of the output
  8182. video. It defaults to @code{(in_w-out_w)/2}.
  8183. This expression is evaluated per-frame.
  8184. @item y
  8185. The vertical position, in the input video, of the top edge of the output video.
  8186. It defaults to @code{(in_h-out_h)/2}.
  8187. This expression is evaluated per-frame.
  8188. @item keep_aspect
  8189. If set to 1 will force the output display aspect ratio
  8190. to be the same of the input, by changing the output sample aspect
  8191. ratio. It defaults to 0.
  8192. @item exact
  8193. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  8194. width/height/x/y as specified and will not be rounded to nearest smaller value.
  8195. It defaults to 0.
  8196. @end table
  8197. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  8198. expressions containing the following constants:
  8199. @table @option
  8200. @item x
  8201. @item y
  8202. The computed values for @var{x} and @var{y}. They are evaluated for
  8203. each new frame.
  8204. @item in_w
  8205. @item in_h
  8206. The input width and height.
  8207. @item iw
  8208. @item ih
  8209. These are the same as @var{in_w} and @var{in_h}.
  8210. @item out_w
  8211. @item out_h
  8212. The output (cropped) width and height.
  8213. @item ow
  8214. @item oh
  8215. These are the same as @var{out_w} and @var{out_h}.
  8216. @item a
  8217. same as @var{iw} / @var{ih}
  8218. @item sar
  8219. input sample aspect ratio
  8220. @item dar
  8221. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8222. @item hsub
  8223. @item vsub
  8224. horizontal and vertical chroma subsample values. For example for the
  8225. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8226. @item n
  8227. The number of the input frame, starting from 0.
  8228. @item pos
  8229. the position in the file of the input frame, NAN if unknown; deprecated,
  8230. do not use
  8231. @item t
  8232. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8233. @end table
  8234. The expression for @var{out_w} may depend on the value of @var{out_h},
  8235. and the expression for @var{out_h} may depend on @var{out_w}, but they
  8236. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  8237. evaluated after @var{out_w} and @var{out_h}.
  8238. The @var{x} and @var{y} parameters specify the expressions for the
  8239. position of the top-left corner of the output (non-cropped) area. They
  8240. are evaluated for each frame. If the evaluated value is not valid, it
  8241. is approximated to the nearest valid value.
  8242. The expression for @var{x} may depend on @var{y}, and the expression
  8243. for @var{y} may depend on @var{x}.
  8244. @subsection Examples
  8245. @itemize
  8246. @item
  8247. Crop area with size 100x100 at position (12,34).
  8248. @example
  8249. crop=100:100:12:34
  8250. @end example
  8251. Using named options, the example above becomes:
  8252. @example
  8253. crop=w=100:h=100:x=12:y=34
  8254. @end example
  8255. @item
  8256. Crop the central input area with size 100x100:
  8257. @example
  8258. crop=100:100
  8259. @end example
  8260. @item
  8261. Crop the central input area with size 2/3 of the input video:
  8262. @example
  8263. crop=2/3*in_w:2/3*in_h
  8264. @end example
  8265. @item
  8266. Crop the input video central square:
  8267. @example
  8268. crop=out_w=in_h
  8269. crop=in_h
  8270. @end example
  8271. @item
  8272. Delimit the rectangle with the top-left corner placed at position
  8273. 100:100 and the right-bottom corner corresponding to the right-bottom
  8274. corner of the input image.
  8275. @example
  8276. crop=in_w-100:in_h-100:100:100
  8277. @end example
  8278. @item
  8279. Crop 10 pixels from the left and right borders, and 20 pixels from
  8280. the top and bottom borders
  8281. @example
  8282. crop=in_w-2*10:in_h-2*20
  8283. @end example
  8284. @item
  8285. Keep only the bottom right quarter of the input image:
  8286. @example
  8287. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8288. @end example
  8289. @item
  8290. Crop height for getting Greek harmony:
  8291. @example
  8292. crop=in_w:1/PHI*in_w
  8293. @end example
  8294. @item
  8295. Apply trembling effect:
  8296. @example
  8297. 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)
  8298. @end example
  8299. @item
  8300. Apply erratic camera effect depending on timestamp:
  8301. @example
  8302. 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)
  8303. @end example
  8304. @item
  8305. Set x depending on the value of y:
  8306. @example
  8307. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8308. @end example
  8309. @end itemize
  8310. @subsection Commands
  8311. This filter supports the following commands:
  8312. @table @option
  8313. @item w, out_w
  8314. @item h, out_h
  8315. @item x
  8316. @item y
  8317. Set width/height of the output video and the horizontal/vertical position
  8318. in the input video.
  8319. The command accepts the same syntax of the corresponding option.
  8320. If the specified expression is not valid, it is kept at its current
  8321. value.
  8322. @end table
  8323. @section cropdetect
  8324. Auto-detect the crop size.
  8325. It calculates the necessary cropping parameters and prints the
  8326. recommended parameters via the logging system. The detected dimensions
  8327. correspond to the non-black or video area of the input video according to @var{mode}.
  8328. It accepts the following parameters:
  8329. @table @option
  8330. @item mode
  8331. 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.
  8332. @table @samp
  8333. @item black
  8334. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8335. @item mvedges
  8336. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8337. @end table
  8338. @item limit
  8339. Set higher black value threshold, which can be optionally specified
  8340. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8341. value greater to the set value is considered non-black. It defaults to 24.
  8342. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8343. on the bitdepth of the pixel format.
  8344. @item round
  8345. The value which the width/height should be divisible by. It defaults to
  8346. 16. The offset is automatically adjusted to center the video. Use 2 to
  8347. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8348. encoding to most video codecs.
  8349. @item skip
  8350. Set the number of initial frames for which evaluation is skipped.
  8351. Default is 2. Range is 0 to INT_MAX.
  8352. @item reset_count, reset
  8353. Set the counter that determines after how many frames cropdetect will
  8354. reset the previously detected largest video area and start over to
  8355. detect the current optimal crop area. Default value is 0.
  8356. This can be useful when channel logos distort the video area. 0
  8357. indicates 'never reset', and returns the largest area encountered during
  8358. playback.
  8359. @item mv_threshold
  8360. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8361. @item low
  8362. @item high
  8363. Set low and high threshold values used by the Canny thresholding
  8364. algorithm.
  8365. The high threshold selects the "strong" edge pixels, which are then
  8366. connected through 8-connectivity with the "weak" edge pixels selected
  8367. by the low threshold.
  8368. @var{low} and @var{high} threshold values must be chosen in the range
  8369. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8370. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8371. is @code{15/255}.
  8372. @end table
  8373. @subsection Examples
  8374. @itemize
  8375. @item
  8376. Find video area surrounded by black borders:
  8377. @example
  8378. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8379. @end example
  8380. @item
  8381. Find an embedded video area, generate motion vectors beforehand:
  8382. @example
  8383. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8384. @end example
  8385. @item
  8386. Find an embedded video area, use motion vectors from decoder:
  8387. @example
  8388. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8389. @end example
  8390. @end itemize
  8391. @subsection Commands
  8392. This filter supports the following commands:
  8393. @table @option
  8394. @item limit
  8395. The command accepts the same syntax of the corresponding option.
  8396. If the specified expression is not valid, it is kept at its current value.
  8397. @end table
  8398. @anchor{cue}
  8399. @section cue
  8400. Delay video filtering until a given wallclock timestamp. The filter first
  8401. passes on @option{preroll} amount of frames, then it buffers at most
  8402. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8403. it forwards the buffered frames and also any subsequent frames coming in its
  8404. input.
  8405. The filter can be used synchronize the output of multiple ffmpeg processes for
  8406. realtime output devices like decklink. By putting the delay in the filtering
  8407. chain and pre-buffering frames the process can pass on data to output almost
  8408. immediately after the target wallclock timestamp is reached.
  8409. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8410. some use cases.
  8411. @table @option
  8412. @item cue
  8413. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8414. @item preroll
  8415. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8416. @item buffer
  8417. The maximum duration of content to buffer before waiting for the cue expressed
  8418. in seconds. Default is 0.
  8419. @end table
  8420. @anchor{curves}
  8421. @section curves
  8422. Apply color adjustments using curves.
  8423. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8424. component (red, green and blue) has its values defined by @var{N} key points
  8425. tied from each other using a smooth curve. The x-axis represents the pixel
  8426. values from the input frame, and the y-axis the new pixel values to be set for
  8427. the output frame.
  8428. By default, a component curve is defined by the two points @var{(0;0)} and
  8429. @var{(1;1)}. This creates a straight line where each original pixel value is
  8430. "adjusted" to its own value, which means no change to the image.
  8431. The filter allows you to redefine these two points and add some more. A new
  8432. curve will be defined to pass smoothly through all these new coordinates. The
  8433. new defined points need to be strictly increasing over the x-axis, and their
  8434. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8435. formed by using a natural or monotonic cubic spline interpolation, depending
  8436. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8437. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8438. spline guarantees the transitions between the specified points to be
  8439. monotonic. If the computed curves happened to go outside the vector spaces,
  8440. the values will be clipped accordingly.
  8441. The filter accepts the following options:
  8442. @table @option
  8443. @item preset
  8444. Select one of the available color presets. This option can be used in addition
  8445. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8446. options takes priority on the preset values.
  8447. Available presets are:
  8448. @table @samp
  8449. @item none
  8450. @item color_negative
  8451. @item cross_process
  8452. @item darker
  8453. @item increase_contrast
  8454. @item lighter
  8455. @item linear_contrast
  8456. @item medium_contrast
  8457. @item negative
  8458. @item strong_contrast
  8459. @item vintage
  8460. @end table
  8461. Default is @code{none}.
  8462. @item master, m
  8463. Set the master key points. These points will define a second pass mapping. It
  8464. is sometimes called a "luminance" or "value" mapping. It can be used with
  8465. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8466. post-processing LUT.
  8467. @item red, r
  8468. Set the key points for the red component.
  8469. @item green, g
  8470. Set the key points for the green component.
  8471. @item blue, b
  8472. Set the key points for the blue component.
  8473. @item all
  8474. Set the key points for all components (not including master).
  8475. Can be used in addition to the other key points component
  8476. options. In this case, the unset component(s) will fallback on this
  8477. @option{all} setting.
  8478. @item psfile
  8479. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8480. @item plot
  8481. Save Gnuplot script of the curves in specified file.
  8482. @item interp
  8483. Specify the kind of interpolation. Available algorithms are:
  8484. @table @samp
  8485. @item natural
  8486. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8487. @item pchip
  8488. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8489. @end table
  8490. @end table
  8491. To avoid some filtergraph syntax conflicts, each key points list need to be
  8492. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8493. @subsection Commands
  8494. This filter supports same @ref{commands} as options.
  8495. @subsection Examples
  8496. @itemize
  8497. @item
  8498. Increase slightly the middle level of blue:
  8499. @example
  8500. curves=blue='0/0 0.5/0.58 1/1'
  8501. @end example
  8502. @item
  8503. Vintage effect:
  8504. @example
  8505. 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'
  8506. @end example
  8507. Here we obtain the following coordinates for each components:
  8508. @table @var
  8509. @item red
  8510. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8511. @item green
  8512. @code{(0;0) (0.50;0.48) (1;1)}
  8513. @item blue
  8514. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8515. @end table
  8516. @item
  8517. The previous example can also be achieved with the associated built-in preset:
  8518. @example
  8519. curves=preset=vintage
  8520. @end example
  8521. @item
  8522. Or simply:
  8523. @example
  8524. curves=vintage
  8525. @end example
  8526. @item
  8527. Use a Photoshop preset and redefine the points of the green component:
  8528. @example
  8529. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8530. @end example
  8531. @item
  8532. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8533. and @command{gnuplot}:
  8534. @example
  8535. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8536. gnuplot -p /tmp/curves.plt
  8537. @end example
  8538. @end itemize
  8539. @section datascope
  8540. Video data analysis filter.
  8541. This filter shows hexadecimal pixel values of part of video.
  8542. The filter accepts the following options:
  8543. @table @option
  8544. @item size, s
  8545. Set output video size.
  8546. @item x
  8547. Set x offset from where to pick pixels.
  8548. @item y
  8549. Set y offset from where to pick pixels.
  8550. @item mode
  8551. Set scope mode, can be one of the following:
  8552. @table @samp
  8553. @item mono
  8554. Draw hexadecimal pixel values with white color on black background.
  8555. @item color
  8556. Draw hexadecimal pixel values with input video pixel color on black
  8557. background.
  8558. @item color2
  8559. Draw hexadecimal pixel values on color background picked from input video,
  8560. the text color is picked in such way so its always visible.
  8561. @end table
  8562. @item axis
  8563. Draw rows and columns numbers on left and top of video.
  8564. @item opacity
  8565. Set background opacity.
  8566. @item format
  8567. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8568. @item components
  8569. Set pixel components to display. By default all pixel components are displayed.
  8570. @end table
  8571. @subsection Commands
  8572. This filter supports same @ref{commands} as options excluding @code{size} option.
  8573. @section dblur
  8574. Apply Directional blur filter.
  8575. The filter accepts the following options:
  8576. @table @option
  8577. @item angle
  8578. Set angle of directional blur. Default is @code{45}.
  8579. @item radius
  8580. Set radius of directional blur. Default is @code{5}.
  8581. @item planes
  8582. Set which planes to filter. By default all planes are filtered.
  8583. @end table
  8584. @subsection Commands
  8585. This filter supports same @ref{commands} as options.
  8586. The command accepts the same syntax of the corresponding option.
  8587. If the specified expression is not valid, it is kept at its current
  8588. value.
  8589. @section dctdnoiz
  8590. Denoise frames using 2D DCT (frequency domain filtering).
  8591. This filter is not designed for real time.
  8592. The filter accepts the following options:
  8593. @table @option
  8594. @item sigma, s
  8595. Set the noise sigma constant.
  8596. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8597. coefficient (absolute value) below this threshold with be dropped.
  8598. If you need a more advanced filtering, see @option{expr}.
  8599. Default is @code{0}.
  8600. @item overlap
  8601. Set number overlapping pixels for each block. Since the filter can be slow, you
  8602. may want to reduce this value, at the cost of a less effective filter and the
  8603. risk of various artefacts.
  8604. If the overlapping value doesn't permit processing the whole input width or
  8605. height, a warning will be displayed and according borders won't be denoised.
  8606. Default value is @var{blocksize}-1, which is the best possible setting.
  8607. @item expr, e
  8608. Set the coefficient factor expression.
  8609. For each coefficient of a DCT block, this expression will be evaluated as a
  8610. multiplier value for the coefficient.
  8611. If this is option is set, the @option{sigma} option will be ignored.
  8612. The absolute value of the coefficient can be accessed through the @var{c}
  8613. variable.
  8614. @item n
  8615. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8616. @var{blocksize}, which is the width and height of the processed blocks.
  8617. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8618. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8619. on the speed processing. Also, a larger block size does not necessarily means a
  8620. better de-noising.
  8621. @end table
  8622. @subsection Examples
  8623. Apply a denoise with a @option{sigma} of @code{4.5}:
  8624. @example
  8625. dctdnoiz=4.5
  8626. @end example
  8627. The same operation can be achieved using the expression system:
  8628. @example
  8629. dctdnoiz=e='gte(c, 4.5*3)'
  8630. @end example
  8631. Violent denoise using a block size of @code{16x16}:
  8632. @example
  8633. dctdnoiz=15:n=4
  8634. @end example
  8635. @section deband
  8636. Remove banding artifacts from input video.
  8637. It works by replacing banded pixels with average value of referenced pixels.
  8638. The filter accepts the following options:
  8639. @table @option
  8640. @item 1thr
  8641. @item 2thr
  8642. @item 3thr
  8643. @item 4thr
  8644. Set banding detection threshold for each plane. Default is 0.02.
  8645. Valid range is 0.00003 to 0.5.
  8646. If difference between current pixel and reference pixel is less than threshold,
  8647. it will be considered as banded.
  8648. @item range, r
  8649. Banding detection range in pixels. Default is 16. If positive, random number
  8650. in range 0 to set value will be used. If negative, exact absolute value
  8651. will be used.
  8652. The range defines square of four pixels around current pixel.
  8653. @item direction, d
  8654. Set direction in radians from which four pixel will be compared. If positive,
  8655. random direction from 0 to set direction will be picked. If negative, exact of
  8656. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8657. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8658. column.
  8659. @item blur, b
  8660. If enabled, current pixel is compared with average value of all four
  8661. surrounding pixels. The default is enabled. If disabled current pixel is
  8662. compared with all four surrounding pixels. The pixel is considered banded
  8663. if only all four differences with surrounding pixels are less than threshold.
  8664. @item coupling, c
  8665. If enabled, current pixel is changed if and only if all pixel components are banded,
  8666. e.g. banding detection threshold is triggered for all color components.
  8667. The default is disabled.
  8668. @end table
  8669. @subsection Commands
  8670. This filter supports the all above options as @ref{commands}.
  8671. @section deblock
  8672. Remove blocking artifacts from input video.
  8673. The filter accepts the following options:
  8674. @table @option
  8675. @item filter
  8676. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8677. This controls what kind of deblocking is applied.
  8678. @item block
  8679. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8680. @item alpha
  8681. @item beta
  8682. @item gamma
  8683. @item delta
  8684. Set blocking detection thresholds. Allowed range is 0 to 1.
  8685. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8686. Using higher threshold gives more deblocking strength.
  8687. Setting @var{alpha} controls threshold detection at exact edge of block.
  8688. Remaining options controls threshold detection near the edge. Each one for
  8689. below/above or left/right. Setting any of those to @var{0} disables
  8690. deblocking.
  8691. @item planes
  8692. Set planes to filter. Default is to filter all available planes.
  8693. @end table
  8694. @subsection Examples
  8695. @itemize
  8696. @item
  8697. Deblock using weak filter and block size of 4 pixels.
  8698. @example
  8699. deblock=filter=weak:block=4
  8700. @end example
  8701. @item
  8702. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8703. deblocking more edges.
  8704. @example
  8705. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8706. @end example
  8707. @item
  8708. Similar as above, but filter only first plane.
  8709. @example
  8710. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8711. @end example
  8712. @item
  8713. Similar as above, but filter only second and third plane.
  8714. @example
  8715. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8716. @end example
  8717. @end itemize
  8718. @subsection Commands
  8719. This filter supports the all above options as @ref{commands}.
  8720. @anchor{decimate}
  8721. @section decimate
  8722. Drop duplicated frames at regular intervals.
  8723. The filter accepts the following options:
  8724. @table @option
  8725. @item cycle
  8726. Set the number of frames from which one will be dropped. Setting this to
  8727. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8728. Default is @code{5}.
  8729. @item dupthresh
  8730. Set the threshold for duplicate detection. If the difference metric for a frame
  8731. is less than or equal to this value, then it is declared as duplicate. Default
  8732. is @code{1.1}
  8733. @item scthresh
  8734. Set scene change threshold. Default is @code{15}.
  8735. @item blockx
  8736. @item blocky
  8737. Set the size of the x and y-axis blocks used during metric calculations.
  8738. Larger blocks give better noise suppression, but also give worse detection of
  8739. small movements. Must be a power of two. Default is @code{32}.
  8740. @item ppsrc
  8741. Mark main input as a pre-processed input and activate clean source input
  8742. stream. This allows the input to be pre-processed with various filters to help
  8743. the metrics calculation while keeping the frame selection lossless. When set to
  8744. @code{1}, the first stream is for the pre-processed input, and the second
  8745. stream is the clean source from where the kept frames are chosen. Default is
  8746. @code{0}.
  8747. @item chroma
  8748. Set whether or not chroma is considered in the metric calculations. Default is
  8749. @code{1}.
  8750. @item mixed
  8751. Set whether or not the input only partially contains content to be decimated.
  8752. Default is @code{false}.
  8753. If enabled video output stream will be in variable frame rate.
  8754. @end table
  8755. @section deconvolve
  8756. Apply 2D deconvolution of video stream in frequency domain using second stream
  8757. as impulse.
  8758. The filter accepts the following options:
  8759. @table @option
  8760. @item planes
  8761. Set which planes to process.
  8762. @item impulse
  8763. Set which impulse video frames will be processed, can be @var{first}
  8764. or @var{all}. Default is @var{all}.
  8765. @item noise
  8766. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8767. and height are not same and not power of 2 or if stream prior to convolving
  8768. had noise.
  8769. @end table
  8770. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8771. @section dedot
  8772. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8773. It accepts the following options:
  8774. @table @option
  8775. @item m
  8776. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8777. @var{rainbows} for cross-color reduction.
  8778. @item lt
  8779. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8780. @item tl
  8781. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8782. @item tc
  8783. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8784. @item ct
  8785. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8786. @end table
  8787. @section deflate
  8788. Apply deflate effect to the video.
  8789. This filter replaces the pixel by the local(3x3) average by taking into account
  8790. only values lower than the pixel.
  8791. It accepts the following options:
  8792. @table @option
  8793. @item threshold0
  8794. @item threshold1
  8795. @item threshold2
  8796. @item threshold3
  8797. Limit the maximum change for each plane, default is 65535.
  8798. If 0, plane will remain unchanged.
  8799. @end table
  8800. @subsection Commands
  8801. This filter supports the all above options as @ref{commands}.
  8802. @section deflicker
  8803. Remove temporal frame luminance variations.
  8804. It accepts the following options:
  8805. @table @option
  8806. @item size, s
  8807. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8808. @item mode, m
  8809. Set averaging mode to smooth temporal luminance variations.
  8810. Available values are:
  8811. @table @samp
  8812. @item am
  8813. Arithmetic mean
  8814. @item gm
  8815. Geometric mean
  8816. @item hm
  8817. Harmonic mean
  8818. @item qm
  8819. Quadratic mean
  8820. @item cm
  8821. Cubic mean
  8822. @item pm
  8823. Power mean
  8824. @item median
  8825. Median
  8826. @end table
  8827. @item bypass
  8828. Do not actually modify frame. Useful when one only wants metadata.
  8829. @end table
  8830. @section dejudder
  8831. Remove judder produced by partially interlaced telecined content.
  8832. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8833. source was partially telecined content then the output of @code{pullup,dejudder}
  8834. will have a variable frame rate. May change the recorded frame rate of the
  8835. container. Aside from that change, this filter will not affect constant frame
  8836. rate video.
  8837. The option available in this filter is:
  8838. @table @option
  8839. @item cycle
  8840. Specify the length of the window over which the judder repeats.
  8841. Accepts any integer greater than 1. Useful values are:
  8842. @table @samp
  8843. @item 4
  8844. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8845. @item 5
  8846. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8847. @item 20
  8848. If a mixture of the two.
  8849. @end table
  8850. The default is @samp{4}.
  8851. @end table
  8852. @section delogo
  8853. Suppress a TV station logo by a simple interpolation of the surrounding
  8854. pixels. Just set a rectangle covering the logo and watch it disappear
  8855. (and sometimes something even uglier appear - your mileage may vary).
  8856. It accepts the following parameters:
  8857. @table @option
  8858. @item x
  8859. @item y
  8860. Specify the top left corner coordinates of the logo. They must be
  8861. specified.
  8862. @item w
  8863. @item h
  8864. Specify the width and height of the logo to clear. They must be
  8865. specified.
  8866. @item show
  8867. When set to 1, a green rectangle is drawn on the screen to simplify
  8868. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8869. The default value is 0.
  8870. The rectangle is drawn on the outermost pixels which will be (partly)
  8871. replaced with interpolated values. The values of the next pixels
  8872. immediately outside this rectangle in each direction will be used to
  8873. compute the interpolated pixel values inside the rectangle.
  8874. @end table
  8875. @subsection Examples
  8876. @itemize
  8877. @item
  8878. Set a rectangle covering the area with top left corner coordinates 0,0
  8879. and size 100x77:
  8880. @example
  8881. delogo=x=0:y=0:w=100:h=77
  8882. @end example
  8883. @end itemize
  8884. @anchor{derain}
  8885. @section derain
  8886. Remove the rain in the input image/video by applying the derain methods based on
  8887. convolutional neural networks. Supported models:
  8888. @itemize
  8889. @item
  8890. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8891. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8892. @end itemize
  8893. Training as well as model generation scripts are provided in
  8894. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8895. The filter accepts the following options:
  8896. @table @option
  8897. @item filter_type
  8898. Specify which filter to use. This option accepts the following values:
  8899. @table @samp
  8900. @item derain
  8901. Derain filter. To conduct derain filter, you need to use a derain model.
  8902. @item dehaze
  8903. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  8904. @end table
  8905. Default value is @samp{derain}.
  8906. @item dnn_backend
  8907. Specify which DNN backend to use for model loading and execution. This option accepts
  8908. the following values:
  8909. @table @samp
  8910. @item tensorflow
  8911. TensorFlow backend. To enable this backend you
  8912. need to install the TensorFlow for C library (see
  8913. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  8914. @code{--enable-libtensorflow}
  8915. @end table
  8916. @item model
  8917. Set path to model file specifying network architecture and its parameters.
  8918. Note that different backends use different file formats. TensorFlow can load files for only its format.
  8919. @end table
  8920. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  8921. @section deshake
  8922. Attempt to fix small changes in horizontal and/or vertical shift. This
  8923. filter helps remove camera shake from hand-holding a camera, bumping a
  8924. tripod, moving on a vehicle, etc.
  8925. The filter accepts the following options:
  8926. @table @option
  8927. @item x
  8928. @item y
  8929. @item w
  8930. @item h
  8931. Specify a rectangular area where to limit the search for motion
  8932. vectors.
  8933. If desired the search for motion vectors can be limited to a
  8934. rectangular area of the frame defined by its top left corner, width
  8935. and height. These parameters have the same meaning as the drawbox
  8936. filter which can be used to visualise the position of the bounding
  8937. box.
  8938. This is useful when simultaneous movement of subjects within the frame
  8939. might be confused for camera motion by the motion vector search.
  8940. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  8941. then the full frame is used. This allows later options to be set
  8942. without specifying the bounding box for the motion vector search.
  8943. Default - search the whole frame.
  8944. @item rx
  8945. @item ry
  8946. Specify the maximum extent of movement in x and y directions in the
  8947. range 0-64 pixels. Default 16.
  8948. @item edge
  8949. Specify how to generate pixels to fill blanks at the edge of the
  8950. frame. Available values are:
  8951. @table @samp
  8952. @item blank, 0
  8953. Fill zeroes at blank locations
  8954. @item original, 1
  8955. Original image at blank locations
  8956. @item clamp, 2
  8957. Extruded edge value at blank locations
  8958. @item mirror, 3
  8959. Mirrored edge at blank locations
  8960. @end table
  8961. Default value is @samp{mirror}.
  8962. @item blocksize
  8963. Specify the blocksize to use for motion search. Range 4-128 pixels,
  8964. default 8.
  8965. @item contrast
  8966. Specify the contrast threshold for blocks. Only blocks with more than
  8967. the specified contrast (difference between darkest and lightest
  8968. pixels) will be considered. Range 1-255, default 125.
  8969. @item search
  8970. Specify the search strategy. Available values are:
  8971. @table @samp
  8972. @item exhaustive, 0
  8973. Set exhaustive search
  8974. @item less, 1
  8975. Set less exhaustive search.
  8976. @end table
  8977. Default value is @samp{exhaustive}.
  8978. @item filename
  8979. If set then a detailed log of the motion search is written to the
  8980. specified file.
  8981. @end table
  8982. @section despill
  8983. Remove unwanted contamination of foreground colors, caused by reflected color of
  8984. greenscreen or bluescreen.
  8985. This filter accepts the following options:
  8986. @table @option
  8987. @item type
  8988. Set what type of despill to use.
  8989. @item mix
  8990. Set how spillmap will be generated.
  8991. @item expand
  8992. Set how much to get rid of still remaining spill.
  8993. @item red
  8994. Controls amount of red in spill area.
  8995. @item green
  8996. Controls amount of green in spill area.
  8997. Should be -1 for greenscreen.
  8998. @item blue
  8999. Controls amount of blue in spill area.
  9000. Should be -1 for bluescreen.
  9001. @item brightness
  9002. Controls brightness of spill area, preserving colors.
  9003. @item alpha
  9004. Modify alpha from generated spillmap.
  9005. @end table
  9006. @subsection Commands
  9007. This filter supports the all above options as @ref{commands}.
  9008. @section detelecine
  9009. Apply an exact inverse of the telecine operation. It requires a predefined
  9010. pattern specified using the pattern option which must be the same as that passed
  9011. to the telecine filter.
  9012. This filter accepts the following options:
  9013. @table @option
  9014. @item first_field
  9015. @table @samp
  9016. @item top, t
  9017. top field first
  9018. @item bottom, b
  9019. bottom field first
  9020. The default value is @code{top}.
  9021. @end table
  9022. @item pattern
  9023. A string of numbers representing the pulldown pattern you wish to apply.
  9024. The default value is @code{23}.
  9025. @item start_frame
  9026. A number representing position of the first frame with respect to the telecine
  9027. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  9028. @end table
  9029. @anchor{dilation}
  9030. @section dilation
  9031. Apply dilation effect to the video.
  9032. This filter replaces the pixel by the local(3x3) maximum.
  9033. It accepts the following options:
  9034. @table @option
  9035. @item threshold0
  9036. @item threshold1
  9037. @item threshold2
  9038. @item threshold3
  9039. Limit the maximum change for each plane, default is 65535.
  9040. If 0, plane will remain unchanged.
  9041. @item coordinates
  9042. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9043. pixels are used.
  9044. Flags to local 3x3 coordinates maps like this:
  9045. 1 2 3
  9046. 4 5
  9047. 6 7 8
  9048. @end table
  9049. @subsection Commands
  9050. This filter supports the all above options as @ref{commands}.
  9051. @section displace
  9052. Displace pixels as indicated by second and third input stream.
  9053. It takes three input streams and outputs one stream, the first input is the
  9054. source, and second and third input are displacement maps.
  9055. The second input specifies how much to displace pixels along the
  9056. x-axis, while the third input specifies how much to displace pixels
  9057. along the y-axis.
  9058. If one of displacement map streams terminates, last frame from that
  9059. displacement map will be used.
  9060. Note that once generated, displacements maps can be reused over and over again.
  9061. A description of the accepted options follows.
  9062. @table @option
  9063. @item edge
  9064. Set displace behavior for pixels that are out of range.
  9065. Available values are:
  9066. @table @samp
  9067. @item blank
  9068. Missing pixels are replaced by black pixels.
  9069. @item smear
  9070. Adjacent pixels will spread out to replace missing pixels.
  9071. @item wrap
  9072. Out of range pixels are wrapped so they point to pixels of other side.
  9073. @item mirror
  9074. Out of range pixels will be replaced with mirrored pixels.
  9075. @end table
  9076. Default is @samp{smear}.
  9077. @end table
  9078. @subsection Examples
  9079. @itemize
  9080. @item
  9081. Add ripple effect to rgb input of video size hd720:
  9082. @example
  9083. 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
  9084. @end example
  9085. @item
  9086. Add wave effect to rgb input of video size hd720:
  9087. @example
  9088. 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
  9089. @end example
  9090. @end itemize
  9091. @section dnn_classify
  9092. Do classification with deep neural networks based on bounding boxes.
  9093. The filter accepts the following options:
  9094. @table @option
  9095. @item dnn_backend
  9096. Specify which DNN backend to use for model loading and execution. This option accepts
  9097. only openvino now, tensorflow backends will be added.
  9098. @item model
  9099. Set path to model file specifying network architecture and its parameters.
  9100. Note that different backends use different file formats.
  9101. @item input
  9102. Set the input name of the dnn network.
  9103. @item output
  9104. Set the output name of the dnn network.
  9105. @item confidence
  9106. Set the confidence threshold (default: 0.5).
  9107. @item labels
  9108. Set path to label file specifying the mapping between label id and name.
  9109. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9110. The first line is the name of label id 0,
  9111. and the second line is the name of label id 1, etc.
  9112. The label id is considered as name if the label file is not provided.
  9113. @item backend_configs
  9114. Set the configs to be passed into backend
  9115. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9116. please use tools/python/tf_sess_config.py to get the configs for your system.
  9117. @end table
  9118. @section dnn_detect
  9119. Do object detection with deep neural networks.
  9120. The filter accepts the following options:
  9121. @table @option
  9122. @item dnn_backend
  9123. Specify which DNN backend to use for model loading and execution. This option accepts
  9124. only openvino now, tensorflow backends will be added.
  9125. @item model
  9126. Set path to model file specifying network architecture and its parameters.
  9127. Note that different backends use different file formats.
  9128. @item input
  9129. Set the input name of the dnn network.
  9130. @item output
  9131. Set the output name of the dnn network.
  9132. @item confidence
  9133. Set the confidence threshold (default: 0.5).
  9134. @item labels
  9135. Set path to label file specifying the mapping between label id and name.
  9136. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9137. The first line is the name of label id 0 (usually it is 'background'),
  9138. and the second line is the name of label id 1, etc.
  9139. The label id is considered as name if the label file is not provided.
  9140. @item backend_configs
  9141. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9142. Roll back to sync execution if the backend does not support async.
  9143. @end table
  9144. @anchor{dnn_processing}
  9145. @section dnn_processing
  9146. Do image processing with deep neural networks. It works together with another filter
  9147. which converts the pixel format of the Frame to what the dnn network requires.
  9148. The filter accepts the following options:
  9149. @table @option
  9150. @item dnn_backend
  9151. Specify which DNN backend to use for model loading and execution. This option accepts
  9152. the following values:
  9153. @table @samp
  9154. @item tensorflow
  9155. TensorFlow backend. To enable this backend you
  9156. need to install the TensorFlow for C library (see
  9157. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  9158. @code{--enable-libtensorflow}
  9159. @item openvino
  9160. OpenVINO backend. To enable this backend you
  9161. need to build and install the OpenVINO for C library (see
  9162. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  9163. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  9164. be needed if the header files and libraries are not installed into system path)
  9165. @item torch
  9166. Libtorch backend. To enable this backend you need to build and install Libtroch
  9167. for C++ library. Please download cxx11 ABI version (see
  9168. @url{https://pytorch.org/get-started/locally})
  9169. and configure FFmpeg with @code{--enable-libtorch
  9170. --extra-cflags=-I/libtorch_root/libtorch/include
  9171. --extra-cflags=-I/libtorch_root/libtorch/include/torch/csrc/api/include
  9172. --extra-ldflags=-L/libtorch_root/libtorch/lib/}
  9173. @end table
  9174. @item model
  9175. Set path to model file specifying network architecture and its parameters.
  9176. Note that different backends use different file formats. TensorFlow, OpenVINO
  9177. and Libtorch backend can load files for only its format.
  9178. @item input
  9179. Set the input name of the dnn network.
  9180. @item output
  9181. Set the output name of the dnn network.
  9182. @item backend_configs
  9183. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9184. Roll back to sync execution if the backend does not support async.
  9185. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9186. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9187. @end table
  9188. @subsection Examples
  9189. @itemize
  9190. @item
  9191. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  9192. @example
  9193. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  9194. @end example
  9195. @item
  9196. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  9197. @example
  9198. ./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
  9199. @end example
  9200. @item
  9201. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  9202. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9203. @example
  9204. ./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
  9205. @end example
  9206. @end itemize
  9207. @section drawbox
  9208. Draw a colored box on the input image.
  9209. It accepts the following parameters:
  9210. @table @option
  9211. @item x
  9212. @item y
  9213. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  9214. @item width, w
  9215. @item height, h
  9216. The expressions which specify the width and height of the box; if 0 they are interpreted as
  9217. the input width and height. It defaults to 0.
  9218. @item color, c
  9219. Specify the color of the box to write. For the general syntax of this option,
  9220. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9221. value @code{invert} is used, the box edge color is the same as the
  9222. video with inverted luma.
  9223. @item thickness, t
  9224. The expression which sets the thickness of the box edge.
  9225. A value of @code{fill} will create a filled box. Default value is @code{3}.
  9226. See below for the list of accepted constants.
  9227. @item replace
  9228. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  9229. will overwrite the video's color and alpha pixels.
  9230. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  9231. @end table
  9232. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9233. following constants:
  9234. @table @option
  9235. @item dar
  9236. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9237. @item hsub
  9238. @item vsub
  9239. horizontal and vertical chroma subsample values. For example for the
  9240. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9241. @item in_h, ih
  9242. @item in_w, iw
  9243. The input width and height.
  9244. @item sar
  9245. The input sample aspect ratio.
  9246. @item x
  9247. @item y
  9248. The x and y offset coordinates where the box is drawn.
  9249. @item w
  9250. @item h
  9251. The width and height of the drawn box.
  9252. @item box_source
  9253. Box source can be set as side_data_detection_bboxes if you want to use box data in
  9254. detection bboxes of side data.
  9255. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  9256. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  9257. not sure about the box source.
  9258. @item t
  9259. The thickness of the drawn box.
  9260. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9261. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9262. @end table
  9263. @subsection Examples
  9264. @itemize
  9265. @item
  9266. Draw a black box around the edge of the input image:
  9267. @example
  9268. drawbox
  9269. @end example
  9270. @item
  9271. Draw a box with color red and an opacity of 50%:
  9272. @example
  9273. drawbox=10:20:200:60:red@@0.5
  9274. @end example
  9275. The previous example can be specified as:
  9276. @example
  9277. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9278. @end example
  9279. @item
  9280. Fill the box with pink color:
  9281. @example
  9282. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9283. @end example
  9284. @item
  9285. Draw a 2-pixel red 2.40:1 mask:
  9286. @example
  9287. 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
  9288. @end example
  9289. @end itemize
  9290. @subsection Commands
  9291. This filter supports same commands as options.
  9292. The command accepts the same syntax of the corresponding option.
  9293. If the specified expression is not valid, it is kept at its current
  9294. value.
  9295. @anchor{drawgraph}
  9296. @section drawgraph
  9297. Draw a graph using input video metadata.
  9298. It accepts the following parameters:
  9299. @table @option
  9300. @item m1
  9301. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9302. @item fg1
  9303. Set 1st foreground color expression.
  9304. @item m2
  9305. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9306. @item fg2
  9307. Set 2nd foreground color expression.
  9308. @item m3
  9309. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9310. @item fg3
  9311. Set 3rd foreground color expression.
  9312. @item m4
  9313. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9314. @item fg4
  9315. Set 4th foreground color expression.
  9316. @item min
  9317. Set minimal value of metadata value.
  9318. @item max
  9319. Set maximal value of metadata value.
  9320. @item bg
  9321. Set graph background color. Default is white.
  9322. @item mode
  9323. Set graph mode.
  9324. Available values for mode is:
  9325. @table @samp
  9326. @item bar
  9327. @item dot
  9328. @item line
  9329. @end table
  9330. Default is @code{line}.
  9331. @item slide
  9332. Set slide mode.
  9333. Available values for slide is:
  9334. @table @samp
  9335. @item frame
  9336. Draw new frame when right border is reached.
  9337. @item replace
  9338. Replace old columns with new ones.
  9339. @item scroll
  9340. Scroll from right to left.
  9341. @item rscroll
  9342. Scroll from left to right.
  9343. @item picture
  9344. Draw single picture.
  9345. @end table
  9346. Default is @code{frame}.
  9347. @item size
  9348. Set size of graph video. For the syntax of this option, check the
  9349. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9350. The default value is @code{900x256}.
  9351. @item rate, r
  9352. Set the output frame rate. Default value is @code{25}.
  9353. The foreground color expressions can use the following variables:
  9354. @table @option
  9355. @item MIN
  9356. Minimal value of metadata value.
  9357. @item MAX
  9358. Maximal value of metadata value.
  9359. @item VAL
  9360. Current metadata key value.
  9361. @end table
  9362. The color is defined as 0xAABBGGRR.
  9363. @end table
  9364. Example using metadata from @ref{signalstats} filter:
  9365. @example
  9366. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9367. @end example
  9368. Example using metadata from @ref{ebur128} filter:
  9369. @example
  9370. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9371. @end example
  9372. @section drawgrid
  9373. Draw a grid on the input image.
  9374. It accepts the following parameters:
  9375. @table @option
  9376. @item x
  9377. @item y
  9378. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9379. @item width, w
  9380. @item height, h
  9381. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9382. input width and height, respectively, minus @code{thickness}, so image gets
  9383. framed. Default to 0.
  9384. @item color, c
  9385. Specify the color of the grid. For the general syntax of this option,
  9386. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9387. value @code{invert} is used, the grid color is the same as the
  9388. video with inverted luma.
  9389. @item thickness, t
  9390. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9391. See below for the list of accepted constants.
  9392. @item replace
  9393. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9394. will overwrite the video's color and alpha pixels.
  9395. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9396. @end table
  9397. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9398. following constants:
  9399. @table @option
  9400. @item dar
  9401. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9402. @item hsub
  9403. @item vsub
  9404. horizontal and vertical chroma subsample values. For example for the
  9405. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9406. @item in_h, ih
  9407. @item in_w, iw
  9408. The input grid cell width and height.
  9409. @item sar
  9410. The input sample aspect ratio.
  9411. @item x
  9412. @item y
  9413. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9414. @item w
  9415. @item h
  9416. The width and height of the drawn cell.
  9417. @item t
  9418. The thickness of the drawn cell.
  9419. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9420. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9421. @end table
  9422. @subsection Examples
  9423. @itemize
  9424. @item
  9425. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9426. @example
  9427. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9428. @end example
  9429. @item
  9430. Draw a white 3x3 grid with an opacity of 50%:
  9431. @example
  9432. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9433. @end example
  9434. @end itemize
  9435. @subsection Commands
  9436. This filter supports same commands as options.
  9437. The command accepts the same syntax of the corresponding option.
  9438. If the specified expression is not valid, it is kept at its current
  9439. value.
  9440. @anchor{drawtext}
  9441. @section drawtext
  9442. Draw a text string or text from a specified file on top of a video, using the
  9443. libfreetype library.
  9444. To enable compilation of this filter, you need to configure FFmpeg with
  9445. @code{--enable-libfreetype} and @code{--enable-libharfbuzz}.
  9446. To enable default font fallback and the @var{font} option you need to
  9447. configure FFmpeg with @code{--enable-libfontconfig}.
  9448. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9449. @code{--enable-libfribidi}.
  9450. @subsection Syntax
  9451. It accepts the following parameters:
  9452. @table @option
  9453. @item box
  9454. Used to draw a box around text using the background color.
  9455. The value must be either 1 (enable) or 0 (disable).
  9456. The default value of @var{box} is 0.
  9457. @item boxborderw
  9458. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9459. The value must be specified using one of the following formats:
  9460. @itemize @bullet
  9461. @item @code{boxborderw=10} set the width of all the borders to 10
  9462. @item @code{boxborderw=10|20} set the width of the top and bottom borders to 10
  9463. and the width of the left and right borders to 20
  9464. @item @code{boxborderw=10|20|30} set the width of the top border to 10, the width
  9465. of the bottom border to 30 and the width of the left and right borders to 20
  9466. @item @code{boxborderw=10|20|30|40} set the borders width to 10 (top), 20 (right),
  9467. 30 (bottom), 40 (left)
  9468. @end itemize
  9469. The default value of @var{boxborderw} is "0".
  9470. @item boxcolor
  9471. The color to be used for drawing box around text. For the syntax of this
  9472. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9473. The default value of @var{boxcolor} is "white".
  9474. @item line_spacing
  9475. Set the line spacing in pixels. The default value of @var{line_spacing} is 0.
  9476. @item text_align
  9477. Set the vertical and horizontal alignment of the text with respect to the box boundaries.
  9478. The value is combination of flags, one for the vertical alignment (T=top,
  9479. M=middle, B=bottom) and one for the horizontal alignment (L=left, C=center, R=right).
  9480. Please note that tab characters are only supported with the left horizontal alignment.
  9481. @item y_align
  9482. Specify what the @var{y} value is referred to. Possible values are:
  9483. @itemize @bullet
  9484. @item @code{text} the top of the highest glyph of the first text line is placed at @var{y}
  9485. @item @code{baseline} the baseline of the first text line is placed at @var{y}
  9486. @item @code{font} the baseline of the first text line is placed at @var{y} plus the
  9487. ascent (in pixels) defined in the font metrics
  9488. @end itemize
  9489. The default value of @var{y_align} is "text" for backward compatibility.
  9490. @item borderw
  9491. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9492. The default value of @var{borderw} is 0.
  9493. @item bordercolor
  9494. Set the color to be used for drawing border around text. For the syntax of this
  9495. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9496. The default value of @var{bordercolor} is "black".
  9497. @item expansion
  9498. Select how the @var{text} is expanded. Can be either @code{none},
  9499. @code{strftime} (deprecated) or @code{normal} (default). See the
  9500. @ref{drawtext_expansion, Text expansion} section below for details.
  9501. @item basetime
  9502. Set a start time for the count. Value is in microseconds. Only applied
  9503. in the deprecated @code{strftime} expansion mode. To emulate in normal expansion
  9504. mode use the @code{pts} function, supplying the start time (in seconds)
  9505. as the second argument.
  9506. @item fix_bounds
  9507. If true, check and fix text coords to avoid clipping.
  9508. @item fontcolor
  9509. The color to be used for drawing fonts. For the syntax of this option, check
  9510. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9511. The default value of @var{fontcolor} is "black".
  9512. @item fontcolor_expr
  9513. String which is expanded the same way as @var{text} to obtain dynamic
  9514. @var{fontcolor} value. By default this option has empty value and is not
  9515. processed. When this option is set, it overrides @var{fontcolor} option.
  9516. @item font
  9517. The font family to be used for drawing text. By default Sans.
  9518. @item fontfile
  9519. The font file to be used for drawing text. The path must be included.
  9520. This parameter is mandatory if the fontconfig support is disabled.
  9521. @item alpha
  9522. Draw the text applying alpha blending. The value can
  9523. be a number between 0.0 and 1.0.
  9524. The expression accepts the same variables @var{x, y} as well.
  9525. The default value is 1.
  9526. Please see @var{fontcolor_expr}.
  9527. @item fontsize
  9528. The font size to be used for drawing text.
  9529. The default value of @var{fontsize} is 16.
  9530. @item text_shaping
  9531. If set to 1, attempt to shape the text (for example, reverse the order of
  9532. right-to-left text and join Arabic characters) before drawing it.
  9533. Otherwise, just draw the text exactly as given.
  9534. By default 1 (if supported).
  9535. @item ft_load_flags
  9536. The flags to be used for loading the fonts.
  9537. The flags map the corresponding flags supported by libfreetype, and are
  9538. a combination of the following values:
  9539. @table @var
  9540. @item default
  9541. @item no_scale
  9542. @item no_hinting
  9543. @item render
  9544. @item no_bitmap
  9545. @item vertical_layout
  9546. @item force_autohint
  9547. @item crop_bitmap
  9548. @item pedantic
  9549. @item ignore_global_advance_width
  9550. @item no_recurse
  9551. @item ignore_transform
  9552. @item monochrome
  9553. @item linear_design
  9554. @item no_autohint
  9555. @end table
  9556. Default value is "default".
  9557. For more information consult the documentation for the FT_LOAD_*
  9558. libfreetype flags.
  9559. @item shadowcolor
  9560. The color to be used for drawing a shadow behind the drawn text. For the
  9561. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9562. ffmpeg-utils manual,ffmpeg-utils}.
  9563. The default value of @var{shadowcolor} is "black".
  9564. @item boxw
  9565. Set the width of the box to be drawn around text.
  9566. The default value of @var{boxw} is computed automatically to match the text width
  9567. @item boxh
  9568. Set the height of the box to be drawn around text.
  9569. The default value of @var{boxh} is computed automatically to match the text height
  9570. @item shadowx
  9571. @item shadowy
  9572. The x and y offsets for the text shadow position with respect to the
  9573. position of the text. They can be either positive or negative
  9574. values. The default value for both is "0".
  9575. @item start_number
  9576. The starting frame number for the n/frame_num variable. The default value
  9577. is "0".
  9578. @item tabsize
  9579. The size in number of spaces to use for rendering the tab.
  9580. Default value is 4.
  9581. @item timecode
  9582. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9583. format. It can be used with or without text parameter. @var{timecode_rate}
  9584. option must be specified.
  9585. @item timecode_rate, rate, r
  9586. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9587. integer. Minimum value is "1".
  9588. Drop-frame timecode is supported for frame rates 30 & 60.
  9589. @item tc24hmax
  9590. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9591. Default is 0 (disabled).
  9592. @item text
  9593. The text string to be drawn. The text must be a sequence of UTF-8
  9594. encoded characters.
  9595. This parameter is mandatory if no file is specified with the parameter
  9596. @var{textfile}.
  9597. @item textfile
  9598. A text file containing text to be drawn. The text must be a sequence
  9599. of UTF-8 encoded characters.
  9600. This parameter is mandatory if no text string is specified with the
  9601. parameter @var{text}.
  9602. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9603. @item text_source
  9604. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9605. detection bboxes of side data.
  9606. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9607. text data in detection bboxes of side data. So please do not use this parameter
  9608. if you are not sure about the text source.
  9609. @item reload
  9610. The @var{textfile} will be reloaded at specified frame interval.
  9611. Be sure to update @var{textfile} atomically, or it may be read partially,
  9612. or even fail.
  9613. Range is 0 to INT_MAX. Default is 0.
  9614. @item x
  9615. @item y
  9616. The expressions which specify the offsets where text will be drawn
  9617. within the video frame. They are relative to the top/left border of the
  9618. output image.
  9619. The default value of @var{x} and @var{y} is "0".
  9620. See below for the list of accepted constants and functions.
  9621. @end table
  9622. The parameters for @var{x} and @var{y} are expressions containing the
  9623. following constants and functions:
  9624. @table @option
  9625. @item dar
  9626. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9627. @item hsub
  9628. @item vsub
  9629. horizontal and vertical chroma subsample values. For example for the
  9630. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9631. @item line_h, lh
  9632. the height of each text line
  9633. @item main_h, h, H
  9634. the input height
  9635. @item main_w, w, W
  9636. the input width
  9637. @item max_glyph_a, ascent
  9638. the maximum distance from the baseline to the highest/upper grid
  9639. coordinate used to place a glyph outline point, for all the rendered
  9640. glyphs.
  9641. It is a positive value, due to the grid's orientation with the Y axis
  9642. upwards.
  9643. @item max_glyph_d, descent
  9644. the maximum distance from the baseline to the lowest grid coordinate
  9645. used to place a glyph outline point, for all the rendered glyphs.
  9646. This is a negative value, due to the grid's orientation, with the Y axis
  9647. upwards.
  9648. @item max_glyph_h
  9649. maximum glyph height, that is the maximum height for all the glyphs
  9650. contained in the rendered text, it is equivalent to @var{ascent} -
  9651. @var{descent}.
  9652. @item max_glyph_w
  9653. maximum glyph width, that is the maximum width for all the glyphs
  9654. contained in the rendered text
  9655. @item font_a
  9656. the ascent size defined in the font metrics
  9657. @item font_d
  9658. the descent size defined in the font metrics
  9659. @item top_a
  9660. the maximum ascender of the glyphs of the first text line
  9661. @item bottom_d
  9662. the maximum descender of the glyphs of the last text line
  9663. @item n
  9664. the number of input frame, starting from 0
  9665. @item rand(min, max)
  9666. return a random number included between @var{min} and @var{max}
  9667. @item sar
  9668. The input sample aspect ratio.
  9669. @item t
  9670. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9671. @item text_h, th
  9672. the height of the rendered text
  9673. @item text_w, tw
  9674. the width of the rendered text
  9675. @item x
  9676. @item y
  9677. the x and y offset coordinates where the text is drawn.
  9678. These parameters allow the @var{x} and @var{y} expressions to refer
  9679. to each other, so you can for example specify @code{y=x/dar}.
  9680. @item pict_type
  9681. A one character description of the current frame's picture type.
  9682. @item pkt_pos
  9683. The current packet's position in the input file or stream
  9684. (in bytes, from the start of the input). A value of -1 indicates
  9685. this info is not available.
  9686. @item duration
  9687. The current packet's duration, in seconds.
  9688. @item pkt_size
  9689. The current packet's size (in bytes).
  9690. @end table
  9691. @anchor{drawtext_expansion}
  9692. @subsection Text expansion
  9693. If @option{expansion} is set to @code{strftime}, the filter recognizes
  9694. sequences accepted by the @code{strftime} C function in the provided
  9695. text and expands them accordingly. Check the documentation of
  9696. @code{strftime}. This feature is deprecated in favor of @code{normal}
  9697. expansion with the @code{gmtime} or @code{localtime} expansion
  9698. functions.
  9699. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9700. If @option{expansion} is set to @code{normal} (which is the default),
  9701. the following expansion mechanism is used.
  9702. The backslash character @samp{\}, followed by any character, always expands to
  9703. the second character.
  9704. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9705. braces is a function name, possibly followed by arguments separated by ':'.
  9706. If the arguments contain special characters or delimiters (':' or '@}'),
  9707. they should be escaped.
  9708. Note that they probably must also be escaped as the value for the @option{text}
  9709. option in the filter argument string and as the filter argument in the
  9710. filtergraph description, and possibly also for the shell, that makes up to four
  9711. levels of escaping; using a text file with the @option{textfile} option avoids
  9712. these problems.
  9713. The following functions are available:
  9714. @table @command
  9715. @item expr, e
  9716. The expression evaluation result.
  9717. It must take one argument specifying the expression to be evaluated,
  9718. which accepts the same constants and functions as the @var{x} and
  9719. @var{y} values. Note that not all constants should be used, for
  9720. example the text size is not known when evaluating the expression, so
  9721. the constants @var{text_w} and @var{text_h} will have an undefined
  9722. value.
  9723. @item expr_int_format, eif
  9724. Evaluate the expression's value and output as formatted integer.
  9725. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9726. The second argument specifies the output format. Allowed values are @samp{x},
  9727. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9728. @code{printf} function.
  9729. The third parameter is optional and sets the number of positions taken by the output.
  9730. It can be used to add padding with zeros from the left.
  9731. @item gmtime
  9732. The time at which the filter is running, expressed in UTC.
  9733. It can accept an argument: a @code{strftime} C function format string.
  9734. The format string is extended to support the variable @var{%[1-6]N}
  9735. which prints fractions of the second with optionally specified number of digits.
  9736. @item localtime
  9737. The time at which the filter is running, expressed in the local time zone.
  9738. It can accept an argument: a @code{strftime} C function format string.
  9739. The format string is extended to support the variable @var{%[1-6]N}
  9740. which prints fractions of the second with optionally specified number of digits.
  9741. @item metadata
  9742. Frame metadata. Takes one or two arguments.
  9743. The first argument is mandatory and specifies the metadata key.
  9744. The second argument is optional and specifies a default value, used when the
  9745. metadata key is not found or empty.
  9746. Available metadata can be identified by inspecting entries
  9747. starting with TAG included within each frame section
  9748. printed by running @code{ffprobe -show_frames}.
  9749. String metadata generated in filters leading to
  9750. the drawtext filter are also available.
  9751. @item n, frame_num
  9752. The frame number, starting from 0.
  9753. @item pict_type
  9754. A one character description of the current picture type.
  9755. @item pts
  9756. The timestamp of the current frame.
  9757. It can take up to three arguments.
  9758. The first argument is the format of the timestamp; it defaults to @code{flt}
  9759. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9760. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9761. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9762. @code{localtime} stands for the timestamp of the frame formatted as
  9763. local time zone time.
  9764. The second argument is an offset added to the timestamp.
  9765. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9766. supplied to present the hour part of the formatted timestamp in 24h format
  9767. (00-23).
  9768. If the format is set to @code{localtime} or @code{gmtime}, a third
  9769. argument may be supplied: a @code{strftime} C function format string.
  9770. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9771. @end table
  9772. @subsection Commands
  9773. This filter supports altering parameters via commands:
  9774. @table @option
  9775. @item reinit
  9776. Alter existing filter parameters.
  9777. Syntax for the argument is the same as for filter invocation, e.g.
  9778. @example
  9779. fontsize=56:fontcolor=green:text='Hello World'
  9780. @end example
  9781. Full filter invocation with sendcmd would look like this:
  9782. @example
  9783. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9784. @end example
  9785. If the entire argument can't be parsed or applied as valid values then the filter will
  9786. continue with its existing parameters.
  9787. @end table
  9788. The following options are also supported as @ref{commands}:
  9789. @itemize @bullet
  9790. @item x
  9791. @item y
  9792. @item alpha
  9793. @item fontsize
  9794. @item fontcolor
  9795. @item boxcolor
  9796. @item bordercolor
  9797. @item shadowcolor
  9798. @item box
  9799. @item boxw
  9800. @item boxh
  9801. @item boxborderw
  9802. @item line_spacing
  9803. @item text_align
  9804. @item shadowx
  9805. @item shadowy
  9806. @item borderw
  9807. @end itemize
  9808. @subsection Examples
  9809. @itemize
  9810. @item
  9811. Draw "Test Text" with font FreeSerif, using the default values for the
  9812. optional parameters.
  9813. @example
  9814. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9815. @end example
  9816. @item
  9817. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9818. and y=50 (counting from the top-left corner of the screen), text is
  9819. yellow with a red box around it. Both the text and the box have an
  9820. opacity of 20%.
  9821. @example
  9822. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9823. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9824. @end example
  9825. Note that the double quotes are not necessary if spaces are not used
  9826. within the parameter list.
  9827. @item
  9828. Show the text at the center of the video frame:
  9829. @example
  9830. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9831. @end example
  9832. @item
  9833. Show the text at a random position, switching to a new position every 30 seconds:
  9834. @example
  9835. 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)"
  9836. @end example
  9837. @item
  9838. Show a text line sliding from right to left in the last row of the video
  9839. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9840. with no newlines.
  9841. @example
  9842. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9843. @end example
  9844. @item
  9845. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9846. @example
  9847. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9848. @end example
  9849. @item
  9850. Draw a single green letter "g", at the center of the input video.
  9851. The glyph baseline is placed at half screen height.
  9852. @example
  9853. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9854. @end example
  9855. @item
  9856. Show text for 1 second every 3 seconds:
  9857. @example
  9858. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9859. @end example
  9860. @item
  9861. Use fontconfig to set the font. Note that the colons need to be escaped.
  9862. @example
  9863. drawtext='fontfile=Linux Libertine O-40\\:style=Semibold:text=FFmpeg'
  9864. @end example
  9865. @item
  9866. Draw "Test Text" with font size dependent on height of the video.
  9867. @example
  9868. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9869. @end example
  9870. @item
  9871. Print the date of a real-time encoding (see documentation for the
  9872. @code{strftime} C function):
  9873. @example
  9874. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9875. @end example
  9876. @item
  9877. Show text fading in and out (appearing/disappearing):
  9878. @example
  9879. #!/bin/sh
  9880. DS=1.0 # display start
  9881. DE=10.0 # display end
  9882. FID=1.5 # fade in duration
  9883. FOD=5 # fade out duration
  9884. 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 @}"
  9885. @end example
  9886. @item
  9887. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9888. and the @option{fontsize} value are included in the @option{y} offset.
  9889. @example
  9890. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9891. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9892. @end example
  9893. @item
  9894. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9895. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9896. must have option @option{-export_path_metadata 1} for the special metadata fields
  9897. to be available for filters.
  9898. @example
  9899. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  9900. @end example
  9901. @end itemize
  9902. For more information about libfreetype, check:
  9903. @url{http://www.freetype.org/}.
  9904. For more information about fontconfig, check:
  9905. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  9906. For more information about libfribidi, check:
  9907. @url{http://fribidi.org/}.
  9908. For more information about libharfbuzz, check:
  9909. @url{https://github.com/harfbuzz/harfbuzz}.
  9910. @section edgedetect
  9911. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  9912. The filter accepts the following options:
  9913. @table @option
  9914. @item low
  9915. @item high
  9916. Set low and high threshold values used by the Canny thresholding
  9917. algorithm.
  9918. The high threshold selects the "strong" edge pixels, which are then
  9919. connected through 8-connectivity with the "weak" edge pixels selected
  9920. by the low threshold.
  9921. @var{low} and @var{high} threshold values must be chosen in the range
  9922. [0,1], and @var{low} should be lesser or equal to @var{high}.
  9923. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  9924. is @code{50/255}.
  9925. @item mode
  9926. Define the drawing mode.
  9927. @table @samp
  9928. @item wires
  9929. Draw white/gray wires on black background.
  9930. @item colormix
  9931. Mix the colors to create a paint/cartoon effect.
  9932. @item canny
  9933. Apply Canny edge detector on all selected planes.
  9934. @end table
  9935. Default value is @var{wires}.
  9936. @item planes
  9937. Select planes for filtering. By default all available planes are filtered.
  9938. @end table
  9939. @subsection Examples
  9940. @itemize
  9941. @item
  9942. Standard edge detection with custom values for the hysteresis thresholding:
  9943. @example
  9944. edgedetect=low=0.1:high=0.4
  9945. @end example
  9946. @item
  9947. Painting effect without thresholding:
  9948. @example
  9949. edgedetect=mode=colormix:high=0
  9950. @end example
  9951. @end itemize
  9952. @section elbg
  9953. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  9954. For each input image, the filter will compute the optimal mapping from
  9955. the input to the output given the codebook length, that is the number
  9956. of distinct output colors.
  9957. This filter accepts the following options.
  9958. @table @option
  9959. @item codebook_length, l
  9960. Set codebook length. The value must be a positive integer, and
  9961. represents the number of distinct output colors. Default value is 256.
  9962. @item nb_steps, n
  9963. Set the maximum number of iterations to apply for computing the optimal
  9964. mapping. The higher the value the better the result and the higher the
  9965. computation time. Default value is 1.
  9966. @item seed, s
  9967. Set a random seed, must be an integer included between 0 and
  9968. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  9969. will try to use a good random seed on a best effort basis.
  9970. @item pal8
  9971. Set pal8 output pixel format. This option does not work with codebook
  9972. length greater than 256. Default is disabled.
  9973. @item use_alpha
  9974. Include alpha values in the quantization calculation. Allows creating
  9975. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  9976. @end table
  9977. @section entropy
  9978. Measure graylevel entropy in histogram of color channels of video frames.
  9979. It accepts the following parameters:
  9980. @table @option
  9981. @item mode
  9982. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  9983. @var{diff} mode measures entropy of histogram delta values, absolute differences
  9984. between neighbour histogram values.
  9985. @end table
  9986. @section epx
  9987. Apply the EPX magnification filter which is designed for pixel art.
  9988. It accepts the following option:
  9989. @table @option
  9990. @item n
  9991. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  9992. @code{3xEPX}.
  9993. Default is @code{3}.
  9994. @end table
  9995. @section eq
  9996. Set brightness, contrast, saturation and approximate gamma adjustment.
  9997. The filter accepts the following options:
  9998. @table @option
  9999. @item contrast
  10000. Set the contrast expression. The value must be a float value in range
  10001. @code{-1000.0} to @code{1000.0}. The default value is "1".
  10002. @item brightness
  10003. Set the brightness expression. The value must be a float value in
  10004. range @code{-1.0} to @code{1.0}. The default value is "0".
  10005. @item saturation
  10006. Set the saturation expression. The value must be a float in
  10007. range @code{0.0} to @code{3.0}. The default value is "1".
  10008. @item gamma
  10009. Set the gamma expression. The value must be a float in range
  10010. @code{0.1} to @code{10.0}. The default value is "1".
  10011. @item gamma_r
  10012. Set the gamma expression for red. The value must be a float in
  10013. range @code{0.1} to @code{10.0}. The default value is "1".
  10014. @item gamma_g
  10015. Set the gamma expression for green. The value must be a float in range
  10016. @code{0.1} to @code{10.0}. The default value is "1".
  10017. @item gamma_b
  10018. Set the gamma expression for blue. The value must be a float in range
  10019. @code{0.1} to @code{10.0}. The default value is "1".
  10020. @item gamma_weight
  10021. Set the gamma weight expression. It can be used to reduce the effect
  10022. of a high gamma value on bright image areas, e.g. keep them from
  10023. getting overamplified and just plain white. The value must be a float
  10024. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  10025. gamma correction all the way down while @code{1.0} leaves it at its
  10026. full strength. Default is "1".
  10027. @item eval
  10028. Set when the expressions for brightness, contrast, saturation and
  10029. gamma expressions are evaluated.
  10030. It accepts the following values:
  10031. @table @samp
  10032. @item init
  10033. only evaluate expressions once during the filter initialization or
  10034. when a command is processed
  10035. @item frame
  10036. evaluate expressions for each incoming frame
  10037. @end table
  10038. Default value is @samp{init}.
  10039. @end table
  10040. The expressions accept the following parameters:
  10041. @table @option
  10042. @item n
  10043. frame count of the input frame starting from 0
  10044. @item pos
  10045. byte position of the corresponding packet in the input file, NAN if
  10046. unspecified; deprecated, do not use
  10047. @item r
  10048. frame rate of the input video, NAN if the input frame rate is unknown
  10049. @item t
  10050. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10051. @end table
  10052. @subsection Commands
  10053. The filter supports the following commands:
  10054. @table @option
  10055. @item contrast
  10056. Set the contrast expression.
  10057. @item brightness
  10058. Set the brightness expression.
  10059. @item saturation
  10060. Set the saturation expression.
  10061. @item gamma
  10062. Set the gamma expression.
  10063. @item gamma_r
  10064. Set the gamma_r expression.
  10065. @item gamma_g
  10066. Set gamma_g expression.
  10067. @item gamma_b
  10068. Set gamma_b expression.
  10069. @item gamma_weight
  10070. Set gamma_weight expression.
  10071. The command accepts the same syntax of the corresponding option.
  10072. If the specified expression is not valid, it is kept at its current
  10073. value.
  10074. @end table
  10075. @anchor{erosion}
  10076. @section erosion
  10077. Apply erosion effect to the video.
  10078. This filter replaces the pixel by the local(3x3) minimum.
  10079. It accepts the following options:
  10080. @table @option
  10081. @item threshold0
  10082. @item threshold1
  10083. @item threshold2
  10084. @item threshold3
  10085. Limit the maximum change for each plane, default is 65535.
  10086. If 0, plane will remain unchanged.
  10087. @item coordinates
  10088. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  10089. pixels are used.
  10090. Flags to local 3x3 coordinates maps like this:
  10091. 1 2 3
  10092. 4 5
  10093. 6 7 8
  10094. @end table
  10095. @subsection Commands
  10096. This filter supports the all above options as @ref{commands}.
  10097. @section estdif
  10098. Deinterlace the input video ("estdif" stands for "Edge Slope
  10099. Tracing Deinterlacing Filter").
  10100. Spatial only filter that uses edge slope tracing algorithm
  10101. to interpolate missing lines.
  10102. It accepts the following parameters:
  10103. @table @option
  10104. @item mode
  10105. The interlacing mode to adopt. It accepts one of the following values:
  10106. @table @option
  10107. @item frame
  10108. Output one frame for each frame.
  10109. @item field
  10110. Output one frame for each field.
  10111. @end table
  10112. The default value is @code{field}.
  10113. @item parity
  10114. The picture field parity assumed for the input interlaced video. It accepts one
  10115. of the following values:
  10116. @table @option
  10117. @item tff
  10118. Assume the top field is first.
  10119. @item bff
  10120. Assume the bottom field is first.
  10121. @item auto
  10122. Enable automatic detection of field parity.
  10123. @end table
  10124. The default value is @code{auto}.
  10125. If the interlacing is unknown or the decoder does not export this information,
  10126. top field first will be assumed.
  10127. @item deint
  10128. Specify which frames to deinterlace. Accepts one of the following
  10129. values:
  10130. @table @option
  10131. @item all
  10132. Deinterlace all frames.
  10133. @item interlaced
  10134. Only deinterlace frames marked as interlaced.
  10135. @end table
  10136. The default value is @code{all}.
  10137. @item rslope
  10138. Specify the search radius for edge slope tracing. Default value is 1.
  10139. Allowed range is from 1 to 15.
  10140. @item redge
  10141. Specify the search radius for best edge matching. Default value is 2.
  10142. Allowed range is from 0 to 15.
  10143. @item ecost
  10144. Specify the edge cost for edge matching. Default value is 2.
  10145. Allowed range is from 0 to 50.
  10146. @item mcost
  10147. Specify the middle cost for edge matching. Default value is 1.
  10148. Allowed range is from 0 to 50.
  10149. @item dcost
  10150. Specify the distance cost for edge matching. Default value is 1.
  10151. Allowed range is from 0 to 50.
  10152. @item interp
  10153. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  10154. of the following values:
  10155. @table @option
  10156. @item 2p
  10157. Two-point interpolation.
  10158. @item 4p
  10159. Four-point interpolation.
  10160. @item 6p
  10161. Six-point interpolation.
  10162. @end table
  10163. @end table
  10164. @subsection Commands
  10165. This filter supports same @ref{commands} as options.
  10166. @section exposure
  10167. Adjust exposure of the video stream.
  10168. The filter accepts the following options:
  10169. @table @option
  10170. @item exposure
  10171. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  10172. Default value is 0 EV.
  10173. @item black
  10174. Set the black level correction. Allowed range is from -1.0 to 1.0.
  10175. Default value is 0.
  10176. @end table
  10177. @subsection Commands
  10178. This filter supports same @ref{commands} as options.
  10179. @section extractplanes
  10180. Extract color channel components from input video stream into
  10181. separate grayscale video streams.
  10182. The filter accepts the following option:
  10183. @table @option
  10184. @item planes
  10185. Set plane(s) to extract.
  10186. Available values for planes are:
  10187. @table @samp
  10188. @item y
  10189. @item u
  10190. @item v
  10191. @item a
  10192. @item r
  10193. @item g
  10194. @item b
  10195. @end table
  10196. Choosing planes not available in the input will result in an error.
  10197. That means you cannot select @code{r}, @code{g}, @code{b} planes
  10198. with @code{y}, @code{u}, @code{v} planes at same time.
  10199. @end table
  10200. @subsection Examples
  10201. @itemize
  10202. @item
  10203. Extract luma, u and v color channel component from input video frame
  10204. into 3 grayscale outputs:
  10205. @example
  10206. 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
  10207. @end example
  10208. @end itemize
  10209. @section fade
  10210. Apply a fade-in/out effect to the input video.
  10211. It accepts the following parameters:
  10212. @table @option
  10213. @item type, t
  10214. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  10215. effect.
  10216. Default is @code{in}.
  10217. @item start_frame, s
  10218. Specify the number of the frame to start applying the fade
  10219. effect at. Default is 0.
  10220. @item nb_frames, n
  10221. The number of frames that the fade effect lasts. At the end of the
  10222. fade-in effect, the output video will have the same intensity as the input video.
  10223. At the end of the fade-out transition, the output video will be filled with the
  10224. selected @option{color}.
  10225. Default is 25.
  10226. @item alpha
  10227. If set to 1, fade only alpha channel, if one exists on the input.
  10228. Default value is 0.
  10229. @item start_time, st
  10230. Specify the timestamp (in seconds) of the frame to start to apply the fade
  10231. effect. If both start_frame and start_time are specified, the fade will start at
  10232. whichever comes last. Default is 0.
  10233. @item duration, d
  10234. The number of seconds for which the fade effect has to last. At the end of the
  10235. fade-in effect the output video will have the same intensity as the input video,
  10236. at the end of the fade-out transition the output video will be filled with the
  10237. selected @option{color}.
  10238. If both duration and nb_frames are specified, duration is used. Default is 0
  10239. (nb_frames is used by default).
  10240. @item color, c
  10241. Specify the color of the fade. Default is "black".
  10242. @end table
  10243. @subsection Examples
  10244. @itemize
  10245. @item
  10246. Fade in the first 30 frames of video:
  10247. @example
  10248. fade=in:0:30
  10249. @end example
  10250. The command above is equivalent to:
  10251. @example
  10252. fade=t=in:s=0:n=30
  10253. @end example
  10254. @item
  10255. Fade out the last 45 frames of a 200-frame video:
  10256. @example
  10257. fade=out:155:45
  10258. fade=type=out:start_frame=155:nb_frames=45
  10259. @end example
  10260. @item
  10261. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  10262. @example
  10263. fade=in:0:25, fade=out:975:25
  10264. @end example
  10265. @item
  10266. Make the first 5 frames yellow, then fade in from frame 5-24:
  10267. @example
  10268. fade=in:5:20:color=yellow
  10269. @end example
  10270. @item
  10271. Fade in alpha over first 25 frames of video:
  10272. @example
  10273. fade=in:0:25:alpha=1
  10274. @end example
  10275. @item
  10276. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  10277. @example
  10278. fade=t=in:st=5.5:d=0.5
  10279. @end example
  10280. @end itemize
  10281. @section feedback
  10282. Apply feedback video filter.
  10283. This filter pass cropped input frames to 2nd output.
  10284. From there it can be filtered with other video filters.
  10285. After filter receives frame from 2nd input, that frame
  10286. is combined on top of original frame from 1st input and passed
  10287. to 1st output.
  10288. The typical usage is filter only part of frame.
  10289. The filter accepts the following options:
  10290. @table @option
  10291. @item x
  10292. @item y
  10293. Set the top left crop position.
  10294. @item w
  10295. @item h
  10296. Set the crop size.
  10297. @end table
  10298. @subsection Examples
  10299. @itemize
  10300. @item
  10301. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  10302. @example
  10303. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  10304. @end example
  10305. @item
  10306. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  10307. @example
  10308. [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]
  10309. @end example
  10310. @item
  10311. Pixelize rectangular part of video frame of size 100x100 with pixelize filter.
  10312. @example
  10313. [in][blurin]feedback=x=320:y=240:w=100:h=100[out][blurout];[blurout]pixelize[blurin]
  10314. @end example
  10315. @end itemize
  10316. @section fftdnoiz
  10317. Denoise frames using 3D FFT (frequency domain filtering).
  10318. The filter accepts the following options:
  10319. @table @option
  10320. @item sigma
  10321. Set the noise sigma constant. This sets denoising strength.
  10322. Default value is 1. Allowed range is from 0 to 30.
  10323. Using very high sigma with low overlap may give blocking artifacts.
  10324. @item amount
  10325. Set amount of denoising. By default all detected noise is reduced.
  10326. Default value is 1. Allowed range is from 0 to 1.
  10327. @item block
  10328. Set size of block in pixels, Default is 32, can be 8 to 256.
  10329. @item overlap
  10330. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10331. @item method
  10332. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10333. @item prev
  10334. Set number of previous frames to use for denoising. By default is set to 0.
  10335. @item next
  10336. Set number of next frames to to use for denoising. By default is set to 0.
  10337. @item planes
  10338. Set planes which will be filtered, by default are all available filtered
  10339. except alpha.
  10340. @end table
  10341. @section fftfilt
  10342. Apply arbitrary expressions to samples in frequency domain
  10343. @table @option
  10344. @item dc_Y
  10345. Adjust the dc value (gain) of the luma plane of the image. The filter
  10346. accepts an integer value in range @code{0} to @code{1000}. The default
  10347. value is set to @code{0}.
  10348. @item dc_U
  10349. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10350. filter accepts an integer value in range @code{0} to @code{1000}. The
  10351. default value is set to @code{0}.
  10352. @item dc_V
  10353. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10354. filter accepts an integer value in range @code{0} to @code{1000}. The
  10355. default value is set to @code{0}.
  10356. @item weight_Y
  10357. Set the frequency domain weight expression for the luma plane.
  10358. @item weight_U
  10359. Set the frequency domain weight expression for the 1st chroma plane.
  10360. @item weight_V
  10361. Set the frequency domain weight expression for the 2nd chroma plane.
  10362. @item eval
  10363. Set when the expressions are evaluated.
  10364. It accepts the following values:
  10365. @table @samp
  10366. @item init
  10367. Only evaluate expressions once during the filter initialization.
  10368. @item frame
  10369. Evaluate expressions for each incoming frame.
  10370. @end table
  10371. Default value is @samp{init}.
  10372. The filter accepts the following variables:
  10373. @item X
  10374. @item Y
  10375. The coordinates of the current sample.
  10376. @item W
  10377. @item H
  10378. The width and height of the image.
  10379. @item N
  10380. The number of input frame, starting from 0.
  10381. @item WS
  10382. @item HS
  10383. The size of FFT array for horizontal and vertical processing.
  10384. @end table
  10385. @subsection Examples
  10386. @itemize
  10387. @item
  10388. High-pass:
  10389. @example
  10390. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10391. @end example
  10392. @item
  10393. Low-pass:
  10394. @example
  10395. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10396. @end example
  10397. @item
  10398. Sharpen:
  10399. @example
  10400. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10401. @end example
  10402. @item
  10403. Blur:
  10404. @example
  10405. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10406. @end example
  10407. @end itemize
  10408. @section field
  10409. Extract a single field from an interlaced image using stride
  10410. arithmetic to avoid wasting CPU time. The output frames are marked as
  10411. non-interlaced.
  10412. The filter accepts the following options:
  10413. @table @option
  10414. @item type
  10415. Specify whether to extract the top (if the value is @code{0} or
  10416. @code{top}) or the bottom field (if the value is @code{1} or
  10417. @code{bottom}).
  10418. @end table
  10419. @section fieldhint
  10420. Create new frames by copying the top and bottom fields from surrounding frames
  10421. supplied as numbers by the hint file.
  10422. @table @option
  10423. @item hint
  10424. Set file containing hints: absolute/relative frame numbers.
  10425. There must be one line for each frame in a clip. Each line must contain two
  10426. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10427. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10428. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10429. for @code{relative} mode. First number tells from which frame to pick up top
  10430. field and second number tells from which frame to pick up bottom field.
  10431. If optionally followed by @code{+} output frame will be marked as interlaced,
  10432. else if followed by @code{-} output frame will be marked as progressive, else
  10433. it will be marked same as input frame.
  10434. If optionally followed by @code{t} output frame will use only top field, or in
  10435. case of @code{b} it will use only bottom field.
  10436. If line starts with @code{#} or @code{;} that line is skipped.
  10437. @item mode
  10438. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10439. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10440. are more frames to process than @code{hint} file is seek back to start.
  10441. @end table
  10442. Example of first several lines of @code{hint} file for @code{relative} mode:
  10443. @example
  10444. 0,0 - # first frame
  10445. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10446. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10447. 1,0 -
  10448. 0,0 -
  10449. 0,0 -
  10450. 1,0 -
  10451. 1,0 -
  10452. 1,0 -
  10453. 0,0 -
  10454. 0,0 -
  10455. 1,0 -
  10456. 1,0 -
  10457. 1,0 -
  10458. 0,0 -
  10459. @end example
  10460. @section fieldmatch
  10461. Field matching filter for inverse telecine. It is meant to reconstruct the
  10462. progressive frames from a telecined stream. The filter does not drop duplicated
  10463. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10464. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10465. The separation of the field matching and the decimation is notably motivated by
  10466. the possibility of inserting a de-interlacing filter fallback between the two.
  10467. If the source has mixed telecined and real interlaced content,
  10468. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10469. But these remaining combed frames will be marked as interlaced, and thus can be
  10470. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10471. In addition to the various configuration options, @code{fieldmatch} can take an
  10472. optional second stream, activated through the @option{ppsrc} option. If
  10473. enabled, the frames reconstruction will be based on the fields and frames from
  10474. this second stream. This allows the first input to be pre-processed in order to
  10475. help the various algorithms of the filter, while keeping the output lossless
  10476. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10477. or brightness/contrast adjustments can help.
  10478. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10479. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10480. which @code{fieldmatch} is based on. While the semantic and usage are very
  10481. close, some behaviour and options names can differ.
  10482. The @ref{decimate} filter currently only works for constant frame rate input.
  10483. If your input has mixed telecined (30fps) and progressive content with a lower
  10484. framerate like 24fps use the following filterchain to produce the necessary cfr
  10485. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10486. The filter accepts the following options:
  10487. @table @option
  10488. @item order
  10489. Specify the assumed field order of the input stream. Available values are:
  10490. @table @samp
  10491. @item auto
  10492. Auto detect parity (use FFmpeg's internal parity value).
  10493. @item bff
  10494. Assume bottom field first.
  10495. @item tff
  10496. Assume top field first.
  10497. @end table
  10498. Note that it is sometimes recommended not to trust the parity announced by the
  10499. stream.
  10500. Default value is @var{auto}.
  10501. @item mode
  10502. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10503. sense that it won't risk creating jerkiness due to duplicate frames when
  10504. possible, but if there are bad edits or blended fields it will end up
  10505. outputting combed frames when a good match might actually exist. On the other
  10506. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10507. but will almost always find a good frame if there is one. The other values are
  10508. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10509. jerkiness and creating duplicate frames versus finding good matches in sections
  10510. with bad edits, orphaned fields, blended fields, etc.
  10511. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10512. Available values are:
  10513. @table @samp
  10514. @item pc
  10515. 2-way matching (p/c)
  10516. @item pc_n
  10517. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10518. @item pc_u
  10519. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10520. @item pc_n_ub
  10521. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10522. still combed (p/c + n + u/b)
  10523. @item pcn
  10524. 3-way matching (p/c/n)
  10525. @item pcn_ub
  10526. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10527. detected as combed (p/c/n + u/b)
  10528. @end table
  10529. The parenthesis at the end indicate the matches that would be used for that
  10530. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10531. @var{top}).
  10532. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10533. the slowest.
  10534. Default value is @var{pc_n}.
  10535. @item ppsrc
  10536. Mark the main input stream as a pre-processed input, and enable the secondary
  10537. input stream as the clean source to pick the fields from. See the filter
  10538. introduction for more details. It is similar to the @option{clip2} feature from
  10539. VFM/TFM.
  10540. Default value is @code{0} (disabled).
  10541. @item field
  10542. Set the field to match from. It is recommended to set this to the same value as
  10543. @option{order} unless you experience matching failures with that setting. In
  10544. certain circumstances changing the field that is used to match from can have a
  10545. large impact on matching performance. Available values are:
  10546. @table @samp
  10547. @item auto
  10548. Automatic (same value as @option{order}).
  10549. @item bottom
  10550. Match from the bottom field.
  10551. @item top
  10552. Match from the top field.
  10553. @end table
  10554. Default value is @var{auto}.
  10555. @item mchroma
  10556. Set whether or not chroma is included during the match comparisons. In most
  10557. cases it is recommended to leave this enabled. You should set this to @code{0}
  10558. only if your clip has bad chroma problems such as heavy rainbowing or other
  10559. artifacts. Setting this to @code{0} could also be used to speed things up at
  10560. the cost of some accuracy.
  10561. Default value is @code{1}.
  10562. @item y0
  10563. @item y1
  10564. These define an exclusion band which excludes the lines between @option{y0} and
  10565. @option{y1} from being included in the field matching decision. An exclusion
  10566. band can be used to ignore subtitles, a logo, or other things that may
  10567. interfere with the matching. @option{y0} sets the starting scan line and
  10568. @option{y1} sets the ending line; all lines in between @option{y0} and
  10569. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10570. @option{y0} and @option{y1} to the same value will disable the feature.
  10571. @option{y0} and @option{y1} defaults to @code{0}.
  10572. @item scthresh
  10573. Set the scene change detection threshold as a percentage of maximum change on
  10574. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10575. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10576. @option{scthresh} is @code{[0.0, 100.0]}.
  10577. Default value is @code{12.0}.
  10578. @item combmatch
  10579. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10580. account the combed scores of matches when deciding what match to use as the
  10581. final match. Available values are:
  10582. @table @samp
  10583. @item none
  10584. No final matching based on combed scores.
  10585. @item sc
  10586. Combed scores are only used when a scene change is detected.
  10587. @item full
  10588. Use combed scores all the time.
  10589. @end table
  10590. Default is @var{sc}.
  10591. @item combdbg
  10592. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10593. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10594. Available values are:
  10595. @table @samp
  10596. @item none
  10597. No forced calculation.
  10598. @item pcn
  10599. Force p/c/n calculations.
  10600. @item pcnub
  10601. Force p/c/n/u/b calculations.
  10602. @end table
  10603. Default value is @var{none}.
  10604. @item cthresh
  10605. This is the area combing threshold used for combed frame detection. This
  10606. essentially controls how "strong" or "visible" combing must be to be detected.
  10607. Larger values mean combing must be more visible and smaller values mean combing
  10608. can be less visible or strong and still be detected. Valid settings are from
  10609. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10610. be detected as combed). This is basically a pixel difference value. A good
  10611. range is @code{[8, 12]}.
  10612. Default value is @code{9}.
  10613. @item chroma
  10614. Sets whether or not chroma is considered in the combed frame decision. Only
  10615. disable this if your source has chroma problems (rainbowing, etc.) that are
  10616. causing problems for the combed frame detection with chroma enabled. Actually,
  10617. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10618. where there is chroma only combing in the source.
  10619. Default value is @code{0}.
  10620. @item blockx
  10621. @item blocky
  10622. Respectively set the x-axis and y-axis size of the window used during combed
  10623. frame detection. This has to do with the size of the area in which
  10624. @option{combpel} pixels are required to be detected as combed for a frame to be
  10625. declared combed. See the @option{combpel} parameter description for more info.
  10626. Possible values are any number that is a power of 2 starting at 4 and going up
  10627. to 512.
  10628. Default value is @code{16}.
  10629. @item combpel
  10630. The number of combed pixels inside any of the @option{blocky} by
  10631. @option{blockx} size blocks on the frame for the frame to be detected as
  10632. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10633. setting controls "how much" combing there must be in any localized area (a
  10634. window defined by the @option{blockx} and @option{blocky} settings) on the
  10635. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10636. which point no frames will ever be detected as combed). This setting is known
  10637. as @option{MI} in TFM/VFM vocabulary.
  10638. Default value is @code{80}.
  10639. @end table
  10640. @anchor{p/c/n/u/b meaning}
  10641. @subsection p/c/n/u/b meaning
  10642. @subsubsection p/c/n
  10643. We assume the following telecined stream:
  10644. @example
  10645. Top fields: 1 2 2 3 4
  10646. Bottom fields: 1 2 3 4 4
  10647. @end example
  10648. The numbers correspond to the progressive frame the fields relate to. Here, the
  10649. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10650. When @code{fieldmatch} is configured to run a matching from bottom
  10651. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10652. @example
  10653. Input stream:
  10654. T 1 2 2 3 4
  10655. B 1 2 3 4 4 <-- matching reference
  10656. Matches: c c n n c
  10657. Output stream:
  10658. T 1 2 3 4 4
  10659. B 1 2 3 4 4
  10660. @end example
  10661. As a result of the field matching, we can see that some frames get duplicated.
  10662. To perform a complete inverse telecine, you need to rely on a decimation filter
  10663. after this operation. See for instance the @ref{decimate} filter.
  10664. The same operation now matching from top fields (@option{field}=@var{top})
  10665. looks like this:
  10666. @example
  10667. Input stream:
  10668. T 1 2 2 3 4 <-- matching reference
  10669. B 1 2 3 4 4
  10670. Matches: c c p p c
  10671. Output stream:
  10672. T 1 2 2 3 4
  10673. B 1 2 2 3 4
  10674. @end example
  10675. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10676. basically, they refer to the frame and field of the opposite parity:
  10677. @itemize
  10678. @item @var{p} matches the field of the opposite parity in the previous frame
  10679. @item @var{c} matches the field of the opposite parity in the current frame
  10680. @item @var{n} matches the field of the opposite parity in the next frame
  10681. @end itemize
  10682. @subsubsection u/b
  10683. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10684. from the opposite parity flag. In the following examples, we assume that we are
  10685. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10686. 'x' is placed above and below each matched fields.
  10687. With bottom matching (@option{field}=@var{bottom}):
  10688. @example
  10689. Match: c p n b u
  10690. x x x x x
  10691. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10692. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10693. x x x x x
  10694. Output frames:
  10695. 2 1 2 2 2
  10696. 2 2 2 1 3
  10697. @end example
  10698. With top matching (@option{field}=@var{top}):
  10699. @example
  10700. Match: c p n b u
  10701. x x x x x
  10702. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10703. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10704. x x x x x
  10705. Output frames:
  10706. 2 2 2 1 2
  10707. 2 1 3 2 2
  10708. @end example
  10709. @subsection Examples
  10710. Simple IVTC of a top field first telecined stream:
  10711. @example
  10712. fieldmatch=order=tff:combmatch=none, decimate
  10713. @end example
  10714. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10715. @example
  10716. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10717. @end example
  10718. @section fieldorder
  10719. Transform the field order of the input video.
  10720. It accepts the following parameters:
  10721. @table @option
  10722. @item order
  10723. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10724. for bottom field first.
  10725. @end table
  10726. The default value is @samp{tff}.
  10727. The transformation is done by shifting the picture content up or down
  10728. by one line, and filling the remaining line with appropriate picture content.
  10729. This method is consistent with most broadcast field order converters.
  10730. If the input video is not flagged as being interlaced, or it is already
  10731. flagged as being of the required output field order, then this filter does
  10732. not alter the incoming video.
  10733. It is very useful when converting to or from PAL DV material,
  10734. which is bottom field first.
  10735. For example:
  10736. @example
  10737. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10738. @end example
  10739. @section fillborders
  10740. Fill borders of the input video, without changing video stream dimensions.
  10741. Sometimes video can have garbage at the four edges and you may not want to
  10742. crop video input to keep size multiple of some number.
  10743. This filter accepts the following options:
  10744. @table @option
  10745. @item left
  10746. Number of pixels to fill from left border.
  10747. @item right
  10748. Number of pixels to fill from right border.
  10749. @item top
  10750. Number of pixels to fill from top border.
  10751. @item bottom
  10752. Number of pixels to fill from bottom border.
  10753. @item mode
  10754. Set fill mode.
  10755. It accepts the following values:
  10756. @table @samp
  10757. @item smear
  10758. fill pixels using outermost pixels
  10759. @item mirror
  10760. fill pixels using mirroring (half sample symmetric)
  10761. @item fixed
  10762. fill pixels with constant value
  10763. @item reflect
  10764. fill pixels using reflecting (whole sample symmetric)
  10765. @item wrap
  10766. fill pixels using wrapping
  10767. @item fade
  10768. fade pixels to constant value
  10769. @item margins
  10770. fill pixels at top and bottom with weighted averages pixels near borders
  10771. @end table
  10772. Default is @var{smear}.
  10773. @item color
  10774. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10775. @end table
  10776. @subsection Commands
  10777. This filter supports same @ref{commands} as options.
  10778. The command accepts the same syntax of the corresponding option.
  10779. If the specified expression is not valid, it is kept at its current
  10780. value.
  10781. @section find_rect
  10782. Find a rectangular object in the input video.
  10783. The object to search for must be specified as a gray8 image specified with the
  10784. @option{object} option.
  10785. For each possible match, a score is computed. If the score reaches the specified
  10786. threshold, the object is considered found.
  10787. If the input video contains multiple instances of the object, the filter will
  10788. find only one of them.
  10789. When an object is found, the following metadata entries are set in the matching
  10790. frame:
  10791. @table @option
  10792. @item lavfi.rect.w
  10793. width of object
  10794. @item lavfi.rect.h
  10795. height of object
  10796. @item lavfi.rect.x
  10797. x position of object
  10798. @item lavfi.rect.y
  10799. y position of object
  10800. @item lavfi.rect.score
  10801. match score of the found object
  10802. @end table
  10803. It accepts the following options:
  10804. @table @option
  10805. @item object
  10806. Filepath of the object image, needs to be in gray8.
  10807. @item threshold
  10808. Detection threshold, expressed as a decimal number in the range 0-1.
  10809. A threshold value of 0.01 means only exact matches, a threshold of 0.99 means
  10810. almost everything matches.
  10811. Default value is 0.5.
  10812. @item mipmaps
  10813. Number of mipmaps, default is 3.
  10814. @item xmin, ymin, xmax, ymax
  10815. Specifies the rectangle in which to search.
  10816. @item discard
  10817. Discard frames where object is not detected. Default is disabled.
  10818. @end table
  10819. @subsection Examples
  10820. @itemize
  10821. @item
  10822. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10823. @example
  10824. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10825. @end example
  10826. @item
  10827. Find the position of an object in each frame using @command{ffprobe} and write
  10828. it to a log file:
  10829. @example
  10830. ffprobe -f lavfi movie=test.mp4,find_rect=object=object.pgm:threshold=0.3 \
  10831. -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.x,lavfi.rect.y \
  10832. -of csv -o find_rect.csv
  10833. @end example
  10834. @end itemize
  10835. @section floodfill
  10836. Flood area with values of same pixel components with another values.
  10837. It accepts the following options:
  10838. @table @option
  10839. @item x
  10840. Set pixel x coordinate.
  10841. @item y
  10842. Set pixel y coordinate.
  10843. @item s0
  10844. Set source #0 component value.
  10845. @item s1
  10846. Set source #1 component value.
  10847. @item s2
  10848. Set source #2 component value.
  10849. @item s3
  10850. Set source #3 component value.
  10851. @item d0
  10852. Set destination #0 component value.
  10853. @item d1
  10854. Set destination #1 component value.
  10855. @item d2
  10856. Set destination #2 component value.
  10857. @item d3
  10858. Set destination #3 component value.
  10859. @end table
  10860. @anchor{format}
  10861. @section format
  10862. Convert the input video to one of the specified pixel formats.
  10863. Libavfilter will try to pick one that is suitable as input to
  10864. the next filter.
  10865. It accepts the following parameters:
  10866. @table @option
  10867. @item pix_fmts
  10868. A '|'-separated list of pixel format names, such as
  10869. "pix_fmts=yuv420p|monow|rgb24".
  10870. @item color_spaces
  10871. A '|'-separated list of color space names, such as
  10872. "color_spaces=bt709|bt470bg|bt2020nc".
  10873. @item color_ranges
  10874. A '|'-separated list of color range names, such as
  10875. "color_ranges=tv|pc".
  10876. @end table
  10877. @subsection Examples
  10878. @itemize
  10879. @item
  10880. Convert the input video to the @var{yuv420p} format
  10881. @example
  10882. format=pix_fmts=yuv420p
  10883. @end example
  10884. Convert the input video to any of the formats in the list
  10885. @example
  10886. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10887. @end example
  10888. @end itemize
  10889. @anchor{fps}
  10890. @section fps
  10891. Convert the video to specified constant frame rate by duplicating or dropping
  10892. frames as necessary.
  10893. It accepts the following parameters:
  10894. @table @option
  10895. @item fps
  10896. The desired output frame rate. It accepts expressions containing the following
  10897. constants:
  10898. @table @samp
  10899. @item source_fps
  10900. The input's frame rate
  10901. @item ntsc
  10902. NTSC frame rate of @code{30000/1001}
  10903. @item pal
  10904. PAL frame rate of @code{25.0}
  10905. @item film
  10906. Film frame rate of @code{24.0}
  10907. @item ntsc_film
  10908. NTSC-film frame rate of @code{24000/1001}
  10909. @end table
  10910. The default is @code{25}.
  10911. @item start_time
  10912. Assume the first PTS should be the given value, in seconds. This allows for
  10913. padding/trimming at the start of stream. By default, no assumption is made
  10914. about the first frame's expected PTS, so no padding or trimming is done.
  10915. For example, this could be set to 0 to pad the beginning with duplicates of
  10916. the first frame if a video stream starts after the audio stream or to trim any
  10917. frames with a negative PTS.
  10918. @item round
  10919. Timestamp (PTS) rounding method.
  10920. Possible values are:
  10921. @table @option
  10922. @item zero
  10923. round towards 0
  10924. @item inf
  10925. round away from 0
  10926. @item down
  10927. round towards -infinity
  10928. @item up
  10929. round towards +infinity
  10930. @item near
  10931. round to nearest
  10932. @end table
  10933. The default is @code{near}.
  10934. @item eof_action
  10935. Action performed when reading the last frame.
  10936. Possible values are:
  10937. @table @option
  10938. @item round
  10939. Use same timestamp rounding method as used for other frames.
  10940. @item pass
  10941. Pass through last frame if input duration has not been reached yet.
  10942. @end table
  10943. The default is @code{round}.
  10944. @end table
  10945. Alternatively, the options can be specified as a flat string:
  10946. @var{fps}[:@var{start_time}[:@var{round}]].
  10947. See also the @ref{setpts} filter.
  10948. @subsection Examples
  10949. @itemize
  10950. @item
  10951. A typical usage in order to set the fps to 25:
  10952. @example
  10953. fps=fps=25
  10954. @end example
  10955. @item
  10956. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  10957. @example
  10958. fps=fps=film:round=near
  10959. @end example
  10960. @end itemize
  10961. @section framepack
  10962. Pack two different video streams into a stereoscopic video, setting proper
  10963. metadata on supported codecs. The two views should have the same size and
  10964. framerate and processing will stop when the shorter video ends. Please note
  10965. that you may conveniently adjust view properties with the @ref{scale} and
  10966. @ref{fps} filters.
  10967. It accepts the following parameters:
  10968. @table @option
  10969. @item format
  10970. The desired packing format. Supported values are:
  10971. @table @option
  10972. @item sbs
  10973. The views are next to each other (default).
  10974. @item tab
  10975. The views are on top of each other.
  10976. @item lines
  10977. The views are packed by line.
  10978. @item columns
  10979. The views are packed by column.
  10980. @item frameseq
  10981. The views are temporally interleaved.
  10982. @end table
  10983. @end table
  10984. Some examples:
  10985. @example
  10986. # Convert left and right views into a frame-sequential video
  10987. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  10988. # Convert views into a side-by-side video with the same output resolution as the input
  10989. 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
  10990. @end example
  10991. @section framerate
  10992. Change the frame rate by interpolating new video output frames from the source
  10993. frames.
  10994. This filter is not designed to function correctly with interlaced media. If
  10995. you wish to change the frame rate of interlaced media then you are required
  10996. to deinterlace before this filter and re-interlace after this filter.
  10997. A description of the accepted options follows.
  10998. @table @option
  10999. @item fps
  11000. Specify the output frames per second. This option can also be specified
  11001. as a value alone. The default is @code{50}.
  11002. @item interp_start
  11003. Specify the start of a range where the output frame will be created as a
  11004. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11005. the default is @code{15}.
  11006. @item interp_end
  11007. Specify the end of a range where the output frame will be created as a
  11008. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11009. the default is @code{240}.
  11010. @item scene
  11011. Specify the level at which a scene change is detected as a value between
  11012. 0 and 100 to indicate a new scene; a low value reflects a low
  11013. probability for the current frame to introduce a new scene, while a higher
  11014. value means the current frame is more likely to be one.
  11015. The default is @code{8.2}.
  11016. @item flags
  11017. Specify flags influencing the filter process.
  11018. Available value for @var{flags} is:
  11019. @table @option
  11020. @item scene_change_detect, scd
  11021. Enable scene change detection using the value of the option @var{scene}.
  11022. This flag is enabled by default.
  11023. @end table
  11024. @end table
  11025. @section framestep
  11026. Select one frame every N-th frame.
  11027. This filter accepts the following option:
  11028. @table @option
  11029. @item step
  11030. Select frame after every @code{step} frames.
  11031. Allowed values are positive integers higher than 0. Default value is @code{1}.
  11032. @end table
  11033. @section freezedetect
  11034. Detect frozen video.
  11035. This filter logs a message and sets frame metadata when it detects that the
  11036. input video has no significant change in content during a specified duration.
  11037. Video freeze detection calculates the mean average absolute difference of all
  11038. the components of video frames and compares it to a noise floor.
  11039. The printed times and duration are expressed in seconds. The
  11040. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  11041. whose timestamp equals or exceeds the detection duration and it contains the
  11042. timestamp of the first frame of the freeze. The
  11043. @code{lavfi.freezedetect.freeze_duration} and
  11044. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  11045. after the freeze.
  11046. The filter accepts the following options:
  11047. @table @option
  11048. @item noise, n
  11049. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  11050. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  11051. 0.001.
  11052. @item duration, d
  11053. Set freeze duration until notification (default is 2 seconds).
  11054. @end table
  11055. @section freezeframes
  11056. Freeze video frames.
  11057. This filter freezes video frames using frame from 2nd input.
  11058. The filter accepts the following options:
  11059. @table @option
  11060. @item first
  11061. Set number of first frame from which to start freeze.
  11062. @item last
  11063. Set number of last frame from which to end freeze.
  11064. @item replace
  11065. Set number of frame from 2nd input which will be used instead of replaced frames.
  11066. @end table
  11067. @anchor{frei0r}
  11068. @section frei0r
  11069. Apply a frei0r effect to the input video.
  11070. To enable the compilation of this filter, you need to install the frei0r
  11071. header and configure FFmpeg with @code{--enable-frei0r}.
  11072. It accepts the following parameters:
  11073. @table @option
  11074. @item filter_name
  11075. The name of the frei0r effect to load. If the environment variable
  11076. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  11077. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  11078. Otherwise, the standard frei0r paths are searched, in this order:
  11079. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  11080. @file{/usr/lib/frei0r-1/}.
  11081. @item filter_params
  11082. A '|'-separated list of parameters to pass to the frei0r effect.
  11083. @end table
  11084. A frei0r effect parameter can be a boolean (its value is either
  11085. "y" or "n"), a double, a color (specified as
  11086. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  11087. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  11088. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  11089. a position (specified as @var{X}/@var{Y}, where
  11090. @var{X} and @var{Y} are floating point numbers) and/or a string.
  11091. The number and types of parameters depend on the loaded effect. If an
  11092. effect parameter is not specified, the default value is set.
  11093. @subsection Examples
  11094. @itemize
  11095. @item
  11096. Apply the distort0r effect, setting the first two double parameters:
  11097. @example
  11098. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  11099. @end example
  11100. @item
  11101. Apply the colordistance effect, taking a color as the first parameter:
  11102. @example
  11103. frei0r=colordistance:0.2/0.3/0.4
  11104. frei0r=colordistance:violet
  11105. frei0r=colordistance:0x112233
  11106. @end example
  11107. @item
  11108. Apply the perspective effect, specifying the top left and top right image
  11109. positions:
  11110. @example
  11111. frei0r=perspective:0.2/0.2|0.8/0.2
  11112. @end example
  11113. @end itemize
  11114. For more information, see
  11115. @url{http://frei0r.dyne.org}
  11116. @subsection Commands
  11117. This filter supports the @option{filter_params} option as @ref{commands}.
  11118. @section fspp
  11119. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  11120. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  11121. processing filter, one of them is performed once per block, not per pixel.
  11122. This allows for much higher speed.
  11123. The filter accepts the following options:
  11124. @table @option
  11125. @item quality
  11126. Set quality. This option defines the number of levels for averaging. It accepts
  11127. an integer in the range 4-5. Default value is @code{4}.
  11128. @item qp
  11129. Force a constant quantization parameter. It accepts an integer in range 0-63.
  11130. If not set, the filter will use the QP from the video stream (if available).
  11131. @item strength
  11132. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  11133. more details but also more artifacts, while higher values make the image smoother
  11134. but also blurrier. Default value is @code{0} − PSNR optimal.
  11135. @item use_bframe_qp
  11136. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11137. option may cause flicker since the B-Frames have often larger QP. Default is
  11138. @code{0} (not enabled).
  11139. @end table
  11140. @anchor{fsync}
  11141. @section fsync
  11142. Synchronize video frames with an external mapping from a file.
  11143. For each input PTS given in the map file it either drops or creates as many
  11144. frames as necessary to recreate the sequence of output frames given in the
  11145. map file.
  11146. This filter is useful to recreate the output frames of a framerate conversion
  11147. by the @ref{fps} filter, recorded into a map file using the ffmpeg option
  11148. @code{-stats_mux_pre}, and do further processing to the corresponding frames
  11149. e.g. quality comparison.
  11150. Each line of the map file must contain three items per input frame, the input
  11151. PTS (decimal), the output PTS (decimal) and the
  11152. output TIMEBASE (decimal/decimal), separated by a space.
  11153. This file format corresponds to the output
  11154. of @code{-stats_mux_pre_fmt="@{ptsi@} @{pts@} @{tb@}"}.
  11155. The filter assumes the map file is sorted by increasing input PTS.
  11156. The filter accepts the following options:
  11157. @table @option
  11158. @item file, f
  11159. The filename of the map file to be used.
  11160. @end table
  11161. Example:
  11162. @example
  11163. # Convert a video to 25 fps and record a MAP_FILE file with the default format of this filter
  11164. ffmpeg -i INPUT -vf fps=fps=25 -stats_mux_pre MAP_FILE -stats_mux_pre_fmt "@{ptsi@} @{pts@} @{tb@}" OUTPUT
  11165. # Sort MAP_FILE by increasing input PTS
  11166. sort -n MAP_FILE
  11167. # Use INPUT, OUTPUT and the MAP_FILE from above to compare the corresponding frames in INPUT and OUTPUT via SSIM
  11168. ffmpeg -i INPUT -i OUTPUT -filter_complex '[0:v]fsync=file=MAP_FILE[ref];[1:v][ref]ssim' -f null -
  11169. @end example
  11170. @section gblur
  11171. Apply Gaussian blur filter.
  11172. The filter accepts the following options:
  11173. @table @option
  11174. @item sigma
  11175. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  11176. @item steps
  11177. Set number of steps for Gaussian approximation. Default is @code{1}.
  11178. @item planes
  11179. Set which planes to filter. By default all planes are filtered.
  11180. @item sigmaV
  11181. Set vertical sigma, if negative it will be same as @code{sigma}.
  11182. Default is @code{-1}.
  11183. @end table
  11184. @subsection Commands
  11185. This filter supports same commands as options.
  11186. The command accepts the same syntax of the corresponding option.
  11187. If the specified expression is not valid, it is kept at its current
  11188. value.
  11189. @section geq
  11190. Apply generic equation to each pixel.
  11191. The filter accepts the following options:
  11192. @table @option
  11193. @item lum_expr, lum
  11194. Set the luma expression.
  11195. @item cb_expr, cb
  11196. Set the chrominance blue expression.
  11197. @item cr_expr, cr
  11198. Set the chrominance red expression.
  11199. @item alpha_expr, a
  11200. Set the alpha expression.
  11201. @item red_expr, r
  11202. Set the red expression.
  11203. @item green_expr, g
  11204. Set the green expression.
  11205. @item blue_expr, b
  11206. Set the blue expression.
  11207. @end table
  11208. The colorspace is selected according to the specified options. If one
  11209. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  11210. options is specified, the filter will automatically select a YCbCr
  11211. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  11212. @option{blue_expr} options is specified, it will select an RGB
  11213. colorspace.
  11214. If one of the chrominance expression is not defined, it falls back on the other
  11215. one. If no alpha expression is specified it will evaluate to opaque value.
  11216. If none of chrominance expressions are specified, they will evaluate
  11217. to the luma expression.
  11218. The expressions can use the following variables and functions:
  11219. @table @option
  11220. @item N
  11221. The sequential number of the filtered frame, starting from @code{0}.
  11222. @item X
  11223. @item Y
  11224. The coordinates of the current sample.
  11225. @item W
  11226. @item H
  11227. The width and height of the image.
  11228. @item SW
  11229. @item SH
  11230. Width and height scale depending on the currently filtered plane. It is the
  11231. ratio between the corresponding luma plane number of pixels and the current
  11232. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  11233. @code{0.5,0.5} for chroma planes.
  11234. @item T
  11235. Time of the current frame, expressed in seconds.
  11236. @item p(x, y)
  11237. Return the value of the pixel at location (@var{x},@var{y}) of the current
  11238. plane.
  11239. @item lum(x, y)
  11240. Return the value of the pixel at location (@var{x},@var{y}) of the luma
  11241. plane.
  11242. @item cb(x, y)
  11243. Return the value of the pixel at location (@var{x},@var{y}) of the
  11244. blue-difference chroma plane. Return 0 if there is no such plane.
  11245. @item cr(x, y)
  11246. Return the value of the pixel at location (@var{x},@var{y}) of the
  11247. red-difference chroma plane. Return 0 if there is no such plane.
  11248. @item r(x, y)
  11249. @item g(x, y)
  11250. @item b(x, y)
  11251. Return the value of the pixel at location (@var{x},@var{y}) of the
  11252. red/green/blue component. Return 0 if there is no such component.
  11253. @item alpha(x, y)
  11254. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  11255. plane. Return 0 if there is no such plane.
  11256. @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)
  11257. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  11258. sums of samples within a rectangle. See the functions without the sum postfix.
  11259. @item interpolation
  11260. Set one of interpolation methods:
  11261. @table @option
  11262. @item nearest, n
  11263. @item bilinear, b
  11264. @end table
  11265. Default is bilinear.
  11266. @end table
  11267. For functions, if @var{x} and @var{y} are outside the area, the value will be
  11268. automatically clipped to the closer edge.
  11269. Please note that this filter can use multiple threads in which case each slice
  11270. will have its own expression state. If you want to use only a single expression
  11271. state because your expressions depend on previous state then you should limit
  11272. the number of filter threads to 1.
  11273. @subsection Examples
  11274. @itemize
  11275. @item
  11276. Flip the image horizontally:
  11277. @example
  11278. geq=p(W-X\,Y)
  11279. @end example
  11280. @item
  11281. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  11282. wavelength of 100 pixels:
  11283. @example
  11284. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  11285. @end example
  11286. @item
  11287. Generate a fancy enigmatic moving light:
  11288. @example
  11289. 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
  11290. @end example
  11291. @item
  11292. Generate a quick emboss effect:
  11293. @example
  11294. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  11295. @end example
  11296. @item
  11297. Modify RGB components depending on pixel position:
  11298. @example
  11299. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  11300. @end example
  11301. @item
  11302. Create a radial gradient that is the same size as the input (also see
  11303. the @ref{vignette} filter):
  11304. @example
  11305. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  11306. @end example
  11307. @end itemize
  11308. @section gradfun
  11309. Fix the banding artifacts that are sometimes introduced into nearly flat
  11310. regions by truncation to 8-bit color depth.
  11311. Interpolate the gradients that should go where the bands are, and
  11312. dither them.
  11313. It is designed for playback only. Do not use it prior to
  11314. lossy compression, because compression tends to lose the dither and
  11315. bring back the bands.
  11316. It accepts the following parameters:
  11317. @table @option
  11318. @item strength
  11319. The maximum amount by which the filter will change any one pixel. This is also
  11320. the threshold for detecting nearly flat regions. Acceptable values range from
  11321. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  11322. valid range.
  11323. @item radius
  11324. The neighborhood to fit the gradient to. A larger radius makes for smoother
  11325. gradients, but also prevents the filter from modifying the pixels near detailed
  11326. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  11327. values will be clipped to the valid range.
  11328. @end table
  11329. Alternatively, the options can be specified as a flat string:
  11330. @var{strength}[:@var{radius}]
  11331. @subsection Examples
  11332. @itemize
  11333. @item
  11334. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  11335. @example
  11336. gradfun=3.5:8
  11337. @end example
  11338. @item
  11339. Specify radius, omitting the strength (which will fall-back to the default
  11340. value):
  11341. @example
  11342. gradfun=radius=8
  11343. @end example
  11344. @end itemize
  11345. @anchor{graphmonitor}
  11346. @section graphmonitor
  11347. Show various filtergraph stats.
  11348. With this filter one can debug complete filtergraph.
  11349. Especially issues with links filling with queued frames.
  11350. The filter accepts the following options:
  11351. @table @option
  11352. @item size, s
  11353. Set video output size. Default is @var{hd720}.
  11354. @item opacity, o
  11355. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  11356. @item mode, m
  11357. Set output mode flags.
  11358. Available values for flags are:
  11359. @table @samp
  11360. @item full
  11361. No any filtering. Default.
  11362. @item compact
  11363. Show only filters with queued frames.
  11364. @item nozero
  11365. Show only filters with non-zero stats.
  11366. @item noeof
  11367. Show only filters with non-eof stat.
  11368. @item nodisabled
  11369. Show only filters that are enabled in timeline.
  11370. @end table
  11371. @item flags, f
  11372. Set flags which enable which stats are shown in video.
  11373. Available values for flags are:
  11374. @table @samp
  11375. @item none
  11376. All flags turned off.
  11377. @item all
  11378. All flags turned on.
  11379. @item queue
  11380. Display number of queued frames in each link.
  11381. @item frame_count_in
  11382. Display number of frames taken from filter.
  11383. @item frame_count_out
  11384. Display number of frames given out from filter.
  11385. @item frame_count_delta
  11386. Display delta number of frames between above two values.
  11387. @item pts
  11388. Display current filtered frame pts.
  11389. @item pts_delta
  11390. Display pts delta between current and previous frame.
  11391. @item time
  11392. Display current filtered frame time.
  11393. @item time_delta
  11394. Display time delta between current and previous frame.
  11395. @item timebase
  11396. Display time base for filter link.
  11397. @item format
  11398. Display used format for filter link.
  11399. @item size
  11400. Display video size or number of audio channels in case of audio used by filter link.
  11401. @item rate
  11402. Display video frame rate or sample rate in case of audio used by filter link.
  11403. @item eof
  11404. Display link output status.
  11405. @item sample_count_in
  11406. Display number of samples taken from filter.
  11407. @item sample_count_out
  11408. Display number of samples given out from filter.
  11409. @item sample_count_delta
  11410. Display delta number of samples between above two values.
  11411. @item disabled
  11412. Show the timeline filter status.
  11413. @end table
  11414. @item rate, r
  11415. Set upper limit for video rate of output stream, Default value is @var{25}.
  11416. This guarantee that output video frame rate will not be higher than this value.
  11417. @end table
  11418. @section grayworld
  11419. A color constancy filter that applies color correction based on the grayworld assumption
  11420. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11421. The algorithm uses linear light, so input
  11422. data should be linearized beforehand (and possibly correctly tagged).
  11423. @example
  11424. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11425. @end example
  11426. @section greyedge
  11427. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11428. and corrects the scene colors accordingly.
  11429. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11430. The filter accepts the following options:
  11431. @table @option
  11432. @item difford
  11433. The order of differentiation to be applied on the scene. Must be chosen in the range
  11434. [0,2] and default value is 1.
  11435. @item minknorm
  11436. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11437. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11438. max value instead of calculating Minkowski distance.
  11439. @item sigma
  11440. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11441. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11442. can't be equal to 0 if @var{difford} is greater than 0.
  11443. @end table
  11444. @subsection Examples
  11445. @itemize
  11446. @item
  11447. Grey Edge:
  11448. @example
  11449. greyedge=difford=1:minknorm=5:sigma=2
  11450. @end example
  11451. @item
  11452. Max Edge:
  11453. @example
  11454. greyedge=difford=1:minknorm=0:sigma=2
  11455. @end example
  11456. @end itemize
  11457. @section guided
  11458. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11459. The filter accepts the following options:
  11460. @table @option
  11461. @item radius
  11462. Set the box radius in pixels.
  11463. Allowed range is 1 to 20. Default is 3.
  11464. @item eps
  11465. Set regularization parameter (with square).
  11466. Allowed range is 0 to 1. Default is 0.01.
  11467. @item mode
  11468. Set filter mode. Can be @code{basic} or @code{fast}.
  11469. Default is @code{basic}.
  11470. @item sub
  11471. Set subsampling ratio for @code{fast} mode.
  11472. Range is 2 to 64. Default is 4.
  11473. No subsampling occurs in @code{basic} mode.
  11474. @item guidance
  11475. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11476. If @code{off}, single input is required.
  11477. If @code{on}, two inputs of the same resolution and pixel format are required.
  11478. The second input serves as the guidance.
  11479. @item planes
  11480. Set planes to filter. Default is first only.
  11481. @end table
  11482. @subsection Commands
  11483. This filter supports the all above options as @ref{commands}.
  11484. @subsection Examples
  11485. @itemize
  11486. @item
  11487. Edge-preserving smoothing with guided filter:
  11488. @example
  11489. ffmpeg -i in.png -vf guided out.png
  11490. @end example
  11491. @item
  11492. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11493. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11494. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11495. @example
  11496. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11497. @end example
  11498. @end itemize
  11499. @anchor{haldclut}
  11500. @section haldclut
  11501. Apply a Hald CLUT to a video stream.
  11502. First input is the video stream to process, and second one is the Hald CLUT.
  11503. The Hald CLUT input can be a simple picture or a complete video stream.
  11504. The filter accepts the following options:
  11505. @table @option
  11506. @item clut
  11507. Set which CLUT video frames will be processed from second input stream,
  11508. can be @var{first} or @var{all}. Default is @var{all}.
  11509. @item shortest
  11510. Force termination when the shortest input terminates. Default is @code{0}.
  11511. @item repeatlast
  11512. Continue applying the last CLUT after the end of the stream. A value of
  11513. @code{0} disable the filter after the last frame of the CLUT is reached.
  11514. Default is @code{1}.
  11515. @end table
  11516. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11517. filters share the same internals).
  11518. This filter also supports the @ref{framesync} options.
  11519. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11520. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11521. @subsection Commands
  11522. This filter supports the @code{interp} option as @ref{commands}.
  11523. @subsection Workflow examples
  11524. @subsubsection Hald CLUT video stream
  11525. Generate an identity Hald CLUT stream altered with various effects:
  11526. @example
  11527. 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
  11528. @end example
  11529. Note: make sure you use a lossless codec.
  11530. Then use it with @code{haldclut} to apply it on some random stream:
  11531. @example
  11532. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11533. @end example
  11534. The Hald CLUT will be applied to the 10 first seconds (duration of
  11535. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11536. to the remaining frames of the @code{mandelbrot} stream.
  11537. @subsubsection Hald CLUT with preview
  11538. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11539. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11540. biggest possible square starting at the top left of the picture. The remaining
  11541. padding pixels (bottom or right) will be ignored. This area can be used to add
  11542. a preview of the Hald CLUT.
  11543. Typically, the following generated Hald CLUT will be supported by the
  11544. @code{haldclut} filter:
  11545. @example
  11546. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11547. pad=iw+320 [padded_clut];
  11548. smptebars=s=320x256, split [a][b];
  11549. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11550. [main][b] overlay=W-320" -frames:v 1 clut.png
  11551. @end example
  11552. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11553. bars are displayed on the right-top, and below the same color bars processed by
  11554. the color changes.
  11555. Then, the effect of this Hald CLUT can be visualized with:
  11556. @example
  11557. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11558. @end example
  11559. @section hflip
  11560. Flip the input video horizontally.
  11561. For example, to horizontally flip the input video with @command{ffmpeg}:
  11562. @example
  11563. ffmpeg -i in.avi -vf "hflip" out.avi
  11564. @end example
  11565. @section histeq
  11566. This filter applies a global color histogram equalization on a
  11567. per-frame basis.
  11568. It can be used to correct video that has a compressed range of pixel
  11569. intensities. The filter redistributes the pixel intensities to
  11570. equalize their distribution across the intensity range. It may be
  11571. viewed as an "automatically adjusting contrast filter". This filter is
  11572. useful only for correcting degraded or poorly captured source
  11573. video.
  11574. The filter accepts the following options:
  11575. @table @option
  11576. @item strength
  11577. Determine the amount of equalization to be applied. As the strength
  11578. is reduced, the distribution of pixel intensities more-and-more
  11579. approaches that of the input frame. The value must be a float number
  11580. in the range [0,1] and defaults to 0.200.
  11581. @item intensity
  11582. Set the maximum intensity that can generated and scale the output
  11583. values appropriately. The strength should be set as desired and then
  11584. the intensity can be limited if needed to avoid washing-out. The value
  11585. must be a float number in the range [0,1] and defaults to 0.210.
  11586. @item antibanding
  11587. Set the antibanding level. If enabled the filter will randomly vary
  11588. the luminance of output pixels by a small amount to avoid banding of
  11589. the histogram. Possible values are @code{none}, @code{weak} or
  11590. @code{strong}. It defaults to @code{none}.
  11591. @end table
  11592. @anchor{histogram}
  11593. @section histogram
  11594. Compute and draw a color distribution histogram for the input video.
  11595. The computed histogram is a representation of the color component
  11596. distribution in an image.
  11597. Standard histogram displays the color components distribution in an image.
  11598. Displays color graph for each color component. Shows distribution of
  11599. the Y, U, V, A or R, G, B components, depending on input format, in the
  11600. current frame. Below each graph a color component scale meter is shown.
  11601. The filter accepts the following options:
  11602. @table @option
  11603. @item level_height
  11604. Set height of level. Default value is @code{200}.
  11605. Allowed range is [50, 2048].
  11606. @item scale_height
  11607. Set height of color scale. Default value is @code{12}.
  11608. Allowed range is [0, 40].
  11609. @item display_mode
  11610. Set display mode.
  11611. It accepts the following values:
  11612. @table @samp
  11613. @item stack
  11614. Per color component graphs are placed below each other.
  11615. @item parade
  11616. Per color component graphs are placed side by side.
  11617. @item overlay
  11618. Presents information identical to that in the @code{parade}, except
  11619. that the graphs representing color components are superimposed directly
  11620. over one another.
  11621. @end table
  11622. Default is @code{stack}.
  11623. @item levels_mode
  11624. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11625. Default is @code{linear}.
  11626. @item components
  11627. Set what color components to display.
  11628. Default is @code{7}.
  11629. @item fgopacity
  11630. Set foreground opacity. Default is @code{0.7}.
  11631. @item bgopacity
  11632. Set background opacity. Default is @code{0.5}.
  11633. @item colors_mode
  11634. Set colors mode.
  11635. It accepts the following values:
  11636. @table @samp
  11637. @item whiteonblack
  11638. @item blackonwhite
  11639. @item whiteongray
  11640. @item blackongray
  11641. @item coloronblack
  11642. @item coloronwhite
  11643. @item colorongray
  11644. @item blackoncolor
  11645. @item whiteoncolor
  11646. @item grayoncolor
  11647. @end table
  11648. Default is @code{whiteonblack}.
  11649. @end table
  11650. @subsection Examples
  11651. @itemize
  11652. @item
  11653. Calculate and draw histogram:
  11654. @example
  11655. ffplay -i input -vf histogram
  11656. @end example
  11657. @end itemize
  11658. @anchor{hqdn3d}
  11659. @section hqdn3d
  11660. This is a high precision/quality 3d denoise filter. It aims to reduce
  11661. image noise, producing smooth images and making still images really
  11662. still. It should enhance compressibility.
  11663. It accepts the following optional parameters:
  11664. @table @option
  11665. @item luma_spatial
  11666. A non-negative floating point number which specifies spatial luma strength.
  11667. It defaults to 4.0.
  11668. @item chroma_spatial
  11669. A non-negative floating point number which specifies spatial chroma strength.
  11670. It defaults to 3.0*@var{luma_spatial}/4.0.
  11671. @item luma_tmp
  11672. A floating point number which specifies luma temporal strength. It defaults to
  11673. 6.0*@var{luma_spatial}/4.0.
  11674. @item chroma_tmp
  11675. A floating point number which specifies chroma temporal strength. It defaults to
  11676. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11677. @end table
  11678. @subsection Commands
  11679. This filter supports same @ref{commands} as options.
  11680. The command accepts the same syntax of the corresponding option.
  11681. If the specified expression is not valid, it is kept at its current
  11682. value.
  11683. @anchor{hwdownload}
  11684. @section hwdownload
  11685. Download hardware frames to system memory.
  11686. The input must be in hardware frames, and the output a non-hardware format.
  11687. Not all formats will be supported on the output - it may be necessary to insert
  11688. an additional @option{format} filter immediately following in the graph to get
  11689. the output in a supported format.
  11690. @section hwmap
  11691. Map hardware frames to system memory or to another device.
  11692. This filter has several different modes of operation; which one is used depends
  11693. on the input and output formats:
  11694. @itemize
  11695. @item
  11696. Hardware frame input, normal frame output
  11697. Map the input frames to system memory and pass them to the output. If the
  11698. original hardware frame is later required (for example, after overlaying
  11699. something else on part of it), the @option{hwmap} filter can be used again
  11700. in the next mode to retrieve it.
  11701. @item
  11702. Normal frame input, hardware frame output
  11703. If the input is actually a software-mapped hardware frame, then unmap it -
  11704. that is, return the original hardware frame.
  11705. Otherwise, a device must be provided. Create new hardware surfaces on that
  11706. device for the output, then map them back to the software format at the input
  11707. and give those frames to the preceding filter. This will then act like the
  11708. @option{hwupload} filter, but may be able to avoid an additional copy when
  11709. the input is already in a compatible format.
  11710. @item
  11711. Hardware frame input and output
  11712. A device must be supplied for the output, either directly or with the
  11713. @option{derive_device} option. The input and output devices must be of
  11714. different types and compatible - the exact meaning of this is
  11715. system-dependent, but typically it means that they must refer to the same
  11716. underlying hardware context (for example, refer to the same graphics card).
  11717. If the input frames were originally created on the output device, then unmap
  11718. to retrieve the original frames.
  11719. Otherwise, map the frames to the output device - create new hardware frames
  11720. on the output corresponding to the frames on the input.
  11721. @end itemize
  11722. The following additional parameters are accepted:
  11723. @table @option
  11724. @item mode
  11725. Set the frame mapping mode. Some combination of:
  11726. @table @var
  11727. @item read
  11728. The mapped frame should be readable.
  11729. @item write
  11730. The mapped frame should be writeable.
  11731. @item overwrite
  11732. The mapping will always overwrite the entire frame.
  11733. This may improve performance in some cases, as the original contents of the
  11734. frame need not be loaded.
  11735. @item direct
  11736. The mapping must not involve any copying.
  11737. Indirect mappings to copies of frames are created in some cases where either
  11738. direct mapping is not possible or it would have unexpected properties.
  11739. Setting this flag ensures that the mapping is direct and will fail if that is
  11740. not possible.
  11741. @end table
  11742. Defaults to @var{read+write} if not specified.
  11743. @item derive_device @var{type}
  11744. Rather than using the device supplied at initialisation, instead derive a new
  11745. device of type @var{type} from the device the input frames exist on.
  11746. @item reverse
  11747. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11748. and map them back to the source. This may be necessary in some cases where
  11749. a mapping in one direction is required but only the opposite direction is
  11750. supported by the devices being used.
  11751. This option is dangerous - it may break the preceding filter in undefined
  11752. ways if there are any additional constraints on that filter's output.
  11753. Do not use it without fully understanding the implications of its use.
  11754. @end table
  11755. @anchor{hwupload}
  11756. @section hwupload
  11757. Upload system memory frames to hardware surfaces.
  11758. The device to upload to must be supplied when the filter is initialised. If
  11759. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11760. option or with the @option{derive_device} option. The input and output devices
  11761. must be of different types and compatible - the exact meaning of this is
  11762. system-dependent, but typically it means that they must refer to the same
  11763. underlying hardware context (for example, refer to the same graphics card).
  11764. The following additional parameters are accepted:
  11765. @table @option
  11766. @item derive_device @var{type}
  11767. Rather than using the device supplied at initialisation, instead derive a new
  11768. device of type @var{type} from the device the input frames exist on.
  11769. @end table
  11770. @anchor{hwupload_cuda}
  11771. @section hwupload_cuda
  11772. Upload system memory frames to a CUDA device.
  11773. It accepts the following optional parameters:
  11774. @table @option
  11775. @item device
  11776. The number of the CUDA device to use
  11777. @end table
  11778. @section hqx
  11779. Apply a high-quality magnification filter designed for pixel art. This filter
  11780. was originally created by Maxim Stepin.
  11781. It accepts the following option:
  11782. @table @option
  11783. @item n
  11784. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11785. @code{hq3x} and @code{4} for @code{hq4x}.
  11786. Default is @code{3}.
  11787. @end table
  11788. @anchor{hstack}
  11789. @section hstack
  11790. Stack input videos horizontally.
  11791. All streams must be of same pixel format and of same height.
  11792. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11793. to create same output.
  11794. The filter accepts the following option:
  11795. @table @option
  11796. @item inputs
  11797. Set number of input streams. Default is 2.
  11798. @item shortest
  11799. If set to 1, force the output to terminate when the shortest input
  11800. terminates. Default value is 0.
  11801. @end table
  11802. @section hsvhold
  11803. Turns a certain HSV range into gray values.
  11804. This filter measures color difference between set HSV color in options
  11805. and ones measured in video stream. Depending on options, output
  11806. colors can be changed to be gray or not.
  11807. The filter accepts the following options:
  11808. @table @option
  11809. @item hue
  11810. Set the hue value which will be used in color difference calculation.
  11811. Allowed range is from -360 to 360. Default value is 0.
  11812. @item sat
  11813. Set the saturation value which will be used in color difference calculation.
  11814. Allowed range is from -1 to 1. Default value is 0.
  11815. @item val
  11816. Set the value which will be used in color difference calculation.
  11817. Allowed range is from -1 to 1. Default value is 0.
  11818. @item similarity
  11819. Set similarity percentage with the key color.
  11820. Allowed range is from 0 to 1. Default value is 0.01.
  11821. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11822. @item blend
  11823. Blend percentage.
  11824. Allowed range is from 0 to 1. Default value is 0.
  11825. 0.0 makes pixels either fully gray, or not gray at all.
  11826. Higher values result in more gray pixels, with a higher gray pixel
  11827. the more similar the pixels color is to the key color.
  11828. @end table
  11829. @section hsvkey
  11830. Turns a certain HSV range into transparency.
  11831. This filter measures color difference between set HSV color in options
  11832. and ones measured in video stream. Depending on options, output
  11833. colors can be changed to transparent by adding alpha channel.
  11834. The filter accepts the following options:
  11835. @table @option
  11836. @item hue
  11837. Set the hue value which will be used in color difference calculation.
  11838. Allowed range is from -360 to 360. Default value is 0.
  11839. @item sat
  11840. Set the saturation value which will be used in color difference calculation.
  11841. Allowed range is from -1 to 1. Default value is 0.
  11842. @item val
  11843. Set the value which will be used in color difference calculation.
  11844. Allowed range is from -1 to 1. Default value is 0.
  11845. @item similarity
  11846. Set similarity percentage with the key color.
  11847. Allowed range is from 0 to 1. Default value is 0.01.
  11848. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11849. @item blend
  11850. Blend percentage.
  11851. Allowed range is from 0 to 1. Default value is 0.
  11852. 0.0 makes pixels either fully transparent, or not transparent at all.
  11853. Higher values result in semi-transparent pixels, with a higher transparency
  11854. the more similar the pixels color is to the key color.
  11855. @end table
  11856. @section hue
  11857. Modify the hue and/or the saturation of the input.
  11858. It accepts the following parameters:
  11859. @table @option
  11860. @item h
  11861. Specify the hue angle as a number of degrees. It accepts an expression,
  11862. and defaults to "0".
  11863. @item s
  11864. Specify the saturation in the [-10,10] range. It accepts an expression and
  11865. defaults to "1".
  11866. @item H
  11867. Specify the hue angle as a number of radians. It accepts an
  11868. expression, and defaults to "0".
  11869. @item b
  11870. Specify the brightness in the [-10,10] range. It accepts an expression and
  11871. defaults to "0".
  11872. @end table
  11873. @option{h} and @option{H} are mutually exclusive, and can't be
  11874. specified at the same time.
  11875. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11876. expressions containing the following constants:
  11877. @table @option
  11878. @item n
  11879. frame count of the input frame starting from 0
  11880. @item pts
  11881. presentation timestamp of the input frame expressed in time base units
  11882. @item r
  11883. frame rate of the input video, NAN if the input frame rate is unknown
  11884. @item t
  11885. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11886. @item tb
  11887. time base of the input video
  11888. @end table
  11889. @subsection Examples
  11890. @itemize
  11891. @item
  11892. Set the hue to 90 degrees and the saturation to 1.0:
  11893. @example
  11894. hue=h=90:s=1
  11895. @end example
  11896. @item
  11897. Same command but expressing the hue in radians:
  11898. @example
  11899. hue=H=PI/2:s=1
  11900. @end example
  11901. @item
  11902. Rotate hue and make the saturation swing between 0
  11903. and 2 over a period of 1 second:
  11904. @example
  11905. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  11906. @end example
  11907. @item
  11908. Apply a 3 seconds saturation fade-in effect starting at 0:
  11909. @example
  11910. hue="s=min(t/3\,1)"
  11911. @end example
  11912. The general fade-in expression can be written as:
  11913. @example
  11914. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  11915. @end example
  11916. @item
  11917. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  11918. @example
  11919. hue="s=max(0\, min(1\, (8-t)/3))"
  11920. @end example
  11921. The general fade-out expression can be written as:
  11922. @example
  11923. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  11924. @end example
  11925. @end itemize
  11926. @subsection Commands
  11927. This filter supports the following commands:
  11928. @table @option
  11929. @item b
  11930. @item s
  11931. @item h
  11932. @item H
  11933. Modify the hue and/or the saturation and/or brightness of the input video.
  11934. The command accepts the same syntax of the corresponding option.
  11935. If the specified expression is not valid, it is kept at its current
  11936. value.
  11937. @end table
  11938. @section huesaturation
  11939. Apply hue-saturation-intensity adjustments to input video stream.
  11940. This filter operates in RGB colorspace.
  11941. This filter accepts the following options:
  11942. @table @option
  11943. @item hue
  11944. Set the hue shift in degrees to apply. Default is 0.
  11945. Allowed range is from -180 to 180.
  11946. @item saturation
  11947. Set the saturation shift. Default is 0.
  11948. Allowed range is from -1 to 1.
  11949. @item intensity
  11950. Set the intensity shift. Default is 0.
  11951. Allowed range is from -1 to 1.
  11952. @item colors
  11953. Set which primary and complementary colors are going to be adjusted.
  11954. This options is set by providing one or multiple values.
  11955. This can select multiple colors at once. By default all colors are selected.
  11956. @table @samp
  11957. @item r
  11958. Adjust reds.
  11959. @item y
  11960. Adjust yellows.
  11961. @item g
  11962. Adjust greens.
  11963. @item c
  11964. Adjust cyans.
  11965. @item b
  11966. Adjust blues.
  11967. @item m
  11968. Adjust magentas.
  11969. @item a
  11970. Adjust all colors.
  11971. @end table
  11972. @item strength
  11973. Set strength of filtering. Allowed range is from 0 to 100.
  11974. Default value is 1.
  11975. @item rw, gw, bw
  11976. Set weight for each RGB component. Allowed range is from 0 to 1.
  11977. By default is set to 0.333, 0.334, 0.333.
  11978. Those options are used in saturation and lightess processing.
  11979. @item lightness
  11980. Set preserving lightness, by default is disabled.
  11981. Adjusting hues can change lightness from original RGB triplet,
  11982. with this option enabled lightness is kept at same value.
  11983. @end table
  11984. @section hysteresis
  11985. Grow first stream into second stream by connecting components.
  11986. This makes it possible to build more robust edge masks.
  11987. This filter accepts the following options:
  11988. @table @option
  11989. @item planes
  11990. Set which planes will be processed as bitmap, unprocessed planes will be
  11991. copied from first stream.
  11992. By default value 0xf, all planes will be processed.
  11993. @item threshold
  11994. Set threshold which is used in filtering. If pixel component value is higher than
  11995. this value filter algorithm for connecting components is activated.
  11996. By default value is 0.
  11997. @end table
  11998. The @code{hysteresis} filter also supports the @ref{framesync} options.
  11999. @section iccdetect
  12000. Detect the colorspace from an embedded ICC profile (if present), and update
  12001. the frame's tags accordingly.
  12002. This filter accepts the following options:
  12003. @table @option
  12004. @item force
  12005. If true, the frame's existing colorspace tags will always be overridden by
  12006. values detected from an ICC profile. Otherwise, they will only be assigned if
  12007. they contain @code{unknown}. Enabled by default.
  12008. @end table
  12009. @section iccgen
  12010. Generate ICC profiles and attach them to frames.
  12011. This filter accepts the following options:
  12012. @table @option
  12013. @item color_primaries
  12014. @item color_trc
  12015. Configure the colorspace that the ICC profile will be generated for. The
  12016. default value of @code{auto} infers the value from the input frame's metadata,
  12017. defaulting to BT.709/sRGB as appropriate.
  12018. See the @ref{setparams} filter for a list of possible values, but note that
  12019. @code{unknown} are not valid values for this filter.
  12020. @item force
  12021. If true, an ICC profile will be generated even if it would overwrite an
  12022. already existing ICC profile. Disabled by default.
  12023. @end table
  12024. @section identity
  12025. Obtain the identity score between two input videos.
  12026. This filter takes two input videos.
  12027. Both input videos must have the same resolution and pixel format for
  12028. this filter to work correctly. Also it assumes that both inputs
  12029. have the same number of frames, which are compared one by one.
  12030. The obtained per component, average, min and max identity score is printed through
  12031. the logging system.
  12032. The filter stores the calculated identity scores of each frame in frame metadata.
  12033. This filter also supports the @ref{framesync} options.
  12034. In the below example the input file @file{main.mpg} being processed is compared
  12035. with the reference file @file{ref.mpg}.
  12036. @example
  12037. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  12038. @end example
  12039. @section idet
  12040. Detect video interlacing type.
  12041. This filter tries to detect if the input frames are interlaced, progressive,
  12042. top or bottom field first. It will also try to detect fields that are
  12043. repeated between adjacent frames (a sign of telecine).
  12044. Single frame detection considers only immediately adjacent frames when classifying each frame.
  12045. Multiple frame detection incorporates the classification history of previous frames.
  12046. The filter will log these metadata values:
  12047. @table @option
  12048. @item single.current_frame
  12049. Detected type of current frame using single-frame detection. One of:
  12050. ``tff'' (top field first), ``bff'' (bottom field first),
  12051. ``progressive'', or ``undetermined''
  12052. @item single.tff
  12053. Cumulative number of frames detected as top field first using single-frame detection.
  12054. @item multiple.tff
  12055. Cumulative number of frames detected as top field first using multiple-frame detection.
  12056. @item single.bff
  12057. Cumulative number of frames detected as bottom field first using single-frame detection.
  12058. @item multiple.current_frame
  12059. Detected type of current frame using multiple-frame detection. One of:
  12060. ``tff'' (top field first), ``bff'' (bottom field first),
  12061. ``progressive'', or ``undetermined''
  12062. @item multiple.bff
  12063. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  12064. @item single.progressive
  12065. Cumulative number of frames detected as progressive using single-frame detection.
  12066. @item multiple.progressive
  12067. Cumulative number of frames detected as progressive using multiple-frame detection.
  12068. @item single.undetermined
  12069. Cumulative number of frames that could not be classified using single-frame detection.
  12070. @item multiple.undetermined
  12071. Cumulative number of frames that could not be classified using multiple-frame detection.
  12072. @item repeated.current_frame
  12073. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  12074. @item repeated.neither
  12075. Cumulative number of frames with no repeated field.
  12076. @item repeated.top
  12077. Cumulative number of frames with the top field repeated from the previous frame's top field.
  12078. @item repeated.bottom
  12079. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  12080. @end table
  12081. The filter accepts the following options:
  12082. @table @option
  12083. @item intl_thres
  12084. Set interlacing threshold.
  12085. @item prog_thres
  12086. Set progressive threshold.
  12087. @item rep_thres
  12088. Threshold for repeated field detection.
  12089. @item half_life
  12090. Number of frames after which a given frame's contribution to the
  12091. statistics is halved (i.e., it contributes only 0.5 to its
  12092. classification). The default of 0 means that all frames seen are given
  12093. full weight of 1.0 forever.
  12094. @item analyze_interlaced_flag
  12095. When this is not 0 then idet will use the specified number of frames to determine
  12096. if the interlaced flag is accurate, it will not count undetermined frames.
  12097. If the flag is found to be accurate it will be used without any further
  12098. computations, if it is found to be inaccurate it will be cleared without any
  12099. further computations. This allows inserting the idet filter as a low computational
  12100. method to clean up the interlaced flag
  12101. @end table
  12102. @subsection Examples
  12103. Inspect the field order of the first 360 frames in a video, in verbose detail:
  12104. @example
  12105. ffmpeg -i INPUT -filter:v idet,metadata=mode=print -frames:v 360 -an -f null -
  12106. @end example
  12107. The idet filter will add analysis metadata to each frame, which will then be
  12108. discarded. At the end, the filter will also print a final report with statistics.
  12109. @section il
  12110. Deinterleave or interleave fields.
  12111. This filter allows one to process interlaced images fields without
  12112. deinterlacing them. Deinterleaving splits the input frame into 2
  12113. fields (so called half pictures). Odd lines are moved to the top
  12114. half of the output image, even lines to the bottom half.
  12115. You can process (filter) them independently and then re-interleave them.
  12116. The filter accepts the following options:
  12117. @table @option
  12118. @item luma_mode, l
  12119. @item chroma_mode, c
  12120. @item alpha_mode, a
  12121. Available values for @var{luma_mode}, @var{chroma_mode} and
  12122. @var{alpha_mode} are:
  12123. @table @samp
  12124. @item none
  12125. Do nothing.
  12126. @item deinterleave, d
  12127. Deinterleave fields, placing one above the other.
  12128. @item interleave, i
  12129. Interleave fields. Reverse the effect of deinterleaving.
  12130. @end table
  12131. Default value is @code{none}.
  12132. @item luma_swap, ls
  12133. @item chroma_swap, cs
  12134. @item alpha_swap, as
  12135. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  12136. @end table
  12137. @subsection Commands
  12138. This filter supports the all above options as @ref{commands}.
  12139. @section inflate
  12140. Apply inflate effect to the video.
  12141. This filter replaces the pixel by the local(3x3) average by taking into account
  12142. only values higher than the pixel.
  12143. It accepts the following options:
  12144. @table @option
  12145. @item threshold0
  12146. @item threshold1
  12147. @item threshold2
  12148. @item threshold3
  12149. Limit the maximum change for each plane, default is 65535.
  12150. If 0, plane will remain unchanged.
  12151. @end table
  12152. @subsection Commands
  12153. This filter supports the all above options as @ref{commands}.
  12154. @section interlace, interlace_vulkan
  12155. Simple interlacing filter from progressive contents. This interleaves upper (or
  12156. lower) lines from odd frames with lower (or upper) lines from even frames,
  12157. halving the frame rate and preserving image height.
  12158. @example
  12159. Original Original New Frame
  12160. Frame 'j' Frame 'j+1' (tff)
  12161. ========== =========== ==================
  12162. Line 0 --------------------> Frame 'j' Line 0
  12163. Line 1 Line 1 ----> Frame 'j+1' Line 1
  12164. Line 2 ---------------------> Frame 'j' Line 2
  12165. Line 3 Line 3 ----> Frame 'j+1' Line 3
  12166. ... ... ...
  12167. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  12168. @end example
  12169. It accepts the following optional parameters:
  12170. @table @option
  12171. @item scan
  12172. This determines whether the interlaced frame is taken from the even
  12173. (tff - default) or odd (bff) lines of the progressive frame.
  12174. @item lowpass
  12175. Vertical lowpass filter to avoid twitter interlacing and
  12176. reduce moire patterns.
  12177. @table @samp
  12178. @item 0, off
  12179. Disable vertical lowpass filter
  12180. @item 1, linear
  12181. Enable linear filter (default)
  12182. @item 2, complex
  12183. Enable complex filter. This will slightly less reduce twitter and moire
  12184. but better retain detail and subjective sharpness impression.
  12185. @end table
  12186. @end table
  12187. @section kerndeint
  12188. Deinterlace input video by applying Donald Graft's adaptive kernel
  12189. deinterling. Work on interlaced parts of a video to produce
  12190. progressive frames.
  12191. The description of the accepted parameters follows.
  12192. @table @option
  12193. @item thresh
  12194. Set the threshold which affects the filter's tolerance when
  12195. determining if a pixel line must be processed. It must be an integer
  12196. in the range [0,255] and defaults to 10. A value of 0 will result in
  12197. applying the process on every pixels.
  12198. @item map
  12199. Paint pixels exceeding the threshold value to white if set to 1.
  12200. Default is 0.
  12201. @item order
  12202. Set the fields order. Swap fields if set to 1, leave fields alone if
  12203. 0. Default is 0.
  12204. @item sharp
  12205. Enable additional sharpening if set to 1. Default is 0.
  12206. @item twoway
  12207. Enable twoway sharpening if set to 1. Default is 0.
  12208. @end table
  12209. @subsection Examples
  12210. @itemize
  12211. @item
  12212. Apply default values:
  12213. @example
  12214. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  12215. @end example
  12216. @item
  12217. Enable additional sharpening:
  12218. @example
  12219. kerndeint=sharp=1
  12220. @end example
  12221. @item
  12222. Paint processed pixels in white:
  12223. @example
  12224. kerndeint=map=1
  12225. @end example
  12226. @end itemize
  12227. @section kirsch
  12228. Apply kirsch operator to input video stream.
  12229. The filter accepts the following option:
  12230. @table @option
  12231. @item planes
  12232. Set which planes will be processed, unprocessed planes will be copied.
  12233. By default value 0xf, all planes will be processed.
  12234. @item scale
  12235. Set value which will be multiplied with filtered result.
  12236. @item delta
  12237. Set value which will be added to filtered result.
  12238. @end table
  12239. @subsection Commands
  12240. This filter supports the all above options as @ref{commands}.
  12241. @section lagfun
  12242. Slowly update darker pixels.
  12243. This filter makes short flashes of light appear longer.
  12244. This filter accepts the following options:
  12245. @table @option
  12246. @item decay
  12247. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  12248. @item planes
  12249. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12250. @end table
  12251. @subsection Commands
  12252. This filter supports the all above options as @ref{commands}.
  12253. @section lenscorrection
  12254. Correct radial lens distortion
  12255. This filter can be used to correct for radial distortion as can result from the use
  12256. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  12257. one can use tools available for example as part of opencv or simply trial-and-error.
  12258. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  12259. and extract the k1 and k2 coefficients from the resulting matrix.
  12260. Note that effectively the same filter is available in the open-source tools Krita and
  12261. Digikam from the KDE project.
  12262. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  12263. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  12264. brightness distribution, so you may want to use both filters together in certain
  12265. cases, though you will have to take care of ordering, i.e. whether vignetting should
  12266. be applied before or after lens correction.
  12267. @subsection Options
  12268. The filter accepts the following options:
  12269. @table @option
  12270. @item cx
  12271. Relative x-coordinate of the focal point of the image, and thereby the center of the
  12272. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12273. width. Default is 0.5.
  12274. @item cy
  12275. Relative y-coordinate of the focal point of the image, and thereby the center of the
  12276. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12277. height. Default is 0.5.
  12278. @item k1
  12279. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  12280. no correction. Default is 0.
  12281. @item k2
  12282. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  12283. 0 means no correction. Default is 0.
  12284. @item i
  12285. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  12286. Default is @code{nearest}.
  12287. @item fc
  12288. Specify the color of the unmapped pixels. For the syntax of this option,
  12289. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12290. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  12291. @end table
  12292. The formula that generates the correction is:
  12293. @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)
  12294. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  12295. distances from the focal point in the source and target images, respectively.
  12296. @subsection Commands
  12297. This filter supports the all above options as @ref{commands}.
  12298. @section lensfun
  12299. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  12300. The @code{lensfun} filter requires the camera make, camera model, and lens model
  12301. to apply the lens correction. The filter will load the lensfun database and
  12302. query it to find the corresponding camera and lens entries in the database. As
  12303. long as these entries can be found with the given options, the filter can
  12304. perform corrections on frames. Note that incomplete strings will result in the
  12305. filter choosing the best match with the given options, and the filter will
  12306. output the chosen camera and lens models (logged with level "info"). You must
  12307. provide the make, camera model, and lens model as they are required.
  12308. To obtain a list of available makes and models, leave out one or both of @code{make} and
  12309. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  12310. The first column is the make and the second column is the model.
  12311. To obtain a list of available lenses, set any values for make and model and leave out the
  12312. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  12313. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  12314. The filter accepts the following options:
  12315. @table @option
  12316. @item make
  12317. The make of the camera (for example, "Canon"). This option is required.
  12318. @item model
  12319. The model of the camera (for example, "Canon EOS 100D"). This option is
  12320. required.
  12321. @item lens_model
  12322. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  12323. option is required.
  12324. @item db_path
  12325. The full path to the lens database folder. If not set, the filter will attempt to
  12326. load the database from the install path when the library was built. Default is unset.
  12327. @item mode
  12328. The type of correction to apply. The following values are valid options:
  12329. @table @samp
  12330. @item vignetting
  12331. Enables fixing lens vignetting.
  12332. @item geometry
  12333. Enables fixing lens geometry. This is the default.
  12334. @item subpixel
  12335. Enables fixing chromatic aberrations.
  12336. @item vig_geo
  12337. Enables fixing lens vignetting and lens geometry.
  12338. @item vig_subpixel
  12339. Enables fixing lens vignetting and chromatic aberrations.
  12340. @item distortion
  12341. Enables fixing both lens geometry and chromatic aberrations.
  12342. @item all
  12343. Enables all possible corrections.
  12344. @end table
  12345. @item focal_length
  12346. The focal length of the image/video (zoom; expected constant for video). For
  12347. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  12348. range should be chosen when using that lens. Default 18.
  12349. @item aperture
  12350. The aperture of the image/video (expected constant for video). Note that
  12351. aperture is only used for vignetting correction. Default 3.5.
  12352. @item focus_distance
  12353. The focus distance of the image/video (expected constant for video). Note that
  12354. focus distance is only used for vignetting and only slightly affects the
  12355. vignetting correction process. If unknown, leave it at the default value (which
  12356. is 1000).
  12357. @item scale
  12358. The scale factor which is applied after transformation. After correction the
  12359. video is no longer necessarily rectangular. This parameter controls how much of
  12360. the resulting image is visible. The value 0 means that a value will be chosen
  12361. automatically such that there is little or no unmapped area in the output
  12362. image. 1.0 means that no additional scaling is done. Lower values may result
  12363. in more of the corrected image being visible, while higher values may avoid
  12364. unmapped areas in the output.
  12365. @item target_geometry
  12366. The target geometry of the output image/video. The following values are valid
  12367. options:
  12368. @table @samp
  12369. @item rectilinear (default)
  12370. @item fisheye
  12371. @item panoramic
  12372. @item equirectangular
  12373. @item fisheye_orthographic
  12374. @item fisheye_stereographic
  12375. @item fisheye_equisolid
  12376. @item fisheye_thoby
  12377. @end table
  12378. @item reverse
  12379. Apply the reverse of image correction (instead of correcting distortion, apply
  12380. it).
  12381. @item interpolation
  12382. The type of interpolation used when correcting distortion. The following values
  12383. are valid options:
  12384. @table @samp
  12385. @item nearest
  12386. @item linear (default)
  12387. @item lanczos
  12388. @end table
  12389. @end table
  12390. @subsection Examples
  12391. @itemize
  12392. @item
  12393. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  12394. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  12395. aperture of "8.0".
  12396. @example
  12397. 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
  12398. @end example
  12399. @item
  12400. Apply the same as before, but only for the first 5 seconds of video.
  12401. @example
  12402. 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
  12403. @end example
  12404. @end itemize
  12405. @section lcevc
  12406. Low Complexity Enhancement Video Codec filter based on liblcevc_dec
  12407. (@url{https://github.com/v-novaltd/LCEVCdec}).
  12408. @section libplacebo
  12409. Flexible GPU-accelerated processing filter based on libplacebo
  12410. (@url{https://code.videolan.org/videolan/libplacebo}).
  12411. @subsection Options
  12412. The options for this filter are divided into the following sections:
  12413. @subsubsection Output mode
  12414. These options control the overall output mode. By default, libplacebo will try
  12415. to preserve the source colorimetry and size as best as it can, but it will
  12416. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12417. in source frames.
  12418. @table @option
  12419. @item inputs
  12420. Set the number of inputs. This can be used, alongside the @code{idx} variable,
  12421. to allow placing/blending multiple inputs inside the output frame. This
  12422. effectively enables functionality similar to @ref{hstack}, @ref{overlay}, etc.
  12423. @item w
  12424. @item h
  12425. Set the output video dimension expression. Default values are @code{iw} and
  12426. @code{ih}.
  12427. Allows for the same expressions as the @ref{scale} filter.
  12428. @item crop_x
  12429. @item crop_y
  12430. Set the input crop x/y expressions, default values are @code{(iw-cw)/2} and
  12431. @code{(ih-ch)/2}.
  12432. @item crop_w
  12433. @item crop_h
  12434. Set the input crop width/height expressions, default values are @code{iw} and
  12435. @code{ih}.
  12436. @item pos_x
  12437. @item pos_y
  12438. Set the output placement x/y expressions, default values are @code{(ow-pw)/2}
  12439. and @code{(oh-ph)/2}.
  12440. @item pos_w
  12441. @item pos_h
  12442. Set the output placement width/height expressions, default values are @code{ow}
  12443. and @code{oh}.
  12444. @item rotate
  12445. Rotate the input frame clockwise by the specified angle.
  12446. @table @samp
  12447. @item 0, 360
  12448. @item 90
  12449. @item 180
  12450. @item 270
  12451. @end table
  12452. @item fps
  12453. Set the output frame rate. This can be rational, e.g. @code{60000/1001}. If
  12454. set to the special string @code{none} (the default), input timestamps will
  12455. instead be passed through to the output unmodified. Otherwise, the input video
  12456. frames will be interpolated as necessary to rescale the video to the specified
  12457. target framerate, in a manner as determined by the @option{frame_mixer} option.
  12458. @item format
  12459. Set the output format override. If unset (the default), frames will be output
  12460. in the same format as the respective input frames. Otherwise, format conversion
  12461. will be performed.
  12462. @item force_original_aspect_ratio
  12463. @item force_divisible_by
  12464. Work the same as the identical @ref{scale} filter options.
  12465. @item reset_sar
  12466. If enabled, output frames will always have a pixel aspect ratio of 1:1. If
  12467. disabled (the default), any aspect ratio mismatches, including those from
  12468. e.g. anamorphic video sources, are forwarded to the output pixel aspect ratio.
  12469. @item normalize_sar
  12470. Like @option{reset_sar}, but instead of stretching the video content to fill
  12471. the new output aspect ratio, the content is instead padded or cropped as
  12472. necessary.
  12473. @item pad_crop_ratio
  12474. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12475. cropping when the input aspect ratio does not match the output aspect ratio and
  12476. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12477. content with black borders, while a value of @code{1.0} always crops off parts
  12478. of the content. Intermediate values are possible, leading to a mix of the two
  12479. approaches.
  12480. @item fillcolor
  12481. Set the color used to fill the output area not covered by the output image, for
  12482. example as a result of @option{normalize_sar}. For the general syntax of this
  12483. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12484. manual,ffmpeg-utils}. Defaults to @code{black@@0}.
  12485. @item corner_rounding
  12486. Render frames with rounded corners. The value, given as a float ranging from
  12487. @code{0.0} to @code{1.0}, indicates the relative degree of rounding, from fully
  12488. square to fully circular. In other words, it gives the radius divided by half
  12489. the smaller side length. Defaults to @code{0.0}.
  12490. @item extra_opts
  12491. Pass extra libplacebo internal configuration options. These can be specified
  12492. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  12493. shows how to configure a custom filter kernel ("EWA LanczosSharp") and use it
  12494. to double the input image resolution:
  12495. @example
  12496. -vf "libplacebo=w=iw*2:h=ih*2:extra_opts='upscaler=custom\:upscaler_preset=ewa_lanczos\:upscaler_blur=0.9812505644269356'"
  12497. @end example
  12498. @item shader_cache
  12499. File path of a cache directory that libplacebo will use to store and load
  12500. cached shader objects. This cache is not cleaned up automatically. If the
  12501. path does not end in a directory separator, the generated filenames will be
  12502. effectively prefixed by the last path component. All directories must already
  12503. exist.
  12504. @example
  12505. -vf "libplacebo=shader_cache=/tmp/pl-shader-"
  12506. @end example
  12507. @item colorspace
  12508. @item color_primaries
  12509. @item color_trc
  12510. @item range
  12511. Configure the colorspace that output frames will be delivered in. The default
  12512. value of @code{auto} outputs frames in the same format as the input frames,
  12513. leading to no change. For any other value, conversion will be performed.
  12514. See the @ref{setparams} filter for a list of possible values.
  12515. @item apply_filmgrain
  12516. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12517. it from the output. Enabled by default.
  12518. @item apply_dolbyvision
  12519. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12520. the output. Enabled by default. Note that Dolby Vision will always output
  12521. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12522. picked as the values of @code{auto} for the respective frame output options.
  12523. @end table
  12524. In addition to the expression constants documented for the @ref{scale} filter,
  12525. the @option{crop_w}, @option{crop_h}, @option{crop_x}, @option{crop_y},
  12526. @option{pos_w}, @option{pos_h}, @option{pos_x} and @option{pos_y} options can
  12527. also contain the following constants:
  12528. @table @option
  12529. @item in_idx, idx
  12530. The (0-based) numeric index of the currently active input stream.
  12531. @item crop_w, cw
  12532. @item crop_h, ch
  12533. The computed values of @option{crop_w} and @option{crop_h}.
  12534. @item pos_w, pw
  12535. @item pos_h, ph
  12536. The computed values of @option{pos_w} and @option{pos_h}.
  12537. @item in_t, t
  12538. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12539. @item out_t, ot
  12540. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12541. @item n
  12542. The input frame number, starting with 0.
  12543. @end table
  12544. @subsubsection Scaling
  12545. The options in this section control how libplacebo performs upscaling and (if
  12546. necessary) downscaling. Note that libplacebo will always internally operate on
  12547. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12548. necessarily be upsampled and downsampled as part of the rendering process. That
  12549. means scaling might be in effect even if the source and destination resolution
  12550. are the same.
  12551. @table @option
  12552. @item upscaler
  12553. @item downscaler
  12554. Configure the filter kernel used for upscaling and downscaling. The respective
  12555. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12556. values, pass @code{help} to these options. The most important values are:
  12557. @table @samp
  12558. @item none
  12559. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12560. fast but poor quality, especially when downscaling.
  12561. @item bilinear
  12562. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12563. doing so would lead to aliasing. Fast and low quality.
  12564. @item nearest
  12565. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12566. @item oversample
  12567. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12568. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12569. minimal distortion of the artistic appearance.
  12570. @item lanczos
  12571. Standard sinc-sinc interpolation kernel.
  12572. @item spline36
  12573. Cubic spline approximation of lanczos. No difference in performance, but has
  12574. very slightly less ringing.
  12575. @item ewa_lanczos
  12576. Elliptically weighted average version of lanczos, based on a jinc-jinc kernel.
  12577. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12578. quality.
  12579. @item gaussian
  12580. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12581. very blurry.
  12582. @item mitchell
  12583. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12584. little ringing.
  12585. @end table
  12586. @item frame_mixer
  12587. Controls the kernel used for mixing frames temporally. The default value is
  12588. @code{none}, which disables frame mixing. For a full list of possible values,
  12589. pass @code{help} to this option. The most important values are:
  12590. @table @samp
  12591. @item none
  12592. Disables frame mixing, giving a result equivalent to "nearest neighbour"
  12593. semantics.
  12594. @item oversample
  12595. Oversamples the input video to create a "Smooth Motion"-type effect: if an
  12596. output frame would exactly fall on the transition between two video frames, it
  12597. is blended according to the relative overlap. This is the recommended option
  12598. whenever preserving the original subjective appearance is desired.
  12599. @item mitchell_clamp
  12600. Larger filter kernel that smoothly interpolates multiple frames in a manner
  12601. designed to eliminate ringing and other artefacts as much as possible. This is
  12602. the recommended option wherever maximum visual smoothness is desired.
  12603. @item linear
  12604. Linear blend/fade between frames. Especially useful for constructing e.g.
  12605. slideshows.
  12606. @end table
  12607. @item antiringing
  12608. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12609. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12610. aliasing if set too high. Disabled by default.
  12611. @item sigmoid
  12612. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12613. Enabled by default.
  12614. @end table
  12615. @subsubsection Deinterlacing
  12616. Deinterlacing is automatically supported when frames are tagged as interlaced,
  12617. however frames are not deinterlaced unless a deinterlacing algorithm is chosen.
  12618. @table @option
  12619. @item deinterlace
  12620. The the deinterlacing algorithm to use.
  12621. @table @samp
  12622. @item weave
  12623. No deinterlacing, weave fields together into a single frame. This is the default.
  12624. @item bob
  12625. Naive bob deinterlacing, simply repeat each field line twice.
  12626. @item yadif
  12627. Yet another deinterlacing filter. See the @ref{yadif} filter for more details.
  12628. @end table
  12629. @item skip_spatial_check
  12630. Skip the spatial deinterlacing check when using @code{yadif} deinterlacing.
  12631. @item send_fields
  12632. Output a frame for each field, rather than for each frame. Note that this will
  12633. always double the tagged output frame rate, even if the input does not contain
  12634. any interlaced frames. Disabled by default.
  12635. @end table
  12636. @subsubsection Debanding
  12637. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12638. many common sources of banding and blocking. Turning this on is highly
  12639. recommended whenever quality is desired.
  12640. @table @option
  12641. @item deband
  12642. Enable (fast) debanding algorithm. Disabled by default.
  12643. @item deband_iterations
  12644. Number of deband iterations of the debanding algorithm. Each iteration is
  12645. performed with progressively increased radius (and diminished threshold).
  12646. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12647. @item deband_threshold
  12648. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12649. Defaults to @code{4.0}.
  12650. @item deband_radius
  12651. Debanding filter radius. A higher radius is better for slow gradients, while
  12652. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12653. @item deband_grain
  12654. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12655. @code{6.0}.
  12656. @end table
  12657. @subsubsection Color adjustment
  12658. A collection of subjective color controls. Not very rigorous, so the exact
  12659. effect will vary somewhat depending on the input primaries and colorspace.
  12660. @table @option
  12661. @item brightness
  12662. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12663. @item contrast
  12664. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12665. @item saturation
  12666. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12667. @item hue
  12668. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12669. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12670. coefficients for RGB inputs.
  12671. @item gamma
  12672. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12673. @item cones
  12674. Cone model to use for color blindness simulation. Accepts any combination of
  12675. @code{l}, @code{m} and @code{s}. Here are some examples:
  12676. @table @samp
  12677. @item m
  12678. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12679. @item l
  12680. Protanomaly / protanopia (affecting 1%-2% of the population)
  12681. @item l+m
  12682. Monochromacy (very rare)
  12683. @item l+m+s
  12684. Achromatopsy (complete loss of daytime vision, extremely rare)
  12685. @end table
  12686. @item cone-strength
  12687. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12688. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12689. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12690. above @code{1.0} result in exaggerating the differences between cones, which
  12691. may help compensate for reduced color vision.
  12692. @end table
  12693. @subsubsection Peak detection
  12694. To help deal with sources that only have static HDR10 metadata (or no tagging
  12695. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12696. analyze source frames and adapt the tone mapping function in realtime. If this
  12697. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12698. recommended to turn this feature off.
  12699. @table @option
  12700. @item peak_detect
  12701. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12702. dynamic detection from the input. Note that the detected values do not get
  12703. written back to the output frames, they merely guide the internal tone mapping
  12704. process. Enabled by default.
  12705. @item smoothing_period
  12706. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12707. values result in peak detection becoming less responsive to changes in the
  12708. input. Defaults to @code{100.0}.
  12709. @item scene_threshold_low
  12710. @item scene_threshold_high
  12711. Lower and upper thresholds for scene change detection. Expressed in a
  12712. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12713. and @code{10.0}, respectively. Setting either to a negative value disables
  12714. this functionality.
  12715. @item percentile
  12716. Which percentile of the frame brightness histogram to use as the source peak
  12717. for tone-mapping. Defaults to @code{99.995}, a fairly conservative value.
  12718. Setting this to @code{100.0} disables frame histogram measurement and instead
  12719. uses the true peak brightness for tone-mapping.
  12720. @end table
  12721. @subsubsection Tone mapping
  12722. The options in this section control how libplacebo performs tone-mapping and
  12723. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12724. In general, libplacebo relies on accurate source tagging and mastering display
  12725. gamut information to produce the best results.
  12726. @table @option
  12727. @item gamut_mode
  12728. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12729. gamut mapping.
  12730. @table @samp
  12731. @item clip
  12732. Do nothing, simply clip out-of-range colors to the RGB volume. Low quality but
  12733. extremely fast.
  12734. @item perceptual
  12735. Perceptually soft-clip colors to the gamut volume. This is the default.
  12736. @item relative
  12737. Relative colorimetric hard-clip. Similar to @code{perceptual} but without
  12738. the soft knee.
  12739. @item saturation
  12740. Saturation mapping, maps primaries directly to primaries in RGB space.
  12741. Not recommended except for artificial computer graphics for which a bright,
  12742. saturated display is desired.
  12743. @item absolute
  12744. Absolute colorimetric hard-clip. Performs no adjustment of the white point.
  12745. @item desaturate
  12746. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12747. luminance. Has a tendency to distort the visual appearance of bright objects.
  12748. @item darken
  12749. Linearly reduces content brightness to preserves saturated details, followed by
  12750. clipping the remaining out-of-gamut colors.
  12751. @item warn
  12752. Highlight out-of-gamut pixels (by inverting/marking them).
  12753. @item linear
  12754. Linearly reduces chromaticity of the entire image to make it fit within the
  12755. target color volume. Be careful when using this on BT.2020 sources without
  12756. proper mastering metadata, as doing so will lead to excessive desaturation.
  12757. @end table
  12758. @item tonemapping
  12759. Tone-mapping algorithm to use. Available values are:
  12760. @table @samp
  12761. @item auto
  12762. Automatic selection based on internal heuristics. This is the default.
  12763. @item clip
  12764. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12765. accuracy for in-range colors but completely destroys out-of-range information.
  12766. Does not perform any black point adaptation. Not configurable.
  12767. @item st2094-40
  12768. EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
  12769. dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
  12770. is adjusted based on the ratio between the targeted and actual display peak
  12771. luminances.
  12772. @item st2094-10
  12773. EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
  12774. average luminance in addition to the maximum/minimum. The configurable contrast
  12775. parameter influences the slope of the linear output segment, defaulting to
  12776. @code{1.0} for no increase/decrease in contrast. Note that this does not
  12777. currently include the subjective gain/offset/gamma controls defined in Annex
  12778. B.3.
  12779. @item bt.2390
  12780. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12781. segment. The knee point offset is configurable. Note that this parameter
  12782. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12783. spec.
  12784. @item bt.2446a
  12785. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12786. sources. Can be used for both forward and inverse tone mapping. Not
  12787. configurable.
  12788. @item spline
  12789. Simple spline consisting of two polynomials, joined by a single pivot point.
  12790. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12791. Can be used for both forward and inverse tone mapping.
  12792. @item reinhard
  12793. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12794. local contrast coefficient at the display peak. Essentially, a parameter of
  12795. @code{0.5} implies that the reference white will be about half as bright as
  12796. when clipping. Defaults to @code{0.5}, which results in the simplest
  12797. formulation of this function.
  12798. @item mobius
  12799. Generalization of the reinhard tone mapping algorithm to support an additional
  12800. linear slope near black. The tone mapping parameter indicates the trade-off
  12801. between the linear section and the non-linear section. Essentially, for a given
  12802. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12803. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12804. this curve behave like @code{clip}, while values near @code{0.0} make this
  12805. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12806. provides a good balance between colorimetric accuracy and preserving
  12807. out-of-gamut details.
  12808. @item hable
  12809. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12810. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12811. Popularized by its use in video games with HDR rendering. Preserves both dark
  12812. and bright details very well, but comes with the drawback of changing the
  12813. average brightness quite significantly. This is sort of similar to
  12814. @code{reinhard} with parameter @code{0.24}.
  12815. @item gamma
  12816. Fits a gamma (power) function to transfer between the source and target color
  12817. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12818. linear sections. This preserves details at all scales fairly accurately, but
  12819. can result in an image with a muted or dull appearance. The parameter is used
  12820. as the cutoff point, defaulting to @code{0.5}.
  12821. @item linear
  12822. Linearly stretches the input range to the output range, in PQ space. This will
  12823. preserve all details accurately, but results in a significantly different
  12824. average brightness. Can be used for inverse tone-mapping in addition to regular
  12825. tone-mapping. The parameter can be used as an additional linear gain
  12826. coefficient (defaulting to @code{1.0}).
  12827. @end table
  12828. @item tonemapping_param
  12829. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12830. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12831. value of @code{0.0} is replaced by the curve's preferred default setting.
  12832. @item inverse_tonemapping
  12833. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12834. output color volumes. Disabled by default.
  12835. @item tonemapping_lut_size
  12836. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12837. @code{256}. Note that this figure is squared when combined with
  12838. @code{peak_detect}.
  12839. @item contrast_recovery
  12840. Contrast recovery strength. If set to a value above @code{0.0}, the source
  12841. image will be divided into high-frequency and low-frequency components, and a
  12842. portion of the high-frequency image is added back onto the tone-mapped output.
  12843. May cause excessive ringing artifacts for some HDR sources, but can improve the
  12844. subjective sharpness and detail left over in the image after tone-mapping.
  12845. Defaults to @code{0.30}.
  12846. @item contrast_smoothness
  12847. Contrast recovery lowpass kernel size. Defaults to @code{3.5}. Increasing or
  12848. decreasing this will affect the visual appearance substantially. Has no effect
  12849. when @code{contrast_recovery} is disabled.
  12850. @end table
  12851. @subsubsection Dithering
  12852. By default, libplacebo will dither whenever necessary, which includes rendering
  12853. to any integer format below 16-bit precision. It's recommended to always leave
  12854. this on, since not doing so may result in visible banding in the output, even
  12855. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12856. use @code{ordered_fixed} instead of disabling dithering.
  12857. @table @option
  12858. @item dithering
  12859. Dithering method to use. Accepts the following values:
  12860. @table @samp
  12861. @item none
  12862. Disables dithering completely. May result in visible banding.
  12863. @item blue
  12864. Dither with pseudo-blue noise. This is the default.
  12865. @item ordered
  12866. Tunable ordered dither pattern.
  12867. @item ordered_fixed
  12868. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12869. @item white
  12870. Dither with white noise. Texture-less.
  12871. @end table
  12872. @item dither_lut_size
  12873. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12874. @code{6}, corresponding to a LUT size of @code{64x64}.
  12875. @item dither_temporal
  12876. Enables temporal dithering. Disabled by default.
  12877. @end table
  12878. @subsubsection Custom shaders
  12879. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12880. syntax. A collection of such shaders can be found here:
  12881. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12882. A full description of the mpv shader format is beyond the scope of this
  12883. section, but a summary can be found here:
  12884. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12885. @table @option
  12886. @item custom_shader_path
  12887. Specifies a path to a custom shader file to load at runtime.
  12888. @item custom_shader_bin
  12889. Specifies a complete custom shader as a raw string.
  12890. @end table
  12891. @subsubsection Debugging / performance
  12892. All of the options in this section default off. They may be of assistance when
  12893. attempting to squeeze the maximum performance at the cost of quality.
  12894. @table @option
  12895. @item skip_aa
  12896. Disable anti-aliasing when downscaling.
  12897. @item disable_linear
  12898. Disable linear light scaling.
  12899. @item disable_builtin
  12900. Disable built-in GPU sampling (forces LUT).
  12901. @item disable_fbos
  12902. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12903. offering the maximum possible speed.
  12904. @end table
  12905. @subsection Commands
  12906. This filter supports almost all of the above options as @ref{commands}.
  12907. @subsection Examples
  12908. @itemize
  12909. @item
  12910. Tone-map input to standard gamut BT.709 output:
  12911. @example
  12912. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12913. @end example
  12914. @item
  12915. Rescale input to fit into standard 1080p, with high quality scaling:
  12916. @example
  12917. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12918. @end example
  12919. @item
  12920. Interpolate low FPS / VFR input to smoothed constant 60 fps output:
  12921. @example
  12922. libplacebo=fps=60:frame_mixer=mitchell_clamp
  12923. @end example
  12924. @item
  12925. Convert input to standard sRGB JPEG:
  12926. @example
  12927. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12928. @end example
  12929. @item
  12930. Use higher quality debanding settings:
  12931. @example
  12932. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  12933. @end example
  12934. @item
  12935. Run this filter on the CPU, on systems with Mesa installed (and with the most
  12936. expensive options disabled):
  12937. @example
  12938. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  12939. @end example
  12940. @item
  12941. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  12942. doing it with this filter. Note that this is only a gain if the frames are
  12943. either already on the GPU, or if you're using libplacebo for other purposes,
  12944. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  12945. @example
  12946. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  12947. @end example
  12948. @item
  12949. Interop with VAAPI hwdec to avoid round-tripping through RAM:
  12950. @example
  12951. ffmpeg -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi ... -vf libplacebo
  12952. @end example
  12953. @end itemize
  12954. @anchor{libvmaf}
  12955. @section libvmaf
  12956. Calculate the VMAF (Video Multi-Method Assessment Fusion) score for a
  12957. reference/distorted pair of input videos.
  12958. The first input is the distorted video, and the second input is the reference video.
  12959. The obtained VMAF score is printed through the logging system.
  12960. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  12961. After installing the library it can be enabled using:
  12962. @code{./configure --enable-libvmaf}.
  12963. The filter has following options:
  12964. @table @option
  12965. @item model
  12966. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  12967. Default value: @code{"version=vmaf_v0.6.1"}
  12968. @item feature
  12969. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  12970. @item log_path
  12971. Set the file path to be used to store log files.
  12972. @item log_fmt
  12973. Set the format of the log file (xml, json, csv, or sub).
  12974. @item pool
  12975. Set the pool method to be used for computing vmaf.
  12976. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  12977. @item n_threads
  12978. Set number of threads to be used when initializing libvmaf.
  12979. Default value: @code{0}, no threads.
  12980. @item n_subsample
  12981. Set frame subsampling interval to be used.
  12982. @end table
  12983. This filter also supports the @ref{framesync} options.
  12984. @subsection Examples
  12985. @itemize
  12986. @item
  12987. In the examples below, a distorted video @file{distorted.mpg} is
  12988. compared with a reference file @file{reference.mpg}.
  12989. @item
  12990. Basic usage:
  12991. @example
  12992. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  12993. @end example
  12994. @item
  12995. Example with multiple models:
  12996. @example
  12997. 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 -
  12998. @end example
  12999. @item
  13000. Example with multiple additional features:
  13001. @example
  13002. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  13003. @end example
  13004. @item
  13005. Example with options and different containers:
  13006. @example
  13007. 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 -
  13008. @end example
  13009. @end itemize
  13010. @section libvmaf_cuda
  13011. This is the CUDA variant of the @ref{libvmaf} filter. It only accepts CUDA frames.
  13012. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  13013. After installing the library it can be enabled using:
  13014. @code{./configure --enable-nonfree --enable-ffnvcodec --enable-libvmaf}.
  13015. @subsection Examples
  13016. @itemize
  13017. @item
  13018. Basic usage showing CUVID hardware decoding and CUDA scaling with @ref{scale_cuda}:
  13019. @example
  13020. ffmpeg \
  13021. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i dis.obu \
  13022. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i ref.obu \
  13023. -filter_complex "
  13024. [0:v]scale_cuda=format=yuv420p[dis]; \
  13025. [1:v]scale_cuda=format=yuv420p[ref]; \
  13026. [dis][ref]libvmaf_cuda=log_fmt=json:log_path=output.json
  13027. " \
  13028. -f null -
  13029. @end example
  13030. @end itemize
  13031. @section limitdiff
  13032. Apply limited difference filter using second and optionally third video stream.
  13033. The filter accepts the following options:
  13034. @table @option
  13035. @item threshold
  13036. Set the threshold to use when allowing certain differences between video streams.
  13037. Any absolute difference value lower or exact than this threshold will pick pixel components from
  13038. first video stream.
  13039. @item elasticity
  13040. Set the elasticity of soft thresholding when processing video streams.
  13041. This value multiplied with first one sets second threshold.
  13042. Any absolute difference value greater or exact than second threshold will pick pixel components
  13043. from second video stream. For values between those two threshold
  13044. linear interpolation between first and second video stream will be used.
  13045. @item reference
  13046. Enable the reference (third) video stream processing. By default is disabled.
  13047. If set, this video stream will be used for calculating absolute difference with first video
  13048. stream.
  13049. @item planes
  13050. Specify which planes will be processed. Defaults to all available.
  13051. @end table
  13052. @subsection Commands
  13053. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  13054. @section limiter
  13055. Limits the pixel components values to the specified range [min, max].
  13056. The filter accepts the following options:
  13057. @table @option
  13058. @item min
  13059. Lower bound. Defaults to the lowest allowed value for the input.
  13060. @item max
  13061. Upper bound. Defaults to the highest allowed value for the input.
  13062. @item planes
  13063. Specify which planes will be processed. Defaults to all available.
  13064. @end table
  13065. @subsection Commands
  13066. This filter supports the all above options as @ref{commands}.
  13067. @section loop
  13068. Loop video frames.
  13069. The filter accepts the following options:
  13070. @table @option
  13071. @item loop
  13072. Set the number of loops. Setting this value to -1 will result in infinite loops.
  13073. Default is 0.
  13074. @item size
  13075. Set maximal size in number of frames. Default is 0.
  13076. @item start
  13077. Set first frame of loop. Default is 0.
  13078. @item time
  13079. Set the time of loop start in seconds.
  13080. Only used if option named @var{start} is set to @code{-1}.
  13081. @end table
  13082. @subsection Examples
  13083. @itemize
  13084. @item
  13085. Loop single first frame infinitely:
  13086. @example
  13087. loop=loop=-1:size=1:start=0
  13088. @end example
  13089. @item
  13090. Loop single first frame 10 times:
  13091. @example
  13092. loop=loop=10:size=1:start=0
  13093. @end example
  13094. @item
  13095. Loop 10 first frames 5 times:
  13096. @example
  13097. loop=loop=5:size=10:start=0
  13098. @end example
  13099. @end itemize
  13100. @section lut1d
  13101. Apply a 1D LUT to an input video.
  13102. The filter accepts the following options:
  13103. @table @option
  13104. @item file
  13105. Set the 1D LUT file name.
  13106. Currently supported formats:
  13107. @table @samp
  13108. @item cube
  13109. Iridas
  13110. @item csp
  13111. cineSpace
  13112. @end table
  13113. @item interp
  13114. Select interpolation mode.
  13115. Available values are:
  13116. @table @samp
  13117. @item nearest
  13118. Use values from the nearest defined point.
  13119. @item linear
  13120. Interpolate values using the linear interpolation.
  13121. @item cosine
  13122. Interpolate values using the cosine interpolation.
  13123. @item cubic
  13124. Interpolate values using the cubic interpolation.
  13125. @item spline
  13126. Interpolate values using the spline interpolation.
  13127. @end table
  13128. @end table
  13129. @subsection Commands
  13130. This filter supports the all above options as @ref{commands}.
  13131. @anchor{lut3d}
  13132. @section lut3d
  13133. Apply a 3D LUT to an input video.
  13134. The filter accepts the following options:
  13135. @table @option
  13136. @item file
  13137. Set the 3D LUT file name.
  13138. Currently supported formats:
  13139. @table @samp
  13140. @item 3dl
  13141. AfterEffects
  13142. @item cube
  13143. Iridas
  13144. @item dat
  13145. DaVinci
  13146. @item m3d
  13147. Pandora
  13148. @item csp
  13149. cineSpace
  13150. @end table
  13151. @item interp
  13152. Select interpolation mode.
  13153. Available values are:
  13154. @table @samp
  13155. @item nearest
  13156. Use values from the nearest defined point.
  13157. @item trilinear
  13158. Interpolate values using the 8 points defining a cube.
  13159. @item tetrahedral
  13160. Interpolate values using a tetrahedron.
  13161. @item pyramid
  13162. Interpolate values using a pyramid.
  13163. @item prism
  13164. Interpolate values using a prism.
  13165. @end table
  13166. @end table
  13167. @subsection Commands
  13168. This filter supports the @code{interp} option as @ref{commands}.
  13169. @section lumakey
  13170. Turn certain luma values into transparency.
  13171. The filter accepts the following options:
  13172. @table @option
  13173. @item threshold
  13174. Set the luma which will be used as base for transparency.
  13175. Default value is @code{0}.
  13176. @item tolerance
  13177. Set the range of luma values to be keyed out.
  13178. Default value is @code{0.01}.
  13179. @item softness
  13180. Set the range of softness. Default value is @code{0}.
  13181. Use this to control gradual transition from zero to full transparency.
  13182. @end table
  13183. @subsection Commands
  13184. This filter supports same @ref{commands} as options.
  13185. The command accepts the same syntax of the corresponding option.
  13186. If the specified expression is not valid, it is kept at its current
  13187. value.
  13188. @anchor{lutrgb}
  13189. @anchor{lutyuv}
  13190. @anchor{lut}
  13191. @section lut, lutrgb, lutyuv
  13192. Compute a look-up table for binding each pixel component input value
  13193. to an output value, and apply it to the input video.
  13194. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  13195. to an RGB input video.
  13196. These filters accept the following parameters:
  13197. @table @option
  13198. @item c0
  13199. set first pixel component expression
  13200. @item c1
  13201. set second pixel component expression
  13202. @item c2
  13203. set third pixel component expression
  13204. @item c3
  13205. set fourth pixel component expression, corresponds to the alpha component
  13206. @item r
  13207. set red component expression
  13208. @item g
  13209. set green component expression
  13210. @item b
  13211. set blue component expression
  13212. @item a
  13213. alpha component expression
  13214. @item y
  13215. set Y/luma component expression
  13216. @item u
  13217. set U/Cb component expression
  13218. @item v
  13219. set V/Cr component expression
  13220. @end table
  13221. Each of them specifies the expression to use for computing the lookup table for
  13222. the corresponding pixel component values.
  13223. The exact component associated to each of the @var{c*} options depends on the
  13224. format in input.
  13225. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  13226. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  13227. The expressions can contain the following constants and functions:
  13228. @table @option
  13229. @item w
  13230. @item h
  13231. The input width and height.
  13232. @item val
  13233. The input value for the pixel component.
  13234. @item clipval
  13235. The input value, clipped to the @var{minval}-@var{maxval} range.
  13236. @item maxval
  13237. The maximum value for the pixel component.
  13238. @item minval
  13239. The minimum value for the pixel component.
  13240. @item negval
  13241. The negated value for the pixel component value, clipped to the
  13242. @var{minval}-@var{maxval} range; it corresponds to the expression
  13243. "maxval-clipval+minval".
  13244. @item clip(val)
  13245. The computed value in @var{val}, clipped to the
  13246. @var{minval}-@var{maxval} range.
  13247. @item gammaval(gamma)
  13248. The computed gamma correction value of the pixel component value,
  13249. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  13250. expression
  13251. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  13252. @end table
  13253. All expressions default to "clipval".
  13254. @subsection Commands
  13255. This filter supports same @ref{commands} as options.
  13256. @subsection Examples
  13257. @itemize
  13258. @item
  13259. Negate input video:
  13260. @example
  13261. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  13262. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  13263. @end example
  13264. The above is the same as:
  13265. @example
  13266. lutrgb="r=negval:g=negval:b=negval"
  13267. lutyuv="y=negval:u=negval:v=negval"
  13268. @end example
  13269. @item
  13270. Negate luma:
  13271. @example
  13272. lutyuv=y=negval
  13273. @end example
  13274. @item
  13275. Remove chroma components, turning the video into a graytone image:
  13276. @example
  13277. lutyuv="u=128:v=128"
  13278. @end example
  13279. @item
  13280. Apply a luma burning effect:
  13281. @example
  13282. lutyuv="y=2*val"
  13283. @end example
  13284. @item
  13285. Remove green and blue components:
  13286. @example
  13287. lutrgb="g=0:b=0"
  13288. @end example
  13289. @item
  13290. Set a constant alpha channel value on input:
  13291. @example
  13292. format=rgba,lutrgb=a="maxval-minval/2"
  13293. @end example
  13294. @item
  13295. Correct luma gamma by a factor of 0.5:
  13296. @example
  13297. lutyuv=y=gammaval(0.5)
  13298. @end example
  13299. @item
  13300. Discard least significant bits of luma:
  13301. @example
  13302. lutyuv=y='bitand(val, 128+64+32)'
  13303. @end example
  13304. @item
  13305. Technicolor like effect:
  13306. @example
  13307. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  13308. @end example
  13309. @end itemize
  13310. @section lut2, tlut2
  13311. The @code{lut2} filter takes two input streams and outputs one
  13312. stream.
  13313. The @code{tlut2} (time lut2) filter takes two consecutive frames
  13314. from one single stream.
  13315. This filter accepts the following parameters:
  13316. @table @option
  13317. @item c0
  13318. set first pixel component expression
  13319. @item c1
  13320. set second pixel component expression
  13321. @item c2
  13322. set third pixel component expression
  13323. @item c3
  13324. set fourth pixel component expression, corresponds to the alpha component
  13325. @item d
  13326. set output bit depth, only available for @code{lut2} filter. By default is 0,
  13327. which means bit depth is automatically picked from first input format.
  13328. @end table
  13329. The @code{lut2} filter also supports the @ref{framesync} options.
  13330. Each of them specifies the expression to use for computing the lookup table for
  13331. the corresponding pixel component values.
  13332. The exact component associated to each of the @var{c*} options depends on the
  13333. format in inputs.
  13334. The expressions can contain the following constants:
  13335. @table @option
  13336. @item w
  13337. @item h
  13338. The input width and height.
  13339. @item x
  13340. The first input value for the pixel component.
  13341. @item y
  13342. The second input value for the pixel component.
  13343. @item bdx
  13344. The first input video bit depth.
  13345. @item bdy
  13346. The second input video bit depth.
  13347. @end table
  13348. All expressions default to "x".
  13349. @subsection Commands
  13350. This filter supports the all above options as @ref{commands} except option @code{d}.
  13351. @subsection Examples
  13352. @itemize
  13353. @item
  13354. Highlight differences between two RGB video streams:
  13355. @example
  13356. 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)'
  13357. @end example
  13358. @item
  13359. Highlight differences between two YUV video streams:
  13360. @example
  13361. 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)'
  13362. @end example
  13363. @item
  13364. Show max difference between two video streams:
  13365. @example
  13366. 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)))'
  13367. @end example
  13368. @end itemize
  13369. @section maskedclamp
  13370. Clamp the first input stream with the second input and third input stream.
  13371. Returns the value of first stream to be between second input
  13372. stream - @code{undershoot} and third input stream + @code{overshoot}.
  13373. This filter accepts the following options:
  13374. @table @option
  13375. @item undershoot
  13376. Default value is @code{0}.
  13377. @item overshoot
  13378. Default value is @code{0}.
  13379. @item planes
  13380. Set which planes will be processed as bitmap, unprocessed planes will be
  13381. copied from first stream.
  13382. By default value 0xf, all planes will be processed.
  13383. @end table
  13384. @subsection Commands
  13385. This filter supports the all above options as @ref{commands}.
  13386. @section maskedmax
  13387. Merge the second and third input stream into output stream using absolute differences
  13388. between second input stream and first input stream and absolute difference between
  13389. third input stream and first input stream. The picked value will be from second input
  13390. stream if second absolute difference is greater than first one or from third input stream
  13391. otherwise.
  13392. This filter accepts the following options:
  13393. @table @option
  13394. @item planes
  13395. Set which planes will be processed as bitmap, unprocessed planes will be
  13396. copied from first stream.
  13397. By default value 0xf, all planes will be processed.
  13398. @end table
  13399. @subsection Commands
  13400. This filter supports the all above options as @ref{commands}.
  13401. @section maskedmerge
  13402. Merge the first input stream with the second input stream using per pixel
  13403. weights in the third input stream.
  13404. A value of 0 in the third stream pixel component means that pixel component
  13405. from first stream is returned unchanged, while maximum value (eg. 255 for
  13406. 8-bit videos) means that pixel component from second stream is returned
  13407. unchanged. Intermediate values define the amount of merging between both
  13408. input stream's pixel components.
  13409. This filter accepts the following options:
  13410. @table @option
  13411. @item planes
  13412. Set which planes will be processed as bitmap, unprocessed planes will be
  13413. copied from first stream.
  13414. By default value 0xf, all planes will be processed.
  13415. @end table
  13416. @subsection Commands
  13417. This filter supports the all above options as @ref{commands}.
  13418. @section maskedmin
  13419. Merge the second and third input stream into output stream using absolute differences
  13420. between second input stream and first input stream and absolute difference between
  13421. third input stream and first input stream. The picked value will be from second input
  13422. stream if second absolute difference is less than first one or from third input stream
  13423. otherwise.
  13424. This filter accepts the following options:
  13425. @table @option
  13426. @item planes
  13427. Set which planes will be processed as bitmap, unprocessed planes will be
  13428. copied from first stream.
  13429. By default value 0xf, all planes will be processed.
  13430. @end table
  13431. @subsection Commands
  13432. This filter supports the all above options as @ref{commands}.
  13433. @section maskedthreshold
  13434. Pick pixels comparing absolute difference of two video streams with fixed
  13435. threshold.
  13436. If absolute difference between pixel component of first and second video
  13437. stream is equal or lower than user supplied threshold than pixel component
  13438. from first video stream is picked, otherwise pixel component from second
  13439. video stream is picked.
  13440. This filter accepts the following options:
  13441. @table @option
  13442. @item threshold
  13443. Set threshold used when picking pixels from absolute difference from two input
  13444. video streams.
  13445. @item planes
  13446. Set which planes will be processed as bitmap, unprocessed planes will be
  13447. copied from second stream.
  13448. By default value 0xf, all planes will be processed.
  13449. @item mode
  13450. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  13451. Default is @code{abs}.
  13452. @end table
  13453. @subsection Commands
  13454. This filter supports the all above options as @ref{commands}.
  13455. @section maskfun
  13456. Create mask from input video.
  13457. For example it is useful to create motion masks after @code{tblend} filter.
  13458. This filter accepts the following options:
  13459. @table @option
  13460. @item low
  13461. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  13462. @item high
  13463. Set high threshold. Any pixel component higher than this value will be set to max value
  13464. allowed for current pixel format.
  13465. @item planes
  13466. Set planes to filter, by default all available planes are filtered.
  13467. @item fill
  13468. Fill all frame pixels with this value.
  13469. @item sum
  13470. Set max average pixel value for frame. If sum of all pixel components is higher that this
  13471. average, output frame will be completely filled with value set by @var{fill} option.
  13472. Typically useful for scene changes when used in combination with @code{tblend} filter.
  13473. @end table
  13474. @subsection Commands
  13475. This filter supports the all above options as @ref{commands}.
  13476. @section mcdeint
  13477. Apply motion-compensation deinterlacing.
  13478. It needs one field per frame as input and must thus be used together
  13479. with yadif=1/3 or equivalent.
  13480. This filter accepts the following options:
  13481. @table @option
  13482. @item mode
  13483. Set the deinterlacing mode.
  13484. It accepts one of the following values:
  13485. @table @samp
  13486. @item fast
  13487. @item medium
  13488. @item slow
  13489. use iterative motion estimation
  13490. @item extra_slow
  13491. like @samp{slow}, but use multiple reference frames.
  13492. @end table
  13493. Default value is @samp{fast}.
  13494. @item parity
  13495. Set the picture field parity assumed for the input video. It must be
  13496. one of the following values:
  13497. @table @samp
  13498. @item 0, tff
  13499. assume top field first
  13500. @item 1, bff
  13501. assume bottom field first
  13502. @end table
  13503. Default value is @samp{bff}.
  13504. @item qp
  13505. Set per-block quantization parameter (QP) used by the internal
  13506. encoder.
  13507. Higher values should result in a smoother motion vector field but less
  13508. optimal individual vectors. Default value is 1.
  13509. @end table
  13510. @section median
  13511. Pick median pixel from certain rectangle defined by radius.
  13512. This filter accepts the following options:
  13513. @table @option
  13514. @item radius
  13515. Set horizontal radius size. Default value is @code{1}.
  13516. Allowed range is integer from 1 to 127.
  13517. @item planes
  13518. Set which planes to process. Default is @code{15}, which is all available planes.
  13519. @item radiusV
  13520. Set vertical radius size. Default value is @code{0}.
  13521. Allowed range is integer from 0 to 127.
  13522. If it is 0, value will be picked from horizontal @code{radius} option.
  13523. @item percentile
  13524. Set median percentile. Default value is @code{0.5}.
  13525. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13526. minimum values, and @code{1} maximum values.
  13527. @end table
  13528. @subsection Commands
  13529. This filter supports same @ref{commands} as options.
  13530. The command accepts the same syntax of the corresponding option.
  13531. If the specified expression is not valid, it is kept at its current
  13532. value.
  13533. @section mergeplanes
  13534. Merge color channel components from several video streams.
  13535. The filter accepts up to 4 input streams, and merge selected input
  13536. planes to the output video.
  13537. This filter accepts the following options:
  13538. @table @option
  13539. @item mapping
  13540. Set input to output plane mapping. Default is @code{0}.
  13541. The mappings is specified as a bitmap. It should be specified as a
  13542. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13543. mapping for the first plane of the output stream. 'A' sets the number of
  13544. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13545. corresponding input to use (from 0 to 3). The rest of the mappings is
  13546. similar, 'Bb' describes the mapping for the output stream second
  13547. plane, 'Cc' describes the mapping for the output stream third plane and
  13548. 'Dd' describes the mapping for the output stream fourth plane.
  13549. @item format
  13550. Set output pixel format. Default is @code{yuva444p}.
  13551. @item map0s
  13552. @item map1s
  13553. @item map2s
  13554. @item map3s
  13555. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13556. @item map0p
  13557. @item map1p
  13558. @item map2p
  13559. @item map3p
  13560. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13561. @end table
  13562. @subsection Examples
  13563. @itemize
  13564. @item
  13565. Merge three gray video streams of same width and height into single video stream:
  13566. @example
  13567. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13568. @end example
  13569. @item
  13570. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13571. @example
  13572. [a0][a1]mergeplanes=0x00010210:yuva444p
  13573. @end example
  13574. @item
  13575. Swap Y and A plane in yuva444p stream:
  13576. @example
  13577. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13578. @end example
  13579. @item
  13580. Swap U and V plane in yuv420p stream:
  13581. @example
  13582. format=yuv420p,mergeplanes=0x000201:yuv420p
  13583. @end example
  13584. @item
  13585. Cast a rgb24 clip to yuv444p:
  13586. @example
  13587. format=rgb24,mergeplanes=0x000102:yuv444p
  13588. @end example
  13589. @end itemize
  13590. @section mestimate
  13591. Estimate and export motion vectors using block matching algorithms.
  13592. Motion vectors are stored in frame side data to be used by other filters.
  13593. This filter accepts the following options:
  13594. @table @option
  13595. @item method
  13596. Specify the motion estimation method. Accepts one of the following values:
  13597. @table @samp
  13598. @item esa
  13599. Exhaustive search algorithm.
  13600. @item tss
  13601. Three step search algorithm.
  13602. @item tdls
  13603. Two dimensional logarithmic search algorithm.
  13604. @item ntss
  13605. New three step search algorithm.
  13606. @item fss
  13607. Four step search algorithm.
  13608. @item ds
  13609. Diamond search algorithm.
  13610. @item hexbs
  13611. Hexagon-based search algorithm.
  13612. @item epzs
  13613. Enhanced predictive zonal search algorithm.
  13614. @item umh
  13615. Uneven multi-hexagon search algorithm.
  13616. @end table
  13617. Default value is @samp{esa}.
  13618. @item mb_size
  13619. Macroblock size. Default @code{16}.
  13620. @item search_param
  13621. Search parameter. Default @code{7}.
  13622. @end table
  13623. @section midequalizer
  13624. Apply Midway Image Equalization effect using two video streams.
  13625. Midway Image Equalization adjusts a pair of images to have the same
  13626. histogram, while maintaining their dynamics as much as possible. It's
  13627. useful for e.g. matching exposures from a pair of stereo cameras.
  13628. This filter has two inputs and one output, which must be of same pixel format, but
  13629. may be of different sizes. The output of filter is first input adjusted with
  13630. midway histogram of both inputs.
  13631. This filter accepts the following option:
  13632. @table @option
  13633. @item planes
  13634. Set which planes to process. Default is @code{15}, which is all available planes.
  13635. @end table
  13636. @section minterpolate
  13637. Convert the video to specified frame rate using motion interpolation.
  13638. This filter accepts the following options:
  13639. @table @option
  13640. @item fps
  13641. 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}.
  13642. @item mi_mode
  13643. Motion interpolation mode. Following values are accepted:
  13644. @table @samp
  13645. @item dup
  13646. Duplicate previous or next frame for interpolating new ones.
  13647. @item blend
  13648. Blend source frames. Interpolated frame is mean of previous and next frames.
  13649. @item mci
  13650. Motion compensated interpolation. Following options are effective when this mode is selected:
  13651. @table @samp
  13652. @item mc_mode
  13653. Motion compensation mode. Following values are accepted:
  13654. @table @samp
  13655. @item obmc
  13656. Overlapped block motion compensation.
  13657. @item aobmc
  13658. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13659. @end table
  13660. Default mode is @samp{obmc}.
  13661. @item me_mode
  13662. Motion estimation mode. Following values are accepted:
  13663. @table @samp
  13664. @item bidir
  13665. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13666. @item bilat
  13667. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13668. @end table
  13669. Default mode is @samp{bilat}.
  13670. @item me
  13671. The algorithm to be used for motion estimation. Following values are accepted:
  13672. @table @samp
  13673. @item esa
  13674. Exhaustive search algorithm.
  13675. @item tss
  13676. Three step search algorithm.
  13677. @item tdls
  13678. Two dimensional logarithmic search algorithm.
  13679. @item ntss
  13680. New three step search algorithm.
  13681. @item fss
  13682. Four step search algorithm.
  13683. @item ds
  13684. Diamond search algorithm.
  13685. @item hexbs
  13686. Hexagon-based search algorithm.
  13687. @item epzs
  13688. Enhanced predictive zonal search algorithm.
  13689. @item umh
  13690. Uneven multi-hexagon search algorithm.
  13691. @end table
  13692. Default algorithm is @samp{epzs}.
  13693. @item mb_size
  13694. Macroblock size. Default @code{16}.
  13695. @item search_param
  13696. Motion estimation search parameter. Default @code{32}.
  13697. @item vsbmc
  13698. 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).
  13699. @end table
  13700. @end table
  13701. @item scd
  13702. 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:
  13703. @table @samp
  13704. @item none
  13705. Disable scene change detection.
  13706. @item fdiff
  13707. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13708. @end table
  13709. Default method is @samp{fdiff}.
  13710. @item scd_threshold
  13711. Scene change detection threshold. Default is @code{10.}.
  13712. @end table
  13713. @section mix
  13714. Mix several video input streams into one video stream.
  13715. A description of the accepted options follows.
  13716. @table @option
  13717. @item inputs
  13718. The number of inputs. If unspecified, it defaults to 2.
  13719. @item weights
  13720. Specify weight of each input video stream as sequence.
  13721. Each weight is separated by space. If number of weights
  13722. is smaller than number of @var{frames} last specified
  13723. weight will be used for all remaining unset weights.
  13724. @item scale
  13725. Specify scale, if it is set it will be multiplied with sum
  13726. of each weight multiplied with pixel values to give final destination
  13727. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13728. @item planes
  13729. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13730. @item duration
  13731. Specify how end of stream is determined.
  13732. @table @samp
  13733. @item longest
  13734. The duration of the longest input. (default)
  13735. @item shortest
  13736. The duration of the shortest input.
  13737. @item first
  13738. The duration of the first input.
  13739. @end table
  13740. @end table
  13741. @subsection Commands
  13742. This filter supports the following commands:
  13743. @table @option
  13744. @item weights
  13745. @item scale
  13746. @item planes
  13747. Syntax is same as option with same name.
  13748. @end table
  13749. @section monochrome
  13750. Convert video to gray using custom color filter.
  13751. A description of the accepted options follows.
  13752. @table @option
  13753. @item cb
  13754. Set the chroma blue spot. Allowed range is from -1 to 1.
  13755. Default value is 0.
  13756. @item cr
  13757. Set the chroma red spot. Allowed range is from -1 to 1.
  13758. Default value is 0.
  13759. @item size
  13760. Set the color filter size. Allowed range is from .1 to 10.
  13761. Default value is 1.
  13762. @item high
  13763. Set the highlights strength. Allowed range is from 0 to 1.
  13764. Default value is 0.
  13765. @end table
  13766. @subsection Commands
  13767. This filter supports the all above options as @ref{commands}.
  13768. @section morpho
  13769. This filter allows to apply main morphological grayscale transforms,
  13770. erode and dilate with arbitrary structures set in second input stream.
  13771. Unlike naive implementation and much slower performance in @ref{erosion}
  13772. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13773. should be used instead.
  13774. A description of accepted options follows,
  13775. @table @option
  13776. @item mode
  13777. Set morphological transform to apply, can be:
  13778. @table @samp
  13779. @item erode
  13780. @item dilate
  13781. @item open
  13782. @item close
  13783. @item gradient
  13784. @item tophat
  13785. @item blackhat
  13786. @end table
  13787. Default is @code{erode}.
  13788. @item planes
  13789. Set planes to filter, by default all planes except alpha are filtered.
  13790. @item structure
  13791. Set which structure video frames will be processed from second input stream,
  13792. can be @var{first} or @var{all}. Default is @var{all}.
  13793. @end table
  13794. The @code{morpho} filter also supports the @ref{framesync} options.
  13795. @subsection Commands
  13796. This filter supports same @ref{commands} as options.
  13797. @section mpdecimate
  13798. Drop frames that do not differ greatly from the previous frame in
  13799. order to reduce frame rate.
  13800. The main use of this filter is for very-low-bitrate encoding
  13801. (e.g. streaming over dialup modem), but it could in theory be used for
  13802. fixing movies that were inverse-telecined incorrectly.
  13803. A description of the accepted options follows.
  13804. @table @option
  13805. @item max
  13806. Set the maximum number of consecutive frames which can be dropped (if
  13807. positive), or the minimum interval between dropped frames (if
  13808. negative). If the value is 0, the frame is dropped disregarding the
  13809. number of previous sequentially dropped frames.
  13810. Default value is 0.
  13811. @item keep
  13812. Set the maximum number of consecutive similar frames to ignore before to start dropping them.
  13813. If the value is 0, the frame is dropped disregarding the
  13814. number of previous sequentially similar frames.
  13815. Default value is 0.
  13816. @item hi
  13817. @item lo
  13818. @item frac
  13819. Set the dropping threshold values.
  13820. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13821. represent actual pixel value differences, so a threshold of 64
  13822. corresponds to 1 unit of difference for each pixel, or the same spread
  13823. out differently over the block.
  13824. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13825. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13826. meaning the whole image) differ by more than a threshold of @option{lo}.
  13827. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13828. 64*5, and default value for @option{frac} is 0.33.
  13829. @end table
  13830. @section msad
  13831. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13832. This filter takes two input videos.
  13833. Both input videos must have the same resolution and pixel format for
  13834. this filter to work correctly. Also it assumes that both inputs
  13835. have the same number of frames, which are compared one by one.
  13836. The obtained per component, average, min and max MSAD is printed through
  13837. the logging system.
  13838. The filter stores the calculated MSAD of each frame in frame metadata.
  13839. This filter also supports the @ref{framesync} options.
  13840. In the below example the input file @file{main.mpg} being processed is compared
  13841. with the reference file @file{ref.mpg}.
  13842. @example
  13843. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13844. @end example
  13845. @section multiply
  13846. Multiply first video stream pixels values with second video stream pixels values.
  13847. The filter accepts the following options:
  13848. @table @option
  13849. @item scale
  13850. Set the scale applied to second video stream. By default is @code{1}.
  13851. Allowed range is from @code{0} to @code{9}.
  13852. @item offset
  13853. Set the offset applied to second video stream. By default is @code{0.5}.
  13854. Allowed range is from @code{-1} to @code{1}.
  13855. @item planes
  13856. Specify planes from input video stream that will be processed.
  13857. By default all planes are processed.
  13858. @end table
  13859. @subsection Commands
  13860. This filter supports same @ref{commands} as options.
  13861. @section negate
  13862. Negate (invert) the input video.
  13863. It accepts the following option:
  13864. @table @option
  13865. @item components
  13866. Set components to negate.
  13867. Available values for components are:
  13868. @table @samp
  13869. @item y
  13870. @item u
  13871. @item v
  13872. @item a
  13873. @item r
  13874. @item g
  13875. @item b
  13876. @end table
  13877. @item negate_alpha
  13878. With value 1, it negates the alpha component, if present. Default value is 0.
  13879. @end table
  13880. @subsection Commands
  13881. This filter supports same @ref{commands} as options.
  13882. @anchor{nlmeans}
  13883. @section nlmeans
  13884. Denoise frames using Non-Local Means algorithm.
  13885. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13886. context similarity is defined by comparing their surrounding patches of size
  13887. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13888. around the pixel.
  13889. Note that the research area defines centers for patches, which means some
  13890. patches will be made of pixels outside that research area.
  13891. The filter accepts the following options.
  13892. @table @option
  13893. @item s
  13894. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13895. @item p
  13896. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13897. @item pc
  13898. Same as @option{p} but for chroma planes.
  13899. The default value is @var{0} and means automatic.
  13900. @item r
  13901. Set research size. Default is 15. Must be odd number in range [0, 99].
  13902. @item rc
  13903. Same as @option{r} but for chroma planes.
  13904. The default value is @var{0} and means automatic.
  13905. @end table
  13906. @section nnedi
  13907. Deinterlace video using neural network edge directed interpolation.
  13908. This filter accepts the following options:
  13909. @table @option
  13910. @item weights
  13911. Mandatory option, without binary file filter can not work.
  13912. Currently file can be found here:
  13913. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13914. @item deint
  13915. Set which frames to deinterlace, by default it is @code{all}.
  13916. Can be @code{all} or @code{interlaced}.
  13917. @item field
  13918. Set mode of operation.
  13919. Can be one of the following:
  13920. @table @samp
  13921. @item af
  13922. Use frame flags, both fields.
  13923. @item a
  13924. Use frame flags, single field.
  13925. @item t
  13926. Use top field only.
  13927. @item b
  13928. Use bottom field only.
  13929. @item tf
  13930. Use both fields, top first.
  13931. @item bf
  13932. Use both fields, bottom first.
  13933. @end table
  13934. @item planes
  13935. Set which planes to process, by default filter process all frames.
  13936. @item nsize
  13937. Set size of local neighborhood around each pixel, used by the predictor neural
  13938. network.
  13939. Can be one of the following:
  13940. @table @samp
  13941. @item s8x6
  13942. @item s16x6
  13943. @item s32x6
  13944. @item s48x6
  13945. @item s8x4
  13946. @item s16x4
  13947. @item s32x4
  13948. @end table
  13949. @item nns
  13950. Set the number of neurons in predictor neural network.
  13951. Can be one of the following:
  13952. @table @samp
  13953. @item n16
  13954. @item n32
  13955. @item n64
  13956. @item n128
  13957. @item n256
  13958. @end table
  13959. @item qual
  13960. Controls the number of different neural network predictions that are blended
  13961. together to compute the final output value. Can be @code{fast}, default or
  13962. @code{slow}.
  13963. @item etype
  13964. Set which set of weights to use in the predictor.
  13965. Can be one of the following:
  13966. @table @samp
  13967. @item a, abs
  13968. weights trained to minimize absolute error
  13969. @item s, mse
  13970. weights trained to minimize squared error
  13971. @end table
  13972. @item pscrn
  13973. Controls whether or not the prescreener neural network is used to decide
  13974. which pixels should be processed by the predictor neural network and which
  13975. can be handled by simple cubic interpolation.
  13976. The prescreener is trained to know whether cubic interpolation will be
  13977. sufficient for a pixel or whether it should be predicted by the predictor nn.
  13978. The computational complexity of the prescreener nn is much less than that of
  13979. the predictor nn. Since most pixels can be handled by cubic interpolation,
  13980. using the prescreener generally results in much faster processing.
  13981. The prescreener is pretty accurate, so the difference between using it and not
  13982. using it is almost always unnoticeable.
  13983. Can be one of the following:
  13984. @table @samp
  13985. @item none
  13986. @item original
  13987. @item new
  13988. @item new2
  13989. @item new3
  13990. @end table
  13991. Default is @code{new}.
  13992. @end table
  13993. @subsection Commands
  13994. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  13995. @section noformat
  13996. Force libavfilter not to use any of the specified pixel formats for the
  13997. input to the next filter.
  13998. It accepts the following parameters:
  13999. @table @option
  14000. @item pix_fmts
  14001. A '|'-separated list of pixel format names, such as
  14002. pix_fmts=yuv420p|monow|rgb24".
  14003. @end table
  14004. @subsection Examples
  14005. @itemize
  14006. @item
  14007. Force libavfilter to use a format different from @var{yuv420p} for the
  14008. input to the vflip filter:
  14009. @example
  14010. noformat=pix_fmts=yuv420p,vflip
  14011. @end example
  14012. @item
  14013. Convert the input video to any of the formats not contained in the list:
  14014. @example
  14015. noformat=yuv420p|yuv444p|yuv410p
  14016. @end example
  14017. @end itemize
  14018. @section noise
  14019. Add noise on video input frame.
  14020. The filter accepts the following options:
  14021. @table @option
  14022. @item all_seed
  14023. @item c0_seed
  14024. @item c1_seed
  14025. @item c2_seed
  14026. @item c3_seed
  14027. Set noise seed for specific pixel component or all pixel components in case
  14028. of @var{all_seed}. Default value is @code{123457}.
  14029. @item all_strength, alls
  14030. @item c0_strength, c0s
  14031. @item c1_strength, c1s
  14032. @item c2_strength, c2s
  14033. @item c3_strength, c3s
  14034. Set noise strength for specific pixel component or all pixel components in case
  14035. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  14036. @item all_flags, allf
  14037. @item c0_flags, c0f
  14038. @item c1_flags, c1f
  14039. @item c2_flags, c2f
  14040. @item c3_flags, c3f
  14041. Set pixel component flags or set flags for all components if @var{all_flags}.
  14042. Available values for component flags are:
  14043. @table @samp
  14044. @item a
  14045. averaged temporal noise (smoother)
  14046. @item p
  14047. mix random noise with a (semi)regular pattern
  14048. @item t
  14049. temporal noise (noise pattern changes between frames)
  14050. @item u
  14051. uniform noise (gaussian otherwise)
  14052. @end table
  14053. @end table
  14054. @subsection Examples
  14055. Add temporal and uniform noise to input video:
  14056. @example
  14057. noise=alls=20:allf=t+u
  14058. @end example
  14059. @section normalize
  14060. Normalize RGB video (aka histogram stretching, contrast stretching).
  14061. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  14062. For each channel of each frame, the filter computes the input range and maps
  14063. it linearly to the user-specified output range. The output range defaults
  14064. to the full dynamic range from pure black to pure white.
  14065. Temporal smoothing can be used on the input range to reduce flickering (rapid
  14066. changes in brightness) caused when small dark or bright objects enter or leave
  14067. the scene. This is similar to the auto-exposure (automatic gain control) on a
  14068. video camera, and, like a video camera, it may cause a period of over- or
  14069. under-exposure of the video.
  14070. The R,G,B channels can be normalized independently, which may cause some
  14071. color shifting, or linked together as a single channel, which prevents
  14072. color shifting. Linked normalization preserves hue. Independent normalization
  14073. does not, so it can be used to remove some color casts. Independent and linked
  14074. normalization can be combined in any ratio.
  14075. The normalize filter accepts the following options:
  14076. @table @option
  14077. @item blackpt
  14078. @item whitept
  14079. Colors which define the output range. The minimum input value is mapped to
  14080. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  14081. The defaults are black and white respectively. Specifying white for
  14082. @var{blackpt} and black for @var{whitept} will give color-inverted,
  14083. normalized video. Shades of grey can be used to reduce the dynamic range
  14084. (contrast). Specifying saturated colors here can create some interesting
  14085. effects.
  14086. @item smoothing
  14087. The number of previous frames to use for temporal smoothing. The input range
  14088. of each channel is smoothed using a rolling average over the current frame
  14089. and the @var{smoothing} previous frames. The default is 0 (no temporal
  14090. smoothing).
  14091. @item independence
  14092. Controls the ratio of independent (color shifting) channel normalization to
  14093. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  14094. independent. Defaults to 1.0 (fully independent).
  14095. @item strength
  14096. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  14097. expensive no-op. Defaults to 1.0 (full strength).
  14098. @end table
  14099. @subsection Commands
  14100. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  14101. The command accepts the same syntax of the corresponding option.
  14102. If the specified expression is not valid, it is kept at its current
  14103. value.
  14104. @subsection Examples
  14105. Stretch video contrast to use the full dynamic range, with no temporal
  14106. smoothing; may flicker depending on the source content:
  14107. @example
  14108. normalize=blackpt=black:whitept=white:smoothing=0
  14109. @end example
  14110. As above, but with 50 frames of temporal smoothing; flicker should be
  14111. reduced, depending on the source content:
  14112. @example
  14113. normalize=blackpt=black:whitept=white:smoothing=50
  14114. @end example
  14115. As above, but with hue-preserving linked channel normalization:
  14116. @example
  14117. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  14118. @end example
  14119. As above, but with half strength:
  14120. @example
  14121. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  14122. @end example
  14123. Map the darkest input color to red, the brightest input color to cyan:
  14124. @example
  14125. normalize=blackpt=red:whitept=cyan
  14126. @end example
  14127. @section null
  14128. Pass the video source unchanged to the output.
  14129. @section ocr
  14130. Optical Character Recognition
  14131. This filter uses Tesseract for optical character recognition. To enable
  14132. compilation of this filter, you need to configure FFmpeg with
  14133. @code{--enable-libtesseract}.
  14134. It accepts the following options:
  14135. @table @option
  14136. @item datapath
  14137. Set datapath to tesseract data. Default is to use whatever was
  14138. set at installation.
  14139. @item language
  14140. Set language, default is "eng".
  14141. @item whitelist
  14142. Set character whitelist.
  14143. @item blacklist
  14144. Set character blacklist.
  14145. @end table
  14146. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  14147. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  14148. @section ocv
  14149. Apply a video transform using libopencv.
  14150. To enable this filter, install the libopencv library and headers and
  14151. configure FFmpeg with @code{--enable-libopencv}.
  14152. It accepts the following parameters:
  14153. @table @option
  14154. @item filter_name
  14155. The name of the libopencv filter to apply.
  14156. @item filter_params
  14157. The parameters to pass to the libopencv filter. If not specified, the default
  14158. values are assumed.
  14159. @end table
  14160. Refer to the official libopencv documentation for more precise
  14161. information:
  14162. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  14163. Several libopencv filters are supported; see the following subsections.
  14164. @anchor{dilate}
  14165. @subsection dilate
  14166. Dilate an image by using a specific structuring element.
  14167. It corresponds to the libopencv function @code{cvDilate}.
  14168. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  14169. @var{struct_el} represents a structuring element, and has the syntax:
  14170. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  14171. @var{cols} and @var{rows} represent the number of columns and rows of
  14172. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  14173. point, and @var{shape} the shape for the structuring element. @var{shape}
  14174. must be "rect", "cross", "ellipse", or "custom".
  14175. If the value for @var{shape} is "custom", it must be followed by a
  14176. string of the form "=@var{filename}". The file with name
  14177. @var{filename} is assumed to represent a binary image, with each
  14178. printable character corresponding to a bright pixel. When a custom
  14179. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  14180. or columns and rows of the read file are assumed instead.
  14181. The default value for @var{struct_el} is "3x3+0x0/rect".
  14182. @var{nb_iterations} specifies the number of times the transform is
  14183. applied to the image, and defaults to 1.
  14184. Some examples:
  14185. @example
  14186. # Use the default values
  14187. ocv=dilate
  14188. # Dilate using a structuring element with a 5x5 cross, iterating two times
  14189. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  14190. # Read the shape from the file diamond.shape, iterating two times.
  14191. # The file diamond.shape may contain a pattern of characters like this
  14192. # *
  14193. # ***
  14194. # *****
  14195. # ***
  14196. # *
  14197. # The specified columns and rows are ignored
  14198. # but the anchor point coordinates are not
  14199. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  14200. @end example
  14201. @subsection erode
  14202. Erode an image by using a specific structuring element.
  14203. It corresponds to the libopencv function @code{cvErode}.
  14204. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  14205. with the same syntax and semantics as the @ref{dilate} filter.
  14206. @subsection smooth
  14207. Smooth the input video.
  14208. The filter takes the following parameters:
  14209. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  14210. @var{type} is the type of smooth filter to apply, and must be one of
  14211. the following values: "blur", "blur_no_scale", "median", "gaussian",
  14212. or "bilateral". The default value is "gaussian".
  14213. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  14214. depends on the smooth type. @var{param1} and
  14215. @var{param2} accept integer positive values or 0. @var{param3} and
  14216. @var{param4} accept floating point values.
  14217. The default value for @var{param1} is 3. The default value for the
  14218. other parameters is 0.
  14219. These parameters correspond to the parameters assigned to the
  14220. libopencv function @code{cvSmooth}.
  14221. @section oscilloscope
  14222. 2D Video Oscilloscope.
  14223. Useful to measure spatial impulse, step responses, chroma delays, etc.
  14224. It accepts the following parameters:
  14225. @table @option
  14226. @item x
  14227. Set scope center x position.
  14228. @item y
  14229. Set scope center y position.
  14230. @item s
  14231. Set scope size, relative to frame diagonal.
  14232. @item t
  14233. Set scope tilt/rotation.
  14234. @item o
  14235. Set trace opacity.
  14236. @item tx
  14237. Set trace center x position.
  14238. @item ty
  14239. Set trace center y position.
  14240. @item tw
  14241. Set trace width, relative to width of frame.
  14242. @item th
  14243. Set trace height, relative to height of frame.
  14244. @item c
  14245. Set which components to trace. By default it traces first three components.
  14246. @item g
  14247. Draw trace grid. By default is enabled.
  14248. @item st
  14249. Draw some statistics. By default is enabled.
  14250. @item sc
  14251. Draw scope. By default is enabled.
  14252. @end table
  14253. @subsection Commands
  14254. This filter supports same @ref{commands} as options.
  14255. The command accepts the same syntax of the corresponding option.
  14256. If the specified expression is not valid, it is kept at its current
  14257. value.
  14258. @subsection Examples
  14259. @itemize
  14260. @item
  14261. Inspect full first row of video frame.
  14262. @example
  14263. oscilloscope=x=0.5:y=0:s=1
  14264. @end example
  14265. @item
  14266. Inspect full last row of video frame.
  14267. @example
  14268. oscilloscope=x=0.5:y=1:s=1
  14269. @end example
  14270. @item
  14271. Inspect full 5th line of video frame of height 1080.
  14272. @example
  14273. oscilloscope=x=0.5:y=5/1080:s=1
  14274. @end example
  14275. @item
  14276. Inspect full last column of video frame.
  14277. @example
  14278. oscilloscope=x=1:y=0.5:s=1:t=1
  14279. @end example
  14280. @end itemize
  14281. @anchor{overlay}
  14282. @section overlay
  14283. Overlay one video on top of another.
  14284. It takes two inputs and has one output. The first input is the "main"
  14285. video on which the second input is overlaid.
  14286. It accepts the following parameters:
  14287. A description of the accepted options follows.
  14288. @table @option
  14289. @item x
  14290. @item y
  14291. Set the expression for the x and y coordinates of the overlaid video
  14292. on the main video. Default value is "0" for both expressions. In case
  14293. the expression is invalid, it is set to a huge value (meaning that the
  14294. overlay will not be displayed within the output visible area).
  14295. @item eof_action
  14296. See @ref{framesync}.
  14297. @item eval
  14298. Set when the expressions for @option{x}, and @option{y} are evaluated.
  14299. It accepts the following values:
  14300. @table @samp
  14301. @item init
  14302. only evaluate expressions once during the filter initialization or
  14303. when a command is processed
  14304. @item frame
  14305. evaluate expressions for each incoming frame
  14306. @end table
  14307. Default value is @samp{frame}.
  14308. @item shortest
  14309. See @ref{framesync}.
  14310. @item format
  14311. Set the format for the output video.
  14312. It accepts the following values:
  14313. @table @samp
  14314. @item yuv420
  14315. force YUV 4:2:0 8-bit planar output
  14316. @item yuv420p10
  14317. force YUV 4:2:0 10-bit planar output
  14318. @item yuv422
  14319. force YUV 4:2:2 8-bit planar output
  14320. @item yuv422p10
  14321. force YUV 4:2:2 10-bit planar output
  14322. @item yuv444
  14323. force YUV 4:4:4 8-bit planar output
  14324. @item yuv444p10
  14325. force YUV 4:4:4 10-bit planar output
  14326. @item rgb
  14327. force RGB 8-bit packed output
  14328. @item gbrp
  14329. force RGB 8-bit planar output
  14330. @item auto
  14331. automatically pick format
  14332. @end table
  14333. Default value is @samp{yuv420}.
  14334. @item repeatlast
  14335. See @ref{framesync}.
  14336. @item alpha
  14337. Set format of alpha of the overlaid video, it can be @var{straight} or
  14338. @var{premultiplied}. Default is @var{straight}.
  14339. @end table
  14340. The @option{x}, and @option{y} expressions can contain the following
  14341. parameters.
  14342. @table @option
  14343. @item main_w, W
  14344. @item main_h, H
  14345. The main input width and height.
  14346. @item overlay_w, w
  14347. @item overlay_h, h
  14348. The overlay input width and height.
  14349. @item x
  14350. @item y
  14351. The computed values for @var{x} and @var{y}. They are evaluated for
  14352. each new frame.
  14353. @item hsub
  14354. @item vsub
  14355. horizontal and vertical chroma subsample values of the output
  14356. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  14357. @var{vsub} is 1.
  14358. @item n
  14359. the number of input frame, starting from 0
  14360. @item pos
  14361. the position in the file of the input frame, NAN if unknown; deprecated,
  14362. do not use
  14363. @item t
  14364. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  14365. @end table
  14366. This filter also supports the @ref{framesync} options.
  14367. Note that the @var{n}, @var{t} variables are available only
  14368. when evaluation is done @emph{per frame}, and will evaluate to NAN
  14369. when @option{eval} is set to @samp{init}.
  14370. Be aware that frames are taken from each input video in timestamp
  14371. order, hence, if their initial timestamps differ, it is a good idea
  14372. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  14373. have them begin in the same zero timestamp, as the example for
  14374. the @var{movie} filter does.
  14375. You can chain together more overlays but you should test the
  14376. efficiency of such approach.
  14377. @subsection Commands
  14378. This filter supports the following commands:
  14379. @table @option
  14380. @item x
  14381. @item y
  14382. Modify the x and y of the overlay input.
  14383. The command accepts the same syntax of the corresponding option.
  14384. If the specified expression is not valid, it is kept at its current
  14385. value.
  14386. @end table
  14387. @subsection Examples
  14388. @itemize
  14389. @item
  14390. Draw the overlay at 10 pixels from the bottom right corner of the main
  14391. video:
  14392. @example
  14393. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  14394. @end example
  14395. Using named options the example above becomes:
  14396. @example
  14397. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  14398. @end example
  14399. @item
  14400. Insert a transparent PNG logo in the bottom left corner of the input,
  14401. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  14402. @example
  14403. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  14404. @end example
  14405. @item
  14406. Insert 2 different transparent PNG logos (second logo on bottom
  14407. right corner) using the @command{ffmpeg} tool:
  14408. @example
  14409. 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
  14410. @end example
  14411. @item
  14412. Add a transparent color layer on top of the main video; @code{WxH}
  14413. must specify the size of the main input to the overlay filter:
  14414. @example
  14415. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  14416. @end example
  14417. @item
  14418. Play an original video and a filtered version (here with the deshake
  14419. filter) side by side using the @command{ffplay} tool:
  14420. @example
  14421. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  14422. @end example
  14423. The above command is the same as:
  14424. @example
  14425. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  14426. @end example
  14427. @item
  14428. Make a sliding overlay appearing from the left to the right top part of the
  14429. screen starting since time 2:
  14430. @example
  14431. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  14432. @end example
  14433. @item
  14434. Compose output by putting two input videos side to side:
  14435. @example
  14436. ffmpeg -i left.avi -i right.avi -filter_complex "
  14437. nullsrc=size=200x100 [background];
  14438. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  14439. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  14440. [background][left] overlay=shortest=1 [background+left];
  14441. [background+left][right] overlay=shortest=1:x=100 [left+right]
  14442. "
  14443. @end example
  14444. @item
  14445. Mask 10-20 seconds of a video by applying the delogo filter to a section
  14446. @example
  14447. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  14448. -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]'
  14449. masked.avi
  14450. @end example
  14451. @item
  14452. Chain several overlays in cascade:
  14453. @example
  14454. nullsrc=s=200x200 [bg];
  14455. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  14456. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  14457. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  14458. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  14459. [in3] null, [mid2] overlay=100:100 [out0]
  14460. @end example
  14461. @end itemize
  14462. @section owdenoise
  14463. Apply Overcomplete Wavelet denoiser.
  14464. The filter accepts the following options:
  14465. @table @option
  14466. @item depth
  14467. Set depth.
  14468. Larger depth values will denoise lower frequency components more, but
  14469. slow down filtering.
  14470. Must be an int in the range 8-16, default is @code{8}.
  14471. @item luma_strength, ls
  14472. Set luma strength.
  14473. Must be a double value in the range 0-1000, default is @code{1.0}.
  14474. @item chroma_strength, cs
  14475. Set chroma strength.
  14476. Must be a double value in the range 0-1000, default is @code{1.0}.
  14477. @end table
  14478. @anchor{pad}
  14479. @section pad
  14480. Add paddings to the input image, and place the original input at the
  14481. provided @var{x}, @var{y} coordinates.
  14482. It accepts the following parameters:
  14483. @table @option
  14484. @item width, w
  14485. @item height, h
  14486. Specify an expression for the size of the output image with the
  14487. paddings added. If the value for @var{width} or @var{height} is 0, the
  14488. corresponding input size is used for the output.
  14489. The @var{width} expression can reference the value set by the
  14490. @var{height} expression, and vice versa.
  14491. The default value of @var{width} and @var{height} is 0.
  14492. @item x
  14493. @item y
  14494. Specify the offsets to place the input image at within the padded area,
  14495. with respect to the top/left border of the output image.
  14496. The @var{x} expression can reference the value set by the @var{y}
  14497. expression, and vice versa.
  14498. The default value of @var{x} and @var{y} is 0.
  14499. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14500. so the input image is centered on the padded area.
  14501. @item color
  14502. Specify the color of the padded area. For the syntax of this option,
  14503. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14504. manual,ffmpeg-utils}.
  14505. The default value of @var{color} is "black".
  14506. @item eval
  14507. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14508. It accepts the following values:
  14509. @table @samp
  14510. @item init
  14511. Only evaluate expressions once during the filter initialization or when
  14512. a command is processed.
  14513. @item frame
  14514. Evaluate expressions for each incoming frame.
  14515. @end table
  14516. Default value is @samp{init}.
  14517. @item aspect
  14518. Pad to aspect instead to a resolution.
  14519. @end table
  14520. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14521. options are expressions containing the following constants:
  14522. @table @option
  14523. @item in_w
  14524. @item in_h
  14525. The input video width and height.
  14526. @item iw
  14527. @item ih
  14528. These are the same as @var{in_w} and @var{in_h}.
  14529. @item out_w
  14530. @item out_h
  14531. The output width and height (the size of the padded area), as
  14532. specified by the @var{width} and @var{height} expressions.
  14533. @item ow
  14534. @item oh
  14535. These are the same as @var{out_w} and @var{out_h}.
  14536. @item x
  14537. @item y
  14538. The x and y offsets as specified by the @var{x} and @var{y}
  14539. expressions, or NAN if not yet specified.
  14540. @item a
  14541. same as @var{iw} / @var{ih}
  14542. @item sar
  14543. input sample aspect ratio
  14544. @item dar
  14545. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14546. @item hsub
  14547. @item vsub
  14548. The horizontal and vertical chroma subsample values. For example for the
  14549. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14550. @end table
  14551. @subsection Examples
  14552. @itemize
  14553. @item
  14554. Add paddings with the color "violet" to the input video. The output video
  14555. size is 640x480, and the top-left corner of the input video is placed at
  14556. column 0, row 40
  14557. @example
  14558. pad=640:480:0:40:violet
  14559. @end example
  14560. The example above is equivalent to the following command:
  14561. @example
  14562. pad=width=640:height=480:x=0:y=40:color=violet
  14563. @end example
  14564. @item
  14565. Pad the input to get an output with dimensions increased by 3/2,
  14566. and put the input video at the center of the padded area:
  14567. @example
  14568. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14569. @end example
  14570. @item
  14571. Pad the input to get a squared output with size equal to the maximum
  14572. value between the input width and height, and put the input video at
  14573. the center of the padded area:
  14574. @example
  14575. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14576. @end example
  14577. @item
  14578. Pad the input to get a final w/h ratio of 16:9:
  14579. @example
  14580. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14581. @end example
  14582. @item
  14583. In case of anamorphic video, in order to set the output display aspect
  14584. correctly, it is necessary to use @var{sar} in the expression,
  14585. according to the relation:
  14586. @example
  14587. (ih * X / ih) * sar = output_dar
  14588. X = output_dar / sar
  14589. @end example
  14590. Thus the previous example needs to be modified to:
  14591. @example
  14592. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14593. @end example
  14594. @item
  14595. Double the output size and put the input video in the bottom-right
  14596. corner of the output padded area:
  14597. @example
  14598. pad="2*iw:2*ih:ow-iw:oh-ih"
  14599. @end example
  14600. @end itemize
  14601. @anchor{palettegen}
  14602. @section palettegen
  14603. Generate one palette for a whole video stream.
  14604. It accepts the following options:
  14605. @table @option
  14606. @item max_colors
  14607. Set the maximum number of colors to quantize in the palette.
  14608. Note: the palette will still contain 256 colors; the unused palette entries
  14609. will be black.
  14610. @item reserve_transparent
  14611. Create a palette of 255 colors maximum and reserve the last one for
  14612. transparency. Reserving the transparency color is useful for GIF optimization.
  14613. If not set, the maximum of colors in the palette will be 256. You probably want
  14614. to disable this option for a standalone image.
  14615. Set by default.
  14616. @item transparency_color
  14617. Set the color that will be used as background for transparency.
  14618. @item stats_mode
  14619. Set statistics mode.
  14620. It accepts the following values:
  14621. @table @samp
  14622. @item full
  14623. Compute full frame histograms.
  14624. @item diff
  14625. Compute histograms only for the part that differs from previous frame. This
  14626. might be relevant to give more importance to the moving part of your input if
  14627. the background is static.
  14628. @item single
  14629. Compute new histogram for each frame.
  14630. @end table
  14631. Default value is @var{full}.
  14632. @end table
  14633. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14634. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14635. color quantization of the palette. This information is also visible at
  14636. @var{info} logging level.
  14637. @subsection Examples
  14638. @itemize
  14639. @item
  14640. Generate a representative palette of a given video using @command{ffmpeg}:
  14641. @example
  14642. ffmpeg -i input.mkv -vf palettegen palette.png
  14643. @end example
  14644. @end itemize
  14645. @section paletteuse
  14646. Use a palette to downsample an input video stream.
  14647. The filter takes two inputs: one video stream and a palette. The palette must
  14648. be a 256 pixels image.
  14649. It accepts the following options:
  14650. @table @option
  14651. @item dither
  14652. Select dithering mode. Available algorithms are:
  14653. @table @samp
  14654. @item bayer
  14655. Ordered 8x8 bayer dithering (deterministic)
  14656. @item heckbert
  14657. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14658. Note: this dithering is sometimes considered "wrong" and is included as a
  14659. reference.
  14660. @item floyd_steinberg
  14661. Floyd and Steingberg dithering (error diffusion)
  14662. @item sierra2
  14663. Frankie Sierra dithering v2 (error diffusion)
  14664. @item sierra2_4a
  14665. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14666. @item sierra3
  14667. Frankie Sierra dithering v3 (error diffusion)
  14668. @item burkes
  14669. Burkes dithering (error diffusion)
  14670. @item atkinson
  14671. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14672. @item none
  14673. Disable dithering.
  14674. @end table
  14675. Default is @var{sierra2_4a}.
  14676. @item bayer_scale
  14677. When @var{bayer} dithering is selected, this option defines the scale of the
  14678. pattern (how much the crosshatch pattern is visible). A low value means more
  14679. visible pattern for less banding, and higher value means less visible pattern
  14680. at the cost of more banding.
  14681. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14682. @item diff_mode
  14683. If set, define the zone to process
  14684. @table @samp
  14685. @item rectangle
  14686. Only the changing rectangle will be reprocessed. This is similar to GIF
  14687. cropping/offsetting compression mechanism. This option can be useful for speed
  14688. if only a part of the image is changing, and has use cases such as limiting the
  14689. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14690. moving scene (it leads to more deterministic output if the scene doesn't change
  14691. much, and as a result less moving noise and better GIF compression).
  14692. @end table
  14693. Default is @var{none}.
  14694. @item new
  14695. Take new palette for each output frame.
  14696. @item alpha_threshold
  14697. Sets the alpha threshold for transparency. Alpha values above this threshold
  14698. will be treated as completely opaque, and values below this threshold will be
  14699. treated as completely transparent.
  14700. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14701. @end table
  14702. @subsection Examples
  14703. @itemize
  14704. @item
  14705. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14706. using @command{ffmpeg}:
  14707. @example
  14708. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14709. @end example
  14710. @end itemize
  14711. @section perspective
  14712. Correct perspective of video not recorded perpendicular to the screen.
  14713. A description of the accepted parameters follows.
  14714. @table @option
  14715. @item x0
  14716. @item y0
  14717. @item x1
  14718. @item y1
  14719. @item x2
  14720. @item y2
  14721. @item x3
  14722. @item y3
  14723. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14724. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14725. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14726. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14727. then the corners of the source will be sent to the specified coordinates.
  14728. The expressions can use the following variables:
  14729. @table @option
  14730. @item W
  14731. @item H
  14732. the width and height of video frame.
  14733. @item in
  14734. Input frame count.
  14735. @item on
  14736. Output frame count.
  14737. @end table
  14738. @item interpolation
  14739. Set interpolation for perspective correction.
  14740. It accepts the following values:
  14741. @table @samp
  14742. @item linear
  14743. @item cubic
  14744. @end table
  14745. Default value is @samp{linear}.
  14746. @item sense
  14747. Set interpretation of coordinate options.
  14748. It accepts the following values:
  14749. @table @samp
  14750. @item 0, source
  14751. Send point in the source specified by the given coordinates to
  14752. the corners of the destination.
  14753. @item 1, destination
  14754. Send the corners of the source to the point in the destination specified
  14755. by the given coordinates.
  14756. Default value is @samp{source}.
  14757. @end table
  14758. @item eval
  14759. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14760. It accepts the following values:
  14761. @table @samp
  14762. @item init
  14763. only evaluate expressions once during the filter initialization or
  14764. when a command is processed
  14765. @item frame
  14766. evaluate expressions for each incoming frame
  14767. @end table
  14768. Default value is @samp{init}.
  14769. @end table
  14770. @section phase
  14771. Delay interlaced video by one field time so that the field order changes.
  14772. The intended use is to fix PAL movies that have been captured with the
  14773. opposite field order to the film-to-video transfer.
  14774. A description of the accepted parameters follows.
  14775. @table @option
  14776. @item mode
  14777. Set phase mode.
  14778. It accepts the following values:
  14779. @table @samp
  14780. @item t
  14781. Capture field order top-first, transfer bottom-first.
  14782. Filter will delay the bottom field.
  14783. @item b
  14784. Capture field order bottom-first, transfer top-first.
  14785. Filter will delay the top field.
  14786. @item p
  14787. Capture and transfer with the same field order. This mode only exists
  14788. for the documentation of the other options to refer to, but if you
  14789. actually select it, the filter will faithfully do nothing.
  14790. @item a
  14791. Capture field order determined automatically by field flags, transfer
  14792. opposite.
  14793. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14794. basis using field flags. If no field information is available,
  14795. then this works just like @samp{u}.
  14796. @item u
  14797. Capture unknown or varying, transfer opposite.
  14798. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14799. analyzing the images and selecting the alternative that produces best
  14800. match between the fields.
  14801. @item T
  14802. Capture top-first, transfer unknown or varying.
  14803. Filter selects among @samp{t} and @samp{p} using image analysis.
  14804. @item B
  14805. Capture bottom-first, transfer unknown or varying.
  14806. Filter selects among @samp{b} and @samp{p} using image analysis.
  14807. @item A
  14808. Capture determined by field flags, transfer unknown or varying.
  14809. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14810. image analysis. If no field information is available, then this works just
  14811. like @samp{U}. This is the default mode.
  14812. @item U
  14813. Both capture and transfer unknown or varying.
  14814. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14815. @end table
  14816. @end table
  14817. @subsection Commands
  14818. This filter supports the all above options as @ref{commands}.
  14819. @section photosensitivity
  14820. Reduce various flashes in video, so to help users with epilepsy.
  14821. It accepts the following options:
  14822. @table @option
  14823. @item frames, f
  14824. Set how many frames to use when filtering. Default is 30.
  14825. @item threshold, t
  14826. Set detection threshold factor. Default is 1.
  14827. Lower is stricter.
  14828. @item skip
  14829. Set how many pixels to skip when sampling frames. Default is 1.
  14830. Allowed range is from 1 to 1024.
  14831. @item bypass
  14832. Leave frames unchanged. Default is disabled.
  14833. @end table
  14834. @section pixdesctest
  14835. Pixel format descriptor test filter, mainly useful for internal
  14836. testing. The output video should be equal to the input video.
  14837. For example:
  14838. @example
  14839. format=monow, pixdesctest
  14840. @end example
  14841. can be used to test the monowhite pixel format descriptor definition.
  14842. @section pixelize
  14843. Apply pixelization to video stream.
  14844. The filter accepts the following options:
  14845. @table @option
  14846. @item width, w
  14847. @item height, h
  14848. Set block dimensions that will be used for pixelization.
  14849. Default value is @code{16}.
  14850. @item mode, m
  14851. Set the mode of pixelization used.
  14852. Possible values are:
  14853. @table @samp
  14854. @item avg
  14855. @item min
  14856. @item max
  14857. @end table
  14858. Default value is @code{avg}.
  14859. @item planes, p
  14860. Set what planes to filter. Default is to filter all planes.
  14861. @end table
  14862. @subsection Commands
  14863. This filter supports all options as @ref{commands}.
  14864. @section pixscope
  14865. Display sample values of color channels. Mainly useful for checking color
  14866. and levels. Minimum supported resolution is 640x480.
  14867. The filters accept the following options:
  14868. @table @option
  14869. @item x
  14870. Set scope X position, relative offset on X axis.
  14871. @item y
  14872. Set scope Y position, relative offset on Y axis.
  14873. @item w
  14874. Set scope width.
  14875. @item h
  14876. Set scope height.
  14877. @item o
  14878. Set window opacity. This window also holds statistics about pixel area.
  14879. @item wx
  14880. Set window X position, relative offset on X axis.
  14881. @item wy
  14882. Set window Y position, relative offset on Y axis.
  14883. @end table
  14884. @subsection Commands
  14885. This filter supports same @ref{commands} as options.
  14886. @section pp7
  14887. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  14888. similar to spp = 6 with 7 point DCT, where only the center sample is
  14889. used after IDCT.
  14890. The filter accepts the following options:
  14891. @table @option
  14892. @item qp
  14893. Force a constant quantization parameter. It accepts an integer in range
  14894. 0 to 63. If not set, the filter will use the QP from the video stream
  14895. (if available).
  14896. @item mode
  14897. Set thresholding mode. Available modes are:
  14898. @table @samp
  14899. @item hard
  14900. Set hard thresholding.
  14901. @item soft
  14902. Set soft thresholding (better de-ringing effect, but likely blurrier).
  14903. @item medium
  14904. Set medium thresholding (good results, default).
  14905. @end table
  14906. @end table
  14907. @section premultiply
  14908. Apply alpha premultiply effect to input video stream using first plane
  14909. of second stream as alpha.
  14910. Both streams must have same dimensions and same pixel format.
  14911. The filter accepts the following option:
  14912. @table @option
  14913. @item planes
  14914. Set which planes will be processed, unprocessed planes will be copied.
  14915. By default value 0xf, all planes will be processed.
  14916. @item inplace
  14917. Do not require 2nd input for processing, instead use alpha plane from input stream.
  14918. @end table
  14919. @section prewitt
  14920. Apply prewitt operator to input video stream.
  14921. The filter accepts the following option:
  14922. @table @option
  14923. @item planes
  14924. Set which planes will be processed, unprocessed planes will be copied.
  14925. By default value 0xf, all planes will be processed.
  14926. @item scale
  14927. Set value which will be multiplied with filtered result.
  14928. @item delta
  14929. Set value which will be added to filtered result.
  14930. @end table
  14931. @subsection Commands
  14932. This filter supports the all above options as @ref{commands}.
  14933. @section pseudocolor
  14934. Alter frame colors in video with pseudocolors.
  14935. This filter accepts the following options:
  14936. @table @option
  14937. @item c0
  14938. set pixel first component expression
  14939. @item c1
  14940. set pixel second component expression
  14941. @item c2
  14942. set pixel third component expression
  14943. @item c3
  14944. set pixel fourth component expression, corresponds to the alpha component
  14945. @item index, i
  14946. set component to use as base for altering colors
  14947. @item preset, p
  14948. Pick one of built-in LUTs. By default is set to none.
  14949. Available LUTs:
  14950. @table @samp
  14951. @item magma
  14952. @item inferno
  14953. @item plasma
  14954. @item viridis
  14955. @item turbo
  14956. @item cividis
  14957. @item range1
  14958. @item range2
  14959. @item shadows
  14960. @item highlights
  14961. @item solar
  14962. @item nominal
  14963. @item preferred
  14964. @item total
  14965. @item spectral
  14966. @item cool
  14967. @item heat
  14968. @item fiery
  14969. @item blues
  14970. @item green
  14971. @item helix
  14972. @end table
  14973. @item opacity
  14974. Set opacity of output colors. Allowed range is from 0 to 1.
  14975. Default value is set to 1.
  14976. @end table
  14977. Each of the expression options specifies the expression to use for computing
  14978. the lookup table for the corresponding pixel component values.
  14979. The expressions can contain the following constants and functions:
  14980. @table @option
  14981. @item w
  14982. @item h
  14983. The input width and height.
  14984. @item val
  14985. The input value for the pixel component.
  14986. @item ymin, umin, vmin, amin
  14987. The minimum allowed component value.
  14988. @item ymax, umax, vmax, amax
  14989. The maximum allowed component value.
  14990. @end table
  14991. All expressions default to "val".
  14992. @subsection Commands
  14993. This filter supports the all above options as @ref{commands}.
  14994. @subsection Examples
  14995. @itemize
  14996. @item
  14997. Change too high luma values to gradient:
  14998. @example
  14999. 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'"
  15000. @end example
  15001. @end itemize
  15002. @anchor{psnr}
  15003. @section psnr
  15004. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  15005. Ratio) between two input videos.
  15006. This filter takes in input two input videos, the first input is
  15007. considered the "main" source and is passed unchanged to the
  15008. output. The second input is used as a "reference" video for computing
  15009. the PSNR.
  15010. Both video inputs must have the same resolution and pixel format for
  15011. this filter to work correctly. Also it assumes that both inputs
  15012. have the same number of frames, which are compared one by one.
  15013. The obtained average PSNR is printed through the logging system.
  15014. The filter stores the accumulated MSE (mean squared error) of each
  15015. frame, and at the end of the processing it is averaged across all frames
  15016. equally, and the following formula is applied to obtain the PSNR:
  15017. @example
  15018. PSNR = 10*log10(MAX^2/MSE)
  15019. @end example
  15020. Where MAX is the average of the maximum values of each component of the
  15021. image.
  15022. The description of the accepted parameters follows.
  15023. @table @option
  15024. @item stats_file, f
  15025. If specified the filter will use the named file to save the PSNR of
  15026. each individual frame. When filename equals "-" the data is sent to
  15027. standard output.
  15028. @item stats_version
  15029. Specifies which version of the stats file format to use. Details of
  15030. each format are written below.
  15031. Default value is 1.
  15032. @item stats_add_max
  15033. Determines whether the max value is output to the stats log.
  15034. Default value is 0.
  15035. Requires stats_version >= 2. If this is set and stats_version < 2,
  15036. the filter will return an error.
  15037. @end table
  15038. This filter also supports the @ref{framesync} options.
  15039. The file printed if @var{stats_file} is selected, contains a sequence of
  15040. key/value pairs of the form @var{key}:@var{value} for each compared
  15041. couple of frames.
  15042. If a @var{stats_version} greater than 1 is specified, a header line precedes
  15043. the list of per-frame-pair stats, with key value pairs following the frame
  15044. format with the following parameters:
  15045. @table @option
  15046. @item psnr_log_version
  15047. The version of the log file format. Will match @var{stats_version}.
  15048. @item fields
  15049. A comma separated list of the per-frame-pair parameters included in
  15050. the log.
  15051. @end table
  15052. A description of each shown per-frame-pair parameter follows:
  15053. @table @option
  15054. @item n
  15055. sequential number of the input frame, starting from 1
  15056. @item mse_avg
  15057. Mean Square Error pixel-by-pixel average difference of the compared
  15058. frames, averaged over all the image components.
  15059. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  15060. Mean Square Error pixel-by-pixel average difference of the compared
  15061. frames for the component specified by the suffix.
  15062. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  15063. Peak Signal to Noise ratio of the compared frames for the component
  15064. specified by the suffix.
  15065. @item max_avg, max_y, max_u, max_v
  15066. Maximum allowed value for each channel, and average over all
  15067. channels.
  15068. @end table
  15069. @subsection Examples
  15070. @itemize
  15071. @item
  15072. For example:
  15073. @example
  15074. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15075. [main][ref] psnr="stats_file=stats.log" [out]
  15076. @end example
  15077. On this example the input file being processed is compared with the
  15078. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  15079. is stored in @file{stats.log}.
  15080. @item
  15081. Another example with different containers:
  15082. @example
  15083. 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 -
  15084. @end example
  15085. @end itemize
  15086. @anchor{pullup}
  15087. @section pullup
  15088. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  15089. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  15090. content.
  15091. The pullup filter is designed to take advantage of future context in making
  15092. its decisions. This filter is stateless in the sense that it does not lock
  15093. onto a pattern to follow, but it instead looks forward to the following
  15094. fields in order to identify matches and rebuild progressive frames.
  15095. To produce content with an even framerate, insert the fps filter after
  15096. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  15097. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  15098. The filter accepts the following options:
  15099. @table @option
  15100. @item jl
  15101. @item jr
  15102. @item jt
  15103. @item jb
  15104. These options set the amount of "junk" to ignore at the left, right, top, and
  15105. bottom of the image, respectively. Left and right are in units of 8 pixels,
  15106. while top and bottom are in units of 2 lines.
  15107. The default is 8 pixels on each side.
  15108. @item sb
  15109. Set the strict breaks. Setting this option to 1 will reduce the chances of
  15110. filter generating an occasional mismatched frame, but it may also cause an
  15111. excessive number of frames to be dropped during high motion sequences.
  15112. Conversely, setting it to -1 will make filter match fields more easily.
  15113. This may help processing of video where there is slight blurring between
  15114. the fields, but may also cause there to be interlaced frames in the output.
  15115. Default value is @code{0}.
  15116. @item mp
  15117. Set the metric plane to use. It accepts the following values:
  15118. @table @samp
  15119. @item l
  15120. Use luma plane.
  15121. @item u
  15122. Use chroma blue plane.
  15123. @item v
  15124. Use chroma red plane.
  15125. @end table
  15126. This option may be set to use chroma plane instead of the default luma plane
  15127. for doing filter's computations. This may improve accuracy on very clean
  15128. source material, but more likely will decrease accuracy, especially if there
  15129. is chroma noise (rainbow effect) or any grayscale video.
  15130. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  15131. load and make pullup usable in realtime on slow machines.
  15132. @end table
  15133. For best results (without duplicated frames in the output file) it is
  15134. necessary to change the output frame rate. For example, to inverse
  15135. telecine NTSC input:
  15136. @example
  15137. ffmpeg -i input -vf pullup -r 24000/1001 ...
  15138. @end example
  15139. @section qp
  15140. Change video quantization parameters (QP).
  15141. The filter accepts the following option:
  15142. @table @option
  15143. @item qp
  15144. Set expression for quantization parameter.
  15145. @end table
  15146. The expression is evaluated through the eval API and can contain, among others,
  15147. the following constants:
  15148. @table @var
  15149. @item known
  15150. 1 if index is not 129, 0 otherwise.
  15151. @item qp
  15152. Sequential index starting from -129 to 128.
  15153. @end table
  15154. @subsection Examples
  15155. @itemize
  15156. @item
  15157. Some equation like:
  15158. @example
  15159. qp=2+2*sin(PI*qp)
  15160. @end example
  15161. @end itemize
  15162. @section qrencode
  15163. Generate a QR code using the libqrencode library (see
  15164. @url{https://fukuchi.org/works/qrencode/}), and overlay it on top of the current
  15165. frame.
  15166. To enable the compilation of this filter, you need to configure FFmpeg with
  15167. @code{--enable-libqrencode}.
  15168. The QR code is generated from the provided text or text pattern. The
  15169. corresponding QR code is scaled and overlaid into the video output according to
  15170. the specified options.
  15171. In case no text is specified, no QR code is overlaied.
  15172. This filter accepts the following options:
  15173. @table @option
  15174. @item qrcode_width, q
  15175. @item padded_qrcode_width, Q
  15176. Specify an expression for the width of the rendered QR code, with and without
  15177. padding. The @var{qrcode_width} expression can reference the value set by the
  15178. @var{padded_qrcode_width} expression, and vice versa.
  15179. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  15180. there is no padding.
  15181. These expressions are evaluated for each new frame.
  15182. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15183. @item x
  15184. @item y
  15185. Specify an expression for positioning the padded QR code top-left corner. The
  15186. @var{x} expression can reference the value set by the @var{y} expression, and
  15187. vice.
  15188. By default @var{x} and @var{y} are set set to @var{0}, meaning that the QR code
  15189. is placed in the top left corner of the input.
  15190. These expressions are evaluated for each new frame.
  15191. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15192. @item case_sensitive, cs
  15193. Instruct libqrencode to use case sensitive encoding. This is enabled by
  15194. default. This can be disabled to reduce the QR encoding size.
  15195. @item level, l
  15196. Specify the QR encoding error correction level. With an higher correction level,
  15197. the encoding size will increase but the code will be more robust to corruption.
  15198. Lower level is @var{L}.
  15199. It accepts the following values:
  15200. @table @samp
  15201. @item L
  15202. @item M
  15203. @item Q
  15204. @item H
  15205. @end table
  15206. @item expansion
  15207. Select how the input text is expanded. Can be either @code{none}, or
  15208. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  15209. section below for details.
  15210. @item text
  15211. @item textfile
  15212. Define the text to be rendered. In case neither is specified, no QR is encoded
  15213. (just an empty colored frame).
  15214. In case expansion is enabled, the text is treated as a text template, using the
  15215. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  15216. Text expansion} section below for details.
  15217. @item background_color, bc
  15218. @item foreground_color, fc
  15219. Set the QR code and background color. The default value of
  15220. @var{foreground_color} is "black", the default value of @var{background_color}
  15221. is "white".
  15222. For the syntax of the color options, check the @ref{color syntax,,"Color"
  15223. section in the ffmpeg-utils manual,ffmpeg-utils}.
  15224. @end table
  15225. @anchor{qrencode_expressions}
  15226. @subsection qrencode Expressions
  15227. The expressions set by the options contain the following constants and functions.
  15228. @table @option
  15229. @item dar
  15230. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  15231. @item duration
  15232. the current frame's duration, in seconds
  15233. @item hsub
  15234. @item vsub
  15235. horizontal and vertical chroma subsample values. For example for the
  15236. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15237. @item main_h, H
  15238. the input height
  15239. @item main_w, W
  15240. the input width
  15241. @item n
  15242. the number of input frame, starting from 0
  15243. @item pict_type
  15244. a number representing the picture type
  15245. @item qr_w, w
  15246. the width of the encoded QR code
  15247. @item rendered_qr_w, q
  15248. @item rendered_padded_qr_w, Q
  15249. the width of the rendered QR code, without and without padding.
  15250. These parameters allow the @var{q} and @var{Q} expressions to refer to each
  15251. other, so you can for example specify @code{q=3/4*Q}.
  15252. @item rand(min, max)
  15253. return a random number included between @var{min} and @var{max}
  15254. @item sar
  15255. the input sample aspect ratio
  15256. @item t
  15257. timestamp expressed in seconds, NAN if the input timestamp is unknown
  15258. @item x
  15259. @item y
  15260. the x and y offset coordinates where the text is drawn.
  15261. These parameters allow the @var{x} and @var{y} expressions to refer to each
  15262. other, so you can for example specify @code{y=x/dar}.
  15263. @end table
  15264. @anchor{qrencode_text_expansion}
  15265. @subsection qrencode Text expansion
  15266. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  15267. If @option{expansion} is set to @code{normal} (which is the default),
  15268. the following expansion mechanism is used.
  15269. The backslash character @samp{\}, followed by any character, always expands to
  15270. the second character.
  15271. Sequences of the form @code{%@{...@}} are expanded. The text between the
  15272. braces is a function name, possibly followed by arguments separated by ':'.
  15273. If the arguments contain special characters or delimiters (':' or '@}'),
  15274. they should be escaped.
  15275. Note that they probably must also be escaped as the value for the @option{text}
  15276. option in the filter argument string and as the filter argument in the
  15277. filtergraph description, and possibly also for the shell, that makes up to four
  15278. levels of escaping; using a text file with the @option{textfile} option avoids
  15279. these problems.
  15280. The following functions are available:
  15281. @table @command
  15282. @item n, frame_num
  15283. return the frame number
  15284. @item pts
  15285. Return the presentation timestamp of the current frame.
  15286. It can take up to two arguments.
  15287. The first argument is the format of the timestamp; it defaults to @code{flt} for
  15288. seconds as a decimal number with microsecond accuracy; @code{hms} stands for a
  15289. formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  15290. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  15291. @code{localtime} stands for the timestamp of the frame formatted as local time
  15292. zone time. If the format is set to @code{hms24hh}, the time is formatted in 24h
  15293. format (00-23).
  15294. The second argument is an offset added to the timestamp.
  15295. If the format is set to @code{localtime} or @code{gmtime}, a third argument may
  15296. be supplied: a @code{strftime} C function format string. By default,
  15297. @var{YYYY-MM-DD HH:MM:SS} format will be used.
  15298. @item expr, e
  15299. Evaluate the expression's value and output as a double.
  15300. It must take one argument specifying the expression to be evaluated, accepting
  15301. the constants and functions defined in @ref{qrencode_expressions}.
  15302. @item expr_formatted, ef
  15303. Evaluate the expression's value and output as a formatted string.
  15304. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  15305. The second argument specifies the output format. Allowed values are @samp{x},
  15306. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  15307. @code{printf} function.
  15308. The third parameter is optional and sets the number of positions taken by the output.
  15309. It can be used to add padding with zeros from the left.
  15310. @item gmtime
  15311. The time at which the filter is running, expressed in UTC.
  15312. It can accept an argument: a @code{strftime} C function format string.
  15313. The format string is extended to support the variable @var{%[1-6]N}
  15314. which prints fractions of the second with optionally specified number of digits.
  15315. @item localtime
  15316. The time at which the filter is running, expressed in the local time zone.
  15317. It can accept an argument: a @code{strftime} C function format string.
  15318. The format string is extended to support the variable @var{%[1-6]N}
  15319. which prints fractions of the second with optionally specified number of digits.
  15320. @item metadata
  15321. Frame metadata. Takes one or two arguments.
  15322. The first argument is mandatory and specifies the metadata key.
  15323. The second argument is optional and specifies a default value, used when the
  15324. metadata key is not found or empty.
  15325. Available metadata can be identified by inspecting entries starting with TAG
  15326. included within each frame section printed by running @code{ffprobe
  15327. -show_frames}.
  15328. String metadata generated in filters leading to the qrencode filter are also
  15329. available.
  15330. @item rand(min, max)
  15331. return a random number included between @var{min} and @var{max}
  15332. @end table
  15333. @subsection Examples
  15334. @itemize
  15335. @item
  15336. Generate a QR code encoding the specified text with the default size, overalaid
  15337. in the top left corner of the input video, with the default size:
  15338. @example
  15339. qrencode=text=www.ffmpeg.org
  15340. @end example
  15341. @item
  15342. Same as below, but select blue on pink colors:
  15343. @example
  15344. qrencode=text=www.ffmpeg.org:bc=pink@@0.5:fc=blue
  15345. @end example
  15346. @item
  15347. Place the QR code in the bottom right corner of the input video:
  15348. @example
  15349. qrencode=text=www.ffmpeg.org:x=W-Q:y=H-Q
  15350. @end example
  15351. @item
  15352. Generate a QR code with width of 200 pixels and padding, making the padded width
  15353. 4/3 of the QR code width:
  15354. @example
  15355. qrencode=text=www.ffmpeg.org:q=200:Q=4/3*q
  15356. @end example
  15357. @item
  15358. Generate a QR code with padded width of 200 pixels and padding, making the QR
  15359. code width 3/4 of the padded width:
  15360. @example
  15361. qrencode=text=www.ffmpeg.org:Q=200:q=3/4*Q
  15362. @end example
  15363. @item
  15364. Make the QR code a fraction of the input video width:
  15365. @example
  15366. qrencode=text=www.ffmpeg.org:q=W/5
  15367. @end example
  15368. @item
  15369. Generate a QR code encoding the frame number:
  15370. @example
  15371. qrencode=text=%@{n@}
  15372. @end example
  15373. @item
  15374. Generate a QR code encoding the GMT timestamp:
  15375. @example
  15376. qrencode=text=%@{gmtime@}
  15377. @end example
  15378. @item
  15379. Generate a QR code encoding the timestamp expressed as a float:
  15380. @example
  15381. qrencode=text=%@{pts@}
  15382. @end example
  15383. @end itemize
  15384. @section quirc
  15385. Identify and decode a QR code using the libquirc library (see
  15386. @url{https://github.com/dlbeer/quirc/}), and print the identified QR codes
  15387. positions and payload as metadata.
  15388. To enable the compilation of this filter, you need to configure FFmpeg with
  15389. @code{--enable-libquirc}.
  15390. For each found QR code in the input video, some metadata entries are added with
  15391. the prefix @var{lavfi.quirc.N}, where @var{N} is the index, starting from 0,
  15392. associated to the QR code.
  15393. A description of each metadata value follows:
  15394. @table @option
  15395. @item lavfi.quirc.count
  15396. the number of found QR codes, it is not set in case none was found
  15397. @item lavfi.quirc.N.corner.M.x
  15398. @item lavfi.quirc.N.coreer.M.y
  15399. the x/y positions of the four corners of the square containing the QR code,
  15400. where @var{M} is the index of the corner starting from 0
  15401. @item lavfi.quirc.N.payload
  15402. the payload of the QR code
  15403. @end table
  15404. @section random
  15405. Flush video frames from internal cache of frames into a random order.
  15406. No frame is discarded.
  15407. Inspired by @ref{frei0r} nervous filter.
  15408. @table @option
  15409. @item frames
  15410. Set size in number of frames of internal cache, in range from @code{2} to
  15411. @code{512}. Default is @code{30}.
  15412. @item seed
  15413. Set seed for random number generator, must be an integer included between
  15414. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15415. less than @code{0}, the filter will try to use a good random seed on a
  15416. best effort basis.
  15417. @end table
  15418. @section readeia608
  15419. Read closed captioning (EIA-608) information from the top lines of a video frame.
  15420. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  15421. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  15422. with EIA-608 data (starting from 0). A description of each metadata value follows:
  15423. @table @option
  15424. @item lavfi.readeia608.X.cc
  15425. The two bytes stored as EIA-608 data (printed in hexadecimal).
  15426. @item lavfi.readeia608.X.line
  15427. The number of the line on which the EIA-608 data was identified and read.
  15428. @end table
  15429. This filter accepts the following options:
  15430. @table @option
  15431. @item scan_min
  15432. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  15433. @item scan_max
  15434. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  15435. @item spw
  15436. Set the ratio of width reserved for sync code detection.
  15437. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  15438. @item chp
  15439. Enable checking the parity bit. In the event of a parity error, the filter will output
  15440. @code{0x00} for that character. Default is false.
  15441. @item lp
  15442. Lowpass lines prior to further processing. Default is enabled.
  15443. @end table
  15444. @subsection Commands
  15445. This filter supports the all above options as @ref{commands}.
  15446. @subsection Examples
  15447. @itemize
  15448. @item
  15449. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  15450. @example
  15451. 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
  15452. @end example
  15453. @end itemize
  15454. @section readvitc
  15455. Read vertical interval timecode (VITC) information from the top lines of a
  15456. video frame.
  15457. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  15458. timecode value, if a valid timecode has been detected. Further metadata key
  15459. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  15460. timecode data has been found or not.
  15461. This filter accepts the following options:
  15462. @table @option
  15463. @item scan_max
  15464. Set the maximum number of lines to scan for VITC data. If the value is set to
  15465. @code{-1} the full video frame is scanned. Default is @code{45}.
  15466. @item thr_b
  15467. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  15468. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  15469. @item thr_w
  15470. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  15471. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  15472. @end table
  15473. @subsection Examples
  15474. @itemize
  15475. @item
  15476. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  15477. draw @code{--:--:--:--} as a placeholder:
  15478. @example
  15479. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  15480. @end example
  15481. @end itemize
  15482. @section remap
  15483. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  15484. Destination pixel at position (X, Y) will be picked from source (x, y) position
  15485. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  15486. value for pixel will be used for destination pixel.
  15487. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  15488. will have Xmap/Ymap video stream dimensions.
  15489. Xmap and Ymap input video streams are 16bit depth, single channel.
  15490. @table @option
  15491. @item format
  15492. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  15493. Default is @code{color}.
  15494. @item fill
  15495. Specify the color of the unmapped pixels. For the syntax of this option,
  15496. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15497. manual,ffmpeg-utils}. Default color is @code{black}.
  15498. @end table
  15499. @section removegrain
  15500. The removegrain filter is a spatial denoiser for progressive video.
  15501. @table @option
  15502. @item m0
  15503. Set mode for the first plane.
  15504. @item m1
  15505. Set mode for the second plane.
  15506. @item m2
  15507. Set mode for the third plane.
  15508. @item m3
  15509. Set mode for the fourth plane.
  15510. @end table
  15511. Range of mode is from 0 to 24. Description of each mode follows:
  15512. @table @var
  15513. @item 0
  15514. Leave input plane unchanged. Default.
  15515. @item 1
  15516. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  15517. @item 2
  15518. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  15519. @item 3
  15520. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  15521. @item 4
  15522. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  15523. This is equivalent to a median filter.
  15524. @item 5
  15525. Line-sensitive clipping giving the minimal change.
  15526. @item 6
  15527. Line-sensitive clipping, intermediate.
  15528. @item 7
  15529. Line-sensitive clipping, intermediate.
  15530. @item 8
  15531. Line-sensitive clipping, intermediate.
  15532. @item 9
  15533. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  15534. @item 10
  15535. Replaces the target pixel with the closest neighbour.
  15536. @item 11
  15537. [1 2 1] horizontal and vertical kernel blur.
  15538. @item 12
  15539. Same as mode 11.
  15540. @item 13
  15541. Bob mode, interpolates top field from the line where the neighbours
  15542. pixels are the closest.
  15543. @item 14
  15544. Bob mode, interpolates bottom field from the line where the neighbours
  15545. pixels are the closest.
  15546. @item 15
  15547. Bob mode, interpolates top field. Same as 13 but with a more complicated
  15548. interpolation formula.
  15549. @item 16
  15550. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  15551. interpolation formula.
  15552. @item 17
  15553. Clips the pixel with the minimum and maximum of respectively the maximum and
  15554. minimum of each pair of opposite neighbour pixels.
  15555. @item 18
  15556. Line-sensitive clipping using opposite neighbours whose greatest distance from
  15557. the current pixel is minimal.
  15558. @item 19
  15559. Replaces the pixel with the average of its 8 neighbours.
  15560. @item 20
  15561. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  15562. @item 21
  15563. Clips pixels using the averages of opposite neighbour.
  15564. @item 22
  15565. Same as mode 21 but simpler and faster.
  15566. @item 23
  15567. Small edge and halo removal, but reputed useless.
  15568. @item 24
  15569. Similar as 23.
  15570. @end table
  15571. @section removelogo
  15572. Suppress a TV station logo, using an image file to determine which
  15573. pixels comprise the logo. It works by filling in the pixels that
  15574. comprise the logo with neighboring pixels.
  15575. The filter accepts the following options:
  15576. @table @option
  15577. @item filename, f
  15578. Set the filter bitmap file, which can be any image format supported by
  15579. libavformat. The width and height of the image file must match those of the
  15580. video stream being processed.
  15581. @end table
  15582. Pixels in the provided bitmap image with a value of zero are not
  15583. considered part of the logo, non-zero pixels are considered part of
  15584. the logo. If you use white (255) for the logo and black (0) for the
  15585. rest, you will be safe. For making the filter bitmap, it is
  15586. recommended to take a screen capture of a black frame with the logo
  15587. visible, and then using a threshold filter followed by the erode
  15588. filter once or twice.
  15589. If needed, little splotches can be fixed manually. Remember that if
  15590. logo pixels are not covered, the filter quality will be much
  15591. reduced. Marking too many pixels as part of the logo does not hurt as
  15592. much, but it will increase the amount of blurring needed to cover over
  15593. the image and will destroy more information than necessary, and extra
  15594. pixels will slow things down on a large logo.
  15595. @section repeatfields
  15596. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15597. fields based on its value.
  15598. @section reverse
  15599. Reverse a video clip.
  15600. Warning: This filter requires memory to buffer the entire clip, so trimming
  15601. is suggested.
  15602. @subsection Examples
  15603. @itemize
  15604. @item
  15605. Take the first 5 seconds of a clip, and reverse it.
  15606. @example
  15607. trim=end=5,reverse
  15608. @end example
  15609. @end itemize
  15610. @section rgbashift
  15611. Shift R/G/B/A pixels horizontally and/or vertically.
  15612. The filter accepts the following options:
  15613. @table @option
  15614. @item rh
  15615. Set amount to shift red horizontally.
  15616. @item rv
  15617. Set amount to shift red vertically.
  15618. @item gh
  15619. Set amount to shift green horizontally.
  15620. @item gv
  15621. Set amount to shift green vertically.
  15622. @item bh
  15623. Set amount to shift blue horizontally.
  15624. @item bv
  15625. Set amount to shift blue vertically.
  15626. @item ah
  15627. Set amount to shift alpha horizontally.
  15628. @item av
  15629. Set amount to shift alpha vertically.
  15630. @item edge
  15631. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15632. @end table
  15633. @subsection Commands
  15634. This filter supports the all above options as @ref{commands}.
  15635. @section roberts
  15636. Apply roberts cross operator to input video stream.
  15637. The filter accepts the following option:
  15638. @table @option
  15639. @item planes
  15640. Set which planes will be processed, unprocessed planes will be copied.
  15641. By default value 0xf, all planes will be processed.
  15642. @item scale
  15643. Set value which will be multiplied with filtered result.
  15644. @item delta
  15645. Set value which will be added to filtered result.
  15646. @end table
  15647. @subsection Commands
  15648. This filter supports the all above options as @ref{commands}.
  15649. @section rotate
  15650. Rotate video by an arbitrary angle expressed in radians.
  15651. The filter accepts the following options:
  15652. A description of the optional parameters follows.
  15653. @table @option
  15654. @item angle, a
  15655. Set an expression for the angle by which to rotate the input video
  15656. clockwise, expressed as a number of radians. A negative value will
  15657. result in a counter-clockwise rotation. By default it is set to "0".
  15658. This expression is evaluated for each frame.
  15659. @item out_w, ow
  15660. Set the output width expression, default value is "iw".
  15661. This expression is evaluated just once during configuration.
  15662. @item out_h, oh
  15663. Set the output height expression, default value is "ih".
  15664. This expression is evaluated just once during configuration.
  15665. @item bilinear
  15666. Enable bilinear interpolation if set to 1, a value of 0 disables
  15667. it. Default value is 1.
  15668. @item fillcolor, c
  15669. Set the color used to fill the output area not covered by the rotated
  15670. image. For the general syntax of this option, check the
  15671. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15672. If the special value "none" is selected then no
  15673. background is printed (useful for example if the background is never shown).
  15674. Default value is "black".
  15675. @end table
  15676. The expressions for the angle and the output size can contain the
  15677. following constants and functions:
  15678. @table @option
  15679. @item n
  15680. sequential number of the input frame, starting from 0. It is always NAN
  15681. before the first frame is filtered.
  15682. @item t
  15683. time in seconds of the input frame, it is set to 0 when the filter is
  15684. configured. It is always NAN before the first frame is filtered.
  15685. @item hsub
  15686. @item vsub
  15687. horizontal and vertical chroma subsample values. For example for the
  15688. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15689. @item in_w, iw
  15690. @item in_h, ih
  15691. the input video width and height
  15692. @item out_w, ow
  15693. @item out_h, oh
  15694. the output width and height, that is the size of the padded area as
  15695. specified by the @var{width} and @var{height} expressions
  15696. @item rotw(a)
  15697. @item roth(a)
  15698. the minimal width/height required for completely containing the input
  15699. video rotated by @var{a} radians.
  15700. These are only available when computing the @option{out_w} and
  15701. @option{out_h} expressions.
  15702. @end table
  15703. @subsection Examples
  15704. @itemize
  15705. @item
  15706. Rotate the input by PI/6 radians clockwise:
  15707. @example
  15708. rotate=PI/6
  15709. @end example
  15710. @item
  15711. Rotate the input by PI/6 radians counter-clockwise:
  15712. @example
  15713. rotate=-PI/6
  15714. @end example
  15715. @item
  15716. Rotate the input by 45 degrees clockwise:
  15717. @example
  15718. rotate=45*PI/180
  15719. @end example
  15720. @item
  15721. Apply a constant rotation with period T, starting from an angle of PI/3:
  15722. @example
  15723. rotate=PI/3+2*PI*t/T
  15724. @end example
  15725. @item
  15726. Make the input video rotation oscillating with a period of T
  15727. seconds and an amplitude of A radians:
  15728. @example
  15729. rotate=A*sin(2*PI/T*t)
  15730. @end example
  15731. @item
  15732. Rotate the video, output size is chosen so that the whole rotating
  15733. input video is always completely contained in the output:
  15734. @example
  15735. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15736. @end example
  15737. @item
  15738. Rotate the video, reduce the output size so that no background is ever
  15739. shown:
  15740. @example
  15741. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  15742. @end example
  15743. @end itemize
  15744. @subsection Commands
  15745. The filter supports the following commands:
  15746. @table @option
  15747. @item a, angle
  15748. Set the angle expression.
  15749. The command accepts the same syntax of the corresponding option.
  15750. If the specified expression is not valid, it is kept at its current
  15751. value.
  15752. @end table
  15753. @section sab
  15754. Apply Shape Adaptive Blur.
  15755. The filter accepts the following options:
  15756. @table @option
  15757. @item luma_radius, lr
  15758. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  15759. value is 1.0. A greater value will result in a more blurred image, and
  15760. in slower processing.
  15761. @item luma_pre_filter_radius, lpfr
  15762. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  15763. value is 1.0.
  15764. @item luma_strength, ls
  15765. Set luma maximum difference between pixels to still be considered, must
  15766. be a value in the 0.1-100.0 range, default value is 1.0.
  15767. @item chroma_radius, cr
  15768. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  15769. greater value will result in a more blurred image, and in slower
  15770. processing.
  15771. @item chroma_pre_filter_radius, cpfr
  15772. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  15773. @item chroma_strength, cs
  15774. Set chroma maximum difference between pixels to still be considered,
  15775. must be a value in the -0.9-100.0 range.
  15776. @end table
  15777. Each chroma option value, if not explicitly specified, is set to the
  15778. corresponding luma option value.
  15779. @anchor{scale}
  15780. @section scale
  15781. Scale (resize) the input video, using the libswscale library.
  15782. The scale filter forces the output display aspect ratio to be the same
  15783. of the input, by changing the output sample aspect ratio.
  15784. If the input image format is different from the format requested by
  15785. the next filter, the scale filter will convert the input to the
  15786. requested format.
  15787. @subsection Options
  15788. The filter accepts the following options, any of the options supported
  15789. by the libswscale scaler, as well as any of the @ref{framesync} options.
  15790. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  15791. the complete list of scaler options.
  15792. @table @option
  15793. @item width, w
  15794. @item height, h
  15795. Set the output video dimension expression. Default value is the input
  15796. dimension.
  15797. If the @var{width} or @var{w} value is 0, the input width is used for
  15798. the output. If the @var{height} or @var{h} value is 0, the input height
  15799. is used for the output.
  15800. If one and only one of the values is -n with n >= 1, the scale filter
  15801. will use a value that maintains the aspect ratio of the input image,
  15802. calculated from the other specified dimension. After that it will,
  15803. however, make sure that the calculated dimension is divisible by n and
  15804. adjust the value if necessary.
  15805. If both values are -n with n >= 1, the behavior will be identical to
  15806. both values being set to 0 as previously detailed.
  15807. See below for the list of accepted constants for use in the dimension
  15808. expression.
  15809. @item eval
  15810. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  15811. @table @samp
  15812. @item init
  15813. Only evaluate expressions once during the filter initialization or when a command is processed.
  15814. @item frame
  15815. Evaluate expressions for each incoming frame.
  15816. @end table
  15817. Default value is @samp{init}.
  15818. @item interl
  15819. Set the interlacing mode. It accepts the following values:
  15820. @table @samp
  15821. @item 1
  15822. Force interlaced aware scaling.
  15823. @item 0
  15824. Do not apply interlaced scaling.
  15825. @item -1
  15826. Select interlaced aware scaling depending on whether the source frames
  15827. are flagged as interlaced or not.
  15828. @end table
  15829. Default value is @samp{0}.
  15830. @item flags
  15831. Set libswscale scaling flags. See
  15832. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15833. complete list of values. If not explicitly specified the filter applies
  15834. the default flags.
  15835. @item param0, param1
  15836. Set libswscale input parameters for scaling algorithms that need them. See
  15837. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  15838. complete documentation. If not explicitly specified the filter applies
  15839. empty parameters.
  15840. @item intent
  15841. Set the ICC rendering intent to use when transforming between different color
  15842. spaces. It accepts the following values:
  15843. @table @samp
  15844. @item perceptual
  15845. Use a perceptually guided tone and gamut mapping curve. The exact details of
  15846. the mapping used may change at any time and should not be relied on as stable.
  15847. This intent is recommended for final viewing of image/video content in typical
  15848. viewing settings.
  15849. @item relative_colorimetric
  15850. Statically clip out-of-gamut colors using a colorimetric clipping curve which
  15851. attempts to find the colorimetrically least dissimilar in-gamut color. This
  15852. intent performs white point adaptation and black point adaptation. This is
  15853. the default. This intent is recommended wherever faithful color reproduction
  15854. is of the utmost importance, even at the cost of clipping.
  15855. @item absolute_colorimetric
  15856. Hard clip out-of-gamut colors with no attempt at white or black point
  15857. reproduction. This intent will reproduce in-gamut colors 1:1 on the output
  15858. display as they would appear on the reference display, assuming the output
  15859. display is appropriately calibrated.
  15860. @item saturation
  15861. Performs saturation mapping - that is, stretches the input color volume
  15862. directly onto the output color volume, in non-linear fashion that preserves the
  15863. original signal appearance as much as possible. This intent is recommended for
  15864. signal content evaluation, as it will not lead to any clipping. It is roughly
  15865. analogous to not performing any color mapping, although it still takes into
  15866. account the mastering display primaries and any differences in encoding TRC.
  15867. @end table
  15868. @item size, s
  15869. Set the video size. For the syntax of this option, check the
  15870. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15871. @item in_color_matrix
  15872. @item out_color_matrix
  15873. Set in/output YCbCr color space type.
  15874. This allows the autodetected value to be overridden as well as allows forcing
  15875. a specific value used for the output and encoder.
  15876. If not specified, the color space type depends on the pixel format.
  15877. Possible values:
  15878. @table @samp
  15879. @item auto
  15880. Choose automatically.
  15881. @item bt709
  15882. Format conforming to International Telecommunication Union (ITU)
  15883. Recommendation BT.709.
  15884. @item fcc
  15885. Set color space conforming to the United States Federal Communications
  15886. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  15887. @item bt601
  15888. @item bt470
  15889. @item smpte170m
  15890. Set color space conforming to:
  15891. @itemize
  15892. @item
  15893. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  15894. @item
  15895. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  15896. @item
  15897. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  15898. @end itemize
  15899. @item smpte240m
  15900. Set color space conforming to SMPTE ST 240:1999.
  15901. @item bt2020
  15902. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  15903. @end table
  15904. @item in_range
  15905. @item out_range
  15906. Set in/output YCbCr sample range.
  15907. This allows the autodetected value to be overridden as well as allows forcing
  15908. a specific value used for the output and encoder. If not specified, the
  15909. range depends on the pixel format. Possible values:
  15910. @table @samp
  15911. @item auto/unknown
  15912. Choose automatically.
  15913. @item jpeg/full/pc
  15914. Set full range (0-255 in case of 8-bit luma).
  15915. @item mpeg/limited/tv
  15916. Set "MPEG" range (16-235 in case of 8-bit luma).
  15917. @end table
  15918. @item in_chroma_loc
  15919. @item out_chroma_loc
  15920. Set in/output chroma sample location. If not specified, center-sited chroma
  15921. is used by default. Possible values:
  15922. @table @samp
  15923. @item auto, unknown
  15924. @item left
  15925. @item center
  15926. @item topleft
  15927. @item top
  15928. @item bottomleft
  15929. @item bottom
  15930. @end table
  15931. @item in_primaries
  15932. @item out_primaries
  15933. Set in/output RGB primaries.
  15934. This allows the autodetected value to be overridden as well as allows forcing
  15935. a specific value used for the output and encoder. Possible values:
  15936. @table @samp
  15937. @item auto
  15938. Choose automatically. This is the default.
  15939. @item bt709
  15940. @item bt470m
  15941. @item bt470bg
  15942. @item smpte170m
  15943. @item smpte240m
  15944. @item film
  15945. @item bt2020
  15946. @item smpte428
  15947. @item smpte431
  15948. @item smpte432
  15949. @item jedec-p22
  15950. @item ebu3213
  15951. @end table
  15952. @item in_transfer
  15953. @item out_transfer
  15954. Set in/output transfer response curve (TRC).
  15955. This allows the autodetected value to be overridden as well as allows forcing
  15956. a specific value used for the output and encoder. Possible values:
  15957. @table @samp
  15958. @item auto
  15959. Choose automatically. This is the default.
  15960. @item bt709
  15961. @item bt470m
  15962. @item gamma22
  15963. @item bt470bg
  15964. @item gamma28
  15965. @item smpte170m
  15966. @item smpte240m
  15967. @item linear
  15968. @item iec61966-2-1
  15969. @item srgb
  15970. @item iec61966-2-4
  15971. @item xvycc
  15972. @item bt1361e
  15973. @item bt2020-10
  15974. @item bt2020-12
  15975. @item smpte2084
  15976. @item smpte428
  15977. @item arib-std-b67
  15978. @end table
  15979. @item force_original_aspect_ratio
  15980. Enable decreasing or increasing output video width or height if necessary to
  15981. keep the original aspect ratio. Possible values:
  15982. @table @samp
  15983. @item disable
  15984. Scale the video as specified and disable this feature.
  15985. @item decrease
  15986. The output video dimensions will automatically be decreased if needed.
  15987. @item increase
  15988. The output video dimensions will automatically be increased if needed.
  15989. @end table
  15990. One useful instance of this option is that when you know a specific device's
  15991. maximum allowed resolution, you can use this to limit the output video to
  15992. that, while retaining the aspect ratio. For example, device A allows
  15993. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  15994. decrease) and specifying 1280x720 to the command line makes the output
  15995. 1280x533.
  15996. Please note that this is a different thing than specifying -1 for @option{w}
  15997. or @option{h}, you still need to specify the output resolution for this option
  15998. to work.
  15999. @item force_divisible_by
  16000. Ensures that both the output dimensions, width and height, are divisible by the
  16001. given integer when used together with @option{force_original_aspect_ratio}. This
  16002. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16003. This option respects the value set for @option{force_original_aspect_ratio},
  16004. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16005. may be slightly modified.
  16006. This option can be handy if you need to have a video fit within or exceed
  16007. a defined resolution using @option{force_original_aspect_ratio} but also have
  16008. encoder restrictions on width or height divisibility.
  16009. @item reset_sar
  16010. Enabling this option leads to the output SAR being reset to 1.
  16011. Additionally, if the user requests proportional scaling either
  16012. through the width or height expressions, e.g. @code{w=-4:h=360} or @code{w=iw/2:h=-1}
  16013. or by enabling @code{force_original_aspect_ratio}, then the input DAR is taken into
  16014. account and the output is scaled to produce square pixels.
  16015. Default is false.
  16016. @end table
  16017. The values of the @option{w} and @option{h} options are expressions
  16018. containing the following constants:
  16019. @table @var
  16020. @item in_w
  16021. @item in_h
  16022. The input width and height
  16023. @item iw
  16024. @item ih
  16025. These are the same as @var{in_w} and @var{in_h}.
  16026. @item out_w
  16027. @item out_h
  16028. The output (scaled) width and height
  16029. @item ow
  16030. @item oh
  16031. These are the same as @var{out_w} and @var{out_h}
  16032. @item a
  16033. The same as @var{iw} / @var{ih}
  16034. @item sar
  16035. input sample aspect ratio
  16036. @item dar
  16037. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16038. @item hsub
  16039. @item vsub
  16040. horizontal and vertical input chroma subsample values. For example for the
  16041. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16042. @item ohsub
  16043. @item ovsub
  16044. horizontal and vertical output chroma subsample values. For example for the
  16045. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16046. @item n
  16047. The (sequential) number of the input frame, starting from 0.
  16048. Only available with @code{eval=frame}.
  16049. @item t
  16050. The presentation timestamp of the input frame, expressed as a number of
  16051. seconds. Only available with @code{eval=frame}.
  16052. @item pos
  16053. The position (byte offset) of the frame in the input stream, or NaN if
  16054. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16055. Only available with @code{eval=frame}.
  16056. Deprecated, do not use.
  16057. @item ref_w, rw
  16058. @item ref_h, rh
  16059. @item ref_a
  16060. @item ref_dar, rdar
  16061. @item ref_n
  16062. @item ref_t
  16063. @item ref_pos
  16064. Eqvuialent to the above, but for a second reference input. If any of these
  16065. variables are present, this filter accepts two inputs.
  16066. @end table
  16067. @subsection Examples
  16068. @itemize
  16069. @item
  16070. Scale the input video to a size of 200x100
  16071. @example
  16072. scale=w=200:h=100
  16073. @end example
  16074. This is equivalent to:
  16075. @example
  16076. scale=200:100
  16077. @end example
  16078. or:
  16079. @example
  16080. scale=200x100
  16081. @end example
  16082. @item
  16083. Specify a size abbreviation for the output size:
  16084. @example
  16085. scale=qcif
  16086. @end example
  16087. which can also be written as:
  16088. @example
  16089. scale=size=qcif
  16090. @end example
  16091. @item
  16092. Scale the input to 2x:
  16093. @example
  16094. scale=w=2*iw:h=2*ih
  16095. @end example
  16096. @item
  16097. The above is the same as:
  16098. @example
  16099. scale=2*in_w:2*in_h
  16100. @end example
  16101. @item
  16102. Scale the input to 2x with forced interlaced scaling:
  16103. @example
  16104. scale=2*iw:2*ih:interl=1
  16105. @end example
  16106. @item
  16107. Scale the input to half size:
  16108. @example
  16109. scale=w=iw/2:h=ih/2
  16110. @end example
  16111. @item
  16112. Increase the width, and set the height to the same size:
  16113. @example
  16114. scale=3/2*iw:ow
  16115. @end example
  16116. @item
  16117. Seek Greek harmony:
  16118. @example
  16119. scale=iw:1/PHI*iw
  16120. scale=ih*PHI:ih
  16121. @end example
  16122. @item
  16123. Increase the height, and set the width to 3/2 of the height:
  16124. @example
  16125. scale=w=3/2*oh:h=3/5*ih
  16126. @end example
  16127. @item
  16128. Increase the size, making the size a multiple of the chroma
  16129. subsample values:
  16130. @example
  16131. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  16132. @end example
  16133. @item
  16134. Increase the width to a maximum of 500 pixels,
  16135. keeping the same aspect ratio as the input:
  16136. @example
  16137. scale=w='min(500\, iw*3/2):h=-1'
  16138. @end example
  16139. @item
  16140. Make pixels square by combining scale and setsar:
  16141. @example
  16142. scale='trunc(ih*dar):ih',setsar=1/1
  16143. @end example
  16144. @item
  16145. Make pixels square using reset_sar,
  16146. making sure the resulting resolution is even (required by some codecs):
  16147. @example
  16148. scale='-2:ih-mod(ih,2):reset_sar=1'
  16149. @end example
  16150. @item
  16151. Scale to target exactly, however reset SAR to 1:
  16152. @example
  16153. scale='400:300:reset_sar=1'
  16154. @end example
  16155. @item
  16156. Scale to even dimensions that fit within 400x300, preserving input SAR:
  16157. @example
  16158. scale='400:300:force_original_aspect_ratio=decrease:force_divisible_by=2'
  16159. @end example
  16160. @item
  16161. Scale to produce square pixels with even dimensions that fit within 400x300:
  16162. @example
  16163. scale='400:300:force_original_aspect_ratio=decrease:force_divisible_by=2:reset_sar=1'
  16164. @end example
  16165. @item
  16166. Scale a subtitle stream (sub) to match the main video (main) in size before
  16167. overlaying. ("scale2ref")
  16168. @example
  16169. '[main]split[a][b]; [ref][a]scale=rw:rh[c]; [b][c]overlay'
  16170. @end example
  16171. @item
  16172. Scale a logo to 1/10th the height of a video, while preserving its display
  16173. aspect ratio.
  16174. @example
  16175. [logo-in][video-in]scale=w=oh*dar:h=rh/10[logo-out]
  16176. @end example
  16177. @end itemize
  16178. @subsection Commands
  16179. This filter supports the following commands:
  16180. @table @option
  16181. @item width, w
  16182. @item height, h
  16183. Set the output video dimension expression.
  16184. The command accepts the same syntax of the corresponding option.
  16185. If the specified expression is not valid, it is kept at its current
  16186. value.
  16187. @end table
  16188. @section scale_vt
  16189. Scale and convert the color parameters using VTPixelTransferSession.
  16190. The filter accepts the following options:
  16191. @table @option
  16192. @item w
  16193. @item h
  16194. Set the output video dimension expression. Default value is the input dimension.
  16195. @item color_matrix
  16196. Set the output colorspace matrix.
  16197. @item color_primaries
  16198. Set the output color primaries.
  16199. @item color_transfer
  16200. Set the output transfer characteristics.
  16201. @end table
  16202. @section scharr
  16203. Apply scharr operator to input video stream.
  16204. The filter accepts the following option:
  16205. @table @option
  16206. @item planes
  16207. Set which planes will be processed, unprocessed planes will be copied.
  16208. By default value 0xf, all planes will be processed.
  16209. @item scale
  16210. Set value which will be multiplied with filtered result.
  16211. @item delta
  16212. Set value which will be added to filtered result.
  16213. @end table
  16214. @subsection Commands
  16215. This filter supports the all above options as @ref{commands}.
  16216. @section scroll
  16217. Scroll input video horizontally and/or vertically by constant speed.
  16218. The filter accepts the following options:
  16219. @table @option
  16220. @item horizontal, h
  16221. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16222. Negative values changes scrolling direction.
  16223. @item vertical, v
  16224. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16225. Negative values changes scrolling direction.
  16226. @item hpos
  16227. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  16228. @item vpos
  16229. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  16230. @end table
  16231. @subsection Commands
  16232. This filter supports the following @ref{commands}:
  16233. @table @option
  16234. @item horizontal, h
  16235. Set the horizontal scrolling speed.
  16236. @item vertical, v
  16237. Set the vertical scrolling speed.
  16238. @end table
  16239. @anchor{scdet}
  16240. @section scdet
  16241. Detect video scene change.
  16242. This filter sets frame metadata with mafd between frame, the scene score, and
  16243. forward the frame to the next filter, so they can use these metadata to detect
  16244. scene change or others.
  16245. In addition, this filter logs a message and sets frame metadata when it detects
  16246. a scene change by @option{threshold}.
  16247. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  16248. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  16249. to detect scene change.
  16250. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  16251. detect scene change with @option{threshold}.
  16252. The filter accepts the following options:
  16253. @table @option
  16254. @item threshold, t
  16255. Set the scene change detection threshold as a percentage of maximum change. Good
  16256. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  16257. @code{[0., 100.]}.
  16258. Default value is @code{10.}.
  16259. @item sc_pass, s
  16260. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  16261. You can enable it if you want to get snapshot of scene change frames only.
  16262. @end table
  16263. @anchor{selectivecolor}
  16264. @section selectivecolor
  16265. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  16266. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  16267. by the "purity" of the color (that is, how saturated it already is).
  16268. This filter is similar to the Adobe Photoshop Selective Color tool.
  16269. The filter accepts the following options:
  16270. @table @option
  16271. @item correction_method
  16272. Select color correction method.
  16273. Available values are:
  16274. @table @samp
  16275. @item absolute
  16276. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  16277. component value).
  16278. @item relative
  16279. Specified adjustments are relative to the original component value.
  16280. @end table
  16281. Default is @code{absolute}.
  16282. @item reds
  16283. Adjustments for red pixels (pixels where the red component is the maximum)
  16284. @item yellows
  16285. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  16286. @item greens
  16287. Adjustments for green pixels (pixels where the green component is the maximum)
  16288. @item cyans
  16289. Adjustments for cyan pixels (pixels where the red component is the minimum)
  16290. @item blues
  16291. Adjustments for blue pixels (pixels where the blue component is the maximum)
  16292. @item magentas
  16293. Adjustments for magenta pixels (pixels where the green component is the minimum)
  16294. @item whites
  16295. Adjustments for white pixels (pixels where all components are greater than 128)
  16296. @item neutrals
  16297. Adjustments for all pixels except pure black and pure white
  16298. @item blacks
  16299. Adjustments for black pixels (pixels where all components are lesser than 128)
  16300. @item psfile
  16301. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  16302. @end table
  16303. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  16304. 4 space separated floating point adjustment values in the [-1,1] range,
  16305. respectively to adjust the amount of cyan, magenta, yellow and black for the
  16306. pixels of its range.
  16307. @subsection Examples
  16308. @itemize
  16309. @item
  16310. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  16311. increase magenta by 27% in blue areas:
  16312. @example
  16313. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  16314. @end example
  16315. @item
  16316. Use a Photoshop selective color preset:
  16317. @example
  16318. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  16319. @end example
  16320. @end itemize
  16321. @anchor{separatefields}
  16322. @section separatefields
  16323. The @code{separatefields} takes a frame-based video input and splits
  16324. each frame into its components fields, producing a new half height clip
  16325. with twice the frame rate and twice the frame count.
  16326. This filter use field-dominance information in frame to decide which
  16327. of each pair of fields to place first in the output.
  16328. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  16329. @section setdar, setsar
  16330. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  16331. output video.
  16332. This is done by changing the specified Sample (aka Pixel) Aspect
  16333. Ratio, according to the following equation:
  16334. @example
  16335. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  16336. @end example
  16337. Keep in mind that the @code{setdar} filter does not modify the pixel
  16338. dimensions of the video frame. Also, the display aspect ratio set by
  16339. this filter may be changed by later filters in the filterchain,
  16340. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  16341. applied.
  16342. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  16343. the filter output video.
  16344. Note that as a consequence of the application of this filter, the
  16345. output display aspect ratio will change according to the equation
  16346. above.
  16347. Keep in mind that the sample aspect ratio set by the @code{setsar}
  16348. filter may be changed by later filters in the filterchain, e.g. if
  16349. another "setsar" or a "setdar" filter is applied.
  16350. It accepts the following parameters:
  16351. @table @option
  16352. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  16353. Set the aspect ratio used by the filter.
  16354. The parameter can be a floating point number string, or an expression. If the
  16355. parameter is not specified, the value "0" is assumed, meaning that the same
  16356. input value is used.
  16357. @item max
  16358. Set the maximum integer value to use for expressing numerator and
  16359. denominator when reducing the expressed aspect ratio to a rational.
  16360. Default value is @code{100}.
  16361. @end table
  16362. The parameter @var{sar} is an expression containing the following constants:
  16363. @table @option
  16364. @item w, h
  16365. The input width and height.
  16366. @item a
  16367. Same as @var{w} / @var{h}.
  16368. @item sar
  16369. The input sample aspect ratio.
  16370. @item dar
  16371. The input display aspect ratio. It is the same as
  16372. (@var{w} / @var{h}) * @var{sar}.
  16373. @item hsub, vsub
  16374. Horizontal and vertical chroma subsample values. For example, for the
  16375. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16376. @end table
  16377. @subsection Examples
  16378. @itemize
  16379. @item
  16380. To change the display aspect ratio to 16:9, specify one of the following:
  16381. @example
  16382. setdar=dar=1.77777
  16383. setdar=dar=16/9
  16384. @end example
  16385. @item
  16386. To change the sample aspect ratio to 10:11, specify:
  16387. @example
  16388. setsar=sar=10/11
  16389. @end example
  16390. @item
  16391. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  16392. 1000 in the aspect ratio reduction, use the command:
  16393. @example
  16394. setdar=ratio=16/9:max=1000
  16395. @end example
  16396. @end itemize
  16397. @anchor{setfield}
  16398. @section setfield
  16399. Force field for the output video frame.
  16400. The @code{setfield} filter marks the interlace type field for the
  16401. output frames. It does not change the input frame, but only sets the
  16402. corresponding property, which affects how the frame is treated by
  16403. following filters (e.g. @code{fieldorder} or @code{yadif}).
  16404. The filter accepts the following options:
  16405. @table @option
  16406. @item mode
  16407. Available values are:
  16408. @table @samp
  16409. @item auto
  16410. Keep the same field property.
  16411. @item bff
  16412. Mark the frame as bottom-field-first.
  16413. @item tff
  16414. Mark the frame as top-field-first.
  16415. @item prog
  16416. Mark the frame as progressive.
  16417. @end table
  16418. @end table
  16419. @anchor{setparams}
  16420. @section setparams
  16421. Force frame parameter for the output video frame.
  16422. The @code{setparams} filter marks interlace and color range for the
  16423. output frames. It does not change the input frame, but only sets the
  16424. corresponding property, which affects how the frame is treated by
  16425. filters/encoders.
  16426. @table @option
  16427. @item field_mode
  16428. Available values are:
  16429. @table @samp
  16430. @item auto
  16431. Keep the same field property (default).
  16432. @item bff
  16433. Mark the frame as bottom-field-first.
  16434. @item tff
  16435. Mark the frame as top-field-first.
  16436. @item prog
  16437. Mark the frame as progressive.
  16438. @end table
  16439. @item range
  16440. Available values are:
  16441. @table @samp
  16442. @item auto
  16443. Keep the same color range property (default).
  16444. @item unspecified, unknown
  16445. Mark the frame as unspecified color range.
  16446. @item limited, tv, mpeg
  16447. Mark the frame as limited range.
  16448. @item full, pc, jpeg
  16449. Mark the frame as full range.
  16450. @end table
  16451. @item color_primaries
  16452. Set the color primaries.
  16453. Available values are:
  16454. @table @samp
  16455. @item auto
  16456. Keep the same color primaries property (default).
  16457. @item bt709
  16458. @item unknown
  16459. @item bt470m
  16460. @item bt470bg
  16461. @item smpte170m
  16462. @item smpte240m
  16463. @item film
  16464. @item bt2020
  16465. @item smpte428
  16466. @item smpte431
  16467. @item smpte432
  16468. @item jedec-p22
  16469. @end table
  16470. @item color_trc
  16471. Set the color transfer.
  16472. Available values are:
  16473. @table @samp
  16474. @item auto
  16475. Keep the same color trc property (default).
  16476. @item bt709
  16477. @item unknown
  16478. @item bt470m
  16479. @item bt470bg
  16480. @item smpte170m
  16481. @item smpte240m
  16482. @item linear
  16483. @item log100
  16484. @item log316
  16485. @item iec61966-2-4
  16486. @item bt1361e
  16487. @item iec61966-2-1
  16488. @item bt2020-10
  16489. @item bt2020-12
  16490. @item smpte2084
  16491. @item smpte428
  16492. @item arib-std-b67
  16493. @end table
  16494. @item colorspace
  16495. Set the colorspace.
  16496. Available values are:
  16497. @table @samp
  16498. @item auto
  16499. Keep the same colorspace property (default).
  16500. @item gbr
  16501. @item bt709
  16502. @item unknown
  16503. @item fcc
  16504. @item bt470bg
  16505. @item smpte170m
  16506. @item smpte240m
  16507. @item ycgco
  16508. @item bt2020nc
  16509. @item bt2020c
  16510. @item smpte2085
  16511. @item chroma-derived-nc
  16512. @item chroma-derived-c
  16513. @item ictcp
  16514. @end table
  16515. @item chroma_location
  16516. Set the chroma sample location.
  16517. Available values are:
  16518. @table @samp
  16519. @item auto
  16520. Keep the same chroma location (default).
  16521. @item unspecified, unknown
  16522. @item left
  16523. @item center
  16524. @item topleft
  16525. @item top
  16526. @item bottomleft
  16527. @item bottom
  16528. @end table
  16529. @end table
  16530. @section shear
  16531. Apply shear transform to input video.
  16532. This filter supports the following options:
  16533. @table @option
  16534. @item shx
  16535. Shear factor in X-direction. Default value is 0.
  16536. Allowed range is from -2 to 2.
  16537. @item shy
  16538. Shear factor in Y-direction. Default value is 0.
  16539. Allowed range is from -2 to 2.
  16540. @item fillcolor, c
  16541. Set the color used to fill the output area not covered by the transformed
  16542. video. For the general syntax of this option, check the
  16543. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16544. If the special value "none" is selected then no
  16545. background is printed (useful for example if the background is never shown).
  16546. Default value is "black".
  16547. @item interp
  16548. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16549. @end table
  16550. @subsection Commands
  16551. This filter supports the all above options as @ref{commands}.
  16552. @section showinfo
  16553. Show a line containing various information for each input video frame.
  16554. The input video is not modified.
  16555. This filter supports the following options:
  16556. @table @option
  16557. @item checksum
  16558. Calculate checksums of each plane. By default enabled.
  16559. @item udu_sei_as_ascii
  16560. Try to print user data unregistered SEI as ascii character when possible,
  16561. in hex format otherwise.
  16562. @end table
  16563. The shown line contains a sequence of key/value pairs of the form
  16564. @var{key}:@var{value}.
  16565. The following values are shown in the output:
  16566. @table @option
  16567. @item n
  16568. The (sequential) number of the input frame, starting from 0.
  16569. @item pts
  16570. The Presentation TimeStamp of the input frame, expressed as a number of
  16571. time base units. The time base unit depends on the filter input pad.
  16572. @item pts_time
  16573. The Presentation TimeStamp of the input frame, expressed as a number of
  16574. seconds.
  16575. @item fmt
  16576. The pixel format name.
  16577. @item sar
  16578. The sample aspect ratio of the input frame, expressed in the form
  16579. @var{num}/@var{den}.
  16580. @item s
  16581. The size of the input frame. For the syntax of this option, check the
  16582. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16583. @item i
  16584. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16585. for bottom field first).
  16586. @item iskey
  16587. This is 1 if the frame is a key frame, 0 otherwise.
  16588. @item type
  16589. The picture type of the input frame ("I" for an I-frame, "P" for a
  16590. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16591. Also refer to the documentation of the @code{AVPictureType} enum and of
  16592. the @code{av_get_picture_type_char} function defined in
  16593. @file{libavutil/avutil.h}.
  16594. @item checksum
  16595. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16596. @item plane_checksum
  16597. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16598. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16599. @item mean
  16600. The mean value of pixels in each plane of the input frame, expressed in the form
  16601. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16602. @item stdev
  16603. The standard deviation of pixel values in each plane of the input frame, expressed
  16604. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16605. @end table
  16606. @section showpalette
  16607. Displays the 256 colors palette of each frame. This filter is only relevant for
  16608. @var{pal8} pixel format frames.
  16609. It accepts the following option:
  16610. @table @option
  16611. @item s
  16612. Set the size of the box used to represent one palette color entry. Default is
  16613. @code{30} (for a @code{30x30} pixel box).
  16614. @end table
  16615. @section shuffleframes
  16616. Reorder and/or duplicate and/or drop video frames.
  16617. It accepts the following parameters:
  16618. @table @option
  16619. @item mapping
  16620. Set the destination indexes of input frames.
  16621. This is space or '|' separated list of indexes that maps input frames to output
  16622. frames. Number of indexes also sets maximal value that each index may have.
  16623. '-1' index have special meaning and that is to drop frame.
  16624. @end table
  16625. The first frame has the index 0. The default is to keep the input unchanged.
  16626. @subsection Examples
  16627. @itemize
  16628. @item
  16629. Swap second and third frame of every three frames of the input:
  16630. @example
  16631. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  16632. @end example
  16633. @item
  16634. Swap 10th and 1st frame of every ten frames of the input:
  16635. @example
  16636. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  16637. @end example
  16638. @end itemize
  16639. @section shufflepixels
  16640. Reorder pixels in video frames.
  16641. This filter accepts the following options:
  16642. @table @option
  16643. @item direction, d
  16644. Set shuffle direction. Can be forward or inverse direction.
  16645. Default direction is forward.
  16646. @item mode, m
  16647. Set shuffle mode. Can be horizontal, vertical or block mode.
  16648. @item width, w
  16649. @item height, h
  16650. Set shuffle block_size. In case of horizontal shuffle mode only width
  16651. part of size is used, and in case of vertical shuffle mode only height
  16652. part of size is used.
  16653. @item seed, s
  16654. Set random seed used with shuffling pixels. Mainly useful to set to be able
  16655. to reverse filtering process to get original input.
  16656. For example, to reverse forward shuffle you need to use same parameters
  16657. and exact same seed and to set direction to inverse.
  16658. @end table
  16659. @section shuffleplanes
  16660. Reorder and/or duplicate video planes.
  16661. It accepts the following parameters:
  16662. @table @option
  16663. @item map0
  16664. The index of the input plane to be used as the first output plane.
  16665. @item map1
  16666. The index of the input plane to be used as the second output plane.
  16667. @item map2
  16668. The index of the input plane to be used as the third output plane.
  16669. @item map3
  16670. The index of the input plane to be used as the fourth output plane.
  16671. @end table
  16672. The first plane has the index 0. The default is to keep the input unchanged.
  16673. @subsection Examples
  16674. @itemize
  16675. @item
  16676. Swap the second and third planes of the input:
  16677. @example
  16678. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  16679. @end example
  16680. @end itemize
  16681. @anchor{signalstats}
  16682. @section signalstats
  16683. Evaluate various visual metrics that assist in determining issues associated
  16684. with the digitization of analog video media.
  16685. By default the filter will log these metadata values:
  16686. @table @option
  16687. @item YMIN
  16688. Display the minimal Y value contained within the input frame. Expressed in
  16689. range of [0-255].
  16690. @item YLOW
  16691. Display the Y value at the 10% percentile within the input frame. Expressed in
  16692. range of [0-255].
  16693. @item YAVG
  16694. Display the average Y value within the input frame. Expressed in range of
  16695. [0-255].
  16696. @item YHIGH
  16697. Display the Y value at the 90% percentile within the input frame. Expressed in
  16698. range of [0-255].
  16699. @item YMAX
  16700. Display the maximum Y value contained within the input frame. Expressed in
  16701. range of [0-255].
  16702. @item UMIN
  16703. Display the minimal U value contained within the input frame. Expressed in
  16704. range of [0-255].
  16705. @item ULOW
  16706. Display the U value at the 10% percentile within the input frame. Expressed in
  16707. range of [0-255].
  16708. @item UAVG
  16709. Display the average U value within the input frame. Expressed in range of
  16710. [0-255].
  16711. @item UHIGH
  16712. Display the U value at the 90% percentile within the input frame. Expressed in
  16713. range of [0-255].
  16714. @item UMAX
  16715. Display the maximum U value contained within the input frame. Expressed in
  16716. range of [0-255].
  16717. @item VMIN
  16718. Display the minimal V value contained within the input frame. Expressed in
  16719. range of [0-255].
  16720. @item VLOW
  16721. Display the V value at the 10% percentile within the input frame. Expressed in
  16722. range of [0-255].
  16723. @item VAVG
  16724. Display the average V value within the input frame. Expressed in range of
  16725. [0-255].
  16726. @item VHIGH
  16727. Display the V value at the 90% percentile within the input frame. Expressed in
  16728. range of [0-255].
  16729. @item VMAX
  16730. Display the maximum V value contained within the input frame. Expressed in
  16731. range of [0-255].
  16732. @item SATMIN
  16733. Display the minimal saturation value contained within the input frame.
  16734. Expressed in range of [0-~181.02].
  16735. @item SATLOW
  16736. Display the saturation value at the 10% percentile within the input frame.
  16737. Expressed in range of [0-~181.02].
  16738. @item SATAVG
  16739. Display the average saturation value within the input frame. Expressed in range
  16740. of [0-~181.02].
  16741. @item SATHIGH
  16742. Display the saturation value at the 90% percentile within the input frame.
  16743. Expressed in range of [0-~181.02].
  16744. @item SATMAX
  16745. Display the maximum saturation value contained within the input frame.
  16746. Expressed in range of [0-~181.02].
  16747. @item HUEMED
  16748. Display the median value for hue within the input frame. Expressed in range of
  16749. [0-360].
  16750. @item HUEAVG
  16751. Display the average value for hue within the input frame. Expressed in range of
  16752. [0-360].
  16753. @item YDIF
  16754. Display the average of sample value difference between all values of the Y
  16755. plane in the current frame and corresponding values of the previous input frame.
  16756. Expressed in range of [0-255].
  16757. @item UDIF
  16758. Display the average of sample value difference between all values of the U
  16759. plane in the current frame and corresponding values of the previous input frame.
  16760. Expressed in range of [0-255].
  16761. @item VDIF
  16762. Display the average of sample value difference between all values of the V
  16763. plane in the current frame and corresponding values of the previous input frame.
  16764. Expressed in range of [0-255].
  16765. @item YBITDEPTH
  16766. Display bit depth of Y plane in current frame.
  16767. Expressed in range of [0-16].
  16768. @item UBITDEPTH
  16769. Display bit depth of U plane in current frame.
  16770. Expressed in range of [0-16].
  16771. @item VBITDEPTH
  16772. Display bit depth of V plane in current frame.
  16773. Expressed in range of [0-16].
  16774. @end table
  16775. The filter accepts the following options:
  16776. @table @option
  16777. @item stat
  16778. @item out
  16779. @option{stat} specify an additional form of image analysis.
  16780. @option{out} output video with the specified type of pixel highlighted.
  16781. Both options accept the following values:
  16782. @table @samp
  16783. @item tout
  16784. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  16785. unlike the neighboring pixels of the same field. Examples of temporal outliers
  16786. include the results of video dropouts, head clogs, or tape tracking issues.
  16787. @item vrep
  16788. Identify @var{vertical line repetition}. Vertical line repetition includes
  16789. similar rows of pixels within a frame. In born-digital video vertical line
  16790. repetition is common, but this pattern is uncommon in video digitized from an
  16791. analog source. When it occurs in video that results from the digitization of an
  16792. analog source it can indicate concealment from a dropout compensator.
  16793. @item brng
  16794. Identify pixels that fall outside of legal broadcast range.
  16795. @end table
  16796. @item color, c
  16797. Set the highlight color for the @option{out} option. The default color is
  16798. yellow.
  16799. @end table
  16800. @subsection Examples
  16801. @itemize
  16802. @item
  16803. Output data of various video metrics:
  16804. @example
  16805. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  16806. @end example
  16807. @item
  16808. Output specific data about the minimum and maximum values of the Y plane per frame:
  16809. @example
  16810. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  16811. @end example
  16812. @item
  16813. Playback video while highlighting pixels that are outside of broadcast range in red.
  16814. @example
  16815. ffplay example.mov -vf signalstats="out=brng:color=red"
  16816. @end example
  16817. @item
  16818. Playback video with signalstats metadata drawn over the frame.
  16819. @example
  16820. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  16821. @end example
  16822. The contents of signalstat_drawtext.txt used in the command are:
  16823. @example
  16824. time %@{pts:hms@}
  16825. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  16826. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  16827. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  16828. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  16829. @end example
  16830. @end itemize
  16831. @anchor{signature}
  16832. @section signature
  16833. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  16834. input. In this case the matching between the inputs can be calculated additionally.
  16835. The filter always passes through the first input. The signature of each stream can
  16836. be written into a file.
  16837. It accepts the following options:
  16838. @table @option
  16839. @item detectmode
  16840. Enable or disable the matching process.
  16841. Available values are:
  16842. @table @samp
  16843. @item off
  16844. Disable the calculation of a matching (default).
  16845. @item full
  16846. Calculate the matching for the whole video and output whether the whole video
  16847. matches or only parts.
  16848. @item fast
  16849. Calculate only until a matching is found or the video ends. Should be faster in
  16850. some cases.
  16851. @end table
  16852. @item nb_inputs
  16853. Set the number of inputs. The option value must be a non negative integer.
  16854. Default value is 1.
  16855. @item filename
  16856. Set the path to which the output is written. If there is more than one input,
  16857. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  16858. integer), that will be replaced with the input number. If no filename is
  16859. specified, no output will be written. This is the default.
  16860. @item format
  16861. Choose the output format.
  16862. Available values are:
  16863. @table @samp
  16864. @item binary
  16865. Use the specified binary representation (default).
  16866. @item xml
  16867. Use the specified xml representation.
  16868. @end table
  16869. @item th_d
  16870. Set threshold to detect one word as similar. The option value must be an integer
  16871. greater than zero. The default value is 9000.
  16872. @item th_dc
  16873. Set threshold to detect all words as similar. The option value must be an integer
  16874. greater than zero. The default value is 60000.
  16875. @item th_xh
  16876. Set threshold to detect frames as similar. The option value must be an integer
  16877. greater than zero. The default value is 116.
  16878. @item th_di
  16879. Set the minimum length of a sequence in frames to recognize it as matching
  16880. sequence. The option value must be a non negative integer value.
  16881. The default value is 0.
  16882. @item th_it
  16883. Set the minimum relation, that matching frames to all frames must have.
  16884. The option value must be a double value between 0 and 1. The default value is 0.5.
  16885. @end table
  16886. @subsection Examples
  16887. @itemize
  16888. @item
  16889. To calculate the signature of an input video and store it in signature.bin:
  16890. @example
  16891. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  16892. @end example
  16893. @item
  16894. To detect whether two videos match and store the signatures in XML format in
  16895. signature0.xml and signature1.xml:
  16896. @example
  16897. 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 -
  16898. @end example
  16899. @end itemize
  16900. @anchor{siti}
  16901. @section siti
  16902. Calculate Spatial Information (SI) and Temporal Information (TI) scores for a video,
  16903. as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment methods
  16904. for multimedia applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
  16905. Note that this is a legacy implementation that corresponds to a superseded recommendation.
  16906. 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}
  16907. It accepts the following option:
  16908. @table @option
  16909. @item print_summary
  16910. If set to 1, Summary statistics will be printed to the console. Default 0.
  16911. @end table
  16912. @subsection Examples
  16913. @itemize
  16914. @item
  16915. To calculate SI/TI metrics and print summary:
  16916. @example
  16917. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  16918. @end example
  16919. @end itemize
  16920. @anchor{smartblur}
  16921. @section smartblur
  16922. Blur the input video without impacting the outlines.
  16923. It accepts the following options:
  16924. @table @option
  16925. @item luma_radius, lr
  16926. Set the luma radius. The option value must be a float number in
  16927. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16928. used to blur the image (slower if larger). Default value is 1.0.
  16929. @item luma_strength, ls
  16930. Set the luma strength. The option value must be a float number
  16931. in the range [-1.0,1.0] that configures the blurring. A value included
  16932. in [0.0,1.0] will blur the image whereas a value included in
  16933. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  16934. @item luma_threshold, lt
  16935. Set the luma threshold used as a coefficient to determine
  16936. whether a pixel should be blurred or not. The option value must be an
  16937. integer in the range [-30,30]. A value of 0 will filter all the image,
  16938. a value included in [0,30] will filter flat areas and a value included
  16939. in [-30,0] will filter edges. Default value is 0.
  16940. @item chroma_radius, cr
  16941. Set the chroma radius. The option value must be a float number in
  16942. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16943. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16944. @item chroma_strength, cs
  16945. Set the chroma strength. The option value must be a float number
  16946. in the range [-1.0,1.0] that configures the blurring. A value included
  16947. in [0.0,1.0] will blur the image whereas a value included in
  16948. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16949. @item chroma_threshold, ct
  16950. Set the chroma threshold used as a coefficient to determine
  16951. whether a pixel should be blurred or not. The option value must be an
  16952. integer in the range [-30,30]. A value of 0 will filter all the image,
  16953. a value included in [0,30] will filter flat areas and a value included
  16954. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16955. @item alpha_radius, ar
  16956. Set the alpha radius. The option value must be a float number in
  16957. the range [0.1,5.0] that specifies the variance of the gaussian filter
  16958. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  16959. @item alpha_strength, as
  16960. Set the alpha strength. The option value must be a float number
  16961. in the range [-1.0,1.0] that configures the blurring. A value included
  16962. in [0.0,1.0] will blur the image whereas a value included in
  16963. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  16964. @item alpha_threshold, at
  16965. Set the alpha threshold used as a coefficient to determine
  16966. whether a pixel should be blurred or not. The option value must be an
  16967. integer in the range [-30,30]. A value of 0 will filter all the image,
  16968. a value included in [0,30] will filter flat areas and a value included
  16969. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  16970. @end table
  16971. If a chroma or alpha option is not explicitly set, the corresponding luma value
  16972. is set.
  16973. @section sobel
  16974. Apply sobel operator to input video stream.
  16975. The filter accepts the following option:
  16976. @table @option
  16977. @item planes
  16978. Set which planes will be processed, unprocessed planes will be copied.
  16979. By default value 0xf, all planes will be processed.
  16980. @item scale
  16981. Set value which will be multiplied with filtered result.
  16982. @item delta
  16983. Set value which will be added to filtered result.
  16984. @end table
  16985. @subsection Commands
  16986. This filter supports the all above options as @ref{commands}.
  16987. @anchor{spp}
  16988. @section spp
  16989. Apply a simple postprocessing filter that compresses and decompresses the image
  16990. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  16991. and average the results.
  16992. The filter accepts the following options:
  16993. @table @option
  16994. @item quality
  16995. Set quality. This option defines the number of levels for averaging. It accepts
  16996. an integer in the range 0-6. If set to @code{0}, the filter will have no
  16997. effect. A value of @code{6} means the higher quality. For each increment of
  16998. that value the speed drops by a factor of approximately 2. Default value is
  16999. @code{3}.
  17000. @item qp
  17001. Force a constant quantization parameter. If not set, the filter will use the QP
  17002. from the video stream (if available).
  17003. @item mode
  17004. Set thresholding mode. Available modes are:
  17005. @table @samp
  17006. @item hard
  17007. Set hard thresholding (default).
  17008. @item soft
  17009. Set soft thresholding (better de-ringing effect, but likely blurrier).
  17010. @end table
  17011. @item use_bframe_qp
  17012. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  17013. option may cause flicker since the B-Frames have often larger QP. Default is
  17014. @code{0} (not enabled).
  17015. @end table
  17016. @subsection Commands
  17017. This filter supports the following commands:
  17018. @table @option
  17019. @item quality, level
  17020. Set quality level. The value @code{max} can be used to set the maximum level,
  17021. currently @code{6}.
  17022. @end table
  17023. @anchor{sr}
  17024. @section sr
  17025. Scale the input by applying one of the super-resolution methods based on
  17026. convolutional neural networks. Supported models:
  17027. @itemize
  17028. @item
  17029. Super-Resolution Convolutional Neural Network model (SRCNN).
  17030. See @url{https://arxiv.org/abs/1501.00092}.
  17031. @item
  17032. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  17033. See @url{https://arxiv.org/abs/1609.05158}.
  17034. @end itemize
  17035. Training scripts as well as scripts for model file (.pb) saving can be found at
  17036. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  17037. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  17038. The filter accepts the following options:
  17039. @table @option
  17040. @item dnn_backend
  17041. Specify which DNN backend to use for model loading and execution. This option accepts
  17042. the following values:
  17043. @table @samp
  17044. @item tensorflow
  17045. TensorFlow backend. To enable this backend you
  17046. need to install the TensorFlow for C library (see
  17047. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  17048. @code{--enable-libtensorflow}
  17049. @end table
  17050. @item model
  17051. Set path to model file specifying network architecture and its parameters.
  17052. Note that different backends use different file formats. TensorFlow, OpenVINO backend
  17053. can load files for only its format.
  17054. @item scale_factor
  17055. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  17056. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  17057. input upscaled using bicubic upscaling with proper scale factor.
  17058. @end table
  17059. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  17060. @anchor{sr_amf}
  17061. @section sr_amf
  17062. Upscale (size increasing) for the input video using AMD Advanced Media Framework library for hardware acceleration.
  17063. Use advanced algorithms for upscaling with higher output quality.
  17064. Setting the output width and height works in the same way as for the @ref{scale} filter.
  17065. The filter accepts the following options:
  17066. @table @option
  17067. @item w
  17068. @item h
  17069. Set the output video dimension expression. Default value is the input dimension.
  17070. Allows for the same expressions as the @ref{scale} filter.
  17071. @item algorithm
  17072. Sets the algorithm used for scaling:
  17073. @table @var
  17074. @item bilinear
  17075. Bilinear
  17076. @item bicubic
  17077. Bicubic
  17078. @item sr1-0
  17079. Video SR1.0
  17080. This is a default value
  17081. @item point
  17082. Point
  17083. @item sr1-1
  17084. Video SR1.1
  17085. @end table
  17086. @item sharpness
  17087. Control hq scaler sharpening. The value is a float in the range of [0.0, 2.0]
  17088. @item format
  17089. Controls the output pixel format. By default, or if none is specified, the input
  17090. pixel format is used.
  17091. @item keep-ratio
  17092. Force the scaler to keep the aspect ratio of the input image when the output size has a different aspect ratio.
  17093. Default value is false.
  17094. @item fill
  17095. Specifies whether the output image outside the region of interest,
  17096. which does not fill the entire output surface should be filled with a solid color.
  17097. @end table
  17098. @subsection Examples
  17099. @itemize
  17100. @item
  17101. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  17102. @example
  17103. sr_amf=-2:720:format=yuv420p
  17104. @end example
  17105. @item
  17106. Upscale to 4K with algorithm video SR1.1.
  17107. @example
  17108. sr_amf=4096:2160:algorithm=sr1-1
  17109. @end example
  17110. @end itemize
  17111. @section ssim
  17112. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  17113. This filter takes in input two input videos, the first input is
  17114. considered the "main" source and is passed unchanged to the
  17115. output. The second input is used as a "reference" video for computing
  17116. the SSIM.
  17117. Both video inputs must have the same resolution and pixel format for
  17118. this filter to work correctly. Also it assumes that both inputs
  17119. have the same number of frames, which are compared one by one.
  17120. The filter stores the calculated SSIM of each frame.
  17121. The description of the accepted parameters follows.
  17122. @table @option
  17123. @item stats_file, f
  17124. If specified the filter will use the named file to save the SSIM of
  17125. each individual frame. When filename equals "-" the data is sent to
  17126. standard output.
  17127. @end table
  17128. The file printed if @var{stats_file} is selected, contains a sequence of
  17129. key/value pairs of the form @var{key}:@var{value} for each compared
  17130. couple of frames.
  17131. A description of each shown parameter follows:
  17132. @table @option
  17133. @item n
  17134. sequential number of the input frame, starting from 1
  17135. @item Y, U, V, R, G, B
  17136. SSIM of the compared frames for the component specified by the suffix.
  17137. @item All
  17138. SSIM of the compared frames for the whole frame.
  17139. @item dB
  17140. Same as above but in dB representation.
  17141. @end table
  17142. This filter also supports the @ref{framesync} options.
  17143. @subsection Examples
  17144. @itemize
  17145. @item
  17146. For example:
  17147. @example
  17148. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  17149. [main][ref] ssim="stats_file=stats.log" [out]
  17150. @end example
  17151. On this example the input file being processed is compared with the
  17152. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  17153. is stored in @file{stats.log}.
  17154. @item
  17155. Another example with both psnr and ssim at same time:
  17156. @example
  17157. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  17158. @end example
  17159. @item
  17160. Another example with different containers:
  17161. @example
  17162. 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 -
  17163. @end example
  17164. @end itemize
  17165. @section stereo3d
  17166. Convert between different stereoscopic image formats.
  17167. The filters accept the following options:
  17168. @table @option
  17169. @item in
  17170. Set stereoscopic image format of input.
  17171. Available values for input image formats are:
  17172. @table @samp
  17173. @item sbsl
  17174. side by side parallel (left eye left, right eye right)
  17175. @item sbsr
  17176. side by side crosseye (right eye left, left eye right)
  17177. @item sbs2l
  17178. side by side parallel with half width resolution
  17179. (left eye left, right eye right)
  17180. @item sbs2r
  17181. side by side crosseye with half width resolution
  17182. (right eye left, left eye right)
  17183. @item abl
  17184. @item tbl
  17185. above-below (left eye above, right eye below)
  17186. @item abr
  17187. @item tbr
  17188. above-below (right eye above, left eye below)
  17189. @item ab2l
  17190. @item tb2l
  17191. above-below with half height resolution
  17192. (left eye above, right eye below)
  17193. @item ab2r
  17194. @item tb2r
  17195. above-below with half height resolution
  17196. (right eye above, left eye below)
  17197. @item al
  17198. alternating frames (left eye first, right eye second)
  17199. @item ar
  17200. alternating frames (right eye first, left eye second)
  17201. @item irl
  17202. interleaved rows (left eye has top row, right eye starts on next row)
  17203. @item irr
  17204. interleaved rows (right eye has top row, left eye starts on next row)
  17205. @item icl
  17206. interleaved columns, left eye first
  17207. @item icr
  17208. interleaved columns, right eye first
  17209. Default value is @samp{sbsl}.
  17210. @end table
  17211. @item out
  17212. Set stereoscopic image format of output.
  17213. @table @samp
  17214. @item sbsl
  17215. side by side parallel (left eye left, right eye right)
  17216. @item sbsr
  17217. side by side crosseye (right eye left, left eye right)
  17218. @item sbs2l
  17219. side by side parallel with half width resolution
  17220. (left eye left, right eye right)
  17221. @item sbs2r
  17222. side by side crosseye with half width resolution
  17223. (right eye left, left eye right)
  17224. @item abl
  17225. @item tbl
  17226. above-below (left eye above, right eye below)
  17227. @item abr
  17228. @item tbr
  17229. above-below (right eye above, left eye below)
  17230. @item ab2l
  17231. @item tb2l
  17232. above-below with half height resolution
  17233. (left eye above, right eye below)
  17234. @item ab2r
  17235. @item tb2r
  17236. above-below with half height resolution
  17237. (right eye above, left eye below)
  17238. @item al
  17239. alternating frames (left eye first, right eye second)
  17240. @item ar
  17241. alternating frames (right eye first, left eye second)
  17242. @item irl
  17243. interleaved rows (left eye has top row, right eye starts on next row)
  17244. @item irr
  17245. interleaved rows (right eye has top row, left eye starts on next row)
  17246. @item arbg
  17247. anaglyph red/blue gray
  17248. (red filter on left eye, blue filter on right eye)
  17249. @item argg
  17250. anaglyph red/green gray
  17251. (red filter on left eye, green filter on right eye)
  17252. @item arcg
  17253. anaglyph red/cyan gray
  17254. (red filter on left eye, cyan filter on right eye)
  17255. @item arch
  17256. anaglyph red/cyan half colored
  17257. (red filter on left eye, cyan filter on right eye)
  17258. @item arcc
  17259. anaglyph red/cyan color
  17260. (red filter on left eye, cyan filter on right eye)
  17261. @item arcd
  17262. anaglyph red/cyan color optimized with the least squares projection of dubois
  17263. (red filter on left eye, cyan filter on right eye)
  17264. @item agmg
  17265. anaglyph green/magenta gray
  17266. (green filter on left eye, magenta filter on right eye)
  17267. @item agmh
  17268. anaglyph green/magenta half colored
  17269. (green filter on left eye, magenta filter on right eye)
  17270. @item agmc
  17271. anaglyph green/magenta colored
  17272. (green filter on left eye, magenta filter on right eye)
  17273. @item agmd
  17274. anaglyph green/magenta color optimized with the least squares projection of dubois
  17275. (green filter on left eye, magenta filter on right eye)
  17276. @item aybg
  17277. anaglyph yellow/blue gray
  17278. (yellow filter on left eye, blue filter on right eye)
  17279. @item aybh
  17280. anaglyph yellow/blue half colored
  17281. (yellow filter on left eye, blue filter on right eye)
  17282. @item aybc
  17283. anaglyph yellow/blue colored
  17284. (yellow filter on left eye, blue filter on right eye)
  17285. @item aybd
  17286. anaglyph yellow/blue color optimized with the least squares projection of dubois
  17287. (yellow filter on left eye, blue filter on right eye)
  17288. @item ml
  17289. mono output (left eye only)
  17290. @item mr
  17291. mono output (right eye only)
  17292. @item chl
  17293. checkerboard, left eye first
  17294. @item chr
  17295. checkerboard, right eye first
  17296. @item icl
  17297. interleaved columns, left eye first
  17298. @item icr
  17299. interleaved columns, right eye first
  17300. @item hdmi
  17301. HDMI frame pack
  17302. @end table
  17303. Default value is @samp{arcd}.
  17304. @end table
  17305. @subsection Examples
  17306. @itemize
  17307. @item
  17308. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  17309. @example
  17310. stereo3d=sbsl:aybd
  17311. @end example
  17312. @item
  17313. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  17314. @example
  17315. stereo3d=abl:sbsr
  17316. @end example
  17317. @end itemize
  17318. @section streamselect, astreamselect
  17319. Select video or audio streams.
  17320. The filter accepts the following options:
  17321. @table @option
  17322. @item inputs
  17323. Set number of inputs. Default is 2.
  17324. @item map
  17325. Set input indexes to remap to outputs.
  17326. @end table
  17327. @subsection Commands
  17328. The @code{streamselect} and @code{astreamselect} filter supports the following
  17329. commands:
  17330. @table @option
  17331. @item map
  17332. Set input indexes to remap to outputs.
  17333. @end table
  17334. @subsection Examples
  17335. @itemize
  17336. @item
  17337. Select first 5 seconds 1st stream and rest of time 2nd stream:
  17338. @example
  17339. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  17340. @end example
  17341. @item
  17342. Same as above, but for audio:
  17343. @example
  17344. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  17345. @end example
  17346. @end itemize
  17347. @anchor{subtitles}
  17348. @section subtitles
  17349. Draw subtitles on top of input video using the libass library.
  17350. To enable compilation of this filter you need to configure FFmpeg with
  17351. @code{--enable-libass}. This filter also requires a build with libavcodec and
  17352. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  17353. Alpha) subtitles format.
  17354. The filter accepts the following options:
  17355. @table @option
  17356. @item filename, f
  17357. Set the filename of the subtitle file to read. It must be specified.
  17358. @item original_size
  17359. Specify the size of the original video, the video for which the ASS file
  17360. was composed. For the syntax of this option, check the
  17361. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17362. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  17363. correctly scale the fonts if the aspect ratio has been changed.
  17364. @item fontsdir
  17365. Set a directory path containing fonts that can be used by the filter.
  17366. These fonts will be used in addition to whatever the font provider uses.
  17367. @item alpha
  17368. Process alpha channel, by default alpha channel is untouched.
  17369. @item charenc
  17370. Set subtitles input character encoding. @code{subtitles} filter only. Only
  17371. useful if not UTF-8.
  17372. @item stream_index, si
  17373. Set subtitles stream index. @code{subtitles} filter only.
  17374. @item force_style
  17375. Override default style or script info parameters of the subtitles. It accepts a
  17376. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  17377. @item wrap_unicode
  17378. Break lines according to the Unicode Line Breaking Algorithm. Availability requires
  17379. at least libass release 0.17.0 (or LIBASS_VERSION 0x01600010), @emph{and} libass must
  17380. have been built with libunibreak.
  17381. The option is enabled by default except for native ASS.
  17382. @end table
  17383. If the first key is not specified, it is assumed that the first value
  17384. specifies the @option{filename}.
  17385. For example, to render the file @file{sub.srt} on top of the input
  17386. video, use the command:
  17387. @example
  17388. subtitles=sub.srt
  17389. @end example
  17390. which is equivalent to:
  17391. @example
  17392. subtitles=filename=sub.srt
  17393. @end example
  17394. To render the default subtitles stream from file @file{video.mkv}, use:
  17395. @example
  17396. subtitles=video.mkv
  17397. @end example
  17398. To render the second subtitles stream from that file, use:
  17399. @example
  17400. subtitles=video.mkv:si=1
  17401. @end example
  17402. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  17403. @code{DejaVu Serif}, use:
  17404. @example
  17405. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  17406. @end example
  17407. @section super2xsai
  17408. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  17409. Interpolate) pixel art scaling algorithm.
  17410. Useful for enlarging pixel art images without reducing sharpness.
  17411. @section swaprect
  17412. Swap two rectangular objects in video.
  17413. This filter accepts the following options:
  17414. @table @option
  17415. @item w
  17416. Set object width.
  17417. @item h
  17418. Set object height.
  17419. @item x1
  17420. Set 1st rect x coordinate.
  17421. @item y1
  17422. Set 1st rect y coordinate.
  17423. @item x2
  17424. Set 2nd rect x coordinate.
  17425. @item y2
  17426. Set 2nd rect y coordinate.
  17427. All expressions are evaluated once for each frame.
  17428. @end table
  17429. The all options are expressions containing the following constants:
  17430. @table @option
  17431. @item w
  17432. @item h
  17433. The input width and height.
  17434. @item a
  17435. same as @var{w} / @var{h}
  17436. @item sar
  17437. input sample aspect ratio
  17438. @item dar
  17439. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  17440. @item n
  17441. The number of the input frame, starting from 0.
  17442. @item t
  17443. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  17444. @item pos
  17445. the position in the file of the input frame, NAN if unknown; deprecated,
  17446. do not use
  17447. @end table
  17448. @subsection Commands
  17449. This filter supports the all above options as @ref{commands}.
  17450. @section swapuv
  17451. Swap U & V plane.
  17452. @section tblend
  17453. Blend successive video frames.
  17454. See @ref{blend}
  17455. @section telecine
  17456. Apply telecine process to the video.
  17457. This filter accepts the following options:
  17458. @table @option
  17459. @item first_field
  17460. @table @samp
  17461. @item top, t
  17462. top field first
  17463. @item bottom, b
  17464. bottom field first
  17465. The default value is @code{top}.
  17466. @end table
  17467. @item pattern
  17468. A string of numbers representing the pulldown pattern you wish to apply.
  17469. The default value is @code{23}.
  17470. @end table
  17471. @example
  17472. Some typical patterns:
  17473. NTSC output (30i):
  17474. 27.5p: 32222
  17475. 24p: 23 (classic)
  17476. 24p: 2332 (preferred)
  17477. 20p: 33
  17478. 18p: 334
  17479. 16p: 3444
  17480. PAL output (25i):
  17481. 27.5p: 12222
  17482. 24p: 222222222223 ("Euro pulldown")
  17483. 16.67p: 33
  17484. 16p: 33333334
  17485. @end example
  17486. @section thistogram
  17487. Compute and draw a color distribution histogram for the input video across time.
  17488. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  17489. at certain time, this filter shows also past histograms of number of frames defined
  17490. by @code{width} option.
  17491. The computed histogram is a representation of the color component
  17492. distribution in an image.
  17493. The filter accepts the following options:
  17494. @table @option
  17495. @item width, w
  17496. Set width of single color component output. Default value is @code{0}.
  17497. Value of @code{0} means width will be picked from input video.
  17498. This also set number of passed histograms to keep.
  17499. Allowed range is [0, 8192].
  17500. @item display_mode, d
  17501. Set display mode.
  17502. It accepts the following values:
  17503. @table @samp
  17504. @item stack
  17505. Per color component graphs are placed below each other.
  17506. @item parade
  17507. Per color component graphs are placed side by side.
  17508. @item overlay
  17509. Presents information identical to that in the @code{parade}, except
  17510. that the graphs representing color components are superimposed directly
  17511. over one another.
  17512. @end table
  17513. Default is @code{stack}.
  17514. @item levels_mode, m
  17515. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  17516. Default is @code{linear}.
  17517. @item components, c
  17518. Set what color components to display.
  17519. Default is @code{7}.
  17520. @item bgopacity, b
  17521. Set background opacity. Default is @code{0.9}.
  17522. @item envelope, e
  17523. Show envelope. Default is disabled.
  17524. @item ecolor, ec
  17525. Set envelope color. Default is @code{gold}.
  17526. @item slide
  17527. Set slide mode.
  17528. Available values for slide is:
  17529. @table @samp
  17530. @item frame
  17531. Draw new frame when right border is reached.
  17532. @item replace
  17533. Replace old columns with new ones.
  17534. @item scroll
  17535. Scroll from right to left.
  17536. @item rscroll
  17537. Scroll from left to right.
  17538. @item picture
  17539. Draw single picture.
  17540. @end table
  17541. Default is @code{replace}.
  17542. @end table
  17543. @section threshold
  17544. Apply threshold effect to video stream.
  17545. This filter needs four video streams to perform thresholding.
  17546. First stream is stream we are filtering.
  17547. Second stream is holding threshold values, third stream is holding min values,
  17548. and last, fourth stream is holding max values.
  17549. The filter accepts the following option:
  17550. @table @option
  17551. @item planes
  17552. Set which planes will be processed, unprocessed planes will be copied.
  17553. By default value 0xf, all planes will be processed.
  17554. @end table
  17555. For example if first stream pixel's component value is less then threshold value
  17556. of pixel component from 2nd threshold stream, third stream value will picked,
  17557. otherwise fourth stream pixel component value will be picked.
  17558. Using color source filter one can perform various types of thresholding:
  17559. @subsection Commands
  17560. This filter supports the all options as @ref{commands}.
  17561. @subsection Examples
  17562. @itemize
  17563. @item
  17564. Binary threshold, using gray color as threshold:
  17565. @example
  17566. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17567. @end example
  17568. @item
  17569. Inverted binary threshold, using gray color as threshold:
  17570. @example
  17571. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17572. @end example
  17573. @item
  17574. Truncate binary threshold, using gray color as threshold:
  17575. @example
  17576. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17577. @end example
  17578. @item
  17579. Threshold to zero, using gray color as threshold:
  17580. @example
  17581. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17582. @end example
  17583. @item
  17584. Inverted threshold to zero, using gray color as threshold:
  17585. @example
  17586. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17587. @end example
  17588. @end itemize
  17589. @section thumbnail
  17590. Select the most representative frame in a given sequence of consecutive frames.
  17591. The filter accepts the following options:
  17592. @table @option
  17593. @item n
  17594. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17595. will pick one of them, and then handle the next batch of @var{n} frames until
  17596. the end. Default is @code{100}.
  17597. @item log
  17598. Set the log level to display picked frame stats.
  17599. Default is @code{info}.
  17600. @end table
  17601. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17602. value will result in a higher memory usage, so a high value is not recommended.
  17603. @subsection Examples
  17604. @itemize
  17605. @item
  17606. Extract one picture each 50 frames:
  17607. @example
  17608. thumbnail=50
  17609. @end example
  17610. @item
  17611. Complete example of a thumbnail creation with @command{ffmpeg}:
  17612. @example
  17613. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17614. @end example
  17615. @end itemize
  17616. @anchor{tile}
  17617. @section tile
  17618. Tile several successive frames together.
  17619. The @ref{untile} filter can do the reverse.
  17620. The filter accepts the following options:
  17621. @table @option
  17622. @item layout
  17623. Set the grid size in the form @code{COLUMNSxROWS}. Range is up to UINT_MAX cells.
  17624. Default is @code{6x5}.
  17625. @item nb_frames
  17626. Set the maximum number of frames to render in the given area. It must be less
  17627. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17628. the area will be used.
  17629. @item margin
  17630. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17631. @item padding
  17632. Set the inner border thickness (i.e. the number of pixels between frames). For
  17633. more advanced padding options (such as having different values for the edges),
  17634. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17635. @item color
  17636. Specify the color of the unused area. For the syntax of this option, check the
  17637. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17638. The default value of @var{color} is "black".
  17639. @item overlap
  17640. Set the number of frames to overlap when tiling several successive frames together.
  17641. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17642. @item init_padding
  17643. Set the number of frames to initially be empty before displaying first output frame.
  17644. This controls how soon will one get first output frame.
  17645. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17646. @end table
  17647. @subsection Examples
  17648. @itemize
  17649. @item
  17650. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17651. @example
  17652. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17653. @end example
  17654. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17655. duplicating each output frame to accommodate the originally detected frame
  17656. rate.
  17657. @item
  17658. Display @code{5} pictures in an area of @code{3x2} frames,
  17659. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17660. mixed flat and named options:
  17661. @example
  17662. tile=3x2:nb_frames=5:padding=7:margin=2
  17663. @end example
  17664. @end itemize
  17665. @section tiltandshift
  17666. Apply tilt-and-shift effect.
  17667. What happens when you invert time and space?
  17668. Normally a video is composed of several frames that represent a different
  17669. instant of time and shows a scene that evolves in the space captured by the
  17670. frame. This filter is the antipode of that concept, taking inspiration from
  17671. tilt and shift photography.
  17672. A filtered frame contains the whole timeline of events composing the sequence,
  17673. and this is obtained by placing a slice of pixels from each frame into a single
  17674. one. However, since there are no infinite-width frames, this is done up the
  17675. width of the input frame, and a video is recomposed by shifting away one
  17676. column for each subsequent frame. In order to map space to time, the filter
  17677. tilts each input frame as well, so that motion is preserved. This is accomplished
  17678. by progressively selecting a different column from each input frame.
  17679. The end result is a sort of inverted parallax, so that far away objects move
  17680. much faster that the ones in the front. The ideal conditions for this video
  17681. effect are when there is either very little motion and the background is static,
  17682. or when there is a lot of motion and a very wide depth of field (e.g. wide
  17683. panorama, while moving on a train).
  17684. The filter accepts the following parameters:
  17685. @table @option
  17686. @item tilt
  17687. Tilt video while shifting (default). When unset, video will be sliding a
  17688. static image, composed of the first column of each frame.
  17689. @item start
  17690. What to do at the start of filtering (see below).
  17691. @item end
  17692. What to do at the end of filtering (see below).
  17693. @item hold
  17694. How many columns should pass through before start of filtering.
  17695. @item pad
  17696. How many columns should be inserted before end of filtering.
  17697. @end table
  17698. Normally the filter shifts and tilts from the very first frame, and stops when
  17699. the last one is received. However, before filtering starts, normal video may
  17700. be preserved, so that the effect is slowly shifted in its place. Similarly,
  17701. the last video frame may be reconstructed at the end. Alternatively it is
  17702. possible to just start and end with black.
  17703. @table @samp
  17704. @item none
  17705. Filtering starts immediately and ends when the last frame is received.
  17706. @item frame
  17707. The first frames or the very last frame are kept intact during processing.
  17708. @item black
  17709. Black is padded at the beginning or at the end of filtering.
  17710. @end table
  17711. @section tinterlace
  17712. Perform various types of temporal field interlacing.
  17713. Frames are counted starting from 1, so the first input frame is
  17714. considered odd.
  17715. The filter accepts the following options:
  17716. @table @option
  17717. @item mode
  17718. Specify the mode of the interlacing. This option can also be specified
  17719. as a value alone. See below for a list of values for this option.
  17720. Available values are:
  17721. @table @samp
  17722. @item merge, 0
  17723. Move odd frames into the upper field, even into the lower field,
  17724. generating a double height frame at half frame rate.
  17725. @example
  17726. ------> time
  17727. Input:
  17728. Frame 1 Frame 2 Frame 3 Frame 4
  17729. 11111 22222 33333 44444
  17730. 11111 22222 33333 44444
  17731. 11111 22222 33333 44444
  17732. 11111 22222 33333 44444
  17733. Output:
  17734. 11111 33333
  17735. 22222 44444
  17736. 11111 33333
  17737. 22222 44444
  17738. 11111 33333
  17739. 22222 44444
  17740. 11111 33333
  17741. 22222 44444
  17742. @end example
  17743. @item drop_even, 1
  17744. Only output odd frames, even frames are dropped, generating a frame with
  17745. unchanged height at half frame rate.
  17746. @example
  17747. ------> time
  17748. Input:
  17749. Frame 1 Frame 2 Frame 3 Frame 4
  17750. 11111 22222 33333 44444
  17751. 11111 22222 33333 44444
  17752. 11111 22222 33333 44444
  17753. 11111 22222 33333 44444
  17754. Output:
  17755. 11111 33333
  17756. 11111 33333
  17757. 11111 33333
  17758. 11111 33333
  17759. @end example
  17760. @item drop_odd, 2
  17761. Only output even frames, odd frames are dropped, generating a frame with
  17762. unchanged height at half frame rate.
  17763. @example
  17764. ------> time
  17765. Input:
  17766. Frame 1 Frame 2 Frame 3 Frame 4
  17767. 11111 22222 33333 44444
  17768. 11111 22222 33333 44444
  17769. 11111 22222 33333 44444
  17770. 11111 22222 33333 44444
  17771. Output:
  17772. 22222 44444
  17773. 22222 44444
  17774. 22222 44444
  17775. 22222 44444
  17776. @end example
  17777. @item pad, 3
  17778. Expand each frame to full height, but pad alternate lines with black,
  17779. generating a frame with double height at the same input frame rate.
  17780. @example
  17781. ------> time
  17782. Input:
  17783. Frame 1 Frame 2 Frame 3 Frame 4
  17784. 11111 22222 33333 44444
  17785. 11111 22222 33333 44444
  17786. 11111 22222 33333 44444
  17787. 11111 22222 33333 44444
  17788. Output:
  17789. 11111 ..... 33333 .....
  17790. ..... 22222 ..... 44444
  17791. 11111 ..... 33333 .....
  17792. ..... 22222 ..... 44444
  17793. 11111 ..... 33333 .....
  17794. ..... 22222 ..... 44444
  17795. 11111 ..... 33333 .....
  17796. ..... 22222 ..... 44444
  17797. @end example
  17798. @item interleave_top, 4
  17799. Interleave the upper field from odd frames with the lower field from
  17800. even frames, generating a frame with unchanged height at half frame rate.
  17801. @example
  17802. ------> time
  17803. Input:
  17804. Frame 1 Frame 2 Frame 3 Frame 4
  17805. 11111<- 22222 33333<- 44444
  17806. 11111 22222<- 33333 44444<-
  17807. 11111<- 22222 33333<- 44444
  17808. 11111 22222<- 33333 44444<-
  17809. Output:
  17810. 11111 33333
  17811. 22222 44444
  17812. 11111 33333
  17813. 22222 44444
  17814. @end example
  17815. @item interleave_bottom, 5
  17816. Interleave the lower field from odd frames with the upper field from
  17817. even frames, generating a frame with unchanged height at half frame rate.
  17818. @example
  17819. ------> time
  17820. Input:
  17821. Frame 1 Frame 2 Frame 3 Frame 4
  17822. 11111 22222<- 33333 44444<-
  17823. 11111<- 22222 33333<- 44444
  17824. 11111 22222<- 33333 44444<-
  17825. 11111<- 22222 33333<- 44444
  17826. Output:
  17827. 22222 44444
  17828. 11111 33333
  17829. 22222 44444
  17830. 11111 33333
  17831. @end example
  17832. @item interlacex2, 6
  17833. Double frame rate with unchanged height. Frames are inserted each
  17834. containing the second temporal field from the previous input frame and
  17835. the first temporal field from the next input frame. This mode relies on
  17836. the top_field_first flag. Useful for interlaced video displays with no
  17837. field synchronisation.
  17838. @example
  17839. ------> time
  17840. Input:
  17841. Frame 1 Frame 2 Frame 3 Frame 4
  17842. 11111 22222 33333 44444
  17843. 11111 22222 33333 44444
  17844. 11111 22222 33333 44444
  17845. 11111 22222 33333 44444
  17846. Output:
  17847. 11111 22222 22222 33333 33333 44444 44444
  17848. 11111 11111 22222 22222 33333 33333 44444
  17849. 11111 22222 22222 33333 33333 44444 44444
  17850. 11111 11111 22222 22222 33333 33333 44444
  17851. @end example
  17852. @item mergex2, 7
  17853. Move odd frames into the upper field, even into the lower field,
  17854. generating a double height frame at same frame rate.
  17855. @example
  17856. ------> time
  17857. Input:
  17858. Frame 1 Frame 2 Frame 3 Frame 4
  17859. 11111 22222 33333 44444
  17860. 11111 22222 33333 44444
  17861. 11111 22222 33333 44444
  17862. 11111 22222 33333 44444
  17863. Output:
  17864. 11111 33333 33333 55555
  17865. 22222 22222 44444 44444
  17866. 11111 33333 33333 55555
  17867. 22222 22222 44444 44444
  17868. 11111 33333 33333 55555
  17869. 22222 22222 44444 44444
  17870. 11111 33333 33333 55555
  17871. 22222 22222 44444 44444
  17872. @end example
  17873. @end table
  17874. Numeric values are deprecated but are accepted for backward
  17875. compatibility reasons.
  17876. Default mode is @code{merge}.
  17877. @item flags
  17878. Specify flags influencing the filter process.
  17879. Available value for @var{flags} is:
  17880. @table @option
  17881. @item low_pass_filter, vlpf
  17882. Enable linear vertical low-pass filtering in the filter.
  17883. Vertical low-pass filtering is required when creating an interlaced
  17884. destination from a progressive source which contains high-frequency
  17885. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  17886. patterning.
  17887. @item complex_filter, cvlpf
  17888. Enable complex vertical low-pass filtering.
  17889. This will slightly less reduce interlace 'twitter' and Moire
  17890. patterning but better retain detail and subjective sharpness impression.
  17891. @item bypass_il
  17892. Bypass already interlaced frames, only adjust the frame rate.
  17893. @end table
  17894. Vertical low-pass filtering and bypassing already interlaced frames can only be
  17895. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  17896. @end table
  17897. @section tmedian
  17898. Pick median pixels from several successive input video frames.
  17899. The filter accepts the following options:
  17900. @table @option
  17901. @item radius
  17902. Set radius of median filter.
  17903. Default is 1. Allowed range is from 1 to 127.
  17904. @item planes
  17905. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  17906. @item percentile
  17907. Set median percentile. Default value is @code{0.5}.
  17908. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  17909. minimum values, and @code{1} maximum values.
  17910. @end table
  17911. @subsection Commands
  17912. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  17913. @section tmidequalizer
  17914. Apply Temporal Midway Video Equalization effect.
  17915. Midway Video Equalization adjusts a sequence of video frames to have the same
  17916. histograms, while maintaining their dynamics as much as possible. It's
  17917. useful for e.g. matching exposures from a video frames sequence.
  17918. This filter accepts the following option:
  17919. @table @option
  17920. @item radius
  17921. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  17922. @item sigma
  17923. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  17924. Setting this option to 0 effectively does nothing.
  17925. @item planes
  17926. Set which planes to process. Default is @code{15}, which is all available planes.
  17927. @end table
  17928. @section tmix
  17929. Mix successive video frames.
  17930. A description of the accepted options follows.
  17931. @table @option
  17932. @item frames
  17933. The number of successive frames to mix. If unspecified, it defaults to 3.
  17934. @item weights
  17935. Specify weight of each input video frame.
  17936. Each weight is separated by space. If number of weights is smaller than
  17937. number of @var{frames} last specified weight will be used for all remaining
  17938. unset weights.
  17939. @item scale
  17940. Specify scale, if it is set it will be multiplied with sum
  17941. of each weight multiplied with pixel values to give final destination
  17942. pixel value. By default @var{scale} is auto scaled to sum of weights.
  17943. @item planes
  17944. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  17945. @end table
  17946. @subsection Examples
  17947. @itemize
  17948. @item
  17949. Average 7 successive frames:
  17950. @example
  17951. tmix=frames=7:weights="1 1 1 1 1 1 1"
  17952. @end example
  17953. @item
  17954. Apply simple temporal convolution:
  17955. @example
  17956. tmix=frames=3:weights="-1 3 -1"
  17957. @end example
  17958. @item
  17959. Similar as above but only showing temporal differences:
  17960. @example
  17961. tmix=frames=3:weights="-1 2 -1":scale=1
  17962. @end example
  17963. @end itemize
  17964. @subsection Commands
  17965. This filter supports the following commands:
  17966. @table @option
  17967. @item weights
  17968. @item scale
  17969. @item planes
  17970. Syntax is same as option with same name.
  17971. @end table
  17972. @anchor{tonemap}
  17973. @section tonemap
  17974. Tone map colors from different dynamic ranges.
  17975. This filter expects data in single precision floating point, as it needs to
  17976. operate on (and can output) out-of-range values. Another filter, such as
  17977. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  17978. The tonemapping algorithms implemented only work on linear light, so input
  17979. data should be linearized beforehand (and possibly correctly tagged).
  17980. @example
  17981. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  17982. @end example
  17983. @subsection Options
  17984. The filter accepts the following options.
  17985. @table @option
  17986. @item tonemap
  17987. Set the tone map algorithm to use.
  17988. Possible values are:
  17989. @table @var
  17990. @item none
  17991. Do not apply any tone map, only desaturate overbright pixels.
  17992. @item clip
  17993. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  17994. in-range values, while distorting out-of-range values.
  17995. @item linear
  17996. Stretch the entire reference gamut to a linear multiple of the display.
  17997. @item gamma
  17998. Fit a logarithmic transfer between the tone curves.
  17999. @item reinhard
  18000. Preserve overall image brightness with a simple curve, using nonlinear
  18001. contrast, which results in flattening details and degrading color accuracy.
  18002. @item hable
  18003. Preserve both dark and bright details better than @var{reinhard}, at the cost
  18004. of slightly darkening everything. Use it when detail preservation is more
  18005. important than color and brightness accuracy.
  18006. @item mobius
  18007. Smoothly map out-of-range values, while retaining contrast and colors for
  18008. in-range material as much as possible. Use it when color accuracy is more
  18009. important than detail preservation.
  18010. @end table
  18011. Default is none.
  18012. @item param
  18013. Tune the tone mapping algorithm.
  18014. This affects the following algorithms:
  18015. @table @var
  18016. @item none
  18017. Ignored.
  18018. @item linear
  18019. Specifies the scale factor to use while stretching.
  18020. Default to 1.0.
  18021. @item gamma
  18022. Specifies the exponent of the function.
  18023. Default to 1.8.
  18024. @item clip
  18025. Specify an extra linear coefficient to multiply into the signal before clipping.
  18026. Default to 1.0.
  18027. @item reinhard
  18028. Specify the local contrast coefficient at the display peak.
  18029. Default to 0.5, which means that in-gamut values will be about half as bright
  18030. as when clipping.
  18031. @item hable
  18032. Ignored.
  18033. @item mobius
  18034. Specify the transition point from linear to mobius transform. Every value
  18035. below this point is guaranteed to be mapped 1:1. The higher the value, the
  18036. more accurate the result will be, at the cost of losing bright details.
  18037. Default to 0.3, which due to the steep initial slope still preserves in-range
  18038. colors fairly accurately.
  18039. @end table
  18040. @item desat
  18041. Apply desaturation for highlights that exceed this level of brightness. The
  18042. higher the parameter, the more color information will be preserved. This
  18043. setting helps prevent unnaturally blown-out colors for super-highlights, by
  18044. (smoothly) turning into white instead. This makes images feel more natural,
  18045. at the cost of reducing information about out-of-range colors.
  18046. The default of 2.0 is somewhat conservative and will mostly just apply to
  18047. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  18048. This option works only if the input frame has a supported color tag.
  18049. @item peak
  18050. Override signal/nominal/reference peak with this value. Useful when the
  18051. embedded peak information in display metadata is not reliable or when tone
  18052. mapping from a lower range to a higher range.
  18053. @end table
  18054. @section tpad
  18055. Temporarily pad video frames.
  18056. The filter accepts the following options:
  18057. @table @option
  18058. @item start
  18059. Specify number of delay frames before input video stream. Default is 0.
  18060. @item stop
  18061. Specify number of padding frames after input video stream.
  18062. Set to -1 to pad indefinitely. Default is 0.
  18063. @item start_mode
  18064. Set kind of frames added to beginning of stream.
  18065. Can be either @var{add} or @var{clone}.
  18066. With @var{add} frames of solid-color are added.
  18067. With @var{clone} frames are clones of first frame.
  18068. Default is @var{add}.
  18069. @item stop_mode
  18070. Set kind of frames added to end of stream.
  18071. Can be either @var{add} or @var{clone}.
  18072. With @var{add} frames of solid-color are added.
  18073. With @var{clone} frames are clones of last frame.
  18074. Default is @var{add}.
  18075. @item start_duration, stop_duration
  18076. Specify the duration of the start/stop delay. See
  18077. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18078. for the accepted syntax.
  18079. These options override @var{start} and @var{stop}. Default is 0.
  18080. @item color
  18081. Specify the color of the padded area. For the syntax of this option,
  18082. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  18083. manual,ffmpeg-utils}.
  18084. The default value of @var{color} is "black".
  18085. @end table
  18086. @anchor{transpose}
  18087. @section transpose
  18088. Transpose rows with columns in the input video and optionally flip it.
  18089. It accepts the following parameters:
  18090. @table @option
  18091. @item dir
  18092. Specify the transposition direction.
  18093. Can assume the following values:
  18094. @table @samp
  18095. @item 0, 4, cclock_flip
  18096. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  18097. @example
  18098. L.R L.l
  18099. . . -> . .
  18100. l.r R.r
  18101. @end example
  18102. @item 1, 5, clock
  18103. Rotate by 90 degrees clockwise, that is:
  18104. @example
  18105. L.R l.L
  18106. . . -> . .
  18107. l.r r.R
  18108. @end example
  18109. @item 2, 6, cclock
  18110. Rotate by 90 degrees counterclockwise, that is:
  18111. @example
  18112. L.R R.r
  18113. . . -> . .
  18114. l.r L.l
  18115. @end example
  18116. @item 3, 7, clock_flip
  18117. Rotate by 90 degrees clockwise and vertically flip, that is:
  18118. @example
  18119. L.R r.R
  18120. . . -> . .
  18121. l.r l.L
  18122. @end example
  18123. @end table
  18124. For values between 4-7, the transposition is only done if the input
  18125. video geometry is portrait and not landscape. These values are
  18126. deprecated, the @code{passthrough} option should be used instead.
  18127. Numerical values are deprecated, and should be dropped in favor of
  18128. symbolic constants.
  18129. @item passthrough
  18130. Do not apply the transposition if the input geometry matches the one
  18131. specified by the specified value. It accepts the following values:
  18132. @table @samp
  18133. @item none
  18134. Always apply transposition.
  18135. @item portrait
  18136. Preserve portrait geometry (when @var{height} >= @var{width}).
  18137. @item landscape
  18138. Preserve landscape geometry (when @var{width} >= @var{height}).
  18139. @end table
  18140. Default value is @code{none}.
  18141. @end table
  18142. For example to rotate by 90 degrees clockwise and preserve portrait
  18143. layout:
  18144. @example
  18145. transpose=dir=1:passthrough=portrait
  18146. @end example
  18147. The command above can also be specified as:
  18148. @example
  18149. transpose=1:portrait
  18150. @end example
  18151. @section trim
  18152. Trim the input so that the output contains one continuous subpart of the input.
  18153. It accepts the following parameters:
  18154. @table @option
  18155. @item start
  18156. Specify the time of the start of the kept section, i.e. the frame with the
  18157. timestamp @var{start} will be the first frame in the output.
  18158. @item end
  18159. Specify the time of the first frame that will be dropped, i.e. the frame
  18160. immediately preceding the one with the timestamp @var{end} will be the last
  18161. frame in the output.
  18162. @item start_pts
  18163. This is the same as @var{start}, except this option sets the start timestamp
  18164. in timebase units instead of seconds.
  18165. @item end_pts
  18166. This is the same as @var{end}, except this option sets the end timestamp
  18167. in timebase units instead of seconds.
  18168. @item duration
  18169. The maximum duration of the output in seconds.
  18170. @item start_frame
  18171. The number of the first frame that should be passed to the output.
  18172. @item end_frame
  18173. The number of the first frame that should be dropped.
  18174. @end table
  18175. @option{start}, @option{end}, and @option{duration} are expressed as time
  18176. duration specifications; see
  18177. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18178. for the accepted syntax.
  18179. Note that the first two sets of the start/end options and the @option{duration}
  18180. option look at the frame timestamp, while the _frame variants simply count the
  18181. frames that pass through the filter. Also note that this filter does not modify
  18182. the timestamps. If you wish for the output timestamps to start at zero, insert a
  18183. setpts filter after the trim filter.
  18184. If multiple start or end options are set, this filter tries to be greedy and
  18185. keep all the frames that match at least one of the specified constraints. To keep
  18186. only the part that matches all the constraints at once, chain multiple trim
  18187. filters.
  18188. The defaults are such that all the input is kept. So it is possible to set e.g.
  18189. just the end values to keep everything before the specified time.
  18190. Examples:
  18191. @itemize
  18192. @item
  18193. Drop everything except the second minute of input:
  18194. @example
  18195. ffmpeg -i INPUT -vf trim=60:120
  18196. @end example
  18197. @item
  18198. Keep only the first second:
  18199. @example
  18200. ffmpeg -i INPUT -vf trim=duration=1
  18201. @end example
  18202. @end itemize
  18203. @section unpremultiply
  18204. Apply alpha unpremultiply effect to input video stream using first plane
  18205. of second stream as alpha.
  18206. Both streams must have same dimensions and same pixel format.
  18207. The filter accepts the following option:
  18208. @table @option
  18209. @item planes
  18210. Set which planes will be processed, unprocessed planes will be copied.
  18211. By default value 0xf, all planes will be processed.
  18212. If the format has 1 or 2 components, then luma is bit 0.
  18213. If the format has 3 or 4 components:
  18214. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  18215. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  18216. If present, the alpha channel is always the last bit.
  18217. @item inplace
  18218. Do not require 2nd input for processing, instead use alpha plane from input stream.
  18219. @end table
  18220. @anchor{unsharp}
  18221. @section unsharp
  18222. Sharpen or blur the input video.
  18223. It accepts the following parameters:
  18224. @table @option
  18225. @item luma_msize_x, lx
  18226. Set the luma matrix horizontal size. It must be an odd integer between
  18227. 3 and 23. The default value is 5.
  18228. @item luma_msize_y, ly
  18229. Set the luma matrix vertical size. It must be an odd integer between 3
  18230. and 23. The default value is 5.
  18231. @item luma_amount, la
  18232. Set the luma effect strength. It must be a floating point number, reasonable
  18233. values lay between -1.5 and 1.5.
  18234. Negative values will blur the input video, while positive values will
  18235. sharpen it, a value of zero will disable the effect.
  18236. Default value is 1.0.
  18237. @item chroma_msize_x, cx
  18238. Set the chroma matrix horizontal size. It must be an odd integer
  18239. between 3 and 23. The default value is 5.
  18240. @item chroma_msize_y, cy
  18241. Set the chroma matrix vertical size. It must be an odd integer
  18242. between 3 and 23. The default value is 5.
  18243. @item chroma_amount, ca
  18244. Set the chroma effect strength. It must be a floating point number, reasonable
  18245. values lay between -1.5 and 1.5.
  18246. Negative values will blur the input video, while positive values will
  18247. sharpen it, a value of zero will disable the effect.
  18248. Default value is 0.0.
  18249. @item alpha_msize_x, ax
  18250. Set the alpha matrix horizontal size. It must be an odd integer
  18251. between 3 and 23. The default value is 5.
  18252. @item alpha_msize_y, ay
  18253. Set the alpha matrix vertical size. It must be an odd integer
  18254. between 3 and 23. The default value is 5.
  18255. @item alpha_amount, aa
  18256. Set the alpha effect strength. It must be a floating point number, reasonable
  18257. values lay between -1.5 and 1.5.
  18258. Negative values will blur the input video, while positive values will
  18259. sharpen it, a value of zero will disable the effect.
  18260. Default value is 0.0.
  18261. @end table
  18262. All parameters are optional and default to the equivalent of the
  18263. string '5:5:1.0:5:5:0.0'.
  18264. @subsection Examples
  18265. @itemize
  18266. @item
  18267. Apply strong luma sharpen effect:
  18268. @example
  18269. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  18270. @end example
  18271. @item
  18272. Apply a strong blur of both luma and chroma parameters:
  18273. @example
  18274. unsharp=7:7:-2:7:7:-2
  18275. @end example
  18276. @end itemize
  18277. @anchor{untile}
  18278. @section untile
  18279. Decompose a video made of tiled images into the individual images.
  18280. The frame rate of the output video is the frame rate of the input video
  18281. multiplied by the number of tiles.
  18282. This filter does the reverse of @ref{tile}.
  18283. The filter accepts the following options:
  18284. @table @option
  18285. @item layout
  18286. Set the grid size (i.e. the number of lines and columns). For the syntax of
  18287. this option, check the
  18288. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18289. @end table
  18290. @subsection Examples
  18291. @itemize
  18292. @item
  18293. Produce a 1-second video from a still image file made of 25 frames stacked
  18294. vertically, like an analogic film reel:
  18295. @example
  18296. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  18297. @end example
  18298. @end itemize
  18299. @section uspp
  18300. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  18301. the image at several (or - in the case of @option{quality} level @code{8} - all)
  18302. shifts and average the results.
  18303. The way this differs from the behavior of spp is that uspp actually encodes &
  18304. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  18305. DCT similar to MJPEG.
  18306. This filter is not available in ffmpeg versions between 5.0 and 6.0.
  18307. The filter accepts the following options:
  18308. @table @option
  18309. @item quality
  18310. Set quality. This option defines the number of levels for averaging. It accepts
  18311. an integer in the range 0-8. If set to @code{0}, the filter will have no
  18312. effect. A value of @code{8} means the higher quality. For each increment of
  18313. that value the speed drops by a factor of approximately 2. Default value is
  18314. @code{3}.
  18315. @item qp
  18316. Force a constant quantization parameter. If not set, the filter will use the QP
  18317. from the video stream (if available).
  18318. @item codec
  18319. Use specified codec instead of snow.
  18320. @end table
  18321. @section v360
  18322. Convert 360 videos between various formats.
  18323. The filter accepts the following options:
  18324. @table @option
  18325. @item input
  18326. @item output
  18327. Set format of the input/output video.
  18328. Available formats:
  18329. @table @samp
  18330. @item e
  18331. @item equirect
  18332. Equirectangular projection.
  18333. @item c3x2
  18334. @item c6x1
  18335. @item c1x6
  18336. Cubemap with 3x2/6x1/1x6 layout.
  18337. Format specific options:
  18338. @table @option
  18339. @item in_pad
  18340. @item out_pad
  18341. Set padding proportion for the input/output cubemap. Values in decimals.
  18342. Example values:
  18343. @table @samp
  18344. @item 0
  18345. No padding.
  18346. @item 0.01
  18347. 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)
  18348. @end table
  18349. Default value is @b{@samp{0}}.
  18350. Maximum value is @b{@samp{0.1}}.
  18351. @item fin_pad
  18352. @item fout_pad
  18353. Set fixed padding for the input/output cubemap. Values in pixels.
  18354. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  18355. @item in_forder
  18356. @item out_forder
  18357. Set order of faces for the input/output cubemap. Choose one direction for each position.
  18358. Designation of directions:
  18359. @table @samp
  18360. @item r
  18361. right
  18362. @item l
  18363. left
  18364. @item u
  18365. up
  18366. @item d
  18367. down
  18368. @item f
  18369. forward
  18370. @item b
  18371. back
  18372. @end table
  18373. Default value is @b{@samp{rludfb}}.
  18374. @item in_frot
  18375. @item out_frot
  18376. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  18377. Designation of angles:
  18378. @table @samp
  18379. @item 0
  18380. 0 degrees clockwise
  18381. @item 1
  18382. 90 degrees clockwise
  18383. @item 2
  18384. 180 degrees clockwise
  18385. @item 3
  18386. 270 degrees clockwise
  18387. @end table
  18388. Default value is @b{@samp{000000}}.
  18389. @end table
  18390. @item eac
  18391. Equi-Angular Cubemap.
  18392. @item flat
  18393. @item gnomonic
  18394. @item rectilinear
  18395. Regular video.
  18396. Format specific options:
  18397. @table @option
  18398. @item h_fov
  18399. @item v_fov
  18400. @item d_fov
  18401. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18402. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18403. @item ih_fov
  18404. @item iv_fov
  18405. @item id_fov
  18406. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18407. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18408. @end table
  18409. @item dfisheye
  18410. Dual fisheye.
  18411. Format specific options:
  18412. @table @option
  18413. @item h_fov
  18414. @item v_fov
  18415. @item d_fov
  18416. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18417. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18418. @item ih_fov
  18419. @item iv_fov
  18420. @item id_fov
  18421. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18422. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18423. @end table
  18424. @item barrel
  18425. @item fb
  18426. @item barrelsplit
  18427. Facebook's 360 formats.
  18428. @item sg
  18429. Stereographic format.
  18430. Format specific options:
  18431. @table @option
  18432. @item h_fov
  18433. @item v_fov
  18434. @item d_fov
  18435. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18436. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18437. @item ih_fov
  18438. @item iv_fov
  18439. @item id_fov
  18440. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18441. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18442. @end table
  18443. @item mercator
  18444. Mercator format.
  18445. @item ball
  18446. Ball format, gives significant distortion toward the back.
  18447. @item hammer
  18448. Hammer-Aitoff map projection format.
  18449. @item sinusoidal
  18450. Sinusoidal map projection format.
  18451. @item fisheye
  18452. Fisheye projection.
  18453. Format specific options:
  18454. @table @option
  18455. @item h_fov
  18456. @item v_fov
  18457. @item d_fov
  18458. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18459. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18460. @item ih_fov
  18461. @item iv_fov
  18462. @item id_fov
  18463. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18464. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18465. @end table
  18466. @item pannini
  18467. Pannini projection.
  18468. Format specific options:
  18469. @table @option
  18470. @item h_fov
  18471. Set output pannini parameter.
  18472. @item ih_fov
  18473. Set input pannini parameter.
  18474. @end table
  18475. @item cylindrical
  18476. Cylindrical projection.
  18477. Format specific options:
  18478. @table @option
  18479. @item h_fov
  18480. @item v_fov
  18481. @item d_fov
  18482. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18483. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18484. @item ih_fov
  18485. @item iv_fov
  18486. @item id_fov
  18487. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18488. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18489. @end table
  18490. @item perspective
  18491. Perspective projection. @i{(output only)}
  18492. Format specific options:
  18493. @table @option
  18494. @item v_fov
  18495. Set perspective parameter.
  18496. @end table
  18497. @item tetrahedron
  18498. Tetrahedron projection.
  18499. @item tsp
  18500. Truncated square pyramid projection.
  18501. @item he
  18502. @item hequirect
  18503. Half equirectangular projection.
  18504. @item equisolid
  18505. Equisolid format.
  18506. Format specific options:
  18507. @table @option
  18508. @item h_fov
  18509. @item v_fov
  18510. @item d_fov
  18511. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18512. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18513. @item ih_fov
  18514. @item iv_fov
  18515. @item id_fov
  18516. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18517. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18518. @end table
  18519. @item og
  18520. Orthographic format.
  18521. Format specific options:
  18522. @table @option
  18523. @item h_fov
  18524. @item v_fov
  18525. @item d_fov
  18526. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18527. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18528. @item ih_fov
  18529. @item iv_fov
  18530. @item id_fov
  18531. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18532. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18533. @end table
  18534. @item octahedron
  18535. Octahedron projection.
  18536. @item cylindricalea
  18537. Cylindrical Equal Area projection.
  18538. @end table
  18539. @item interp
  18540. Set interpolation method.@*
  18541. @i{Note: more complex interpolation methods require much more memory to run.}
  18542. Available methods:
  18543. @table @samp
  18544. @item near
  18545. @item nearest
  18546. Nearest neighbour.
  18547. @item line
  18548. @item linear
  18549. Bilinear interpolation.
  18550. @item lagrange9
  18551. Lagrange9 interpolation.
  18552. @item cube
  18553. @item cubic
  18554. Bicubic interpolation.
  18555. @item lanc
  18556. @item lanczos
  18557. Lanczos interpolation.
  18558. @item sp16
  18559. @item spline16
  18560. Spline16 interpolation.
  18561. @item gauss
  18562. @item gaussian
  18563. Gaussian interpolation.
  18564. @item mitchell
  18565. Mitchell interpolation.
  18566. @end table
  18567. Default value is @b{@samp{line}}.
  18568. @item w
  18569. @item h
  18570. Set the output video resolution.
  18571. Default resolution depends on formats.
  18572. @item in_stereo
  18573. @item out_stereo
  18574. Set the input/output stereo format.
  18575. @table @samp
  18576. @item 2d
  18577. 2D mono
  18578. @item sbs
  18579. Side by side
  18580. @item tb
  18581. Top bottom
  18582. @end table
  18583. Default value is @b{@samp{2d}} for input and output format.
  18584. @item yaw
  18585. @item pitch
  18586. @item roll
  18587. Set rotation for the output video. Values in degrees.
  18588. @item rorder
  18589. Set rotation order for the output video. Choose one item for each position.
  18590. @table @samp
  18591. @item y, Y
  18592. yaw
  18593. @item p, P
  18594. pitch
  18595. @item r, R
  18596. roll
  18597. @end table
  18598. Default value is @b{@samp{ypr}}.
  18599. @item h_flip
  18600. @item v_flip
  18601. @item d_flip
  18602. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18603. @item ih_flip
  18604. @item iv_flip
  18605. Set if input video is flipped horizontally/vertically. Boolean values.
  18606. @item in_trans
  18607. Set if input video is transposed. Boolean value, by default disabled.
  18608. @item out_trans
  18609. Set if output video needs to be transposed. Boolean value, by default disabled.
  18610. @item h_offset
  18611. @item v_offset
  18612. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18613. Allowed range is from -1 to 1.
  18614. @item alpha_mask
  18615. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18616. @item reset_rot
  18617. Reset rotation of output video. Boolean value, by default disabled.
  18618. @end table
  18619. @subsection Examples
  18620. @itemize
  18621. @item
  18622. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18623. @example
  18624. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18625. @end example
  18626. @item
  18627. Extract back view of Equi-Angular Cubemap:
  18628. @example
  18629. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18630. @end example
  18631. @item
  18632. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18633. @example
  18634. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18635. @end example
  18636. @end itemize
  18637. @subsection Commands
  18638. This filter supports subset of above options as @ref{commands}.
  18639. @section vaguedenoiser
  18640. Apply a wavelet based denoiser.
  18641. It transforms each frame from the video input into the wavelet domain,
  18642. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18643. the obtained coefficients. It does an inverse wavelet transform after.
  18644. Due to wavelet properties, it should give a nice smoothed result, and
  18645. reduced noise, without blurring picture features.
  18646. This filter accepts the following options:
  18647. @table @option
  18648. @item threshold
  18649. The filtering strength. The higher, the more filtered the video will be.
  18650. Hard thresholding can use a higher threshold than soft thresholding
  18651. before the video looks overfiltered. Default value is 2.
  18652. @item method
  18653. The filtering method the filter will use.
  18654. It accepts the following values:
  18655. @table @samp
  18656. @item hard
  18657. All values under the threshold will be zeroed.
  18658. @item soft
  18659. All values under the threshold will be zeroed. All values above will be
  18660. reduced by the threshold.
  18661. @item garrote
  18662. Scales or nullifies coefficients - intermediary between (more) soft and
  18663. (less) hard thresholding.
  18664. @end table
  18665. Default is garrote.
  18666. @item nsteps
  18667. Number of times, the wavelet will decompose the picture. Picture can't
  18668. be decomposed beyond a particular point (typically, 8 for a 640x480
  18669. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  18670. @item percent
  18671. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  18672. @item planes
  18673. A list of the planes to process. By default all planes are processed.
  18674. @item type
  18675. The threshold type the filter will use.
  18676. It accepts the following values:
  18677. @table @samp
  18678. @item universal
  18679. Threshold used is same for all decompositions.
  18680. @item bayes
  18681. Threshold used depends also on each decomposition coefficients.
  18682. @end table
  18683. Default is universal.
  18684. @end table
  18685. @section varblur
  18686. Apply variable blur filter by using 2nd video stream to set blur radius.
  18687. The 2nd stream must have the same dimensions.
  18688. This filter accepts the following options:
  18689. @table @option
  18690. @item min_r
  18691. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  18692. @item max_r
  18693. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  18694. @item planes
  18695. Set which planes to process. By default, all are used.
  18696. @end table
  18697. The @code{varblur} filter also supports the @ref{framesync} options.
  18698. @subsection Commands
  18699. This filter supports all the above options as @ref{commands}.
  18700. @section vectorscope
  18701. Display 2 color component values in the two dimensional graph (which is called
  18702. a vectorscope).
  18703. This filter accepts the following options:
  18704. @table @option
  18705. @item mode, m
  18706. Set vectorscope mode.
  18707. It accepts the following values:
  18708. @table @samp
  18709. @item gray
  18710. @item tint
  18711. Gray values are displayed on graph, higher brightness means more pixels have
  18712. same component color value on location in graph. This is the default mode.
  18713. @item color
  18714. Gray values are displayed on graph. Surrounding pixels values which are not
  18715. present in video frame are drawn in gradient of 2 color components which are
  18716. set by option @code{x} and @code{y}. The 3rd color component is static.
  18717. @item color2
  18718. Actual color components values present in video frame are displayed on graph.
  18719. @item color3
  18720. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  18721. on graph increases value of another color component, which is luminance by
  18722. default values of @code{x} and @code{y}.
  18723. @item color4
  18724. Actual colors present in video frame are displayed on graph. If two different
  18725. colors map to same position on graph then color with higher value of component
  18726. not present in graph is picked.
  18727. @item color5
  18728. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  18729. component picked from radial gradient.
  18730. @end table
  18731. @item x
  18732. Set which color component will be represented on X-axis. Default is @code{1}.
  18733. @item y
  18734. Set which color component will be represented on Y-axis. Default is @code{2}.
  18735. @item intensity, i
  18736. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  18737. of color component which represents frequency of (X, Y) location in graph.
  18738. @item envelope, e
  18739. @table @samp
  18740. @item none
  18741. No envelope, this is default.
  18742. @item instant
  18743. Instant envelope, even darkest single pixel will be clearly highlighted.
  18744. @item peak
  18745. Hold maximum and minimum values presented in graph over time. This way you
  18746. can still spot out of range values without constantly looking at vectorscope.
  18747. @item peak+instant
  18748. Peak and instant envelope combined together.
  18749. @end table
  18750. @item graticule, g
  18751. Set what kind of graticule to draw.
  18752. @table @samp
  18753. @item none
  18754. @item green
  18755. @item color
  18756. @item invert
  18757. @end table
  18758. @item opacity, o
  18759. Set graticule opacity.
  18760. @item flags, f
  18761. Set graticule flags.
  18762. @table @samp
  18763. @item white
  18764. Draw graticule for white point.
  18765. @item black
  18766. Draw graticule for black point.
  18767. @item name
  18768. Draw color points short names.
  18769. @end table
  18770. @item bgopacity, b
  18771. Set background opacity.
  18772. @item lthreshold, l
  18773. Set low threshold for color component not represented on X or Y axis.
  18774. Values lower than this value will be ignored. Default is 0.
  18775. Note this value is multiplied with actual max possible value one pixel component
  18776. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  18777. is 0.1 * 255 = 25.
  18778. @item hthreshold, h
  18779. Set high threshold for color component not represented on X or Y axis.
  18780. Values higher than this value will be ignored. Default is 1.
  18781. Note this value is multiplied with actual max possible value one pixel component
  18782. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  18783. is 0.9 * 255 = 230.
  18784. @item colorspace, c
  18785. Set what kind of colorspace to use when drawing graticule.
  18786. @table @samp
  18787. @item auto
  18788. @item 601
  18789. @item 709
  18790. @end table
  18791. Default is auto.
  18792. @item tint0, t0
  18793. @item tint1, t1
  18794. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  18795. This means no tint, and output will remain gray.
  18796. @end table
  18797. @anchor{vidstabdetect}
  18798. @section vidstabdetect
  18799. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  18800. @ref{vidstabtransform} for pass 2.
  18801. This filter generates a file with relative translation and rotation
  18802. transform information about subsequent frames, which is then used by
  18803. the @ref{vidstabtransform} filter.
  18804. To enable compilation of this filter you need to configure FFmpeg with
  18805. @code{--enable-libvidstab}.
  18806. This filter accepts the following options:
  18807. @table @option
  18808. @item result
  18809. Set the path to the file used to write the transforms information.
  18810. Default value is @file{transforms.trf}.
  18811. @item shakiness
  18812. Set how shaky the video is and how quick the camera is. It accepts an
  18813. integer in the range 1-10, a value of 1 means little shakiness, a
  18814. value of 10 means strong shakiness. Default value is 5.
  18815. @item accuracy
  18816. Set the accuracy of the detection process. It must be a value in the
  18817. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  18818. accuracy. Default value is 15.
  18819. @item stepsize
  18820. Set stepsize of the search process. The region around minimum is
  18821. scanned with 1 pixel resolution. Default value is 6.
  18822. @item mincontrast
  18823. Set minimum contrast. Below this value a local measurement field is
  18824. discarded. Must be a floating point value in the range 0-1. Default
  18825. value is 0.3.
  18826. @item tripod
  18827. Set reference frame number for tripod mode.
  18828. If enabled, the motion of the frames is compared to a reference frame
  18829. in the filtered stream, identified by the specified number. The idea
  18830. is to compensate all movements in a more-or-less static scene and keep
  18831. the camera view absolutely still.
  18832. If set to 0, it is disabled. The frames are counted starting from 1.
  18833. @item show
  18834. Show fields and transforms in the resulting frames. It accepts an
  18835. integer in the range 0-2. Default value is 0, which disables any
  18836. visualization.
  18837. @item fileformat
  18838. Format for the transforms data file to be written.
  18839. Acceptable values are
  18840. @table @samp
  18841. @item ascii
  18842. Human-readable plain text
  18843. @item binary
  18844. Binary format, roughly 40% smaller than @code{ascii}. (@emph{default})
  18845. @end table
  18846. @end table
  18847. @subsection Examples
  18848. @itemize
  18849. @item
  18850. Use default values:
  18851. @example
  18852. vidstabdetect
  18853. @end example
  18854. @item
  18855. Analyze strongly shaky movie and put the results in file
  18856. @file{mytransforms.trf}:
  18857. @example
  18858. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  18859. @end example
  18860. @item
  18861. Visualize the result of internal transformations in the resulting
  18862. video:
  18863. @example
  18864. vidstabdetect=show=1
  18865. @end example
  18866. @item
  18867. Analyze a video with medium shakiness using @command{ffmpeg}:
  18868. @example
  18869. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  18870. @end example
  18871. @end itemize
  18872. @anchor{vidstabtransform}
  18873. @section vidstabtransform
  18874. Video stabilization/deshaking: pass 2 of 2,
  18875. see @ref{vidstabdetect} for pass 1.
  18876. Read a file with transform information for each frame and
  18877. apply/compensate them. Together with the @ref{vidstabdetect}
  18878. filter this can be used to deshake videos. See also
  18879. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  18880. the @ref{unsharp} filter, see below.
  18881. To enable compilation of this filter you need to configure FFmpeg with
  18882. @code{--enable-libvidstab}.
  18883. @subsection Options
  18884. @table @option
  18885. @item input
  18886. Set path to the file used to read the transforms. Default value is
  18887. @file{transforms.trf}.
  18888. @item smoothing
  18889. Set the number of frames (value*2 + 1) used for lowpass filtering the
  18890. camera movements. Default value is 10.
  18891. For example a number of 10 means that 21 frames are used (10 in the
  18892. past and 10 in the future) to smoothen the motion in the video. A
  18893. larger value leads to a smoother video, but limits the acceleration of
  18894. the camera (pan/tilt movements). 0 is a special case where a static
  18895. camera is simulated.
  18896. @item optalgo
  18897. Set the camera path optimization algorithm.
  18898. Accepted values are:
  18899. @table @samp
  18900. @item gauss
  18901. gaussian kernel low-pass filter on camera motion (default)
  18902. @item avg
  18903. averaging on transformations
  18904. @end table
  18905. @item maxshift
  18906. Set maximal number of pixels to translate frames. Default value is -1,
  18907. meaning no limit.
  18908. @item maxangle
  18909. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  18910. value is -1, meaning no limit.
  18911. @item crop
  18912. Specify how to deal with borders that may be visible due to movement
  18913. compensation.
  18914. Available values are:
  18915. @table @samp
  18916. @item keep
  18917. keep image information from previous frame (default)
  18918. @item black
  18919. fill the border black
  18920. @end table
  18921. @item invert
  18922. Invert transforms if set to 1. Default value is 0.
  18923. @item relative
  18924. Consider transforms as relative to previous frame if set to 1,
  18925. absolute if set to 0. Default value is 0.
  18926. @item zoom
  18927. Set percentage to zoom. A positive value will result in a zoom-in
  18928. effect, a negative value in a zoom-out effect. Default value is 0 (no
  18929. zoom).
  18930. @item optzoom
  18931. Set optimal zooming to avoid borders.
  18932. Accepted values are:
  18933. @table @samp
  18934. @item 0
  18935. disabled
  18936. @item 1
  18937. optimal static zoom value is determined (only very strong movements
  18938. will lead to visible borders) (default)
  18939. @item 2
  18940. optimal adaptive zoom value is determined (no borders will be
  18941. visible), see @option{zoomspeed}
  18942. @end table
  18943. Note that the value given at zoom is added to the one calculated here.
  18944. @item zoomspeed
  18945. Set percent to zoom maximally each frame (enabled when
  18946. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  18947. 0.25.
  18948. @item interpol
  18949. Specify type of interpolation.
  18950. Available values are:
  18951. @table @samp
  18952. @item no
  18953. no interpolation
  18954. @item linear
  18955. linear only horizontal
  18956. @item bilinear
  18957. linear in both directions (default)
  18958. @item bicubic
  18959. cubic in both directions (slow)
  18960. @end table
  18961. @item tripod
  18962. Enable virtual tripod mode if set to 1, which is equivalent to
  18963. @code{relative=0:smoothing=0}. Default value is 0.
  18964. Use also @code{tripod} option of @ref{vidstabdetect}.
  18965. @item debug
  18966. Increase log verbosity if set to 1. Also the detected global motions
  18967. are written to the temporary file @file{global_motions.trf}. Default
  18968. value is 0.
  18969. @end table
  18970. @subsection Examples
  18971. @itemize
  18972. @item
  18973. Use @command{ffmpeg} for a typical stabilization with default values:
  18974. @example
  18975. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  18976. @end example
  18977. Note the use of the @ref{unsharp} filter which is always recommended.
  18978. @item
  18979. Zoom in a bit more and load transform data from a given file:
  18980. @example
  18981. vidstabtransform=zoom=5:input="mytransforms.trf"
  18982. @end example
  18983. @item
  18984. Smoothen the video even more:
  18985. @example
  18986. vidstabtransform=smoothing=30
  18987. @end example
  18988. @end itemize
  18989. @section vflip
  18990. Flip the input video vertically.
  18991. For example, to vertically flip a video with @command{ffmpeg}:
  18992. @example
  18993. ffmpeg -i in.avi -vf "vflip" out.avi
  18994. @end example
  18995. @section vfrdet
  18996. Detect variable frame rate video.
  18997. This filter tries to detect if the input is variable or constant frame rate.
  18998. At end it will output number of frames detected as having variable delta pts,
  18999. and ones with constant delta pts.
  19000. If there was frames with variable delta, than it will also show min, max and
  19001. average delta encountered.
  19002. @section vibrance
  19003. Boost or alter saturation.
  19004. The filter accepts the following options:
  19005. @table @option
  19006. @item intensity
  19007. Set strength of boost if positive value or strength of alter if negative value.
  19008. Default is 0. Allowed range is from -2 to 2.
  19009. @item rbal
  19010. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  19011. @item gbal
  19012. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  19013. @item bbal
  19014. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  19015. @item rlum
  19016. Set the red luma coefficient.
  19017. @item glum
  19018. Set the green luma coefficient.
  19019. @item blum
  19020. Set the blue luma coefficient.
  19021. @item alternate
  19022. If @code{intensity} is negative and this is set to 1, colors will change,
  19023. otherwise colors will be less saturated, more towards gray.
  19024. @end table
  19025. @subsection Commands
  19026. This filter supports the all above options as @ref{commands}.
  19027. @section vif
  19028. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  19029. This filter takes two input videos.
  19030. Both input videos must have the same resolution and pixel format for
  19031. this filter to work correctly. Also it assumes that both inputs
  19032. have the same number of frames, which are compared one by one.
  19033. The obtained average VIF score is printed through the logging system.
  19034. The filter stores the calculated VIF score of each frame.
  19035. This filter also supports the @ref{framesync} options.
  19036. In the below example the input file @file{main.mpg} being processed is compared
  19037. with the reference file @file{ref.mpg}.
  19038. @example
  19039. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  19040. @end example
  19041. @anchor{vignette}
  19042. @section vignette
  19043. Make or reverse a natural vignetting effect.
  19044. The filter accepts the following options:
  19045. @table @option
  19046. @item angle, a
  19047. Set lens angle expression as a number of radians.
  19048. The value is clipped in the @code{[0,PI/2]} range.
  19049. Default value: @code{"PI/5"}
  19050. @item x0
  19051. @item y0
  19052. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  19053. by default.
  19054. @item mode
  19055. Set forward/backward mode.
  19056. Available modes are:
  19057. @table @samp
  19058. @item forward
  19059. The larger the distance from the central point, the darker the image becomes.
  19060. @item backward
  19061. The larger the distance from the central point, the brighter the image becomes.
  19062. This can be used to reverse a vignette effect, though there is no automatic
  19063. detection to extract the lens @option{angle} and other settings (yet). It can
  19064. also be used to create a burning effect.
  19065. @end table
  19066. Default value is @samp{forward}.
  19067. @item eval
  19068. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  19069. It accepts the following values:
  19070. @table @samp
  19071. @item init
  19072. Evaluate expressions only once during the filter initialization.
  19073. @item frame
  19074. Evaluate expressions for each incoming frame. This is way slower than the
  19075. @samp{init} mode since it requires all the scalers to be re-computed, but it
  19076. allows advanced dynamic expressions.
  19077. @end table
  19078. Default value is @samp{init}.
  19079. @item dither
  19080. Set dithering to reduce the circular banding effects. Default is @code{1}
  19081. (enabled).
  19082. @item aspect
  19083. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  19084. Setting this value to the SAR of the input will make a rectangular vignetting
  19085. following the dimensions of the video.
  19086. Default is @code{1/1}.
  19087. @end table
  19088. @subsection Expressions
  19089. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  19090. following parameters.
  19091. @table @option
  19092. @item w
  19093. @item h
  19094. input width and height
  19095. @item n
  19096. the number of input frame, starting from 0
  19097. @item pts
  19098. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  19099. @var{TB} units, NAN if undefined
  19100. @item r
  19101. frame rate of the input video, NAN if the input frame rate is unknown
  19102. @item t
  19103. the PTS (Presentation TimeStamp) of the filtered video frame,
  19104. expressed in seconds, NAN if undefined
  19105. @item tb
  19106. time base of the input video
  19107. @end table
  19108. @subsection Examples
  19109. @itemize
  19110. @item
  19111. Apply simple strong vignetting effect:
  19112. @example
  19113. vignette=PI/4
  19114. @end example
  19115. @item
  19116. Make a flickering vignetting:
  19117. @example
  19118. vignette='PI/4+random(1)*PI/50':eval=frame
  19119. @end example
  19120. @end itemize
  19121. @section vmafmotion
  19122. Obtain the average VMAF motion score of a video.
  19123. It is one of the component metrics of VMAF.
  19124. The obtained average motion score is printed through the logging system.
  19125. The filter accepts the following options:
  19126. @table @option
  19127. @item stats_file
  19128. If specified, the filter will use the named file to save the motion score of
  19129. each frame with respect to the previous frame.
  19130. When filename equals "-" the data is sent to standard output.
  19131. @end table
  19132. Example:
  19133. @example
  19134. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  19135. @end example
  19136. @anchor{vpp_amf}
  19137. @section vpp_amf
  19138. Scale (resize) and convert colorspace, transfer characteristics or color primaries for the input video, using AMD Advanced Media Framework library for hardware acceleration.
  19139. Setting the output width and height works in the same way as for the @ref{scale} filter.
  19140. The filter accepts the following options:
  19141. @table @option
  19142. @item w
  19143. @item h
  19144. Set the output video dimension expression. Default value is the input dimension.
  19145. Allows for the same expressions as the @ref{scale} filter.
  19146. @item scale_type
  19147. Sets the algorithm used for scaling:
  19148. @table @var
  19149. @item bilinear
  19150. Bilinear
  19151. This is the default.
  19152. @item bicubic
  19153. Bicubic
  19154. @end table
  19155. @item format
  19156. Controls the output pixel format. By default, or if none is specified, the input
  19157. pixel format is used.
  19158. @item force_original_aspect_ratio
  19159. @item force_divisible_by
  19160. Work the same as the identical @ref{scale} filter options.
  19161. @item reset_sar
  19162. Works the same as the identical @ref{scale} filter option.
  19163. @anchor{color_profile}
  19164. @item color_profile
  19165. Specify all color properties at once.
  19166. The accepted values are:
  19167. @table @samp
  19168. @item bt601
  19169. BT.601
  19170. @item bt709
  19171. BT.709
  19172. @item bt2020
  19173. BT.2020
  19174. @end table
  19175. @item trc
  19176. Specify output transfer characteristics.
  19177. The accepted values are:
  19178. @table @samp
  19179. @item bt709
  19180. BT.709
  19181. @item gamma22
  19182. Constant gamma of 2.2
  19183. @item gamma28
  19184. Constant gamma of 2.8
  19185. @item smpte170m
  19186. SMPTE-170M
  19187. @item smpte240m
  19188. SMPTE-240M
  19189. @item linear
  19190. Linear
  19191. @item log
  19192. LOG
  19193. @item log-sqrt
  19194. LOG_SQRT
  19195. @item iec61966-2-4
  19196. iec61966-2-4
  19197. @item bt1361-ecg
  19198. BT1361_ECG
  19199. @item iec61966-2-1
  19200. iec61966-2-1
  19201. @item bt2020-10
  19202. BT.2020 for 10-bits content
  19203. @item bt2020-12
  19204. BT.2020 for 12-bits content
  19205. @item smpte2084
  19206. SMPTE2084
  19207. @item smpte428
  19208. SMPTE428
  19209. @item arib-std-b67
  19210. ARIB_STD_B67
  19211. @end table
  19212. @item primaries
  19213. Specify output color primaries.
  19214. The accepted values are:
  19215. @table @samp
  19216. @item bt709
  19217. BT.709
  19218. @item bt470m
  19219. BT.470M
  19220. @item bt470bg
  19221. BT.470BG or BT.601-6 625
  19222. @item smpte170m
  19223. SMPTE-170M or BT.601-6 525
  19224. @item smpte240m
  19225. SMPTE-240M
  19226. @item film
  19227. film
  19228. @item bt2020
  19229. BT.2020
  19230. @item smpte428
  19231. SMPTE-428
  19232. @item smpte431
  19233. SMPTE-431
  19234. @item smpte432
  19235. SMPTE-432
  19236. @item jedec-p22
  19237. JEDEC P22 phosphors
  19238. @end table
  19239. @end table
  19240. @subsection Examples
  19241. @itemize
  19242. @item
  19243. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  19244. @example
  19245. vpp_amf=-2:720:format=yuv420p
  19246. @end example
  19247. @item
  19248. Upscale to 4K and change color profile to bt2020.
  19249. @example
  19250. vpp_amf=4096:2160:color_profile=bt2020
  19251. @end example
  19252. @end itemize
  19253. @anchor{vstack}
  19254. @section vstack
  19255. Stack input videos vertically.
  19256. All streams must be of same pixel format and of same width.
  19257. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  19258. to create same output.
  19259. The filter accepts the following options:
  19260. @table @option
  19261. @item inputs
  19262. Set number of input streams. Default is 2.
  19263. @item shortest
  19264. If set to 1, force the output to terminate when the shortest input
  19265. terminates. Default value is 0.
  19266. @end table
  19267. @section w3fdif
  19268. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  19269. Deinterlacing Filter").
  19270. Based on the process described by Martin Weston for BBC R&D, and
  19271. implemented based on the de-interlace algorithm written by Jim
  19272. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  19273. uses filter coefficients calculated by BBC R&D.
  19274. This filter uses field-dominance information in frame to decide which
  19275. of each pair of fields to place first in the output.
  19276. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  19277. There are two sets of filter coefficients, so called "simple"
  19278. and "complex". Which set of filter coefficients is used can
  19279. be set by passing an optional parameter:
  19280. @table @option
  19281. @item filter
  19282. Set the interlacing filter coefficients. Accepts one of the following values:
  19283. @table @samp
  19284. @item simple
  19285. Simple filter coefficient set.
  19286. @item complex
  19287. More-complex filter coefficient set.
  19288. @end table
  19289. Default value is @samp{complex}.
  19290. @item mode
  19291. The interlacing mode to adopt. It accepts one of the following values:
  19292. @table @option
  19293. @item frame
  19294. Output one frame for each frame.
  19295. @item field
  19296. Output one frame for each field.
  19297. @end table
  19298. The default value is @code{field}.
  19299. @item parity
  19300. The picture field parity assumed for the input interlaced video. It accepts one
  19301. of the following values:
  19302. @table @option
  19303. @item tff
  19304. Assume the top field is first.
  19305. @item bff
  19306. Assume the bottom field is first.
  19307. @item auto
  19308. Enable automatic detection of field parity.
  19309. @end table
  19310. The default value is @code{auto}.
  19311. If the interlacing is unknown or the decoder does not export this information,
  19312. top field first will be assumed.
  19313. @item deint
  19314. Specify which frames to deinterlace. Accepts one of the following values:
  19315. @table @samp
  19316. @item all
  19317. Deinterlace all frames,
  19318. @item interlaced
  19319. Only deinterlace frames marked as interlaced.
  19320. @end table
  19321. Default value is @samp{all}.
  19322. @end table
  19323. @subsection Commands
  19324. This filter supports same @ref{commands} as options.
  19325. @section waveform
  19326. Video waveform monitor.
  19327. The waveform monitor plots color component intensity. By default luma
  19328. only. Each column of the waveform corresponds to a column of pixels in the
  19329. source video.
  19330. It accepts the following options:
  19331. @table @option
  19332. @item mode, m
  19333. Can be either @code{row}, or @code{column}. Default is @code{column}.
  19334. In row mode, the graph on the left side represents color component value 0 and
  19335. the right side represents value = 255. In column mode, the top side represents
  19336. color component value = 0 and bottom side represents value = 255.
  19337. @item intensity, i
  19338. Set intensity. Smaller values are useful to find out how many values of the same
  19339. luminance are distributed across input rows/columns.
  19340. Default value is @code{0.04}. Allowed range is [0, 1].
  19341. @item mirror, r
  19342. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  19343. In mirrored mode, higher values will be represented on the left
  19344. side for @code{row} mode and at the top for @code{column} mode. Default is
  19345. @code{1} (mirrored).
  19346. @item display, d
  19347. Set display mode.
  19348. It accepts the following values:
  19349. @table @samp
  19350. @item overlay
  19351. Presents information identical to that in the @code{parade}, except
  19352. that the graphs representing color components are superimposed directly
  19353. over one another.
  19354. This display mode makes it easier to spot relative differences or similarities
  19355. in overlapping areas of the color components that are supposed to be identical,
  19356. such as neutral whites, grays, or blacks.
  19357. @item stack
  19358. Display separate graph for the color components side by side in
  19359. @code{row} mode or one below the other in @code{column} mode.
  19360. @item parade
  19361. Display separate graph for the color components side by side in
  19362. @code{column} mode or one below the other in @code{row} mode.
  19363. Using this display mode makes it easy to spot color casts in the highlights
  19364. and shadows of an image, by comparing the contours of the top and the bottom
  19365. graphs of each waveform. Since whites, grays, and blacks are characterized
  19366. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  19367. should display three waveforms of roughly equal width/height. If not, the
  19368. correction is easy to perform by making level adjustments the three waveforms.
  19369. @end table
  19370. Default is @code{stack}.
  19371. @item components, c
  19372. Set which color components to display. Default is 1, which means only luma
  19373. or red color component if input is in RGB colorspace. If is set for example to
  19374. 7 it will display all 3 (if) available color components.
  19375. @item envelope, e
  19376. @table @samp
  19377. @item none
  19378. No envelope, this is default.
  19379. @item instant
  19380. Instant envelope, minimum and maximum values presented in graph will be easily
  19381. visible even with small @code{step} value.
  19382. @item peak
  19383. Hold minimum and maximum values presented in graph across time. This way you
  19384. can still spot out of range values without constantly looking at waveforms.
  19385. @item peak+instant
  19386. Peak and instant envelope combined together.
  19387. @end table
  19388. @item filter, f
  19389. @table @samp
  19390. @item lowpass
  19391. No filtering, this is default.
  19392. @item flat
  19393. Luma and chroma combined together.
  19394. @item aflat
  19395. Similar as above, but shows difference between blue and red chroma.
  19396. @item xflat
  19397. Similar as above, but use different colors.
  19398. @item yflat
  19399. Similar as above, but again with different colors.
  19400. @item chroma
  19401. Displays only chroma.
  19402. @item color
  19403. Displays actual color value on waveform.
  19404. @item acolor
  19405. Similar as above, but with luma showing frequency of chroma values.
  19406. @end table
  19407. @item graticule, g
  19408. Set which graticule to display.
  19409. @table @samp
  19410. @item none
  19411. Do not display graticule.
  19412. @item green
  19413. Display green graticule showing legal broadcast ranges.
  19414. @item orange
  19415. Display orange graticule showing legal broadcast ranges.
  19416. @item invert
  19417. Display invert graticule showing legal broadcast ranges.
  19418. @end table
  19419. @item opacity, o
  19420. Set graticule opacity.
  19421. @item flags, fl
  19422. Set graticule flags.
  19423. @table @samp
  19424. @item numbers
  19425. Draw numbers above lines. By default enabled.
  19426. @item dots
  19427. Draw dots instead of lines.
  19428. @end table
  19429. @item scale, s
  19430. Set scale used for displaying graticule.
  19431. @table @samp
  19432. @item digital
  19433. @item millivolts
  19434. @item ire
  19435. @end table
  19436. Default is digital.
  19437. @item bgopacity, b
  19438. Set background opacity.
  19439. @item tint0, t0
  19440. @item tint1, t1
  19441. Set tint for output.
  19442. Only used with lowpass filter and when display is not overlay and input
  19443. pixel formats are not RGB.
  19444. @item fitmode, fm
  19445. Set sample aspect ratio of video output frames.
  19446. Can be used to configure waveform so it is not
  19447. stretched too much in one of directions.
  19448. @table @samp
  19449. @item none
  19450. Set sample aspect ration to 1/1.
  19451. @item size
  19452. Set sample aspect ratio to match input size of video
  19453. @end table
  19454. Default is @samp{none}.
  19455. @item input
  19456. Set input formats for filter to pick from.
  19457. Can be @samp{all}, for selecting from all available formats,
  19458. or @samp{first}, for selecting first available format.
  19459. Default is @samp{first}.
  19460. @end table
  19461. @section weave, doubleweave
  19462. The @code{weave} takes a field-based video input and join
  19463. each two sequential fields into single frame, producing a new double
  19464. height clip with half the frame rate and half the frame count.
  19465. The @code{doubleweave} works same as @code{weave} but without
  19466. halving frame rate and frame count.
  19467. It accepts the following option:
  19468. @table @option
  19469. @item first_field
  19470. Set first field. Available values are:
  19471. @table @samp
  19472. @item top, t
  19473. Set the frame as top-field-first.
  19474. @item bottom, b
  19475. Set the frame as bottom-field-first.
  19476. @end table
  19477. @end table
  19478. @subsection Examples
  19479. @itemize
  19480. @item
  19481. Interlace video using @ref{select} and @ref{separatefields} filter:
  19482. @example
  19483. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  19484. @end example
  19485. @end itemize
  19486. @section xbr
  19487. Apply the xBR high-quality magnification filter which is designed for pixel
  19488. art. It follows a set of edge-detection rules, see
  19489. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  19490. It accepts the following option:
  19491. @table @option
  19492. @item n
  19493. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  19494. @code{3xBR} and @code{4} for @code{4xBR}.
  19495. Default is @code{3}.
  19496. @end table
  19497. @section xcorrelate
  19498. Apply normalized cross-correlation between first and second input video stream.
  19499. Second input video stream dimensions must be lower than first input video stream.
  19500. The filter accepts the following options:
  19501. @table @option
  19502. @item planes
  19503. Set which planes to process.
  19504. @item secondary
  19505. Set which secondary video frames will be processed from second input video stream,
  19506. can be @var{first} or @var{all}. Default is @var{all}.
  19507. @end table
  19508. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  19509. @section xfade
  19510. Apply cross fade from one input video stream to another input video stream.
  19511. The cross fade is applied for specified duration.
  19512. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  19513. frame rate and timebase.
  19514. The filter accepts the following options:
  19515. @table @option
  19516. @item transition
  19517. Set one of available transition effects:
  19518. @table @samp
  19519. @item custom
  19520. @item fade
  19521. @item wipeleft
  19522. @item wiperight
  19523. @item wipeup
  19524. @item wipedown
  19525. @item slideleft
  19526. @item slideright
  19527. @item slideup
  19528. @item slidedown
  19529. @item circlecrop
  19530. @item rectcrop
  19531. @item distance
  19532. @item fadeblack
  19533. @item fadewhite
  19534. @item radial
  19535. @item smoothleft
  19536. @item smoothright
  19537. @item smoothup
  19538. @item smoothdown
  19539. @item circleopen
  19540. @item circleclose
  19541. @item vertopen
  19542. @item vertclose
  19543. @item horzopen
  19544. @item horzclose
  19545. @item dissolve
  19546. @item pixelize
  19547. @item diagtl
  19548. @item diagtr
  19549. @item diagbl
  19550. @item diagbr
  19551. @item hlslice
  19552. @item hrslice
  19553. @item vuslice
  19554. @item vdslice
  19555. @item hblur
  19556. @item fadegrays
  19557. @item wipetl
  19558. @item wipetr
  19559. @item wipebl
  19560. @item wipebr
  19561. @item squeezeh
  19562. @item squeezev
  19563. @item zoomin
  19564. @item fadefast
  19565. @item fadeslow
  19566. @item hlwind
  19567. @item hrwind
  19568. @item vuwind
  19569. @item vdwind
  19570. @item coverleft
  19571. @item coverright
  19572. @item coverup
  19573. @item coverdown
  19574. @item revealleft
  19575. @item revealright
  19576. @item revealup
  19577. @item revealdown
  19578. @end table
  19579. Default transition effect is fade.
  19580. @item duration
  19581. Set cross fade duration in seconds.
  19582. Range is 0 to 60 seconds.
  19583. Default duration is 1 second.
  19584. @item offset
  19585. Set cross fade start relative to first input stream in seconds.
  19586. Default offset is 0.
  19587. @item expr
  19588. Set expression for custom transition effect.
  19589. The expressions can use the following variables and functions:
  19590. @table @option
  19591. @item X
  19592. @item Y
  19593. The coordinates of the current sample.
  19594. @item W
  19595. @item H
  19596. The width and height of the image.
  19597. @item P
  19598. Progress of transition effect.
  19599. @item PLANE
  19600. Currently processed plane.
  19601. @item A
  19602. Return value of first input at current location and plane.
  19603. @item B
  19604. Return value of second input at current location and plane.
  19605. @item a0(x, y)
  19606. @item a1(x, y)
  19607. @item a2(x, y)
  19608. @item a3(x, y)
  19609. Return the value of the pixel at location (@var{x},@var{y}) of the
  19610. first/second/third/fourth component of first input.
  19611. @item b0(x, y)
  19612. @item b1(x, y)
  19613. @item b2(x, y)
  19614. @item b3(x, y)
  19615. Return the value of the pixel at location (@var{x},@var{y}) of the
  19616. first/second/third/fourth component of second input.
  19617. @end table
  19618. @end table
  19619. @subsection Examples
  19620. @itemize
  19621. @item
  19622. Cross fade from one input video to another input video, with fade transition and duration of transition
  19623. of 2 seconds starting at offset of 5 seconds:
  19624. @example
  19625. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  19626. @end example
  19627. @end itemize
  19628. @section xmedian
  19629. Pick median pixels from several input videos.
  19630. The filter accepts the following options:
  19631. @table @option
  19632. @item inputs
  19633. Set number of inputs.
  19634. Default is 3. Allowed range is from 3 to 255.
  19635. If number of inputs is even number, than result will be mean value between two median values.
  19636. @item planes
  19637. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  19638. @item percentile
  19639. Set median percentile. Default value is @code{0.5}.
  19640. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  19641. minimum values, and @code{1} maximum values.
  19642. @end table
  19643. @subsection Commands
  19644. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  19645. @anchor{xpsnr}
  19646. @section xpsnr
  19647. Obtain the average (across all input frames) and minimum (across all color plane averages)
  19648. eXtended Perceptually weighted peak Signal-to-Noise Ratio (XPSNR) between two input videos.
  19649. The XPSNR is a low-complexity psychovisually motivated distortion measurement algorithm for
  19650. assessing the difference between two video streams or images. This is especially useful for
  19651. objectively quantifying the distortions caused by video and image codecs, as an alternative
  19652. to a formal subjective test. The logarithmic XPSNR output values are in a similar range as
  19653. those of traditional @ref{psnr} assessments but better reflect human impressions of visual
  19654. coding quality. More details on the XPSNR measure, which essentially represents a blockwise
  19655. weighted variant of the PSNR measure, can be found in the following freely available papers:
  19656. @itemize
  19657. @item
  19658. C. R. Helmrich, M. Siekmann, S. Becker, S. Bosse, D. Marpe, and T. Wiegand, "XPSNR: A
  19659. Low-Complexity Extension of the Perceptually Weighted Peak Signal-to-Noise Ratio for
  19660. High-Resolution Video Quality Assessment," in Proc. IEEE Int. Conf. Acoustics, Speech,
  19661. Sig. Process. (ICASSP), virt./online, May 2020. @url{www.ecodis.de/xpsnr.htm}
  19662. @item
  19663. C. R. Helmrich, S. Bosse, H. Schwarz, D. Marpe, and T. Wiegand, "A Study of the
  19664. Extended Perceptually Weighted Peak Signal-to-Noise Ratio (XPSNR) for Video Compression
  19665. with Different Resolutions and Bit Depths," ITU Journal: ICT Discoveries, vol. 3, no.
  19666. 1, pp. 65 - 72, May 2020. @url{http://handle.itu.int/11.1002/pub/8153d78b-en}
  19667. @end itemize
  19668. When publishing the results of XPSNR assessments obtained using, e.g., this FFmpeg filter, a
  19669. reference to the above papers as a means of documentation is strongly encouraged. The filter
  19670. requires two input videos. The first input is considered a (usually not distorted) reference
  19671. source and is passed unchanged to the output, whereas the second input is a (distorted) test
  19672. signal. Except for the bit depth, these two video inputs must have the same pixel format. In
  19673. addition, for best performance, both compared input videos should be in YCbCr color format.
  19674. The obtained overall XPSNR values mentioned above are printed through the logging system. In
  19675. case of input with multiple color planes, we suggest reporting of the minimum XPSNR average.
  19676. The following parameter, which behaves like the one for the @ref{psnr} filter, is accepted:
  19677. @table @option
  19678. @item stats_file, f
  19679. If specified, the filter will use the named file to save the XPSNR value of each individual
  19680. frame and color plane. When the file name equals "-", that data is sent to standard output.
  19681. @end table
  19682. This filter also supports the @ref{framesync} options.
  19683. @subsection Examples
  19684. @itemize
  19685. @item
  19686. XPSNR analysis of two 1080p HD videos, ref_source.yuv and test_video.yuv, both at 24 frames
  19687. per second, with color format 4:2:0, bit depth 8, and output of a logfile named "xpsnr.log":
  19688. @example
  19689. ffmpeg -s 1920x1080 -framerate 24 -pix_fmt yuv420p -i ref_source.yuv -s 1920x1080 -framerate
  19690. 24 -pix_fmt yuv420p -i test_video.yuv -lavfi xpsnr="stats_file=xpsnr.log" -f null -
  19691. @end example
  19692. @item
  19693. XPSNR analysis of two 2160p UHD videos, ref_source.yuv with bit depth 8 and test_video.yuv
  19694. with bit depth 10, both at 60 frames per second with color format 4:2:0, no logfile output:
  19695. @example
  19696. ffmpeg -s 3840x2160 -framerate 60 -pix_fmt yuv420p -i ref_source.yuv -s 3840x2160 -framerate
  19697. 60 -pix_fmt yuv420p10le -i test_video.yuv -lavfi xpsnr="stats_file=-" -f null -
  19698. @end example
  19699. @end itemize
  19700. @anchor{xstack}
  19701. @section xstack
  19702. Stack video inputs into custom layout.
  19703. All streams must be of same pixel format.
  19704. The filter accepts the following options:
  19705. @table @option
  19706. @item inputs
  19707. Set number of input streams. Default is 2.
  19708. @item layout
  19709. Specify layout of inputs.
  19710. This option requires the desired layout configuration to be explicitly set by the user.
  19711. This sets position of each video input in output. Each input
  19712. is separated by '|'.
  19713. The first number represents the column, and the second number represents the row.
  19714. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  19715. where X is video input from which to take width or height.
  19716. Multiple values can be used when separated by '+'. In such
  19717. case values are summed together.
  19718. Note that if inputs are of different sizes gaps may appear, as not all of
  19719. the output video frame will be filled. Similarly, videos can overlap each
  19720. other if their position doesn't leave enough space for the full frame of
  19721. adjoining videos.
  19722. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  19723. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  19724. the user. Either @code{grid} or @code{layout} can be specified at a time.
  19725. Specifying both will result in an error.
  19726. @item grid
  19727. Specify a fixed size grid of inputs.
  19728. This option is used to create a fixed size grid of the input streams. Set the
  19729. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  19730. input streams and they will be arranged as a grid with @code{ROWS} rows and
  19731. @code{COLUMNS} columns. When using this option, each input stream within a row
  19732. must have the same height and all the rows must have the same width.
  19733. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  19734. set to @code{ROWS * COLUMNS}.
  19735. For 2 inputs, a default grid of @code{2x1} (equivalent to
  19736. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  19737. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  19738. Specifying both will result in an error.
  19739. @item shortest
  19740. If set to 1, force the output to terminate when the shortest input
  19741. terminates. Default value is 0.
  19742. @item fill
  19743. If set to valid color, all unused pixels will be filled with that color.
  19744. By default fill is set to none, so it is disabled.
  19745. @end table
  19746. @subsection Examples
  19747. @itemize
  19748. @item
  19749. Display 4 inputs into 2x2 grid.
  19750. Layout:
  19751. @example
  19752. input1(0, 0) | input3(w0, 0)
  19753. input2(0, h0) | input4(w0, h0)
  19754. @end example
  19755. @example
  19756. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  19757. @end example
  19758. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19759. @item
  19760. Display 4 inputs into 1x4 grid.
  19761. Layout:
  19762. @example
  19763. input1(0, 0)
  19764. input2(0, h0)
  19765. input3(0, h0+h1)
  19766. input4(0, h0+h1+h2)
  19767. @end example
  19768. @example
  19769. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  19770. @end example
  19771. Note that if inputs are of different widths, unused space will appear.
  19772. @item
  19773. Display 9 inputs into 3x3 grid.
  19774. Layout:
  19775. @example
  19776. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  19777. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  19778. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  19779. @end example
  19780. @example
  19781. 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
  19782. @end example
  19783. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19784. @item
  19785. Display 16 inputs into 4x4 grid.
  19786. Layout:
  19787. @example
  19788. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  19789. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  19790. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  19791. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  19792. @end example
  19793. @example
  19794. 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|
  19795. 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
  19796. @end example
  19797. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19798. @end itemize
  19799. @anchor{yadif}
  19800. @section yadif
  19801. Deinterlace the input video ("yadif" means "yet another deinterlacing
  19802. filter").
  19803. It accepts the following parameters:
  19804. @table @option
  19805. @item mode
  19806. The interlacing mode to adopt. It accepts one of the following values:
  19807. @table @option
  19808. @item 0, send_frame
  19809. Output one frame for each frame.
  19810. @item 1, send_field
  19811. Output one frame for each field.
  19812. @item 2, send_frame_nospatial
  19813. Like @code{send_frame}, but it skips the spatial interlacing check.
  19814. @item 3, send_field_nospatial
  19815. Like @code{send_field}, but it skips the spatial interlacing check.
  19816. @end table
  19817. The default value is @code{send_frame}.
  19818. @item parity
  19819. The picture field parity assumed for the input interlaced video. It accepts one
  19820. of the following values:
  19821. @table @option
  19822. @item 0, tff
  19823. Assume the top field is first.
  19824. @item 1, bff
  19825. Assume the bottom field is first.
  19826. @item -1, auto
  19827. Enable automatic detection of field parity.
  19828. @end table
  19829. The default value is @code{auto}.
  19830. If the interlacing is unknown or the decoder does not export this information,
  19831. top field first will be assumed.
  19832. @item deint
  19833. Specify which frames to deinterlace. Accepts one of the following
  19834. values:
  19835. @table @option
  19836. @item 0, all
  19837. Deinterlace all frames.
  19838. @item 1, interlaced
  19839. Only deinterlace frames marked as interlaced.
  19840. @end table
  19841. The default value is @code{all}.
  19842. @end table
  19843. @section yaepblur
  19844. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  19845. The algorithm is described in
  19846. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  19847. It accepts the following parameters:
  19848. @table @option
  19849. @item radius, r
  19850. Set the window radius. Default value is 3.
  19851. @item planes, p
  19852. Set which planes to filter. Default is only the first plane.
  19853. @item sigma, s
  19854. Set blur strength. Default value is 128.
  19855. @end table
  19856. @subsection Commands
  19857. This filter supports same @ref{commands} as options.
  19858. @section zoompan
  19859. Apply Zoom & Pan effect.
  19860. This filter accepts the following options:
  19861. @table @option
  19862. @item zoom, z
  19863. Set the zoom expression. Range is 1-10. Default is 1.
  19864. @item x
  19865. @item y
  19866. Set the x and y expression. Default is 0.
  19867. @item d
  19868. Set the duration expression in number of frames.
  19869. This sets for how many number of frames effect will last for
  19870. single input image. Default is 90.
  19871. @item s
  19872. Set the output image size, default is 'hd720'.
  19873. @item fps
  19874. Set the output frame rate, default is '25'.
  19875. @end table
  19876. Each expression can contain the following constants:
  19877. @table @option
  19878. @item in_w, iw
  19879. Input width.
  19880. @item in_h, ih
  19881. Input height.
  19882. @item out_w, ow
  19883. Output width.
  19884. @item out_h, oh
  19885. Output height.
  19886. @item in
  19887. Input frame count.
  19888. @item on
  19889. Output frame count.
  19890. @item in_time, it
  19891. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  19892. @item out_time, time, ot
  19893. The output timestamp expressed in seconds.
  19894. @item x
  19895. @item y
  19896. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  19897. for current input frame.
  19898. @item px
  19899. @item py
  19900. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  19901. not yet such frame (first input frame).
  19902. @item zoom
  19903. Last calculated zoom from 'z' expression for current input frame.
  19904. @item pzoom
  19905. Last calculated zoom of last output frame of previous input frame.
  19906. @item duration
  19907. Number of output frames for current input frame. Calculated from 'd' expression
  19908. for each input frame.
  19909. @item pduration
  19910. number of output frames created for previous input frame
  19911. @item a
  19912. Rational number: input width / input height
  19913. @item sar
  19914. sample aspect ratio
  19915. @item dar
  19916. display aspect ratio
  19917. @end table
  19918. @subsection Examples
  19919. @itemize
  19920. @item
  19921. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  19922. @example
  19923. 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
  19924. @end example
  19925. @item
  19926. Zoom in up to 1.5x and pan always at center of picture:
  19927. @example
  19928. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19929. @end example
  19930. @item
  19931. Same as above but without pausing:
  19932. @example
  19933. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19934. @end example
  19935. @item
  19936. Zoom in 2x into center of picture only for the first second of the input video:
  19937. @example
  19938. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  19939. @end example
  19940. @end itemize
  19941. @anchor{zscale}
  19942. @section zscale
  19943. Scale (resize) the input video, using the z.lib library:
  19944. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  19945. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  19946. The zscale filter forces the output display aspect ratio to be the same
  19947. as the input, by changing the output sample aspect ratio.
  19948. If the input image format is different from the format requested by
  19949. the next filter, the zscale filter will convert the input to the
  19950. requested format.
  19951. @subsection Options
  19952. The filter accepts the following options.
  19953. @table @option
  19954. @item width, w
  19955. @item height, h
  19956. Set the output video dimension expression. Default value is the input
  19957. dimension.
  19958. If the @var{width} or @var{w} value is 0, the input width is used for
  19959. the output. If the @var{height} or @var{h} value is 0, the input height
  19960. is used for the output.
  19961. If one and only one of the values is -n with n >= 1, the zscale filter
  19962. will use a value that maintains the aspect ratio of the input image,
  19963. calculated from the other specified dimension. After that it will,
  19964. however, make sure that the calculated dimension is divisible by n and
  19965. adjust the value if necessary.
  19966. If both values are -n with n >= 1, the behavior will be identical to
  19967. both values being set to 0 as previously detailed.
  19968. See below for the list of accepted constants for use in the dimension
  19969. expression.
  19970. @item size, s
  19971. Set the video size. For the syntax of this option, check the
  19972. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  19973. @item dither, d
  19974. Set the dither type.
  19975. Possible values are:
  19976. @table @var
  19977. @item none
  19978. @item ordered
  19979. @item random
  19980. @item error_diffusion
  19981. @end table
  19982. Default is none.
  19983. @item filter, f
  19984. Set the resize filter type.
  19985. Possible values are:
  19986. @table @var
  19987. @item point
  19988. @item bilinear
  19989. @item bicubic
  19990. @item spline16
  19991. @item spline36
  19992. @item lanczos
  19993. @end table
  19994. Default is bilinear.
  19995. @item range, r
  19996. Set the color range.
  19997. Possible values are:
  19998. @table @var
  19999. @item input
  20000. @item limited
  20001. @item full
  20002. @end table
  20003. Default is same as input.
  20004. @item primaries, p
  20005. Set the color primaries.
  20006. Possible values are:
  20007. @table @var
  20008. @item input
  20009. @item 709
  20010. @item unspecified
  20011. @item 170m
  20012. @item 240m
  20013. @item 2020
  20014. @end table
  20015. Default is same as input.
  20016. @item transfer, t
  20017. Set the transfer characteristics.
  20018. Possible values are:
  20019. @table @var
  20020. @item input
  20021. @item 709
  20022. @item unspecified
  20023. @item 601
  20024. @item linear
  20025. @item 2020_10
  20026. @item 2020_12
  20027. @item smpte2084
  20028. @item iec61966-2-1
  20029. @item arib-std-b67
  20030. @end table
  20031. Default is same as input.
  20032. @item matrix, m
  20033. Set the colorspace matrix.
  20034. Possible value are:
  20035. @table @var
  20036. @item input
  20037. @item 709
  20038. @item unspecified
  20039. @item 470bg
  20040. @item 170m
  20041. @item 2020_ncl
  20042. @item 2020_cl
  20043. @end table
  20044. Default is same as input.
  20045. @item rangein, rin
  20046. Set the input color range.
  20047. Possible values are:
  20048. @table @var
  20049. @item input
  20050. @item limited
  20051. @item full
  20052. @end table
  20053. Default is same as input.
  20054. @item primariesin, pin
  20055. Set the input color primaries.
  20056. Possible values are:
  20057. @table @var
  20058. @item input
  20059. @item 709
  20060. @item unspecified
  20061. @item 170m
  20062. @item 240m
  20063. @item 2020
  20064. @end table
  20065. Default is same as input.
  20066. @item transferin, tin
  20067. Set the input transfer characteristics.
  20068. Possible values are:
  20069. @table @var
  20070. @item input
  20071. @item 709
  20072. @item unspecified
  20073. @item 601
  20074. @item linear
  20075. @item 2020_10
  20076. @item 2020_12
  20077. @end table
  20078. Default is same as input.
  20079. @item matrixin, min
  20080. Set the input colorspace matrix.
  20081. Possible value are:
  20082. @table @var
  20083. @item input
  20084. @item 709
  20085. @item unspecified
  20086. @item 470bg
  20087. @item 170m
  20088. @item 2020_ncl
  20089. @item 2020_cl
  20090. @end table
  20091. @item chromal, c
  20092. Set the output chroma location.
  20093. Possible values are:
  20094. @table @var
  20095. @item input
  20096. @item left
  20097. @item center
  20098. @item topleft
  20099. @item top
  20100. @item bottomleft
  20101. @item bottom
  20102. @end table
  20103. @item chromalin, cin
  20104. Set the input chroma location.
  20105. Possible values are:
  20106. @table @var
  20107. @item input
  20108. @item left
  20109. @item center
  20110. @item topleft
  20111. @item top
  20112. @item bottomleft
  20113. @item bottom
  20114. @end table
  20115. @item npl
  20116. Set the nominal peak luminance.
  20117. @item param_a
  20118. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  20119. filter taps for lanczos.
  20120. @item param_b
  20121. Parameter B for scaling filters. Parameter "c" for bicubic.
  20122. @end table
  20123. The values of the @option{w} and @option{h} options are expressions
  20124. containing the following constants:
  20125. @table @var
  20126. @item in_w
  20127. @item in_h
  20128. The input width and height
  20129. @item iw
  20130. @item ih
  20131. These are the same as @var{in_w} and @var{in_h}.
  20132. @item out_w
  20133. @item out_h
  20134. The output (scaled) width and height
  20135. @item ow
  20136. @item oh
  20137. These are the same as @var{out_w} and @var{out_h}
  20138. @item a
  20139. The same as @var{iw} / @var{ih}
  20140. @item sar
  20141. input sample aspect ratio
  20142. @item dar
  20143. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  20144. @item hsub
  20145. @item vsub
  20146. horizontal and vertical input chroma subsample values. For example for the
  20147. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20148. @item ohsub
  20149. @item ovsub
  20150. horizontal and vertical output chroma subsample values. For example for the
  20151. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20152. @end table
  20153. @subsection Commands
  20154. This filter supports the following commands:
  20155. @table @option
  20156. @item width, w
  20157. @item height, h
  20158. Set the output video dimension expression.
  20159. The command accepts the same syntax of the corresponding option.
  20160. If the specified expression is not valid, it is kept at its current
  20161. value.
  20162. @end table
  20163. @c man end VIDEO FILTERS
  20164. @chapter CUDA Video Filters
  20165. @c man begin CUDA Video Filters
  20166. To enable CUDA and/or NPP filters please refer to configuration guidelines for @ref{CUDA} and for @ref{CUDA NPP} filters.
  20167. Running CUDA filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20168. @table @option
  20169. @item -init_hw_device cuda[=@var{name}][:@var{device}[,@var{key=value}...]]
  20170. Initialise a new hardware device of type @var{cuda} called @var{name}, using the
  20171. given device parameters.
  20172. @item -filter_hw_device @var{name}
  20173. Pass the hardware device called @var{name} to all filters in any filter graph.
  20174. @end table
  20175. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20176. @itemize
  20177. @item
  20178. Example of initializing second CUDA device on the system and running scale_cuda and bilateral_cuda filters.
  20179. @example
  20180. ./ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -init_hw_device cuda:1 -filter_complex \
  20181. "[0:v]scale_cuda=format=yuv444p[scaled_video];[scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  20182. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  20183. @end example
  20184. @end itemize
  20185. Since CUDA filters operate exclusively on GPU memory, frame data must sometimes be uploaded (@ref{hwupload}) to hardware surfaces associated with the appropriate CUDA device before processing, and downloaded (@ref{hwdownload}) back to normal memory afterward, if required. Whether @ref{hwupload} or @ref{hwdownload} is necessary depends on the specific workflow:
  20186. @itemize
  20187. @item If the input frames are already in GPU memory (e.g., when using @code{-hwaccel cuda} or @code{-hwaccel_output_format cuda}), explicit use of @ref{hwupload} is not needed, as the data is already in the appropriate memory space.
  20188. @item If the input frames are in CPU memory (e.g., software-decoded frames or frames processed by CPU-based filters), it is necessary to use @ref{hwupload} to transfer the data to GPU memory for CUDA processing.
  20189. @item If the output of the CUDA filters needs to be further processed by software-based filters or saved in a format not supported by GPU-based encoders, @ref{hwdownload} is required to transfer the data back to CPU memory.
  20190. @end itemize
  20191. Note that @ref{hwupload} uploads data to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before @ref{hwupload} to ensure the input is in the correct format. Similarly, @ref{hwdownload} may not support all output formats, so an additional @ref{format} filter may need to be inserted immediately after @ref{hwdownload} in the filter graph to ensure compatibility.
  20192. @anchor{CUDA}
  20193. @section CUDA
  20194. Below is a description of the currently available Nvidia CUDA video filters.
  20195. Prerequisites:
  20196. @itemize
  20197. @item Install Nvidia CUDA Toolkit
  20198. @end itemize
  20199. Note: If FFmpeg detects the Nvidia CUDA Toolkit during configuration, it will enable CUDA filters automatically without requiring any additional flags. If you want to explicitly enable them, use the following options:
  20200. @itemize
  20201. @item Configure FFmpeg with @code{--enable-cuda-nvcc --enable-nonfree}.
  20202. @item Configure FFmpeg with @code{--enable-cuda-llvm}. Additional requirement: @code{llvm} lib must be installed.
  20203. @end itemize
  20204. @subsection bilateral_cuda
  20205. CUDA accelerated bilateral filter, an edge preserving filter.
  20206. This filter is mathematically accurate thanks to the use of GPU acceleration.
  20207. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  20208. The filter accepts the following options:
  20209. @table @option
  20210. @item sigmaS
  20211. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  20212. Allowed range is 0.1 to 512. Default is 0.1.
  20213. @item sigmaR
  20214. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  20215. Allowed range is 0.1 to 512. Default is 0.1.
  20216. @item window_size
  20217. Set window size of the bilateral function to determine the number of neighbours to loop on.
  20218. If the number entered is even, one will be added automatically.
  20219. Allowed range is 1 to 255. Default is 1.
  20220. @end table
  20221. @subsubsection Examples
  20222. @itemize
  20223. @item
  20224. Apply the bilateral filter on a video.
  20225. @example
  20226. ./ffmpeg -v verbose \
  20227. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  20228. -init_hw_device cuda \
  20229. -filter_complex \
  20230. " \
  20231. [0:v]scale_cuda=format=yuv444p[scaled_video];
  20232. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  20233. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  20234. @end example
  20235. @end itemize
  20236. @subsection bwdif_cuda
  20237. Deinterlace the input video using the @ref{bwdif} algorithm, but implemented
  20238. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  20239. and/or nvenc.
  20240. It accepts the following parameters:
  20241. @table @option
  20242. @item mode
  20243. The interlacing mode to adopt. It accepts one of the following values:
  20244. @table @option
  20245. @item 0, send_frame
  20246. Output one frame for each frame.
  20247. @item 1, send_field
  20248. Output one frame for each field.
  20249. @end table
  20250. The default value is @code{send_field}.
  20251. @item parity
  20252. The picture field parity assumed for the input interlaced video. It accepts one
  20253. of the following values:
  20254. @table @option
  20255. @item 0, tff
  20256. Assume the top field is first.
  20257. @item 1, bff
  20258. Assume the bottom field is first.
  20259. @item -1, auto
  20260. Enable automatic detection of field parity.
  20261. @end table
  20262. The default value is @code{auto}.
  20263. If the interlacing is unknown or the decoder does not export this information,
  20264. top field first will be assumed.
  20265. @item deint
  20266. Specify which frames to deinterlace. Accepts one of the following
  20267. values:
  20268. @table @option
  20269. @item 0, all
  20270. Deinterlace all frames.
  20271. @item 1, interlaced
  20272. Only deinterlace frames marked as interlaced.
  20273. @end table
  20274. The default value is @code{all}.
  20275. @end table
  20276. @subsection chromakey_cuda
  20277. CUDA accelerated YUV colorspace color/chroma keying.
  20278. This filter works like normal chromakey filter but operates on CUDA frames.
  20279. for more details and parameters see @ref{chromakey}.
  20280. @subsubsection Examples
  20281. @itemize
  20282. @item
  20283. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  20284. @example
  20285. ./ffmpeg \
  20286. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  20287. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  20288. -init_hw_device cuda \
  20289. -filter_complex \
  20290. " \
  20291. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  20292. [1:v]scale_cuda=format=yuv420p[base]; \
  20293. [base][overlay_video]overlay_cuda" \
  20294. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  20295. @end example
  20296. @item
  20297. Process two software sources, explicitly uploading the frames:
  20298. @example
  20299. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  20300. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  20301. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  20302. -filter_complex \
  20303. " \
  20304. [0]hwupload[under]; \
  20305. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  20306. [under][over]overlay_cuda" \
  20307. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  20308. @end example
  20309. @end itemize
  20310. @subsection colorspace_cuda
  20311. CUDA accelerated implementation of the colorspace filter.
  20312. It is by no means feature complete compared to the software colorspace filter,
  20313. and at the current time only supports color range conversion between jpeg/full
  20314. and mpeg/limited range.
  20315. The filter accepts the following options:
  20316. @table @option
  20317. @item range
  20318. Specify output color range.
  20319. The accepted values are:
  20320. @table @samp
  20321. @item tv
  20322. TV (restricted) range
  20323. @item mpeg
  20324. MPEG (restricted) range
  20325. @item pc
  20326. PC (full) range
  20327. @item jpeg
  20328. JPEG (full) range
  20329. @end table
  20330. @end table
  20331. @anchor{overlay_cuda}
  20332. @subsection overlay_cuda
  20333. Overlay one video on top of another.
  20334. This is the CUDA variant of the @ref{overlay} filter.
  20335. It only accepts CUDA frames. The underlying input pixel formats have to match.
  20336. It takes two inputs and has one output. The first input is the "main"
  20337. video on which the second input is overlaid.
  20338. It accepts the following parameters:
  20339. @table @option
  20340. @item x
  20341. @item y
  20342. Set expressions for the x and y coordinates of the overlaid video
  20343. on the main video.
  20344. They can contain the following parameters:
  20345. @table @option
  20346. @item main_w, W
  20347. @item main_h, H
  20348. The main input width and height.
  20349. @item overlay_w, w
  20350. @item overlay_h, h
  20351. The overlay input width and height.
  20352. @item x
  20353. @item y
  20354. The computed values for @var{x} and @var{y}. They are evaluated for
  20355. each new frame.
  20356. @item n
  20357. The ordinal index of the main input frame, starting from 0.
  20358. @item pos
  20359. The byte offset position in the file of the main input frame, NAN if unknown.
  20360. Deprecated, do not use.
  20361. @item t
  20362. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  20363. @end table
  20364. Default value is "0" for both expressions.
  20365. @item eval
  20366. Set when the expressions for @option{x} and @option{y} are evaluated.
  20367. It accepts the following values:
  20368. @table @option
  20369. @item init
  20370. Evaluate expressions once during filter initialization or
  20371. when a command is processed.
  20372. @item frame
  20373. Evaluate expressions for each incoming frame
  20374. @end table
  20375. Default value is @option{frame}.
  20376. @item eof_action
  20377. See @ref{framesync}.
  20378. @item shortest
  20379. See @ref{framesync}.
  20380. @item repeatlast
  20381. See @ref{framesync}.
  20382. @end table
  20383. This filter also supports the @ref{framesync} options.
  20384. @anchor{pad_cuda}
  20385. @subsection pad_cuda
  20386. Add paddings to an input video stream using CUDA.
  20387. This filter is the CUDA-accelerated version of the @ref{pad} filter. It accepts the same options and expressions and provides the same core functionality.
  20388. For a detailed description of available options, please see the documentation for the @ref{pad} filter.
  20389. @subsubsection Examples
  20390. @itemize
  20391. @item
  20392. Add a 200-pixel black border to all sides of a video frame:
  20393. @example
  20394. ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -vf "pad_cuda=w=iw+400:h=ih+400:x=200:y=200" -c:v h264_nvenc out.mp4
  20395. @end example
  20396. @item
  20397. Pad the input video to a 16:9 aspect ratio, filling with the color "blue":
  20398. @example
  20399. ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -vf "pad_cuda=w=ih*16/9/sar:h=ih:x=(ow-iw)/2:y=(oh-ih)/2:color=blue" -c:v h264_nvenc out.mp4
  20400. @end example
  20401. @end itemize
  20402. @anchor{scale_cuda}
  20403. @subsection scale_cuda
  20404. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  20405. Setting the output width and height works in the same way as for the @ref{scale} filter.
  20406. The filter accepts the following options:
  20407. @table @option
  20408. @item w
  20409. @item h
  20410. Set the output video dimension expression. Default value is the input dimension.
  20411. Allows for the same expressions as the @ref{scale} filter.
  20412. @item interp_algo
  20413. Sets the algorithm used for scaling:
  20414. @table @var
  20415. @item nearest
  20416. Nearest neighbour
  20417. Used by default if input parameters match the desired output.
  20418. @item bilinear
  20419. Bilinear
  20420. @item bicubic
  20421. Bicubic
  20422. This is the default.
  20423. @item lanczos
  20424. Lanczos
  20425. @end table
  20426. @item format
  20427. Controls the output pixel format. By default, or if none is specified, the input
  20428. pixel format is used.
  20429. The filter does not support converting between YUV and RGB pixel formats.
  20430. @item passthrough
  20431. If set to 0, every frame is processed, even if no conversion is necessary.
  20432. This mode can be useful to use the filter as a buffer for a downstream
  20433. frame-consumer that exhausts the limited decoder frame pool.
  20434. If set to 1, frames are passed through as-is if they match the desired output
  20435. parameters. This is the default behaviour.
  20436. @item param
  20437. Algorithm-Specific parameter.
  20438. Affects the curves of the bicubic algorithm.
  20439. @item force_original_aspect_ratio
  20440. @item force_divisible_by
  20441. Work the same as the identical @ref{scale} filter options.
  20442. @item reset_sar
  20443. Works the same as the identical @ref{scale} filter option.
  20444. @end table
  20445. @subsubsection Examples
  20446. @itemize
  20447. @item
  20448. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  20449. @example
  20450. scale_cuda=-2:720:format=yuv420p
  20451. @end example
  20452. @item
  20453. Upscale to 4K using nearest neighbour algorithm.
  20454. @example
  20455. scale_cuda=4096:2160:interp_algo=nearest
  20456. @end example
  20457. @item
  20458. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  20459. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  20460. decoders frame pool.
  20461. @example
  20462. scale_cuda=passthrough=0
  20463. @end example
  20464. @end itemize
  20465. @subsection thumbnail_cuda
  20466. Select the most representative frame in a given sequence of consecutive frames using CUDA.
  20467. The filter accepts the following options:
  20468. @table @option
  20469. @item n
  20470. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  20471. will pick one of them, and then handle the next batch of @var{n} frames until
  20472. the end. Default is @code{100}.
  20473. @end table
  20474. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  20475. value will result in a higher memory usage, so a high value is not recommended.
  20476. @subsubsection Example
  20477. @itemize
  20478. @item
  20479. Thumbnails are extracted from every @var{n}=150-frame batch, selecting one per batch. Chosen frames are then scaled with @ref{scale_cuda}.
  20480. @example
  20481. ./ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i ./input.mp4 -vf "thumbnail_cuda=150,scale_cuda=1920:1080,hwdownload,format=nv12" ./output/out%03d.png
  20482. @end example
  20483. @end itemize
  20484. @subsection yadif_cuda
  20485. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  20486. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  20487. and/or nvenc.
  20488. It accepts the following parameters:
  20489. @table @option
  20490. @item mode
  20491. The interlacing mode to adopt. It accepts one of the following values:
  20492. @table @option
  20493. @item 0, send_frame
  20494. Output one frame for each frame.
  20495. @item 1, send_field
  20496. Output one frame for each field.
  20497. @item 2, send_frame_nospatial
  20498. Like @code{send_frame}, but it skips the spatial interlacing check.
  20499. @item 3, send_field_nospatial
  20500. Like @code{send_field}, but it skips the spatial interlacing check.
  20501. @end table
  20502. The default value is @code{send_frame}.
  20503. @item parity
  20504. The picture field parity assumed for the input interlaced video. It accepts one
  20505. of the following values:
  20506. @table @option
  20507. @item 0, tff
  20508. Assume the top field is first.
  20509. @item 1, bff
  20510. Assume the bottom field is first.
  20511. @item -1, auto
  20512. Enable automatic detection of field parity.
  20513. @end table
  20514. The default value is @code{auto}.
  20515. If the interlacing is unknown or the decoder does not export this information,
  20516. top field first will be assumed.
  20517. @item deint
  20518. Specify which frames to deinterlace. Accepts one of the following
  20519. values:
  20520. @table @option
  20521. @item 0, all
  20522. Deinterlace all frames.
  20523. @item 1, interlaced
  20524. Only deinterlace frames marked as interlaced.
  20525. @end table
  20526. The default value is @code{all}.
  20527. @end table
  20528. @anchor{CUDA NPP}
  20529. @section CUDA NPP
  20530. Below is a description of the currently available NVIDIA Performance Primitives (libnpp) video filters.
  20531. Prerequisites:
  20532. @itemize
  20533. @item Install Nvidia CUDA Toolkit
  20534. @item Install libnpp
  20535. @end itemize
  20536. To enable CUDA NPP filters:
  20537. @itemize
  20538. @item Configure FFmpeg with @code{--enable-nonfree --enable-libnpp}.
  20539. @end itemize
  20540. @anchor{scale_npp}
  20541. @subsection scale_npp
  20542. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  20543. format conversion on CUDA video frames. Setting the output width and height
  20544. works in the same way as for the @var{scale} filter.
  20545. The following additional options are accepted:
  20546. @table @option
  20547. @item format
  20548. The pixel format of the output CUDA frames. If set to the string "same" (the
  20549. default), the input format will be kept. Note that automatic format negotiation
  20550. and conversion is not yet supported for hardware frames
  20551. @item interp_algo
  20552. The interpolation algorithm used for resizing. One of the following:
  20553. @table @option
  20554. @item nn
  20555. Nearest neighbour.
  20556. @item linear
  20557. @item cubic
  20558. @item cubic2p_bspline
  20559. 2-parameter cubic (B=1, C=0)
  20560. @item cubic2p_catmullrom
  20561. 2-parameter cubic (B=0, C=1/2)
  20562. @item cubic2p_b05c03
  20563. 2-parameter cubic (B=1/2, C=3/10)
  20564. @item super
  20565. Supersampling
  20566. @item lanczos
  20567. @end table
  20568. @item force_original_aspect_ratio
  20569. Enable decreasing or increasing output video width or height if necessary to
  20570. keep the original aspect ratio. Possible values:
  20571. @table @samp
  20572. @item disable
  20573. Scale the video as specified and disable this feature.
  20574. @item decrease
  20575. The output video dimensions will automatically be decreased if needed.
  20576. @item increase
  20577. The output video dimensions will automatically be increased if needed.
  20578. @end table
  20579. One useful instance of this option is that when you know a specific device's
  20580. maximum allowed resolution, you can use this to limit the output video to
  20581. that, while retaining the aspect ratio. For example, device A allows
  20582. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  20583. decrease) and specifying 1280x720 to the command line makes the output
  20584. 1280x533.
  20585. Please note that this is a different thing than specifying -1 for @option{w}
  20586. or @option{h}, you still need to specify the output resolution for this option
  20587. to work.
  20588. @item force_divisible_by
  20589. Ensures that both the output dimensions, width and height, are divisible by the
  20590. given integer when used together with @option{force_original_aspect_ratio}. This
  20591. works similar to using @code{-n} in the @option{w} and @option{h} options.
  20592. This option respects the value set for @option{force_original_aspect_ratio},
  20593. increasing or decreasing the resolution accordingly. The video's aspect ratio
  20594. may be slightly modified.
  20595. This option can be handy if you need to have a video fit within or exceed
  20596. a defined resolution using @option{force_original_aspect_ratio} but also have
  20597. encoder restrictions on width or height divisibility.
  20598. @item reset_sar
  20599. Works the same as the identical @ref{scale} filter option.
  20600. @item eval
  20601. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  20602. @table @samp
  20603. @item init
  20604. Only evaluate expressions once during the filter initialization or when a command is processed.
  20605. @item frame
  20606. Evaluate expressions for each incoming frame.
  20607. @end table
  20608. @end table
  20609. The values of the @option{w} and @option{h} options are expressions
  20610. containing the following constants:
  20611. @table @var
  20612. @item in_w
  20613. @item in_h
  20614. The input width and height
  20615. @item iw
  20616. @item ih
  20617. These are the same as @var{in_w} and @var{in_h}.
  20618. @item out_w
  20619. @item out_h
  20620. The output (scaled) width and height
  20621. @item ow
  20622. @item oh
  20623. These are the same as @var{out_w} and @var{out_h}
  20624. @item a
  20625. The same as @var{iw} / @var{ih}
  20626. @item sar
  20627. input sample aspect ratio
  20628. @item dar
  20629. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  20630. @item n
  20631. The (sequential) number of the input frame, starting from 0.
  20632. Only available with @code{eval=frame}.
  20633. @item t
  20634. The presentation timestamp of the input frame, expressed as a number of
  20635. seconds. Only available with @code{eval=frame}.
  20636. @item pos
  20637. The position (byte offset) of the frame in the input stream, or NaN if
  20638. this information is unavailable and/or meaningless (for example in case of synthetic video).
  20639. Only available with @code{eval=frame}.
  20640. Deprecated, do not use.
  20641. @end table
  20642. @subsection scale2ref_npp
  20643. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  20644. video, based on a reference video.
  20645. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  20646. but uses the reference video instead of the main input as basis. scale2ref_npp
  20647. also supports the following additional constants for the @option{w} and
  20648. @option{h} options:
  20649. @table @var
  20650. @item main_w
  20651. @item main_h
  20652. The main input video's width and height
  20653. @item main_a
  20654. The same as @var{main_w} / @var{main_h}
  20655. @item main_sar
  20656. The main input video's sample aspect ratio
  20657. @item main_dar, mdar
  20658. The main input video's display aspect ratio. Calculated from
  20659. @code{(main_w / main_h) * main_sar}.
  20660. @item main_n
  20661. The (sequential) number of the main input frame, starting from 0.
  20662. Only available with @code{eval=frame}.
  20663. @item main_t
  20664. The presentation timestamp of the main input frame, expressed as a number of
  20665. seconds. Only available with @code{eval=frame}.
  20666. @item main_pos
  20667. The position (byte offset) of the frame in the main input stream, or NaN if
  20668. this information is unavailable and/or meaningless (for example in case of synthetic video).
  20669. Only available with @code{eval=frame}.
  20670. @end table
  20671. @subsubsection Examples
  20672. @itemize
  20673. @item
  20674. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  20675. @example
  20676. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  20677. @end example
  20678. @item
  20679. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  20680. @example
  20681. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  20682. @end example
  20683. @end itemize
  20684. @subsection sharpen_npp
  20685. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  20686. border control.
  20687. The following additional options are accepted:
  20688. @table @option
  20689. @item border_type
  20690. Type of sampling to be used ad frame borders. One of the following:
  20691. @table @option
  20692. @item replicate
  20693. Replicate pixel values.
  20694. @end table
  20695. @end table
  20696. @subsection transpose_npp
  20697. Transpose rows with columns in the input video and optionally flip it.
  20698. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  20699. It accepts the following parameters:
  20700. @table @option
  20701. @item dir
  20702. Specify the transposition direction.
  20703. Can assume the following values:
  20704. @table @samp
  20705. @item cclock_flip
  20706. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  20707. @item clock
  20708. Rotate by 90 degrees clockwise.
  20709. @item cclock
  20710. Rotate by 90 degrees counterclockwise.
  20711. @item clock_flip
  20712. Rotate by 90 degrees clockwise and vertically flip.
  20713. @end table
  20714. @item passthrough
  20715. Do not apply the transposition if the input geometry matches the one
  20716. specified by the specified value. It accepts the following values:
  20717. @table @samp
  20718. @item none
  20719. Always apply transposition. (default)
  20720. @item portrait
  20721. Preserve portrait geometry (when @var{height} >= @var{width}).
  20722. @item landscape
  20723. Preserve landscape geometry (when @var{width} >= @var{height}).
  20724. @end table
  20725. @end table
  20726. @c man end CUDA Video Filters
  20727. @chapter OpenCL Video Filters
  20728. @c man begin OPENCL VIDEO FILTERS
  20729. Below is a description of the currently available OpenCL video filters.
  20730. To enable compilation of these filters you need to configure FFmpeg with
  20731. @code{--enable-opencl}.
  20732. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20733. @table @option
  20734. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  20735. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  20736. given device parameters.
  20737. @item -filter_hw_device @var{name}
  20738. Pass the hardware device called @var{name} to all filters in any filter graph.
  20739. @end table
  20740. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20741. @itemize
  20742. @item
  20743. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  20744. @example
  20745. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  20746. @end example
  20747. @end itemize
  20748. 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.
  20749. @section avgblur_opencl
  20750. Apply average blur filter.
  20751. The filter accepts the following options:
  20752. @table @option
  20753. @item sizeX
  20754. Set horizontal radius size.
  20755. Range is @code{[1, 1024]} and default value is @code{1}.
  20756. @item planes
  20757. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20758. @item sizeY
  20759. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  20760. @end table
  20761. @subsection Example
  20762. @itemize
  20763. @item
  20764. 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.
  20765. @example
  20766. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  20767. @end example
  20768. @end itemize
  20769. @section boxblur_opencl
  20770. Apply a boxblur algorithm to the input video.
  20771. It accepts the following parameters:
  20772. @table @option
  20773. @item luma_radius, lr
  20774. @item luma_power, lp
  20775. @item chroma_radius, cr
  20776. @item chroma_power, cp
  20777. @item alpha_radius, ar
  20778. @item alpha_power, ap
  20779. @end table
  20780. A description of the accepted options follows.
  20781. @table @option
  20782. @item luma_radius, lr
  20783. @item chroma_radius, cr
  20784. @item alpha_radius, ar
  20785. Set an expression for the box radius in pixels used for blurring the
  20786. corresponding input plane.
  20787. The radius value must be a non-negative number, and must not be
  20788. greater than the value of the expression @code{min(w,h)/2} for the
  20789. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  20790. planes.
  20791. Default value for @option{luma_radius} is "2". If not specified,
  20792. @option{chroma_radius} and @option{alpha_radius} default to the
  20793. corresponding value set for @option{luma_radius}.
  20794. The expressions can contain the following constants:
  20795. @table @option
  20796. @item w
  20797. @item h
  20798. The input width and height in pixels.
  20799. @item cw
  20800. @item ch
  20801. The input chroma image width and height in pixels.
  20802. @item hsub
  20803. @item vsub
  20804. The horizontal and vertical chroma subsample values. For example, for the
  20805. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  20806. @end table
  20807. @item luma_power, lp
  20808. @item chroma_power, cp
  20809. @item alpha_power, ap
  20810. Specify how many times the boxblur filter is applied to the
  20811. corresponding plane.
  20812. Default value for @option{luma_power} is 2. If not specified,
  20813. @option{chroma_power} and @option{alpha_power} default to the
  20814. corresponding value set for @option{luma_power}.
  20815. A value of 0 will disable the effect.
  20816. @end table
  20817. @subsection Examples
  20818. 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.
  20819. @itemize
  20820. @item
  20821. Apply a boxblur filter with the luma, chroma, and alpha radius
  20822. 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.
  20823. @example
  20824. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  20825. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  20826. @end example
  20827. @item
  20828. 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.
  20829. For the luma plane, a 2x2 box radius will be run once.
  20830. For the chroma plane, a 4x4 box radius will be run 5 times.
  20831. For the alpha plane, a 3x3 box radius will be run 7 times.
  20832. @example
  20833. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  20834. @end example
  20835. @end itemize
  20836. @section colorkey_opencl
  20837. RGB colorspace color keying.
  20838. The filter accepts the following options:
  20839. @table @option
  20840. @item color
  20841. The color which will be replaced with transparency.
  20842. @item similarity
  20843. Similarity percentage with the key color.
  20844. 0.01 matches only the exact key color, while 1.0 matches everything.
  20845. @item blend
  20846. Blend percentage.
  20847. 0.0 makes pixels either fully transparent, or not transparent at all.
  20848. Higher values result in semi-transparent pixels, with a higher transparency
  20849. the more similar the pixels color is to the key color.
  20850. @end table
  20851. @subsection Examples
  20852. @itemize
  20853. @item
  20854. Make every semi-green pixel in the input transparent with some slight blending:
  20855. @example
  20856. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  20857. @end example
  20858. @end itemize
  20859. @section convolution_opencl
  20860. Apply convolution of 3x3, 5x5, 7x7 matrix.
  20861. The filter accepts the following options:
  20862. @table @option
  20863. @item 0m
  20864. @item 1m
  20865. @item 2m
  20866. @item 3m
  20867. Set matrix for each plane.
  20868. Matrix is sequence of 9, 25 or 49 signed numbers.
  20869. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  20870. @item 0rdiv
  20871. @item 1rdiv
  20872. @item 2rdiv
  20873. @item 3rdiv
  20874. Set multiplier for calculated value for each plane.
  20875. If unset or 0, it will be sum of all matrix elements.
  20876. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  20877. @item 0bias
  20878. @item 1bias
  20879. @item 2bias
  20880. @item 3bias
  20881. Set bias for each plane. This value is added to the result of the multiplication.
  20882. Useful for making the overall image brighter or darker.
  20883. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  20884. @end table
  20885. @subsection Examples
  20886. @itemize
  20887. @item
  20888. Apply sharpen:
  20889. @example
  20890. -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
  20891. @end example
  20892. @item
  20893. Apply blur:
  20894. @example
  20895. -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
  20896. @end example
  20897. @item
  20898. Apply edge enhance:
  20899. @example
  20900. -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
  20901. @end example
  20902. @item
  20903. Apply edge detect:
  20904. @example
  20905. -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
  20906. @end example
  20907. @item
  20908. Apply laplacian edge detector which includes diagonals:
  20909. @example
  20910. -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
  20911. @end example
  20912. @item
  20913. Apply emboss:
  20914. @example
  20915. -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
  20916. @end example
  20917. @end itemize
  20918. @section erosion_opencl
  20919. Apply erosion effect to the video.
  20920. This filter replaces the pixel by the local(3x3) minimum.
  20921. It accepts the following options:
  20922. @table @option
  20923. @item threshold0
  20924. @item threshold1
  20925. @item threshold2
  20926. @item threshold3
  20927. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20928. If @code{0}, plane will remain unchanged.
  20929. @item coordinates
  20930. Flag which specifies the pixel to refer to.
  20931. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20932. Flags to local 3x3 coordinates region centered on @code{x}:
  20933. 1 2 3
  20934. 4 x 5
  20935. 6 7 8
  20936. @end table
  20937. @subsection Example
  20938. @itemize
  20939. @item
  20940. 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.
  20941. @example
  20942. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20943. @end example
  20944. @end itemize
  20945. @section deshake_opencl
  20946. Feature-point based video stabilization filter.
  20947. The filter accepts the following options:
  20948. @table @option
  20949. @item tripod
  20950. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  20951. @item debug
  20952. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  20953. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  20954. Viewing point matches in the output video is only supported for RGB input.
  20955. Defaults to @code{0}.
  20956. @item adaptive_crop
  20957. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  20958. Defaults to @code{1}.
  20959. @item refine_features
  20960. Whether or not feature points should be refined at a sub-pixel level.
  20961. This can be turned off for a slight performance gain at the cost of precision.
  20962. Defaults to @code{1}.
  20963. @item smooth_strength
  20964. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  20965. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  20966. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  20967. Defaults to @code{0.0}.
  20968. @item smooth_window_multiplier
  20969. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  20970. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  20971. Acceptable values range from @code{0.1} to @code{10.0}.
  20972. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  20973. potentially improving smoothness, but also increase latency and memory usage.
  20974. Defaults to @code{2.0}.
  20975. @end table
  20976. @subsection Examples
  20977. @itemize
  20978. @item
  20979. Stabilize a video with a fixed, medium smoothing strength:
  20980. @example
  20981. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  20982. @end example
  20983. @item
  20984. Stabilize a video with debugging (both in console and in rendered video):
  20985. @example
  20986. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  20987. @end example
  20988. @end itemize
  20989. @section dilation_opencl
  20990. Apply dilation effect to the video.
  20991. This filter replaces the pixel by the local(3x3) maximum.
  20992. It accepts the following options:
  20993. @table @option
  20994. @item threshold0
  20995. @item threshold1
  20996. @item threshold2
  20997. @item threshold3
  20998. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20999. If @code{0}, plane will remain unchanged.
  21000. @item coordinates
  21001. Flag which specifies the pixel to refer to.
  21002. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  21003. Flags to local 3x3 coordinates region centered on @code{x}:
  21004. 1 2 3
  21005. 4 x 5
  21006. 6 7 8
  21007. @end table
  21008. @subsection Example
  21009. @itemize
  21010. @item
  21011. 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.
  21012. @example
  21013. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  21014. @end example
  21015. @end itemize
  21016. @anchor{nlmeans_opencl}
  21017. @section nlmeans_opencl
  21018. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  21019. @section overlay_opencl
  21020. Overlay one video on top of another.
  21021. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21022. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  21023. The filter accepts the following options:
  21024. @table @option
  21025. @item x
  21026. Set the x coordinate of the overlaid video on the main video.
  21027. Default value is @code{0}.
  21028. @item y
  21029. Set the y coordinate of the overlaid video on the main video.
  21030. Default value is @code{0}.
  21031. @end table
  21032. @subsection Examples
  21033. @itemize
  21034. @item
  21035. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  21036. @example
  21037. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  21038. @end example
  21039. @item
  21040. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  21041. @example
  21042. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  21043. @end example
  21044. @end itemize
  21045. @section pad_opencl
  21046. Add paddings to the input image, and place the original input at the
  21047. provided @var{x}, @var{y} coordinates.
  21048. It accepts the following options:
  21049. @table @option
  21050. @item width, w
  21051. @item height, h
  21052. Specify an expression for the size of the output image with the
  21053. paddings added. If the value for @var{width} or @var{height} is 0, the
  21054. corresponding input size is used for the output.
  21055. The @var{width} expression can reference the value set by the
  21056. @var{height} expression, and vice versa.
  21057. The default value of @var{width} and @var{height} is 0.
  21058. @item x
  21059. @item y
  21060. Specify the offsets to place the input image at within the padded area,
  21061. with respect to the top/left border of the output image.
  21062. The @var{x} expression can reference the value set by the @var{y}
  21063. expression, and vice versa.
  21064. The default value of @var{x} and @var{y} is 0.
  21065. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  21066. so the input image is centered on the padded area.
  21067. @item color
  21068. Specify the color of the padded area. For the syntax of this option,
  21069. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21070. manual,ffmpeg-utils}.
  21071. @item aspect
  21072. Pad to an aspect instead to a resolution.
  21073. @end table
  21074. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  21075. options are expressions containing the following constants:
  21076. @table @option
  21077. @item in_w
  21078. @item in_h
  21079. The input video width and height.
  21080. @item iw
  21081. @item ih
  21082. These are the same as @var{in_w} and @var{in_h}.
  21083. @item out_w
  21084. @item out_h
  21085. The output width and height (the size of the padded area), as
  21086. specified by the @var{width} and @var{height} expressions.
  21087. @item ow
  21088. @item oh
  21089. These are the same as @var{out_w} and @var{out_h}.
  21090. @item x
  21091. @item y
  21092. The x and y offsets as specified by the @var{x} and @var{y}
  21093. expressions, or NAN if not yet specified.
  21094. @item a
  21095. same as @var{iw} / @var{ih}
  21096. @item sar
  21097. input sample aspect ratio
  21098. @item dar
  21099. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  21100. @end table
  21101. @section prewitt_opencl
  21102. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  21103. The filter accepts the following option:
  21104. @table @option
  21105. @item planes
  21106. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21107. @item scale
  21108. Set value which will be multiplied with filtered result.
  21109. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  21110. @item delta
  21111. Set value which will be added to filtered result.
  21112. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  21113. @end table
  21114. @subsection Example
  21115. @itemize
  21116. @item
  21117. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  21118. @example
  21119. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  21120. @end example
  21121. @end itemize
  21122. @anchor{program_opencl}
  21123. @section program_opencl
  21124. Filter video using an OpenCL program.
  21125. @table @option
  21126. @item source
  21127. OpenCL program source file.
  21128. @item kernel
  21129. Kernel name in program.
  21130. @item inputs
  21131. Number of inputs to the filter. Defaults to 1.
  21132. @item size, s
  21133. Size of output frames. Defaults to the same as the first input.
  21134. @end table
  21135. The @code{program_opencl} filter also supports the @ref{framesync} options.
  21136. The program source file must contain a kernel function with the given name,
  21137. which will be run once for each plane of the output. Each run on a plane
  21138. gets enqueued as a separate 2D global NDRange with one work-item for each
  21139. pixel to be generated. The global ID offset for each work-item is therefore
  21140. the coordinates of a pixel in the destination image.
  21141. The kernel function needs to take the following arguments:
  21142. @itemize
  21143. @item
  21144. Destination image, @var{__write_only image2d_t}.
  21145. This image will become the output; the kernel should write all of it.
  21146. @item
  21147. Frame index, @var{unsigned int}.
  21148. This is a counter starting from zero and increasing by one for each frame.
  21149. @item
  21150. Source images, @var{__read_only image2d_t}.
  21151. These are the most recent images on each input. The kernel may read from
  21152. them to generate the output, but they can't be written to.
  21153. @end itemize
  21154. Example programs:
  21155. @itemize
  21156. @item
  21157. Copy the input to the output (output must be the same size as the input).
  21158. @verbatim
  21159. __kernel void copy(__write_only image2d_t destination,
  21160. unsigned int index,
  21161. __read_only image2d_t source)
  21162. {
  21163. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  21164. int2 location = (int2)(get_global_id(0), get_global_id(1));
  21165. float4 value = read_imagef(source, sampler, location);
  21166. write_imagef(destination, location, value);
  21167. }
  21168. @end verbatim
  21169. @item
  21170. Apply a simple transformation, rotating the input by an amount increasing
  21171. with the index counter. Pixel values are linearly interpolated by the
  21172. sampler, and the output need not have the same dimensions as the input.
  21173. @verbatim
  21174. __kernel void rotate_image(__write_only image2d_t dst,
  21175. unsigned int index,
  21176. __read_only image2d_t src)
  21177. {
  21178. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21179. CLK_FILTER_LINEAR);
  21180. float angle = (float)index / 100.0f;
  21181. float2 dst_dim = convert_float2(get_image_dim(dst));
  21182. float2 src_dim = convert_float2(get_image_dim(src));
  21183. float2 dst_cen = dst_dim / 2.0f;
  21184. float2 src_cen = src_dim / 2.0f;
  21185. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  21186. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  21187. float2 src_pos = {
  21188. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  21189. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  21190. };
  21191. src_pos = src_pos * src_dim / dst_dim;
  21192. float2 src_loc = src_pos + src_cen;
  21193. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  21194. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  21195. write_imagef(dst, dst_loc, 0.5f);
  21196. else
  21197. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  21198. }
  21199. @end verbatim
  21200. @item
  21201. Blend two inputs together, with the amount of each input used varying
  21202. with the index counter.
  21203. @verbatim
  21204. __kernel void blend_images(__write_only image2d_t dst,
  21205. unsigned int index,
  21206. __read_only image2d_t src1,
  21207. __read_only image2d_t src2)
  21208. {
  21209. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21210. CLK_FILTER_LINEAR);
  21211. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  21212. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  21213. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  21214. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  21215. float4 val1 = read_imagef(src1, sampler, src1_loc);
  21216. float4 val2 = read_imagef(src2, sampler, src2_loc);
  21217. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  21218. }
  21219. @end verbatim
  21220. @end itemize
  21221. @section remap_opencl
  21222. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  21223. Destination pixel at position (X, Y) will be picked from source (x, y) position
  21224. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  21225. value for pixel will be used for destination pixel.
  21226. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  21227. will have Xmap/Ymap video stream dimensions.
  21228. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  21229. @table @option
  21230. @item interp
  21231. Specify interpolation used for remapping of pixels.
  21232. Allowed values are @code{near} and @code{linear}.
  21233. Default value is @code{linear}.
  21234. @item fill
  21235. Specify the color of the unmapped pixels. For the syntax of this option,
  21236. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21237. manual,ffmpeg-utils}. Default color is @code{black}.
  21238. @end table
  21239. @section roberts_opencl
  21240. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  21241. The filter accepts the following option:
  21242. @table @option
  21243. @item planes
  21244. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21245. @item scale
  21246. Set value which will be multiplied with filtered result.
  21247. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  21248. @item delta
  21249. Set value which will be added to filtered result.
  21250. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  21251. @end table
  21252. @subsection Example
  21253. @itemize
  21254. @item
  21255. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  21256. @example
  21257. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  21258. @end example
  21259. @end itemize
  21260. @section sobel_opencl
  21261. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  21262. The filter accepts the following option:
  21263. @table @option
  21264. @item planes
  21265. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21266. @item scale
  21267. Set value which will be multiplied with filtered result.
  21268. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  21269. @item delta
  21270. Set value which will be added to filtered result.
  21271. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  21272. @end table
  21273. @subsection Example
  21274. @itemize
  21275. @item
  21276. Apply sobel operator with scale set to 2 and delta set to 10
  21277. @example
  21278. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  21279. @end example
  21280. @end itemize
  21281. @section tonemap_opencl
  21282. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  21283. It accepts the following parameters:
  21284. @table @option
  21285. @item tonemap
  21286. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  21287. @item param
  21288. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  21289. @item desat
  21290. Apply desaturation for highlights that exceed this level of brightness. The
  21291. higher the parameter, the more color information will be preserved. This
  21292. setting helps prevent unnaturally blown-out colors for super-highlights, by
  21293. (smoothly) turning into white instead. This makes images feel more natural,
  21294. at the cost of reducing information about out-of-range colors.
  21295. The default value is 0.5, and the algorithm here is a little different from
  21296. the cpu version tonemap currently. A setting of 0.0 disables this option.
  21297. @item threshold
  21298. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  21299. is used to detect whether the scene has changed or not. If the distance between
  21300. the current frame average brightness and the current running average exceeds
  21301. a threshold value, we would re-calculate scene average and peak brightness.
  21302. The default value is 0.2.
  21303. @item format
  21304. Specify the output pixel format.
  21305. Currently supported formats are:
  21306. @table @var
  21307. @item p010
  21308. @item nv12
  21309. @end table
  21310. @item range, r
  21311. Set the output color range.
  21312. Possible values are:
  21313. @table @var
  21314. @item tv/mpeg
  21315. @item pc/jpeg
  21316. @end table
  21317. Default is same as input.
  21318. @item primaries, p
  21319. Set the output color primaries.
  21320. Possible values are:
  21321. @table @var
  21322. @item bt709
  21323. @item bt2020
  21324. @end table
  21325. Default is same as input.
  21326. @item transfer, t
  21327. Set the output transfer characteristics.
  21328. Possible values are:
  21329. @table @var
  21330. @item bt709
  21331. @item bt2020
  21332. @end table
  21333. Default is bt709.
  21334. @item matrix, m
  21335. Set the output colorspace matrix.
  21336. Possible value are:
  21337. @table @var
  21338. @item bt709
  21339. @item bt2020
  21340. @end table
  21341. Default is same as input.
  21342. @end table
  21343. @subsection Example
  21344. @itemize
  21345. @item
  21346. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  21347. @example
  21348. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  21349. @end example
  21350. @end itemize
  21351. @section unsharp_opencl
  21352. Sharpen or blur the input video.
  21353. It accepts the following parameters:
  21354. @table @option
  21355. @item luma_msize_x, lx
  21356. Set the luma matrix horizontal size.
  21357. Range is @code{[1, 23]} and default value is @code{5}.
  21358. @item luma_msize_y, ly
  21359. Set the luma matrix vertical size.
  21360. Range is @code{[1, 23]} and default value is @code{5}.
  21361. @item luma_amount, la
  21362. Set the luma effect strength.
  21363. Range is @code{[-10, 10]} and default value is @code{1.0}.
  21364. Negative values will blur the input video, while positive values will
  21365. sharpen it, a value of zero will disable the effect.
  21366. @item chroma_msize_x, cx
  21367. Set the chroma matrix horizontal size.
  21368. Range is @code{[1, 23]} and default value is @code{5}.
  21369. @item chroma_msize_y, cy
  21370. Set the chroma matrix vertical size.
  21371. Range is @code{[1, 23]} and default value is @code{5}.
  21372. @item chroma_amount, ca
  21373. Set the chroma effect strength.
  21374. Range is @code{[-10, 10]} and default value is @code{0.0}.
  21375. Negative values will blur the input video, while positive values will
  21376. sharpen it, a value of zero will disable the effect.
  21377. @end table
  21378. All parameters are optional and default to the equivalent of the
  21379. string '5:5:1.0:5:5:0.0'.
  21380. @subsection Examples
  21381. @itemize
  21382. @item
  21383. Apply strong luma sharpen effect:
  21384. @example
  21385. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  21386. @end example
  21387. @item
  21388. Apply a strong blur of both luma and chroma parameters:
  21389. @example
  21390. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  21391. @end example
  21392. @end itemize
  21393. @section xfade_opencl
  21394. Cross fade two videos with custom transition effect by using OpenCL.
  21395. It accepts the following options:
  21396. @table @option
  21397. @item transition
  21398. Set one of possible transition effects.
  21399. @table @option
  21400. @item custom
  21401. Select custom transition effect, the actual transition description
  21402. will be picked from source and kernel options.
  21403. @item fade
  21404. @item wipeleft
  21405. @item wiperight
  21406. @item wipeup
  21407. @item wipedown
  21408. @item slideleft
  21409. @item slideright
  21410. @item slideup
  21411. @item slidedown
  21412. Default transition is fade.
  21413. @end table
  21414. @item source
  21415. OpenCL program source file for custom transition.
  21416. @item kernel
  21417. Set name of kernel to use for custom transition from program source file.
  21418. @item duration
  21419. Set duration of video transition.
  21420. @item offset
  21421. Set time of start of transition relative to first video.
  21422. @end table
  21423. The program source file must contain a kernel function with the given name,
  21424. which will be run once for each plane of the output. Each run on a plane
  21425. gets enqueued as a separate 2D global NDRange with one work-item for each
  21426. pixel to be generated. The global ID offset for each work-item is therefore
  21427. the coordinates of a pixel in the destination image.
  21428. The kernel function needs to take the following arguments:
  21429. @itemize
  21430. @item
  21431. Destination image, @var{__write_only image2d_t}.
  21432. This image will become the output; the kernel should write all of it.
  21433. @item
  21434. First Source image, @var{__read_only image2d_t}.
  21435. Second Source image, @var{__read_only image2d_t}.
  21436. These are the most recent images on each input. The kernel may read from
  21437. them to generate the output, but they can't be written to.
  21438. @item
  21439. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  21440. @end itemize
  21441. Example programs:
  21442. @itemize
  21443. @item
  21444. Apply dots curtain transition effect:
  21445. @verbatim
  21446. __kernel void blend_images(__write_only image2d_t dst,
  21447. __read_only image2d_t src1,
  21448. __read_only image2d_t src2,
  21449. float progress)
  21450. {
  21451. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21452. CLK_FILTER_LINEAR);
  21453. int2 p = (int2)(get_global_id(0), get_global_id(1));
  21454. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  21455. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  21456. rp = rp / dim;
  21457. float2 dots = (float2)(20.0, 20.0);
  21458. float2 center = (float2)(0,0);
  21459. float2 unused;
  21460. float4 val1 = read_imagef(src1, sampler, p);
  21461. float4 val2 = read_imagef(src2, sampler, p);
  21462. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  21463. write_imagef(dst, p, next ? val1 : val2);
  21464. }
  21465. @end verbatim
  21466. @end itemize
  21467. @c man end OPENCL VIDEO FILTERS
  21468. @chapter VAAPI Video Filters
  21469. @c man begin VAAPI VIDEO FILTERS
  21470. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  21471. To enable compilation of these filters you need to configure FFmpeg with
  21472. @code{--enable-vaapi}.
  21473. 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}
  21474. @section overlay_vaapi
  21475. Overlay one video on the top of another.
  21476. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21477. The filter accepts the following options:
  21478. @table @option
  21479. @item x
  21480. @item y
  21481. Set expressions for the x and y coordinates of the overlaid video
  21482. on the main video.
  21483. Default value is "0" for both expressions.
  21484. @item w
  21485. @item h
  21486. Set expressions for the width and height the overlaid video
  21487. on the main video.
  21488. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  21489. The expressions can contain the following parameters:
  21490. @table @option
  21491. @item main_w, W
  21492. @item main_h, H
  21493. The main input width and height.
  21494. @item overlay_iw
  21495. @item overlay_ih
  21496. The overlay input width and height.
  21497. @item overlay_w, w
  21498. @item overlay_h, h
  21499. The overlay output width and height.
  21500. @item overlay_x, x
  21501. @item overlay_y, y
  21502. Position of the overlay layer inside of main
  21503. @end table
  21504. @item alpha
  21505. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  21506. Higher value means lower transparency.
  21507. Default value is @code{1.0}.
  21508. @item eof_action
  21509. See @ref{framesync}.
  21510. @item shortest
  21511. See @ref{framesync}.
  21512. @item repeatlast
  21513. See @ref{framesync}.
  21514. @end table
  21515. This filter also supports the @ref{framesync} options.
  21516. @subsection Examples
  21517. @itemize
  21518. @item
  21519. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  21520. @example
  21521. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  21522. @end example
  21523. @item
  21524. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  21525. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  21526. @example
  21527. -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
  21528. @end example
  21529. @end itemize
  21530. @section tonemap_vaapi
  21531. Perform HDR-to-SDR or HDR-to-HDR tone-mapping.
  21532. It currently only accepts HDR10 as input.
  21533. It accepts the following parameters:
  21534. @table @option
  21535. @item format
  21536. Specify the output pixel format.
  21537. Default is nv12 for HDR-to-SDR tone-mapping and p010 for HDR-to-HDR
  21538. tone-mapping.
  21539. @item primaries, p
  21540. Set the output color primaries.
  21541. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21542. tone-mapping.
  21543. @item transfer, t
  21544. Set the output transfer characteristics.
  21545. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21546. tone-mapping.
  21547. @item matrix, m
  21548. Set the output colorspace matrix.
  21549. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21550. tone-mapping.
  21551. @item display
  21552. Set the output mastering display colour volume. It is given by a '|'-separated
  21553. list of two values, two values are space separated. It set display primaries
  21554. x & y in G, B, R order, then white point x & y, the nominal minimum & maximum
  21555. display luminances.
  21556. HDR-to-HDR tone-mapping will be performed when this option is set.
  21557. @item light
  21558. Set the output content light level information. It accepts 2 space-separated
  21559. values, the first input is the maximum light level and the second input is
  21560. the maximum average light level.
  21561. It is ignored for HDR-to-SDR tone-mapping, and optional for HDR-to-HDR
  21562. tone-mapping.
  21563. @end table
  21564. @subsection Example
  21565. @itemize
  21566. @item
  21567. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  21568. @example
  21569. tonemap_vaapi=format=p010:t=bt2020-10
  21570. @end example
  21571. @item
  21572. Convert HDR video to HDR video
  21573. @example
  21574. tonemap_vaapi=display=7500\ 3000|34000\ 16000|13250\ 34500|15635\ 16450|500\ 10000000
  21575. @end example
  21576. @end itemize
  21577. @section hstack_vaapi
  21578. Stack input videos horizontally.
  21579. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  21580. have different height, this filter will scale down/up each input stream while
  21581. keeping the original aspect.
  21582. It accepts the following options:
  21583. @table @option
  21584. @item inputs
  21585. See @ref{hstack}.
  21586. @item shortest
  21587. See @ref{hstack}.
  21588. @item height
  21589. Set height of output. If set to 0, this filter will set height of output to
  21590. height of the first input stream. Default value is 0.
  21591. @end table
  21592. @section vstack_vaapi
  21593. Stack input videos vertically.
  21594. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  21595. have different width, this filter will scale down/up each input stream while
  21596. keeping the original aspect.
  21597. It accepts the following options:
  21598. @table @option
  21599. @item inputs
  21600. See @ref{vstack}.
  21601. @item shortest
  21602. See @ref{vstack}.
  21603. @item width
  21604. Set width of output. If set to 0, this filter will set width of output to
  21605. width of the first input stream. Default value is 0.
  21606. @end table
  21607. @section xstack_vaapi
  21608. Stack video inputs into custom layout.
  21609. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  21610. have different size, this filter will scale down/up each input stream to the
  21611. given output size, or the size of the first input stream.
  21612. It accepts the following options:
  21613. @table @option
  21614. @item inputs
  21615. See @ref{xstack}.
  21616. @item shortest
  21617. See @ref{xstack}.
  21618. @item layout
  21619. See @ref{xstack}.
  21620. Moreover, this permits the user to supply output size for each input stream.
  21621. @example
  21622. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21623. @end example
  21624. @item grid
  21625. See @ref{xstack}.
  21626. @item grid_tile_size
  21627. Set output size for each input stream when @option{grid} is set. If this option
  21628. is not set, this filter will set output size by default to the size of the
  21629. first input stream. For the syntax of this option, check the
  21630. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21631. @item fill
  21632. See @ref{xstack}.
  21633. @end table
  21634. @section pad_vaapi
  21635. Add paddings to the input image, and place the original input at the
  21636. provided @var{x}, @var{y} coordinates.
  21637. It accepts the following options:
  21638. @table @option
  21639. @item width, w
  21640. @item height, h
  21641. Specify an expression for the size of the output image with the
  21642. paddings added. If the value for @var{width} or @var{height} is 0, the
  21643. corresponding input size is used for the output.
  21644. The @var{width} expression can reference the value set by the
  21645. @var{height} expression, and vice versa.
  21646. The default value of @var{width} and @var{height} is 0.
  21647. @item x
  21648. @item y
  21649. Specify the offsets to place the input image at within the padded area,
  21650. with respect to the top/left border of the output image.
  21651. The @var{x} expression can reference the value set by the @var{y}
  21652. expression, and vice versa.
  21653. The default value of @var{x} and @var{y} is 0.
  21654. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  21655. so the input image is centered on the padded area.
  21656. @item color
  21657. Specify the color of the padded area. For the syntax of this option,
  21658. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21659. manual,ffmpeg-utils}.
  21660. @item aspect
  21661. Pad to an aspect instead to a resolution.
  21662. @end table
  21663. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  21664. options are expressions containing the following constants:
  21665. @table @option
  21666. @item in_w
  21667. @item in_h
  21668. The input video width and height.
  21669. @item iw
  21670. @item ih
  21671. These are the same as @var{in_w} and @var{in_h}.
  21672. @item out_w
  21673. @item out_h
  21674. The output width and height (the size of the padded area), as
  21675. specified by the @var{width} and @var{height} expressions.
  21676. @item ow
  21677. @item oh
  21678. These are the same as @var{out_w} and @var{out_h}.
  21679. @item x
  21680. @item y
  21681. The x and y offsets as specified by the @var{x} and @var{y}
  21682. expressions, or NAN if not yet specified.
  21683. @item a
  21684. same as @var{iw} / @var{ih}
  21685. @item sar
  21686. input sample aspect ratio
  21687. @item dar
  21688. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  21689. @end table
  21690. @section drawbox_vaapi
  21691. Draw a colored box on the input image.
  21692. It accepts the following parameters:
  21693. @table @option
  21694. @item x
  21695. @item y
  21696. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  21697. @item width, w
  21698. @item height, h
  21699. The expressions which specify the width and height of the box; if 0 they are interpreted as
  21700. the input width and height. It defaults to 0.
  21701. @item color, c
  21702. Specify the color of the box to write. For the general syntax of this option,
  21703. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21704. @item thickness, t
  21705. The expression which sets the thickness of the box edge.
  21706. A value of @code{fill} will create a filled box. Default value is @code{3}.
  21707. See below for the list of accepted constants.
  21708. @item replace
  21709. With value @code{1}, the pixels of the painted box will overwrite the video's color and alpha pixels.
  21710. Default is @code{0}, which composites the box onto the input video.
  21711. @end table
  21712. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  21713. following constants:
  21714. @table @option
  21715. @item in_h, ih
  21716. @item in_w, iw
  21717. The input width and height.
  21718. @item x
  21719. @item y
  21720. The x and y offset coordinates where the box is drawn.
  21721. @item w
  21722. @item h
  21723. The width and height of the drawn box.
  21724. @item t
  21725. The thickness of the drawn box.
  21726. @end table
  21727. @subsection Examples
  21728. @itemize
  21729. @item
  21730. Draw a black box around the edge of the input image:
  21731. @example
  21732. drawbox
  21733. @end example
  21734. @item
  21735. Draw a box with color red and an opacity of 50%:
  21736. @example
  21737. drawbox=10:20:200:60:red@@0.5
  21738. @end example
  21739. The previous example can be specified as:
  21740. @example
  21741. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  21742. @end example
  21743. @item
  21744. Fill the box with pink color:
  21745. @example
  21746. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  21747. @end example
  21748. @item
  21749. Draw a 2-pixel red 2.40:1 mask:
  21750. @example
  21751. 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
  21752. @end example
  21753. @end itemize
  21754. @c man end VAAPI VIDEO FILTERS
  21755. @chapter Vulkan Video Filters
  21756. @c man begin VULKAN VIDEO FILTERS
  21757. Below is a description of the currently available Vulkan video filters.
  21758. To enable compilation of these filters you need to configure FFmpeg with
  21759. @code{--enable-vulkan} and either @code{--enable-libglslang} or @code{--enable-libshaderc}.
  21760. Running Vulkan filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  21761. @table @option
  21762. @item -init_hw_device vulkan[=@var{name}][:@var{device}[,@var{key=value}...]]
  21763. Initialise a new hardware device of type @var{vulkan} called @var{name}, using the
  21764. given device parameters and options in @var{key=value}. The following options
  21765. are supported:
  21766. @table @option
  21767. @item debug
  21768. Switches validation layers on if set to 1.
  21769. @item linear_images
  21770. Allocates linear images. Does not apply to decoding.
  21771. @item disable_multiplane
  21772. Disables multiplane images. Does not apply to decoding.
  21773. @end table
  21774. @item -filter_hw_device @var{name}
  21775. Pass the hardware device called @var{name} to all filters in any filter graph.
  21776. @end table
  21777. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  21778. @itemize
  21779. @item
  21780. Example of choosing the first device and running nlmeans_vulkan filter with default parameters on it.
  21781. @example
  21782. -init_hw_device vulkan=vk:0 -filter_hw_device vk -i INPUT -vf "hwupload,nlmeans_vulkan,hwdownload" OUTPUT
  21783. @end example
  21784. @end itemize
  21785. 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.
  21786. @section avgblur_vulkan
  21787. Apply an average blur filter, implemented on the GPU using Vulkan.
  21788. The filter accepts the following options:
  21789. @table @option
  21790. @item sizeX
  21791. Set horizontal radius size.
  21792. Range is @code{[1, 32]} and default value is @code{3}.
  21793. @item sizeY
  21794. Set vertical radius size. Range is @code{[1, 32]} and default value is @code{3}.
  21795. @item planes
  21796. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21797. @end table
  21798. @section blend_vulkan
  21799. Blend two Vulkan frames into each other.
  21800. The @code{blend} filter takes two input streams and outputs one
  21801. stream, the first input is the "top" layer and second input is
  21802. "bottom" layer. By default, the output terminates when the longest input terminates.
  21803. A description of the accepted options follows.
  21804. @table @option
  21805. @item c0_mode
  21806. @item c1_mode
  21807. @item c2_mode
  21808. @item c3_mode
  21809. @item all_mode
  21810. Set blend mode for specific pixel component or all pixel components in case
  21811. of @var{all_mode}. Default value is @code{normal}.
  21812. Available values for component modes are:
  21813. @table @samp
  21814. @item normal
  21815. @item multiply
  21816. @end table
  21817. @end table
  21818. @section bwdif_vulkan
  21819. Deinterlacer using @ref{bwdif}, the "Bob Weaver Deinterlacing Filter" algorithm, implemented
  21820. on the GPU using Vulkan.
  21821. It accepts the following parameters:
  21822. @table @option
  21823. @item mode
  21824. The interlacing mode to adopt. It accepts one of the following values:
  21825. @table @option
  21826. @item 0, send_frame
  21827. Output one frame for each frame.
  21828. @item 1, send_field
  21829. Output one frame for each field.
  21830. @end table
  21831. The default value is @code{send_field}.
  21832. @item parity
  21833. The picture field parity assumed for the input interlaced video. It accepts one
  21834. of the following values:
  21835. @table @option
  21836. @item 0, tff
  21837. Assume the top field is first.
  21838. @item 1, bff
  21839. Assume the bottom field is first.
  21840. @item -1, auto
  21841. Enable automatic detection of field parity.
  21842. @end table
  21843. The default value is @code{auto}.
  21844. If the interlacing is unknown or the decoder does not export this information,
  21845. top field first will be assumed.
  21846. @item deint
  21847. Specify which frames to deinterlace. Accepts one of the following
  21848. values:
  21849. @table @option
  21850. @item 0, all
  21851. Deinterlace all frames.
  21852. @item 1, interlaced
  21853. Only deinterlace frames marked as interlaced.
  21854. @end table
  21855. The default value is @code{all}.
  21856. @end table
  21857. @section chromaber_vulkan
  21858. Apply an effect that emulates chromatic aberration. Works best with RGB inputs,
  21859. but provides a similar effect with YCbCr inputs too.
  21860. @table @option
  21861. @item dist_x
  21862. Horizontal displacement multiplier. Each chroma pixel's position will be multiplied
  21863. by this amount, starting from the center of the image. Default is @code{0}.
  21864. @item dist_y
  21865. Similarly, this sets the vertical displacement multiplier. Default is @code{0}.
  21866. @end table
  21867. @section color_vulkan
  21868. Video source that creates a Vulkan frame of a solid color.
  21869. Useful for benchmarking, or overlaying.
  21870. It accepts the following parameters:
  21871. @table @option
  21872. @item color
  21873. The color to use. Either a name, or a hexadecimal value.
  21874. The default value is @code{black}.
  21875. @item size
  21876. The size of the output frame. Default value is @code{1920x1080}.
  21877. @item rate
  21878. The framerate to output at. Default value is @code{60} frames per second.
  21879. @item duration
  21880. The video duration. Default value is @code{-0.000001}.
  21881. @item sar
  21882. The video signal aspect ratio. Default value is @code{1/1}.
  21883. @item format
  21884. The pixel format of the output Vulkan frames. Default value is @code{yuv444p}.
  21885. @item out_range
  21886. Set the output YCbCr sample range.
  21887. This allows the autodetected value to be overridden as well as allows forcing
  21888. a specific value used for the output and encoder. If not specified, the
  21889. range depends on the pixel format. Possible values:
  21890. @table @samp
  21891. @item auto/unknown
  21892. Choose automatically.
  21893. @item jpeg/full/pc
  21894. Set full range (0-255 in case of 8-bit luma).
  21895. @item mpeg/limited/tv
  21896. Set "MPEG" range (16-235 in case of 8-bit luma).
  21897. @end table
  21898. @end table
  21899. @section vflip_vulkan
  21900. Flips an image vertically.
  21901. @section hflip_vulkan
  21902. Flips an image horizontally.
  21903. @section flip_vulkan
  21904. Flips an image along both the vertical and horizontal axis.
  21905. @section gblur_vulkan
  21906. Apply Gaussian blur filter on Vulkan frames.
  21907. The filter accepts the following options:
  21908. @table @option
  21909. @item sigma
  21910. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  21911. @item sigmaV
  21912. Set vertical sigma, if negative it will be same as @code{sigma}.
  21913. Default is @code{-1}.
  21914. @item planes
  21915. Set which planes to filter. By default all planes are filtered.
  21916. @item size
  21917. Set the kernel size along the horizontal axis. Default is @code{19}.
  21918. @item sizeV
  21919. Set the kernel size along the vertical axis. Default is @code{0},
  21920. which sets to use the same value as @var{size}.
  21921. @end table
  21922. @section nlmeans_vulkan
  21923. Denoise frames using Non-Local Means algorithm, implemented on the GPU using
  21924. Vulkan.
  21925. Supports more pixel formats than @ref{nlmeans} or @ref{nlmeans_opencl}, including
  21926. alpha channel support.
  21927. The filter accepts the following options.
  21928. @table @option
  21929. @item s
  21930. Set denoising strength for all components. Default is 1.0. Must be in range [1.0, 100.0].
  21931. @item p
  21932. Set patch size for all planes. Default is 7. Must be odd number in range [0, 99].
  21933. @item r
  21934. Set research size. Default is 15. Must be odd number in range [0, 99].
  21935. @item t
  21936. Set parallelism. Default is 36. Must be a number in the range [1, 168].
  21937. Larger values may speed up processing, at the cost of more VRAM.
  21938. Lower values will slow it down, reducing VRAM usage.
  21939. Only supported on GPUs with atomic float operations (RDNA3+, Ampere+).
  21940. @item s0
  21941. @item s1
  21942. @item s2
  21943. @item s3
  21944. Set denoising strength for a specific component. Default is @var{1}, equal to @option{s}.
  21945. Must be odd number in range [1, 100].
  21946. @item p0
  21947. @item p1
  21948. @item p2
  21949. @item p3
  21950. Set patch size for a specific component. Default is @var{7}, equal to @option{p}.
  21951. Must be odd number in range [0, 99].
  21952. @end table
  21953. @section overlay_vulkan
  21954. Overlay one video on top of another.
  21955. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21956. This filter requires all inputs to use the same pixel format. So, format conversion may be needed.
  21957. The filter accepts the following options:
  21958. @table @option
  21959. @item x
  21960. Set the x coordinate of the overlaid video on the main video.
  21961. Default value is @code{0}.
  21962. @item y
  21963. Set the y coordinate of the overlaid video on the main video.
  21964. Default value is @code{0}.
  21965. @end table
  21966. @section transpose_vt
  21967. Transpose rows with columns in the input video and optionally flip it.
  21968. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21969. It accepts the following parameters:
  21970. @table @option
  21971. @item dir
  21972. Specify the transposition direction.
  21973. Can assume the following values:
  21974. @table @samp
  21975. @item cclock_flip
  21976. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21977. @item clock
  21978. Rotate by 90 degrees clockwise.
  21979. @item cclock
  21980. Rotate by 90 degrees counterclockwise.
  21981. @item clock_flip
  21982. Rotate by 90 degrees clockwise and vertically flip.
  21983. @item hflip
  21984. Flip the input video horizontally.
  21985. @item vflip
  21986. Flip the input video vertically.
  21987. @end table
  21988. @item passthrough
  21989. Do not apply the transposition if the input geometry matches the one
  21990. specified by the specified value. It accepts the following values:
  21991. @table @samp
  21992. @item none
  21993. Always apply transposition. (default)
  21994. @item portrait
  21995. Preserve portrait geometry (when @var{height} >= @var{width}).
  21996. @item landscape
  21997. Preserve landscape geometry (when @var{width} >= @var{height}).
  21998. @end table
  21999. @end table
  22000. @section transpose_vulkan
  22001. Transpose rows with columns in the input video and optionally flip it.
  22002. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  22003. It accepts the following parameters:
  22004. @table @option
  22005. @item dir
  22006. Specify the transposition direction.
  22007. Can assume the following values:
  22008. @table @samp
  22009. @item cclock_flip
  22010. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  22011. @item clock
  22012. Rotate by 90 degrees clockwise.
  22013. @item cclock
  22014. Rotate by 90 degrees counterclockwise.
  22015. @item clock_flip
  22016. Rotate by 90 degrees clockwise and vertically flip.
  22017. @end table
  22018. @item passthrough
  22019. Do not apply the transposition if the input geometry matches the one
  22020. specified by the specified value. It accepts the following values:
  22021. @table @samp
  22022. @item none
  22023. Always apply transposition. (default)
  22024. @item portrait
  22025. Preserve portrait geometry (when @var{height} >= @var{width}).
  22026. @item landscape
  22027. Preserve landscape geometry (when @var{width} >= @var{height}).
  22028. @end table
  22029. @end table
  22030. @c man end VULKAN VIDEO FILTERS
  22031. @chapter QSV Video Filters
  22032. @c man begin QSV VIDEO FILTERS
  22033. Below is a description of the currently available QSV video filters.
  22034. To enable compilation of these filters you need to configure FFmpeg with
  22035. @code{--enable-libmfx} or @code{--enable-libvpl}.
  22036. 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}
  22037. @section hstack_qsv
  22038. Stack input videos horizontally.
  22039. This is the QSV variant of the @ref{hstack} filter, each input stream may
  22040. have different height, this filter will scale down/up each input stream while
  22041. keeping the original aspect.
  22042. It accepts the following options:
  22043. @table @option
  22044. @item inputs
  22045. See @ref{hstack}.
  22046. @item shortest
  22047. See @ref{hstack}.
  22048. @item height
  22049. Set height of output. If set to 0, this filter will set height of output to
  22050. height of the first input stream. Default value is 0.
  22051. @end table
  22052. @section vstack_qsv
  22053. Stack input videos vertically.
  22054. This is the QSV variant of the @ref{vstack} filter, each input stream may
  22055. have different width, this filter will scale down/up each input stream while
  22056. keeping the original aspect.
  22057. It accepts the following options:
  22058. @table @option
  22059. @item inputs
  22060. See @ref{vstack}.
  22061. @item shortest
  22062. See @ref{vstack}.
  22063. @item width
  22064. Set width of output. If set to 0, this filter will set width of output to
  22065. width of the first input stream. Default value is 0.
  22066. @end table
  22067. @section xstack_qsv
  22068. Stack video inputs into custom layout.
  22069. This is the QSV variant of the @ref{xstack} filter.
  22070. It accepts the following options:
  22071. @table @option
  22072. @item inputs
  22073. See @ref{xstack}.
  22074. @item shortest
  22075. See @ref{xstack}.
  22076. @item layout
  22077. See @ref{xstack}.
  22078. Moreover, this permits the user to supply output size for each input stream.
  22079. @example
  22080. xstack_qsv=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  22081. @end example
  22082. @item grid
  22083. See @ref{xstack}.
  22084. @item grid_tile_size
  22085. Set output size for each input stream when @option{grid} is set. If this option
  22086. is not set, this filter will set output size by default to the size of the
  22087. first input stream. For the syntax of this option, check the
  22088. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22089. @item fill
  22090. See @ref{xstack}.
  22091. @end table
  22092. @c man end QSV VIDEO FILTERS
  22093. @chapter Video Sources
  22094. @c man begin VIDEO SOURCES
  22095. Below is a description of the currently available video sources.
  22096. @section buffer
  22097. Buffer video frames, and make them available to the filter chain.
  22098. This source is mainly intended for a programmatic use, in particular
  22099. through the interface defined in @file{libavfilter/buffersrc.h}.
  22100. It accepts the following parameters:
  22101. @table @option
  22102. @item video_size
  22103. Specify the size (width and height) of the buffered video frames. For the
  22104. syntax of this option, check the
  22105. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22106. @item width
  22107. The input video width.
  22108. @item height
  22109. The input video height.
  22110. @item pix_fmt
  22111. A string representing the pixel format of the buffered video frames.
  22112. It may be a number corresponding to a pixel format, or a pixel format
  22113. name.
  22114. @item time_base
  22115. Specify the timebase assumed by the timestamps of the buffered frames.
  22116. @item frame_rate
  22117. Specify the frame rate expected for the video stream.
  22118. @item colorspace
  22119. A string representing the color space of the buffered video frames.
  22120. It may be a number corresponding to a color space, or a color space
  22121. name.
  22122. @item range
  22123. A string representing the color range of the buffered video frames.
  22124. It may be a number corresponding to a color range, or a color range
  22125. name.
  22126. @item pixel_aspect, sar
  22127. The sample (pixel) aspect ratio of the input video.
  22128. @item hw_frames_ctx
  22129. When using a hardware pixel format, this should be a reference to an
  22130. AVHWFramesContext describing input frames.
  22131. @end table
  22132. For example:
  22133. @example
  22134. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  22135. @end example
  22136. will instruct the source to accept video frames with size 320x240 and
  22137. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  22138. square pixels (1:1 sample aspect ratio).
  22139. Since the pixel format with name "yuv410p" corresponds to the number 6
  22140. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  22141. this example corresponds to:
  22142. @example
  22143. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  22144. @end example
  22145. Alternatively, the options can be specified as a flat string, but this
  22146. syntax is deprecated:
  22147. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  22148. @section cellauto
  22149. Create a pattern generated by an elementary cellular automaton.
  22150. The initial state of the cellular automaton can be defined through the
  22151. @option{filename} and @option{pattern} options. If such options are
  22152. not specified an initial state is created randomly.
  22153. At each new frame a new row in the video is filled with the result of
  22154. the cellular automaton next generation. The behavior when the whole
  22155. frame is filled is defined by the @option{scroll} option.
  22156. This source accepts the following options:
  22157. @table @option
  22158. @item filename, f
  22159. Read the initial cellular automaton state, i.e. the starting row, from
  22160. the specified file.
  22161. In the file, each non-whitespace character is considered an alive
  22162. cell, a newline will terminate the row, and further characters in the
  22163. file will be ignored.
  22164. @item pattern, p
  22165. Read the initial cellular automaton state, i.e. the starting row, from
  22166. the specified string.
  22167. Each non-whitespace character in the string is considered an alive
  22168. cell, a newline will terminate the row, and further characters in the
  22169. string will be ignored.
  22170. @item rate, r
  22171. Set the video rate, that is the number of frames generated per second.
  22172. Default is 25.
  22173. @item random_fill_ratio, ratio
  22174. Set the random fill ratio for the initial cellular automaton row. It
  22175. is a floating point number value ranging from 0 to 1, defaults to
  22176. 1/PHI.
  22177. This option is ignored when a file or a pattern is specified.
  22178. @item random_seed, seed
  22179. Set the seed for filling randomly the initial row, must be an integer
  22180. included between 0 and UINT32_MAX. If not specified, or if explicitly
  22181. set to -1, the filter will try to use a good random seed on a best
  22182. effort basis.
  22183. @item rule
  22184. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  22185. Default value is 110.
  22186. @item size, s
  22187. Set the size of the output video. For the syntax of this option, check the
  22188. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22189. If @option{filename} or @option{pattern} is specified, the size is set
  22190. by default to the width of the specified initial state row, and the
  22191. height is set to @var{width} * PHI.
  22192. If @option{size} is set, it must contain the width of the specified
  22193. pattern string, and the specified pattern will be centered in the
  22194. larger row.
  22195. If a filename or a pattern string is not specified, the size value
  22196. defaults to "320x518" (used for a randomly generated initial state).
  22197. @item scroll
  22198. If set to 1, scroll the output upward when all the rows in the output
  22199. have been already filled. If set to 0, the new generated row will be
  22200. written over the top row just after the bottom row is filled.
  22201. Defaults to 1.
  22202. @item start_full, full
  22203. If set to 1, completely fill the output with generated rows before
  22204. outputting the first frame.
  22205. This is the default behavior, for disabling set the value to 0.
  22206. @item stitch
  22207. If set to 1, stitch the left and right row edges together.
  22208. This is the default behavior, for disabling set the value to 0.
  22209. @end table
  22210. @subsection Examples
  22211. @itemize
  22212. @item
  22213. Read the initial state from @file{pattern}, and specify an output of
  22214. size 200x400.
  22215. @example
  22216. cellauto=f=pattern:s=200x400
  22217. @end example
  22218. @item
  22219. Generate a random initial row with a width of 200 cells, with a fill
  22220. ratio of 2/3:
  22221. @example
  22222. cellauto=ratio=2/3:s=200x200
  22223. @end example
  22224. @item
  22225. Create a pattern generated by rule 18 starting by a single alive cell
  22226. centered on an initial row with width 100:
  22227. @example
  22228. cellauto=p=@@:s=100x400:full=0:rule=18
  22229. @end example
  22230. @item
  22231. Specify a more elaborated initial pattern:
  22232. @example
  22233. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  22234. @end example
  22235. @end itemize
  22236. @anchor{coreimagesrc}
  22237. @section coreimagesrc
  22238. Video source generated on GPU using Apple's CoreImage API on OSX.
  22239. This video source is a specialized version of the @ref{coreimage} video filter.
  22240. Use a core image generator at the beginning of the applied filterchain to
  22241. generate the content.
  22242. The coreimagesrc video source accepts the following options:
  22243. @table @option
  22244. @item list_generators
  22245. List all available generators along with all their respective options as well as
  22246. possible minimum and maximum values along with the default values.
  22247. @example
  22248. list_generators=true
  22249. @end example
  22250. @item size, s
  22251. Specify the size of the sourced video. For the syntax of this option, check the
  22252. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22253. The default value is @code{320x240}.
  22254. @item rate, r
  22255. Specify the frame rate of the sourced video, as the number of frames
  22256. generated per second. It has to be a string in the format
  22257. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22258. number or a valid video frame rate abbreviation. The default value is
  22259. "25".
  22260. @item sar
  22261. Set the sample aspect ratio of the sourced video.
  22262. @item duration, d
  22263. Set the duration of the sourced video. See
  22264. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22265. for the accepted syntax.
  22266. If not specified, or the expressed duration is negative, the video is
  22267. supposed to be generated forever.
  22268. @end table
  22269. Additionally, all options of the @ref{coreimage} video filter are accepted.
  22270. A complete filterchain can be used for further processing of the
  22271. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  22272. and examples for details.
  22273. @subsection Examples
  22274. @itemize
  22275. @item
  22276. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  22277. given as complete and escaped command-line for Apple's standard bash shell:
  22278. @example
  22279. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  22280. @end example
  22281. This example is equivalent to the QRCode example of @ref{coreimage} without the
  22282. need for a nullsrc video source.
  22283. @end itemize
  22284. @section ddagrab
  22285. Captures the Windows Desktop via Desktop Duplication API.
  22286. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  22287. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  22288. software processing.
  22289. It accepts the following options:
  22290. @table @option
  22291. @item output_idx
  22292. DXGI Output Index to capture.
  22293. Usually corresponds to the index Windows has given the screen minus one,
  22294. so it's starting at 0.
  22295. Defaults to output 0.
  22296. @item draw_mouse
  22297. Whether to draw the mouse cursor.
  22298. Defaults to true.
  22299. Only affects hardware cursors. If a game or application renders its own cursor,
  22300. it'll always be captured.
  22301. @item framerate
  22302. Maximum framerate at which the desktop will be captured - the interval between
  22303. successive frames will not be smaller than the inverse of the framerate. When
  22304. @var{dup_frames} is true (the default) and the desktop is not being updated
  22305. often enough, the filter will duplicate a previous frame. Note that there is no
  22306. background buffering going on, so when the filter is not polled often enough
  22307. then the actual inter-frame interval may be significantly larger.
  22308. Defaults to 30 FPS.
  22309. @item video_size
  22310. Specify the size of the captured video.
  22311. Defaults to the full size of the screen.
  22312. Cropped from the bottom/right if smaller than screen size.
  22313. @item offset_x
  22314. Horizontal offset of the captured video.
  22315. @item offset_y
  22316. Vertical offset of the captured video.
  22317. @item output_fmt
  22318. Desired filter output format.
  22319. Defaults to 8 Bit BGRA.
  22320. It accepts the following values:
  22321. @table @samp
  22322. @item auto
  22323. Passes all supported output formats to DDA and returns what DDA decides to use.
  22324. @item 8bit
  22325. @item bgra
  22326. 8 Bit formats always work, and DDA will convert to them if necessary.
  22327. @item 10bit
  22328. @item x2bgr10
  22329. Filter initialization will fail if 10 bit format is requested but unavailable.
  22330. @end table
  22331. @item dup_frames
  22332. When this option is set to true (the default), the filter will duplicate frames
  22333. when the desktop has not been updated in order to maintain approximately
  22334. constant target framerate. When this option is set to false, the filter will
  22335. wait for the desktop to be updated (inter-frame intervals may vary significantly
  22336. in this case).
  22337. @end table
  22338. @subsection Examples
  22339. Capture primary screen and encode using nvenc:
  22340. @example
  22341. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  22342. @end example
  22343. You can also skip the lavfi device and directly use the filter.
  22344. Also demonstrates downloading the frame and encoding with libx264.
  22345. Explicit output format specification is required in this case:
  22346. @example
  22347. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  22348. @end example
  22349. If you want to capture only a subsection of the desktop, this can be achieved
  22350. by specifying a smaller size and its offsets into the screen:
  22351. @example
  22352. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  22353. @end example
  22354. @section gradients
  22355. Generate several gradients.
  22356. @table @option
  22357. @item size, s
  22358. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22359. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22360. @item rate, r
  22361. Set frame rate, expressed as number of frames per second. Default
  22362. value is "25".
  22363. @item c0, c1, c2, c3, c4, c5, c6, c7
  22364. Set 8 colors. Default values for colors is to pick random one.
  22365. @item x0, y0, y0, y1
  22366. Set gradient line source and destination points. If negative or out of range, random ones
  22367. are picked.
  22368. @item nb_colors, n
  22369. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  22370. @item seed
  22371. Set seed for picking gradient line points.
  22372. @item duration, d
  22373. Set the duration of the sourced video. See
  22374. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22375. for the accepted syntax.
  22376. If not specified, or the expressed duration is negative, the video is
  22377. supposed to be generated forever.
  22378. @item speed
  22379. Set speed of gradients rotation.
  22380. @item type, t
  22381. Set type of gradients.
  22382. Available values are:
  22383. @table @samp
  22384. @item linear
  22385. @item radial
  22386. @item circular
  22387. @item spiral
  22388. @item square
  22389. @end table
  22390. Default type is @var{linear}.
  22391. @end table
  22392. @subsection Commands
  22393. This source supports the some above options as @ref{commands}.
  22394. @section mandelbrot
  22395. Generate a Mandelbrot set fractal, and progressively zoom towards the
  22396. point specified with @var{start_x} and @var{start_y}.
  22397. This source accepts the following options:
  22398. @table @option
  22399. @item end_pts
  22400. Set the terminal pts value. Default value is 400.
  22401. @item end_scale
  22402. Set the terminal scale value.
  22403. Must be a floating point value. Default value is 0.3.
  22404. @item inner
  22405. Set the inner coloring mode, that is the algorithm used to draw the
  22406. Mandelbrot fractal internal region.
  22407. It shall assume one of the following values:
  22408. @table @option
  22409. @item black
  22410. Set black mode.
  22411. @item convergence
  22412. Show time until convergence.
  22413. @item mincol
  22414. Set color based on point closest to the origin of the iterations.
  22415. @item period
  22416. Set period mode.
  22417. @end table
  22418. Default value is @var{mincol}.
  22419. @item bailout
  22420. Set the bailout value. Default value is 10.0.
  22421. @item maxiter
  22422. Set the maximum of iterations performed by the rendering
  22423. algorithm. Default value is 7189.
  22424. @item outer
  22425. Set outer coloring mode.
  22426. It shall assume one of following values:
  22427. @table @option
  22428. @item iteration_count
  22429. Set iteration count mode.
  22430. @item normalized_iteration_count
  22431. set normalized iteration count mode.
  22432. @end table
  22433. Default value is @var{normalized_iteration_count}.
  22434. @item rate, r
  22435. Set frame rate, expressed as number of frames per second. Default
  22436. value is "25".
  22437. @item size, s
  22438. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22439. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22440. @item start_scale
  22441. Set the initial scale value. Default value is 3.0.
  22442. @item start_x
  22443. Set the initial x position. Must be a floating point value between
  22444. -100 and 100. Default value is -0.743643887037158704752191506114774.
  22445. @item start_y
  22446. Set the initial y position. Must be a floating point value between
  22447. -100 and 100. Default value is -0.131825904205311970493132056385139.
  22448. @end table
  22449. @section mptestsrc
  22450. Generate various test patterns, as generated by the MPlayer test filter.
  22451. The size of the generated video is fixed, and is 512x512.
  22452. This source is useful in particular for testing encoding features.
  22453. This source accepts the following options:
  22454. @table @option
  22455. @item rate, r
  22456. Specify the frame rate of the sourced video, as the number of frames
  22457. generated per second. It has to be a string in the format
  22458. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22459. number or a valid video frame rate abbreviation. The default value is
  22460. "25".
  22461. @item duration, d
  22462. Set the duration of the sourced video. See
  22463. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22464. for the accepted syntax.
  22465. If not specified, or the expressed duration is negative, the video is
  22466. supposed to be generated forever.
  22467. @item test, t
  22468. Set the number or the name of the test to perform. Supported tests are:
  22469. @table @option
  22470. @item dc_luma
  22471. @item dc_chroma
  22472. @item freq_luma
  22473. @item freq_chroma
  22474. @item amp_luma
  22475. @item amp_chroma
  22476. @item cbp
  22477. @item mv
  22478. @item ring1
  22479. @item ring2
  22480. @item all
  22481. @item max_frames, m
  22482. Set the maximum number of frames generated for each test, default value is 30.
  22483. @end table
  22484. Default value is "all", which will cycle through the list of all tests.
  22485. @end table
  22486. Some examples:
  22487. @example
  22488. mptestsrc=t=dc_luma
  22489. @end example
  22490. will generate a "dc_luma" test pattern.
  22491. @section frei0r_src
  22492. Provide a frei0r source.
  22493. To enable compilation of this filter you need to install the frei0r
  22494. header and configure FFmpeg with @code{--enable-frei0r}.
  22495. This source accepts the following parameters:
  22496. @table @option
  22497. @item size
  22498. The size of the video to generate. For the syntax of this option, check the
  22499. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22500. @item framerate
  22501. The framerate of the generated video. It may be a string of the form
  22502. @var{num}/@var{den} or a frame rate abbreviation.
  22503. @item filter_name
  22504. The name to the frei0r source to load. For more information regarding frei0r and
  22505. how to set the parameters, read the @ref{frei0r} section in the video filters
  22506. documentation.
  22507. @item filter_params
  22508. A '|'-separated list of parameters to pass to the frei0r source.
  22509. @end table
  22510. For example, to generate a frei0r partik0l source with size 200x200
  22511. and frame rate 10 which is overlaid on the overlay filter main input:
  22512. @example
  22513. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  22514. @end example
  22515. @section life
  22516. Generate a life pattern.
  22517. This source is based on a generalization of John Conway's life game.
  22518. The sourced input represents a life grid, each pixel represents a cell
  22519. which can be in one of two possible states, alive or dead. Every cell
  22520. interacts with its eight neighbours, which are the cells that are
  22521. horizontally, vertically, or diagonally adjacent.
  22522. At each interaction the grid evolves according to the adopted rule,
  22523. which specifies the number of neighbor alive cells which will make a
  22524. cell stay alive or born. The @option{rule} option allows one to specify
  22525. the rule to adopt.
  22526. This source accepts the following options:
  22527. @table @option
  22528. @item filename, f
  22529. Set the file from which to read the initial grid state. In the file,
  22530. each non-whitespace character is considered an alive cell, and newline
  22531. is used to delimit the end of each row.
  22532. If this option is not specified, the initial grid is generated
  22533. randomly.
  22534. @item rate, r
  22535. Set the video rate, that is the number of frames generated per second.
  22536. Default is 25.
  22537. @item random_fill_ratio, ratio
  22538. Set the random fill ratio for the initial random grid. It is a
  22539. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  22540. It is ignored when a file is specified.
  22541. @item random_seed, seed
  22542. Set the seed for filling the initial random grid, must be an integer
  22543. included between 0 and UINT32_MAX. If not specified, or if explicitly
  22544. set to -1, the filter will try to use a good random seed on a best
  22545. effort basis.
  22546. @item rule
  22547. Set the life rule.
  22548. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  22549. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  22550. @var{NS} specifies the number of alive neighbor cells which make a
  22551. live cell stay alive, and @var{NB} the number of alive neighbor cells
  22552. which make a dead cell to become alive (i.e. to "born").
  22553. "s" and "b" can be used in place of "S" and "B", respectively.
  22554. Alternatively a rule can be specified by an 18-bits integer. The 9
  22555. high order bits are used to encode the next cell state if it is alive
  22556. for each number of neighbor alive cells, the low order bits specify
  22557. the rule for "borning" new cells. Higher order bits encode for an
  22558. higher number of neighbor cells.
  22559. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  22560. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  22561. Default value is "S23/B3", which is the original Conway's game of life
  22562. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  22563. cells, and will born a new cell if there are three alive cells around
  22564. a dead cell.
  22565. @item size, s
  22566. Set the size of the output video. For the syntax of this option, check the
  22567. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22568. If @option{filename} is specified, the size is set by default to the
  22569. same size of the input file. If @option{size} is set, it must contain
  22570. the size specified in the input file, and the initial grid defined in
  22571. that file is centered in the larger resulting area.
  22572. If a filename is not specified, the size value defaults to "320x240"
  22573. (used for a randomly generated initial grid).
  22574. @item stitch
  22575. If set to 1, stitch the left and right grid edges together, and the
  22576. top and bottom edges also. Defaults to 1.
  22577. @item mold
  22578. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  22579. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  22580. value from 0 to 255.
  22581. @item life_color
  22582. Set the color of living (or new born) cells.
  22583. @item death_color
  22584. Set the color of dead cells. If @option{mold} is set, this is the first color
  22585. used to represent a dead cell.
  22586. @item mold_color
  22587. Set mold color, for definitely dead and moldy cells.
  22588. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  22589. ffmpeg-utils manual,ffmpeg-utils}.
  22590. @end table
  22591. @subsection Examples
  22592. @itemize
  22593. @item
  22594. Read a grid from @file{pattern}, and center it on a grid of size
  22595. 300x300 pixels:
  22596. @example
  22597. life=f=pattern:s=300x300
  22598. @end example
  22599. @item
  22600. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  22601. @example
  22602. life=ratio=2/3:s=200x200
  22603. @end example
  22604. @item
  22605. Specify a custom rule for evolving a randomly generated grid:
  22606. @example
  22607. life=rule=S14/B34
  22608. @end example
  22609. @item
  22610. Full example with slow death effect (mold) using @command{ffplay}:
  22611. @example
  22612. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  22613. @end example
  22614. @end itemize
  22615. @section perlin
  22616. Generate Perlin noise.
  22617. Perlin noise is a kind of noise with local continuity in space. This
  22618. can be used to generate patterns with continuity in space and time,
  22619. e.g. to simulate smoke, fluids, or terrain.
  22620. In case more than one octave is specified through the @option{octaves}
  22621. option, Perlin noise is generated as a sum of components, each one
  22622. with doubled frequency. In this case the @option{persistence} option
  22623. specify the ratio of the amplitude with respect to the previous
  22624. component. More octave components enable to specify more high
  22625. frequency details in the generated noise (e.g. small size variations
  22626. due to boulders in a generated terrain).
  22627. @subsection Options
  22628. @table @option
  22629. @item size, s
  22630. Specify the size (width and height) of the buffered video frames. For the
  22631. syntax of this option, check the
  22632. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22633. Default value is @code{320x240}.
  22634. @item rate, r
  22635. Specify the frame rate expected for the video stream, expressed as a
  22636. number of frames per second. Default value is @code{25}.
  22637. @item octaves
  22638. Specify the total number of components making up the noise, each one
  22639. with doubled frequency. Default value is @code{1}.
  22640. @item persistence
  22641. Set the ratio used to compute the amplitude of the next octave
  22642. component with respect to the previous component amplitude. Default
  22643. value is @code{1}.
  22644. @item xscale
  22645. @item yscale
  22646. Define a scale factor used to multiple the x, y coordinates. This can
  22647. be useful to define an effect with a pattern stretched along the x or
  22648. y axis. Default value is @code{1}.
  22649. @item tscale
  22650. Define a scale factor used to multiple the time coordinate. This can
  22651. be useful to change the time variation speed. Default value is @code{1}.
  22652. @item random_mode
  22653. Set random mode used to compute initial pattern.
  22654. Supported values are:
  22655. @table @option
  22656. @item random
  22657. Compute and use random seed.
  22658. @item ken
  22659. Use the predefined initial pattern defined by Ken Perlin in the
  22660. original article, can be useful to compare the output with other
  22661. sources.
  22662. @item seed
  22663. Use the value specified by @option{random_seed} option.
  22664. @end table
  22665. Default value is @code{random}.
  22666. @item random_seed, seed
  22667. When @option{random_mode} is set to @var{random_seed}, use this value
  22668. to compute the initial pattern. Default value is @code{0}.
  22669. @end table
  22670. @subsection Examples
  22671. @itemize
  22672. @item
  22673. Generate single component:
  22674. @example
  22675. perlin
  22676. @end example
  22677. @item
  22678. Use Perlin noise with 7 components, each one with a halved contribution
  22679. to total amplitude:
  22680. @example
  22681. perlin=octaves=7:persistence=0.5
  22682. @end example
  22683. @item
  22684. Chain Perlin noise with the @ref{lutyuv} to generate a black&white
  22685. effect:
  22686. @example
  22687. perlin=octaves=3:tscale=0.3,lutyuv=y='if(lt(val\,128)\,255\,0)'
  22688. @end example
  22689. @item
  22690. Stretch noise along the y axis, and convert gray level to red-only
  22691. signal:
  22692. @example
  22693. perlin=octaves=7:tscale=0.4:yscale=0.3,lutrgb=r=val:b=0:g=0
  22694. @end example
  22695. @end itemize
  22696. @section qrencodesrc
  22697. Generate a QR code using the libqrencode library (see
  22698. @url{https://fukuchi.org/works/qrencode/}).
  22699. To enable the compilation of this source, you need to configure FFmpeg with
  22700. @code{--enable-libqrencode}.
  22701. The QR code is generated from the provided text or text pattern. The
  22702. corresponding QR code is scaled and put in the video output according to the
  22703. specified output size options.
  22704. In case no text is specified, the QR code is not generated, but an empty colored
  22705. output is returned instead.
  22706. This source accepts the following options:
  22707. @table @option
  22708. @item qrcode_width, q
  22709. @item padded_qrcode_width, Q
  22710. Specify an expression for the width of the rendered QR code, with and without
  22711. padding. The @var{qrcode_width} expression can reference the value set by the
  22712. @var{padded_qrcode_width} expression, and vice versa.
  22713. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  22714. there is no padding.
  22715. These expressions are evaluated only once, when initializing the source.
  22716. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  22717. Note that some of the constants are missing for the source (for example the
  22718. @var{x} or @var{t} or ¸@var{n}), since they only makes sense when evaluating the
  22719. expression for each frame rather than at initialization time.
  22720. @item rate, r
  22721. Specify the frame rate of the sourced video, as the number of frames
  22722. generated per second. It has to be a string in the format
  22723. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22724. number or a valid video frame rate abbreviation. The default value is
  22725. "25".
  22726. @item case_sensitive, cs
  22727. Instruct libqrencode to use case sensitive encoding. This is enabled by
  22728. default. This can be disabled to reduce the QR encoding size.
  22729. @item level, l
  22730. Specify the QR encoding error correction level. With an higher correction level,
  22731. the encoding size will increase but the code will be more robust to corruption.
  22732. Lower level is @var{L}.
  22733. It accepts the following values:
  22734. @table @samp
  22735. @item L
  22736. @item M
  22737. @item Q
  22738. @item H
  22739. @end table
  22740. @item expansion
  22741. Select how the input text is expanded. Can be either @code{none}, or
  22742. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  22743. section for details.
  22744. @item text
  22745. @item textfile
  22746. Define the text to be rendered. In case neither is specified, no QR is encoded
  22747. (just an empty colored frame).
  22748. In case expansion is enabled, the text is treated as a text template, using the
  22749. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  22750. Text expansion} section for details.
  22751. @item background_color, bc
  22752. @item foreground_color, fc
  22753. Set the QR code and background color. The default value of
  22754. @var{foreground_color} is "black", the default value of @var{background_color}
  22755. is "white".
  22756. For the syntax of the color options, check the @ref{color syntax,,"Color"
  22757. section in the ffmpeg-utils manual,ffmpeg-utils}.
  22758. @end table
  22759. @subsection Examples
  22760. @itemize
  22761. @item
  22762. Generate a QR code encoding the specified text with the default size:
  22763. @example
  22764. qrencodesrc=text=www.ffmpeg.org
  22765. @end example
  22766. @item
  22767. Same as below, but select blue on pink colors:
  22768. @example
  22769. qrencodesrc=text=www.ffmpeg.org:bc=pink:fc=blue
  22770. @end example
  22771. @item
  22772. Generate a QR code with width of 200 pixels and padding, making the padded width
  22773. 4/3 of the QR code width:
  22774. @example
  22775. qrencodesrc=text=www.ffmpeg.org:q=200:Q=4/3*q
  22776. @end example
  22777. @item
  22778. Generate a QR code with padded width of 200 pixels and padding, making the QR
  22779. code width 3/4 of the padded width:
  22780. @example
  22781. qrencodesrc=text=www.ffmpeg.org:Q=200:q=3/4*Q
  22782. @end example
  22783. @item
  22784. Generate a QR code encoding the frame number:
  22785. @example
  22786. qrencodesrc=text=%@{n@}
  22787. @end example
  22788. @item
  22789. Generate a QR code encoding the GMT timestamp:
  22790. @example
  22791. qrencodesrc=text=%@{gmtime@}
  22792. @end example
  22793. @item
  22794. Generate a QR code encoding the timestamp expressed as a float:
  22795. @example
  22796. qrencodesrc=text=%@{pts@}
  22797. @end example
  22798. @end itemize
  22799. @anchor{allrgb}
  22800. @anchor{allyuv}
  22801. @anchor{color}
  22802. @anchor{colorchart}
  22803. @anchor{colorspectrum}
  22804. @anchor{haldclutsrc}
  22805. @anchor{nullsrc}
  22806. @anchor{pal75bars}
  22807. @anchor{pal100bars}
  22808. @anchor{rgbtestsrc}
  22809. @anchor{smptebars}
  22810. @anchor{smptehdbars}
  22811. @anchor{testsrc}
  22812. @anchor{testsrc2}
  22813. @anchor{yuvtestsrc}
  22814. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  22815. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  22816. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  22817. The @code{color} source provides an uniformly colored input.
  22818. The @code{colorchart} source provides a colors checker chart.
  22819. The @code{colorspectrum} source provides a color spectrum input.
  22820. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  22821. @ref{haldclut} filter.
  22822. The @code{nullsrc} source returns unprocessed video frames. It is
  22823. mainly useful to be employed in analysis / debugging tools, or as the
  22824. source for filters which ignore the input data.
  22825. The @code{pal75bars} source generates a color bars pattern, based on
  22826. EBU PAL recommendations with 75% color levels.
  22827. The @code{pal100bars} source generates a color bars pattern, based on
  22828. EBU PAL recommendations with 100% color levels.
  22829. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  22830. detecting RGB vs BGR issues. You should see a red, green and blue
  22831. stripe from top to bottom.
  22832. The @code{smptebars} source generates a color bars pattern, based on
  22833. the SMPTE Engineering Guideline EG 1-1990.
  22834. The @code{smptehdbars} source generates a color bars pattern, based on
  22835. the SMPTE RP 219-2002.
  22836. The @code{testsrc} source generates a test video pattern, showing a
  22837. color pattern, a scrolling gradient and a timestamp. This is mainly
  22838. intended for testing purposes.
  22839. The @code{testsrc2} source is similar to testsrc, but supports more
  22840. pixel formats instead of just @code{rgb24}. This allows using it as an
  22841. input for other tests without requiring a format conversion.
  22842. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  22843. see a y, cb and cr stripe from top to bottom.
  22844. The sources accept the following parameters:
  22845. @table @option
  22846. @item level
  22847. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  22848. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  22849. pixels to be used as identity matrix for 3D lookup tables. Each component is
  22850. coded on a @code{1/(N*N)} scale.
  22851. @item color, c
  22852. Specify the color of the source, only available in the @code{color}
  22853. source. For the syntax of this option, check the
  22854. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22855. @item size, s
  22856. Specify the size of the sourced video. For the syntax of this option, check the
  22857. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22858. The default value is @code{320x240}.
  22859. This option is not available with the @code{allrgb}, @code{allyuv}, and
  22860. @code{haldclutsrc} filters.
  22861. @item rate, r
  22862. Specify the frame rate of the sourced video, as the number of frames
  22863. generated per second. It has to be a string in the format
  22864. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22865. number or a valid video frame rate abbreviation. The default value is
  22866. "25".
  22867. @item duration, d
  22868. Set the duration of the sourced video. See
  22869. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22870. for the accepted syntax.
  22871. If not specified, or the expressed duration is negative, the video is
  22872. supposed to be generated forever.
  22873. Since the frame rate is used as time base, all frames including the last one
  22874. will have their full duration. If the specified duration is not a multiple
  22875. of the frame duration, it will be rounded up.
  22876. @item sar
  22877. Set the sample aspect ratio of the sourced video.
  22878. @item alpha
  22879. Specify the alpha (opacity) of the background, only available in the
  22880. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  22881. 255 (fully opaque, the default).
  22882. @item decimals, n
  22883. Set the number of decimals to show in the timestamp, only available in the
  22884. @code{testsrc} source.
  22885. The displayed timestamp value will correspond to the original
  22886. timestamp value multiplied by the power of 10 of the specified
  22887. value. Default value is 0.
  22888. @item type
  22889. Set the type of the color spectrum, only available in the
  22890. @code{colorspectrum} source. Can be one of the following:
  22891. @table @samp
  22892. @item black
  22893. @item white
  22894. @item all
  22895. @end table
  22896. @item patch_size
  22897. Set patch size of single color patch, only available in the
  22898. @code{colorchart} source. Default is @code{64x64}.
  22899. @item preset
  22900. Set colorchecker colors preset, only available in the
  22901. @code{colorchart} source.
  22902. Available values are:
  22903. @table @samp
  22904. @item reference
  22905. @item skintones
  22906. @end table
  22907. Default value is @code{reference}.
  22908. @end table
  22909. @subsection Examples
  22910. @itemize
  22911. @item
  22912. Generate a video with a duration of 5.3 seconds, with size
  22913. 176x144 and a frame rate of 10 frames per second:
  22914. @example
  22915. testsrc=duration=5.3:size=qcif:rate=10
  22916. @end example
  22917. @item
  22918. The following graph description will generate a red source
  22919. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  22920. frames per second:
  22921. @example
  22922. color=c=red@@0.2:s=qcif:r=10
  22923. @end example
  22924. @item
  22925. If the input content is to be ignored, @code{nullsrc} can be used. The
  22926. following command generates noise in the luma plane by employing
  22927. the @code{geq} filter:
  22928. @example
  22929. nullsrc=s=256x256, geq=random(1)*255:128:128
  22930. @end example
  22931. @end itemize
  22932. @subsection Commands
  22933. The @code{color} source supports the following commands:
  22934. @table @option
  22935. @item c, color
  22936. Set the color of the created image. Accepts the same syntax of the
  22937. corresponding @option{color} option.
  22938. @end table
  22939. @section openclsrc
  22940. Generate video using an OpenCL program.
  22941. @table @option
  22942. @item source
  22943. OpenCL program source file.
  22944. @item kernel
  22945. Kernel name in program.
  22946. @item size, s
  22947. Size of frames to generate. This must be set.
  22948. @item format
  22949. Pixel format to use for the generated frames. This must be set.
  22950. @item rate, r
  22951. Number of frames generated every second. Default value is '25'.
  22952. @end table
  22953. For details of how the program loading works, see the @ref{program_opencl}
  22954. filter.
  22955. Example programs:
  22956. @itemize
  22957. @item
  22958. Generate a colour ramp by setting pixel values from the position of the pixel
  22959. in the output image. (Note that this will work with all pixel formats, but
  22960. the generated output will not be the same.)
  22961. @verbatim
  22962. __kernel void ramp(__write_only image2d_t dst,
  22963. unsigned int index)
  22964. {
  22965. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22966. float4 val;
  22967. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  22968. write_imagef(dst, loc, val);
  22969. }
  22970. @end verbatim
  22971. @item
  22972. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  22973. @verbatim
  22974. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  22975. unsigned int index)
  22976. {
  22977. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22978. float4 value = 0.0f;
  22979. int x = loc.x + index;
  22980. int y = loc.y + index;
  22981. while (x > 0 || y > 0) {
  22982. if (x % 3 == 1 && y % 3 == 1) {
  22983. value = 1.0f;
  22984. break;
  22985. }
  22986. x /= 3;
  22987. y /= 3;
  22988. }
  22989. write_imagef(dst, loc, value);
  22990. }
  22991. @end verbatim
  22992. @end itemize
  22993. @section sierpinski
  22994. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  22995. This source accepts the following options:
  22996. @table @option
  22997. @item size, s
  22998. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22999. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  23000. @item rate, r
  23001. Set frame rate, expressed as number of frames per second. Default
  23002. value is "25".
  23003. @item seed
  23004. Set seed which is used for random panning.
  23005. @item jump
  23006. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  23007. @item type
  23008. Set fractal type, can be default @code{carpet} or @code{triangle}.
  23009. @end table
  23010. @section zoneplate
  23011. Generate a zoneplate test video pattern.
  23012. This source accepts the following options:
  23013. @table @option
  23014. @item size, s
  23015. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  23016. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "320x240".
  23017. @item rate, r
  23018. Set frame rate, expressed as number of frames per second. Default
  23019. value is "25".
  23020. @item duration, d
  23021. Set the duration of the sourced video. See
  23022. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  23023. for the accepted syntax.
  23024. If not specified, or the expressed duration is negative, the video is
  23025. supposed to be generated forever.
  23026. @item sar
  23027. Set the sample aspect ratio of the sourced video.
  23028. @item precision
  23029. Set precision in bits for look-up table for sine calculations. Default value is 10.
  23030. Allowed range is from 4 to 16.
  23031. @item xo
  23032. Set horizontal axis offset for output signal. Default value is 0.
  23033. @item yo
  23034. Set vertical axis offset for output signal. Default value is 0.
  23035. @item to
  23036. Set time axis offset for output signal. Default value is 0.
  23037. @item k0
  23038. Set 0-order, constant added to signal phase. Default value is 0.
  23039. @item kx
  23040. Set 1-order, phase factor multiplier for horizontal axis. Default value is 0.
  23041. @item ky
  23042. Set 1-order, phase factor multiplier for vertical axis. Default value is 0.
  23043. @item kt
  23044. Set 1-order, phase factor multiplier for time axis. Default value is 0.
  23045. @item kxt, kyt, kxy
  23046. Set phase factor multipliers for combination of spatial and temporal axis.
  23047. Default value is 0.
  23048. @item kx2
  23049. Set 2-order, phase factor multiplier for horizontal axis. Default value is 0.
  23050. @item ky2
  23051. Set 2-order, phase factor multiplier for vertical axis. Default value is 0.
  23052. @item kt2
  23053. Set 2-order, phase factor multiplier for time axis. Default value is 0.
  23054. @item ku
  23055. Set the constant added to final phase to produce chroma-blue component of signal.
  23056. Default value is 0.
  23057. @item kv
  23058. Set the constant added to final phase to produce chroma-red component of signal.
  23059. Default value is 0.
  23060. @end table
  23061. @subsection Commands
  23062. This source supports the some above options as @ref{commands}.
  23063. @subsection Examples
  23064. @itemize
  23065. @item
  23066. Generate horizontal color sine sweep:
  23067. @example
  23068. zoneplate=ku=512:kv=0:kt2=0:kx2=256:s=wvga:xo=-426:kt=11
  23069. @end example
  23070. @item
  23071. Generate vertical color sine sweep:
  23072. @example
  23073. zoneplate=ku=512:kv=0:kt2=0:ky2=156:s=wvga:yo=-240:kt=11
  23074. @end example
  23075. @item
  23076. Generate circular zone-plate:
  23077. @example
  23078. zoneplate=ku=512:kv=100:kt2=0:ky2=256:kx2=556:s=wvga:yo=0:kt=11
  23079. @end example
  23080. @end itemize
  23081. @c man end VIDEO SOURCES
  23082. @chapter Video Sinks
  23083. @c man begin VIDEO SINKS
  23084. Below is a description of the currently available video sinks.
  23085. @section buffersink
  23086. Buffer video frames, and make them available to the end of the filter
  23087. graph.
  23088. This sink is mainly intended for programmatic use, in particular
  23089. through the interface defined in @file{libavfilter/buffersink.h}
  23090. or the options system.
  23091. It accepts a pointer to an AVBufferSinkContext structure, which
  23092. defines the incoming buffers' formats, to be passed as the opaque
  23093. parameter to @code{avfilter_init_filter} for initialization.
  23094. @section nullsink
  23095. Null video sink: do absolutely nothing with the input video. It is
  23096. mainly useful as a template and for use in analysis / debugging
  23097. tools.
  23098. @c man end VIDEO SINKS
  23099. @chapter Multimedia Filters
  23100. @c man begin MULTIMEDIA FILTERS
  23101. Below is a description of the currently available multimedia filters.
  23102. @section a3dscope
  23103. Convert input audio to 3d scope video output.
  23104. The filter accepts the following options:
  23105. @table @option
  23106. @item rate, r
  23107. Set frame rate, expressed as number of frames per second. Default
  23108. value is "25".
  23109. @item size, s
  23110. Specify the video size for the output. For the syntax of this option, check the
  23111. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23112. Default value is @code{hd720}.
  23113. @item fov
  23114. Set the camera field of view. Default is 90 degrees.
  23115. Allowed range is from 40 to 150.
  23116. @item roll
  23117. Set the camera roll.
  23118. @item pitch
  23119. Set the camera pitch.
  23120. @item yaw
  23121. Set the camera yaw.
  23122. @item xzoom
  23123. Set the camera zoom on X-axis.
  23124. @item yzoom
  23125. Set the camera zoom on Y-axis.
  23126. @item zzoom
  23127. Set the camera zoom on Z-axis.
  23128. @item xpos
  23129. Set the camera position on X-axis.
  23130. @item ypos
  23131. Set the camera position on Y-axis.
  23132. @item zpos
  23133. Set the camera position on Z-axis.
  23134. @item length
  23135. Set the length of displayed audio waves in number of frames.
  23136. @end table
  23137. @subsection Commands
  23138. Filter supports the some above options as @ref{commands}.
  23139. @section abitscope
  23140. Convert input audio to a video output, displaying the audio bit scope.
  23141. The filter accepts the following options:
  23142. @table @option
  23143. @item rate, r
  23144. Set frame rate, expressed as number of frames per second. Default
  23145. value is "25".
  23146. @item size, s
  23147. Specify the video size for the output. For the syntax of this option, check the
  23148. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23149. Default value is @code{1024x256}.
  23150. @item colors
  23151. Specify list of colors separated by space or by '|' which will be used to
  23152. draw channels. Unrecognized or missing colors will be replaced
  23153. by white color.
  23154. @item mode, m
  23155. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  23156. @end table
  23157. @section adrawgraph
  23158. Draw a graph using input audio metadata.
  23159. See @ref{drawgraph}
  23160. @section agraphmonitor
  23161. See @ref{graphmonitor}.
  23162. @section ahistogram
  23163. Convert input audio to a video output, displaying the volume histogram.
  23164. The filter accepts the following options:
  23165. @table @option
  23166. @item dmode
  23167. Specify how histogram is calculated.
  23168. It accepts the following values:
  23169. @table @samp
  23170. @item single
  23171. Use single histogram for all channels.
  23172. @item separate
  23173. Use separate histogram for each channel.
  23174. @end table
  23175. Default is @code{single}.
  23176. @item rate, r
  23177. Set frame rate, expressed as number of frames per second. Default
  23178. value is "25".
  23179. @item size, s
  23180. Specify the video size for the output. For the syntax of this option, check the
  23181. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23182. Default value is @code{hd720}.
  23183. @item scale
  23184. Set display scale.
  23185. It accepts the following values:
  23186. @table @samp
  23187. @item log
  23188. logarithmic
  23189. @item sqrt
  23190. square root
  23191. @item cbrt
  23192. cubic root
  23193. @item lin
  23194. linear
  23195. @item rlog
  23196. reverse logarithmic
  23197. @end table
  23198. Default is @code{log}.
  23199. @item ascale
  23200. Set amplitude scale.
  23201. It accepts the following values:
  23202. @table @samp
  23203. @item log
  23204. logarithmic
  23205. @item lin
  23206. linear
  23207. @end table
  23208. Default is @code{log}.
  23209. @item acount
  23210. Set how much frames to accumulate in histogram.
  23211. Default is 1. Setting this to -1 accumulates all frames.
  23212. @item rheight
  23213. Set histogram ratio of window height.
  23214. @item slide
  23215. Set sonogram sliding.
  23216. It accepts the following values:
  23217. @table @samp
  23218. @item replace
  23219. replace old rows with new ones.
  23220. @item scroll
  23221. scroll from top to bottom.
  23222. @end table
  23223. Default is @code{replace}.
  23224. @item hmode
  23225. Set histogram mode.
  23226. It accepts the following values:
  23227. @table @samp
  23228. @item abs
  23229. Use absolute values of samples.
  23230. @item sign
  23231. Use untouched values of samples.
  23232. @end table
  23233. Default is @code{abs}.
  23234. @end table
  23235. @section aphasemeter
  23236. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  23237. representing mean phase of current audio frame. A video output can also be produced and is
  23238. enabled by default. The audio is passed through as first output.
  23239. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  23240. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  23241. and @code{1} means channels are in phase.
  23242. The filter accepts the following options, all related to its video output:
  23243. @table @option
  23244. @item rate, r
  23245. Set the output frame rate. Default value is @code{25}.
  23246. @item size, s
  23247. Set the video size for the output. For the syntax of this option, check the
  23248. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23249. Default value is @code{800x400}.
  23250. @item rc
  23251. @item gc
  23252. @item bc
  23253. Specify the red, green, blue contrast. Default values are @code{2},
  23254. @code{7} and @code{1}.
  23255. Allowed range is @code{[0, 255]}.
  23256. @item mpc
  23257. Set color which will be used for drawing median phase. If color is
  23258. @code{none} which is default, no median phase value will be drawn.
  23259. @item video
  23260. Enable video output. Default is enabled.
  23261. @end table
  23262. @subsection phasing detection
  23263. The filter also detects out of phase and mono sequences in stereo streams.
  23264. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  23265. The filter accepts the following options for this detection:
  23266. @table @option
  23267. @item phasing
  23268. Enable mono and out of phase detection. Default is disabled.
  23269. @item tolerance, t
  23270. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  23271. Allowed range is @code{[0, 1]}.
  23272. @item angle, a
  23273. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  23274. Allowed range is @code{[90, 180]}.
  23275. @item duration, d
  23276. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  23277. @end table
  23278. @subsection Examples
  23279. @itemize
  23280. @item
  23281. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  23282. @example
  23283. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  23284. @end example
  23285. @end itemize
  23286. @section avectorscope
  23287. Convert input audio to a video output, representing the audio vector
  23288. scope.
  23289. The filter is used to measure the difference between channels of stereo
  23290. audio stream. A monaural signal, consisting of identical left and right
  23291. signal, results in straight vertical line. Any stereo separation is visible
  23292. as a deviation from this line, creating a Lissajous figure.
  23293. If the straight (or deviation from it) but horizontal line appears this
  23294. indicates that the left and right channels are out of phase.
  23295. The filter accepts the following options:
  23296. @table @option
  23297. @item mode, m
  23298. Set the vectorscope mode.
  23299. Available values are:
  23300. @table @samp
  23301. @item lissajous
  23302. Lissajous rotated by 45 degrees.
  23303. @item lissajous_xy
  23304. Same as above but not rotated.
  23305. @item polar
  23306. Shape resembling half of circle.
  23307. @end table
  23308. Default value is @samp{lissajous}.
  23309. @item size, s
  23310. Set the video size for the output. For the syntax of this option, check the
  23311. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23312. Default value is @code{400x400}.
  23313. @item rate, r
  23314. Set the output frame rate. Default value is @code{25}.
  23315. @item rc
  23316. @item gc
  23317. @item bc
  23318. @item ac
  23319. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  23320. @code{160}, @code{80} and @code{255}.
  23321. Allowed range is @code{[0, 255]}.
  23322. @item rf
  23323. @item gf
  23324. @item bf
  23325. @item af
  23326. Specify the red, green, blue and alpha fade. Default values are @code{15},
  23327. @code{10}, @code{5} and @code{5}.
  23328. Allowed range is @code{[0, 255]}.
  23329. @item zoom
  23330. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  23331. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  23332. @item draw
  23333. Set the vectorscope drawing mode.
  23334. Available values are:
  23335. @table @samp
  23336. @item dot
  23337. Draw dot for each sample.
  23338. @item line
  23339. Draw line between previous and current sample.
  23340. @item aaline
  23341. Draw anti-aliased line between previous and current sample.
  23342. @end table
  23343. Default value is @samp{dot}.
  23344. @item scale
  23345. Specify amplitude scale of audio samples.
  23346. Available values are:
  23347. @table @samp
  23348. @item lin
  23349. Linear.
  23350. @item sqrt
  23351. Square root.
  23352. @item cbrt
  23353. Cubic root.
  23354. @item log
  23355. Logarithmic.
  23356. @end table
  23357. @item swap
  23358. Swap left channel axis with right channel axis.
  23359. @item mirror
  23360. Mirror axis.
  23361. @table @samp
  23362. @item none
  23363. No mirror.
  23364. @item x
  23365. Mirror only x axis.
  23366. @item y
  23367. Mirror only y axis.
  23368. @item xy
  23369. Mirror both axis.
  23370. @end table
  23371. @end table
  23372. @subsection Examples
  23373. @itemize
  23374. @item
  23375. Complete example using @command{ffplay}:
  23376. @example
  23377. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  23378. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  23379. @end example
  23380. @end itemize
  23381. @subsection Commands
  23382. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  23383. @section bench, abench
  23384. Benchmark part of a filtergraph.
  23385. The filter accepts the following options:
  23386. @table @option
  23387. @item action
  23388. Start or stop a timer.
  23389. Available values are:
  23390. @table @samp
  23391. @item start
  23392. Get the current time, set it as frame metadata (using the key
  23393. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  23394. @item stop
  23395. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  23396. the input frame metadata to get the time difference. Time difference, average,
  23397. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  23398. @code{min}) are then printed. The timestamps are expressed in seconds.
  23399. @end table
  23400. @end table
  23401. @subsection Examples
  23402. @itemize
  23403. @item
  23404. Benchmark @ref{selectivecolor} filter:
  23405. @example
  23406. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  23407. @end example
  23408. @end itemize
  23409. @section concat
  23410. Concatenate audio and video streams, joining them together one after the
  23411. other.
  23412. The filter works on segments of synchronized video and audio streams. All
  23413. segments must have the same number of streams of each type, and that will
  23414. also be the number of streams at output.
  23415. The filter accepts the following options:
  23416. @table @option
  23417. @item n
  23418. Set the number of segments. Default is 2.
  23419. @item v
  23420. Set the number of output video streams, that is also the number of video
  23421. streams in each segment. Default is 1.
  23422. @item a
  23423. Set the number of output audio streams, that is also the number of audio
  23424. streams in each segment. Default is 0.
  23425. @item unsafe
  23426. Activate unsafe mode: do not fail if segments have a different format.
  23427. @end table
  23428. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  23429. @var{a} audio outputs.
  23430. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  23431. segment, in the same order as the outputs, then the inputs for the second
  23432. segment, etc.
  23433. Related streams do not always have exactly the same duration, for various
  23434. reasons including codec frame size or sloppy authoring. For that reason,
  23435. related synchronized streams (e.g. a video and its audio track) should be
  23436. concatenated at once. The concat filter will use the duration of the longest
  23437. stream in each segment (except the last one), and if necessary pad shorter
  23438. audio streams with silence.
  23439. For this filter to work correctly, all segments must start at timestamp 0.
  23440. All corresponding streams must have the same parameters in all segments; the
  23441. filtering system will automatically select a common pixel format for video
  23442. streams, and a common sample format, sample rate and channel layout for
  23443. audio streams, but other settings, such as resolution, must be converted
  23444. explicitly by the user.
  23445. Different frame rates are acceptable but will result in variable frame rate
  23446. at output; be sure to configure the output file to handle it.
  23447. @subsection Examples
  23448. @itemize
  23449. @item
  23450. Concatenate an opening, an episode and an ending, all in bilingual version
  23451. (video in stream 0, audio in streams 1 and 2):
  23452. @example
  23453. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  23454. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  23455. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  23456. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  23457. @end example
  23458. @item
  23459. Concatenate two parts, handling audio and video separately, using the
  23460. (a)movie sources, and adjusting the resolution:
  23461. @example
  23462. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  23463. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  23464. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  23465. @end example
  23466. Note that a desync will happen at the stitch if the audio and video streams
  23467. do not have exactly the same duration in the first file.
  23468. @end itemize
  23469. @subsection Commands
  23470. This filter supports the following commands:
  23471. @table @option
  23472. @item next
  23473. Close the current segment and step to the next one
  23474. @end table
  23475. @anchor{ebur128}
  23476. @section ebur128
  23477. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  23478. level. By default, it logs a message at a frequency of 10Hz with the
  23479. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  23480. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  23481. The filter can only analyze streams which have
  23482. sample format is double-precision floating point. The input stream will be converted to
  23483. this specification, if needed. Users may need to insert aformat and/or aresample filters
  23484. after this filter to obtain the original parameters.
  23485. The filter also has a video output (see the @var{video} option) with a real
  23486. time graph to observe the loudness evolution. The graphic contains the logged
  23487. message mentioned above, so it is not printed anymore when this option is set,
  23488. unless the verbose logging is set. The main graphing area contains the
  23489. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  23490. the momentary loudness (400 milliseconds), but can optionally be configured
  23491. to instead display short-term loudness (see @var{gauge}).
  23492. The green area marks a +/- 1LU target range around the target loudness
  23493. (-23LUFS by default, unless modified through @var{target}).
  23494. More information about the Loudness Recommendation EBU R128 on
  23495. @url{http://tech.ebu.ch/loudness}.
  23496. The filter accepts the following options:
  23497. @table @option
  23498. @item video
  23499. Activate the video output. The audio stream is passed unchanged whether this
  23500. option is set or no. The video stream will be the first output stream if
  23501. activated. Default is @code{0}.
  23502. @item size
  23503. Set the video size. This option is for video only. For the syntax of this
  23504. option, check the
  23505. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23506. Default and minimum resolution is @code{640x480}.
  23507. @item meter
  23508. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  23509. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  23510. other integer value between this range is allowed.
  23511. @item metadata
  23512. Set metadata injection. If set to @code{1}, the audio input will be segmented
  23513. into 100ms output frames, each of them containing various loudness information
  23514. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  23515. Default is @code{0}.
  23516. @item framelog
  23517. Force the frame logging level.
  23518. Available values are:
  23519. @table @samp
  23520. @item quiet
  23521. logging disabled
  23522. @item info
  23523. information logging level
  23524. @item verbose
  23525. verbose logging level
  23526. @end table
  23527. By default, the logging level is set to @var{info}. If the @option{video} or
  23528. the @option{metadata} options are set, it switches to @var{verbose}.
  23529. @item peak
  23530. Set peak mode(s).
  23531. Available modes can be cumulated (the option is a @code{flag} type). Possible
  23532. values are:
  23533. @table @samp
  23534. @item none
  23535. Disable any peak mode (default).
  23536. @item sample
  23537. Enable sample-peak mode.
  23538. Simple peak mode looking for the higher sample value. It logs a message
  23539. for sample-peak (identified by @code{SPK}).
  23540. @item true
  23541. Enable true-peak mode.
  23542. If enabled, the peak lookup is done on an over-sampled version of the input
  23543. stream for better peak accuracy. It logs a message for true-peak.
  23544. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  23545. This mode requires a build with @code{libswresample}.
  23546. @end table
  23547. @item dualmono
  23548. Treat mono input files as "dual mono". If a mono file is intended for playback
  23549. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  23550. If set to @code{true}, this option will compensate for this effect.
  23551. Multi-channel input files are not affected by this option.
  23552. @item panlaw
  23553. Set a specific pan law to be used for the measurement of dual mono files.
  23554. This parameter is optional, and has a default value of -3.01dB.
  23555. @item target
  23556. Set a specific target level (in LUFS) used as relative zero in the visualization.
  23557. This parameter is optional and has a default value of -23LUFS as specified
  23558. by EBU R128. However, material published online may prefer a level of -16LUFS
  23559. (e.g. for use with podcasts or video platforms).
  23560. @item gauge
  23561. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  23562. @code{shortterm}. By default the momentary value will be used, but in certain
  23563. scenarios it may be more useful to observe the short term value instead (e.g.
  23564. live mixing).
  23565. @item scale
  23566. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  23567. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  23568. video output, not the summary or continuous log output.
  23569. @item integrated
  23570. Read-only exported value for measured integrated loudness, in LUFS.
  23571. @item range
  23572. Read-only exported value for measured loudness range, in LU.
  23573. @item lra_low
  23574. Read-only exported value for measured LRA low, in LUFS.
  23575. @item lra_high
  23576. Read-only exported value for measured LRA high, in LUFS.
  23577. @item sample_peak
  23578. Read-only exported value for measured sample peak, in dBFS.
  23579. @item true_peak
  23580. Read-only exported value for measured true peak, in dBFS.
  23581. @end table
  23582. @subsection Examples
  23583. @itemize
  23584. @item
  23585. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  23586. @example
  23587. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  23588. @end example
  23589. @item
  23590. Run an analysis with @command{ffmpeg}:
  23591. @example
  23592. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  23593. @end example
  23594. @end itemize
  23595. @section interleave, ainterleave
  23596. Temporally interleave frames from several inputs.
  23597. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  23598. These filters read frames from several inputs and send the oldest
  23599. queued frame to the output.
  23600. Input streams must have well defined, monotonically increasing frame
  23601. timestamp values.
  23602. In order to submit one frame to output, these filters need to enqueue
  23603. at least one frame for each input, so they cannot work in case one
  23604. input is not yet terminated and will not receive incoming frames.
  23605. For example consider the case when one input is a @code{select} filter
  23606. which always drops input frames. The @code{interleave} filter will keep
  23607. reading from that input, but it will never be able to send new frames
  23608. to output until the input sends an end-of-stream signal.
  23609. Also, depending on inputs synchronization, the filters will drop
  23610. frames in case one input receives more frames than the other ones, and
  23611. the queue is already filled.
  23612. These filters accept the following options:
  23613. @table @option
  23614. @item nb_inputs, n
  23615. Set the number of different inputs, it is 2 by default.
  23616. @item duration
  23617. How to determine the end-of-stream.
  23618. @table @option
  23619. @item longest
  23620. The duration of the longest input. (default)
  23621. @item shortest
  23622. The duration of the shortest input.
  23623. @item first
  23624. The duration of the first input.
  23625. @end table
  23626. @end table
  23627. @subsection Examples
  23628. @itemize
  23629. @item
  23630. Interleave frames belonging to different streams using @command{ffmpeg}:
  23631. @example
  23632. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  23633. @end example
  23634. @item
  23635. Add flickering blur effect:
  23636. @example
  23637. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  23638. @end example
  23639. @end itemize
  23640. @section latency, alatency
  23641. Measure filtering latency.
  23642. Report previous filter filtering latency, delay in number of audio samples for audio filters
  23643. or number of video frames for video filters.
  23644. On end of input stream, filter will report min and max measured latency for previous running filter
  23645. in filtergraph.
  23646. @section metadata, ametadata
  23647. Manipulate frame metadata.
  23648. This filter accepts the following options:
  23649. @table @option
  23650. @item mode
  23651. Set mode of operation of the filter.
  23652. Can be one of the following:
  23653. @table @samp
  23654. @item select
  23655. If both @code{value} and @code{key} is set, select frames
  23656. which have such metadata. If only @code{key} is set, select
  23657. every frame that has such key in metadata.
  23658. @item add
  23659. Add new metadata @code{key} and @code{value}. If key is already available
  23660. do nothing.
  23661. @item modify
  23662. Modify value of already present key.
  23663. @item delete
  23664. If @code{value} is set, delete only keys that have such value.
  23665. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  23666. the frame.
  23667. @item print
  23668. Print key and its value if metadata was found. If @code{key} is not set print all
  23669. metadata values available in frame.
  23670. @end table
  23671. @item key
  23672. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  23673. @item value
  23674. Set metadata value which will be used. This option is mandatory for
  23675. @code{modify} and @code{add} mode.
  23676. @item function
  23677. Which function to use when comparing metadata value and @code{value}.
  23678. Can be one of following:
  23679. @table @samp
  23680. @item same_str
  23681. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  23682. @item starts_with
  23683. Values are interpreted as strings, returns true if metadata value starts with
  23684. the @code{value} option string.
  23685. @item less
  23686. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  23687. @item equal
  23688. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  23689. @item greater
  23690. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  23691. @item expr
  23692. Values are interpreted as floats, returns true if expression from option @code{expr}
  23693. evaluates to true.
  23694. @item ends_with
  23695. Values are interpreted as strings, returns true if metadata value ends with
  23696. the @code{value} option string.
  23697. @end table
  23698. @item expr
  23699. Set expression which is used when @code{function} is set to @code{expr}.
  23700. The expression is evaluated through the eval API and can contain the following
  23701. constants:
  23702. @table @option
  23703. @item VALUE1, FRAMEVAL
  23704. Float representation of @code{value} from metadata key.
  23705. @item VALUE2, USERVAL
  23706. Float representation of @code{value} as supplied by user in @code{value} option.
  23707. @end table
  23708. @item file
  23709. If specified in @code{print} mode, output is written to the named file. Instead of
  23710. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  23711. for standard output. If @code{file} option is not set, output is written to the log
  23712. with AV_LOG_INFO loglevel.
  23713. @item direct
  23714. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  23715. @end table
  23716. @subsection Examples
  23717. @itemize
  23718. @item
  23719. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  23720. between 0 and 1.
  23721. @example
  23722. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  23723. @end example
  23724. @item
  23725. Print silencedetect output to file @file{metadata.txt}.
  23726. @example
  23727. silencedetect,ametadata=mode=print:file=metadata.txt
  23728. @end example
  23729. @item
  23730. Direct all metadata to a pipe with file descriptor 4.
  23731. @example
  23732. metadata=mode=print:file='pipe\:4'
  23733. @end example
  23734. @end itemize
  23735. @section perms, aperms
  23736. Set read/write permissions for the output frames.
  23737. These filters are mainly aimed at developers to test direct path in the
  23738. following filter in the filtergraph.
  23739. The filters accept the following options:
  23740. @table @option
  23741. @item mode
  23742. Select the permissions mode.
  23743. It accepts the following values:
  23744. @table @samp
  23745. @item none
  23746. Do nothing. This is the default.
  23747. @item ro
  23748. Set all the output frames read-only.
  23749. @item rw
  23750. Set all the output frames directly writable.
  23751. @item toggle
  23752. Make the frame read-only if writable, and writable if read-only.
  23753. @item random
  23754. Set each output frame read-only or writable randomly.
  23755. @end table
  23756. @item seed
  23757. Set the seed for the @var{random} mode, must be an integer included between
  23758. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  23759. @code{-1}, the filter will try to use a good random seed on a best effort
  23760. basis.
  23761. @end table
  23762. Note: in case of auto-inserted filter between the permission filter and the
  23763. following one, the permission might not be received as expected in that
  23764. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  23765. perms/aperms filter can avoid this problem.
  23766. @section realtime, arealtime
  23767. Slow down filtering to match real time approximately.
  23768. These filters will pause the filtering for a variable amount of time to
  23769. match the output rate with the input timestamps.
  23770. They are similar to the @option{re} option to @code{ffmpeg}.
  23771. They accept the following options:
  23772. @table @option
  23773. @item limit
  23774. Time limit for the pauses. Any pause longer than that will be considered
  23775. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  23776. @item speed
  23777. Speed factor for processing. The value must be a float larger than zero.
  23778. Values larger than 1.0 will result in faster than realtime processing,
  23779. smaller will slow processing down. The @var{limit} is automatically adapted
  23780. accordingly. Default is 1.0.
  23781. A processing speed faster than what is possible without these filters cannot
  23782. be achieved.
  23783. @end table
  23784. @subsection Commands
  23785. Both filters supports the all above options as @ref{commands}.
  23786. @section segment, asegment
  23787. Split single input stream into multiple streams.
  23788. This filter does opposite of concat filters.
  23789. @code{segment} works on video frames, @code{asegment} on audio samples.
  23790. This filter accepts the following options:
  23791. @table @option
  23792. @item timestamps
  23793. Timestamps of output segments separated by '|'. The first segment will run
  23794. from the beginning of the input stream. The last segment will run until
  23795. the end of the input stream
  23796. @item frames, samples
  23797. Exact frame/sample count to split the segments.
  23798. @end table
  23799. In all cases, prefixing an each segment with '+' will make it relative to the
  23800. previous segment.
  23801. @subsection Examples
  23802. @itemize
  23803. @item
  23804. Split input audio stream into three output audio streams, starting at start of input audio stream
  23805. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  23806. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  23807. @example
  23808. asegment=timestamps="60|150"
  23809. @end example
  23810. @end itemize
  23811. @anchor{select}
  23812. @section select, aselect
  23813. Select frames to pass in output.
  23814. This filter accepts the following options:
  23815. @table @option
  23816. @item expr, e
  23817. Set expression, which is evaluated for each input frame.
  23818. If the expression is evaluated to zero, the frame is discarded.
  23819. If the evaluation result is negative or NaN, the frame is sent to the
  23820. first output; otherwise it is sent to the output with index
  23821. @code{ceil(val)-1}, assuming that the input index starts from 0.
  23822. For example a value of @code{1.2} corresponds to the output with index
  23823. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  23824. @item outputs, n
  23825. Set the number of outputs. The output to which to send the selected
  23826. frame is based on the result of the evaluation. Default value is 1.
  23827. @end table
  23828. The expression can contain the following constants:
  23829. @table @option
  23830. @item n
  23831. The (sequential) number of the filtered frame, starting from 0.
  23832. @item selected_n
  23833. The (sequential) number of the selected frame, starting from 0.
  23834. @item prev_selected_n
  23835. The sequential number of the last selected frame. It's NAN if undefined.
  23836. @item TB
  23837. The timebase of the input timestamps.
  23838. @item pts
  23839. The PTS (Presentation TimeStamp) of the filtered frame,
  23840. expressed in @var{TB} units. It's NAN if undefined.
  23841. @item t
  23842. The PTS of the filtered frame,
  23843. expressed in seconds. It's NAN if undefined.
  23844. @item prev_pts
  23845. The PTS of the previously filtered frame. It's NAN if undefined.
  23846. @item prev_selected_pts
  23847. The PTS of the last previously filtered frame. It's NAN if undefined.
  23848. @item prev_selected_t
  23849. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  23850. @item start_pts
  23851. The first PTS in the stream which is not NAN. It remains NAN if not found.
  23852. @item start_t
  23853. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  23854. @item pict_type @emph{(video only)}
  23855. The type of the filtered frame. It can assume one of the following
  23856. values:
  23857. @table @option
  23858. @item I
  23859. @item P
  23860. @item B
  23861. @item S
  23862. @item SI
  23863. @item SP
  23864. @item BI
  23865. @end table
  23866. @item interlace_type @emph{(video only)}
  23867. The frame interlace type. It can assume one of the following values:
  23868. @table @option
  23869. @item PROGRESSIVE
  23870. The frame is progressive (not interlaced).
  23871. @item TOPFIRST
  23872. The frame is top-field-first.
  23873. @item BOTTOMFIRST
  23874. The frame is bottom-field-first.
  23875. @end table
  23876. @item consumed_sample_n @emph{(audio only)}
  23877. the number of selected samples before the current frame
  23878. @item samples_n @emph{(audio only)}
  23879. the number of samples in the current frame
  23880. @item sample_rate @emph{(audio only)}
  23881. the input sample rate
  23882. @item key
  23883. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  23884. @item pos
  23885. the position in the file of the filtered frame, -1 if the information
  23886. is not available (e.g. for synthetic video); deprecated, do not use
  23887. @item scene @emph{(video only)}
  23888. value between 0 and 1 to indicate a new scene; a low value reflects a low
  23889. probability for the current frame to introduce a new scene, while a higher
  23890. value means the current frame is more likely to be one (see the example below)
  23891. @item concatdec_select
  23892. The concat demuxer can select only part of a concat input file by setting an
  23893. inpoint and an outpoint, but the output packets may not be entirely contained
  23894. in the selected interval. By using this variable, it is possible to skip frames
  23895. generated by the concat demuxer which are not exactly contained in the selected
  23896. interval.
  23897. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  23898. and the @var{lavf.concat.duration} packet metadata values which are also
  23899. present in the decoded frames.
  23900. The @var{concatdec_select} variable is -1 if the frame pts is at least
  23901. start_time and either the duration metadata is missing or the frame pts is less
  23902. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  23903. missing.
  23904. That basically means that an input frame is selected if its pts is within the
  23905. interval set by the concat demuxer.
  23906. @item iw @emph{(video only)}
  23907. Represents the width of the input video frame.
  23908. @item ih @emph{(video only)}
  23909. Represents the height of the input video frame.
  23910. @item view @emph{(video only)}
  23911. View ID for multi-view video.
  23912. @end table
  23913. The default value of the select expression is "1".
  23914. @subsection Examples
  23915. @itemize
  23916. @item
  23917. Select all frames in input:
  23918. @example
  23919. select
  23920. @end example
  23921. The example above is the same as:
  23922. @example
  23923. select=1
  23924. @end example
  23925. @item
  23926. Skip all frames:
  23927. @example
  23928. select=0
  23929. @end example
  23930. @item
  23931. Select only I-frames:
  23932. @example
  23933. select='eq(pict_type\,I)'
  23934. @end example
  23935. @item
  23936. Select one frame every 100:
  23937. @example
  23938. select='not(mod(n\,100))'
  23939. @end example
  23940. @item
  23941. Select only frames contained in the 10-20 time interval:
  23942. @example
  23943. select=between(t\,10\,20)
  23944. @end example
  23945. @item
  23946. Select only I-frames contained in the 10-20 time interval:
  23947. @example
  23948. select=between(t\,10\,20)*eq(pict_type\,I)
  23949. @end example
  23950. @item
  23951. Select frames with a minimum distance of 10 seconds:
  23952. @example
  23953. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  23954. @end example
  23955. @item
  23956. Use aselect to select only audio frames with samples number > 100:
  23957. @example
  23958. aselect='gt(samples_n\,100)'
  23959. @end example
  23960. @item
  23961. Create a mosaic of the first scenes:
  23962. @example
  23963. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  23964. @end example
  23965. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  23966. choice.
  23967. @item
  23968. Send even and odd frames to separate outputs, and compose them:
  23969. @example
  23970. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  23971. @end example
  23972. @item
  23973. Select useful frames from an ffconcat file which is using inpoints and
  23974. outpoints but where the source files are not intra frame only.
  23975. @example
  23976. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  23977. @end example
  23978. @end itemize
  23979. @section sendcmd, asendcmd
  23980. Send commands to filters in the filtergraph.
  23981. These filters read commands to be sent to other filters in the
  23982. filtergraph.
  23983. @code{sendcmd} must be inserted between two video filters,
  23984. @code{asendcmd} must be inserted between two audio filters, but apart
  23985. from that they act the same way.
  23986. The specification of commands can be provided in the filter arguments
  23987. with the @var{commands} option, or in a file specified by the
  23988. @var{filename} option.
  23989. These filters accept the following options:
  23990. @table @option
  23991. @item commands, c
  23992. Set the commands to be read and sent to the other filters.
  23993. @item filename, f
  23994. Set the filename of the commands to be read and sent to the other
  23995. filters.
  23996. @end table
  23997. @subsection Commands syntax
  23998. A commands description consists of a sequence of interval
  23999. specifications, comprising a list of commands to be executed when a
  24000. particular event related to that interval occurs. The occurring event
  24001. is typically the current frame time entering or leaving a given time
  24002. interval.
  24003. An interval is specified by the following syntax:
  24004. @example
  24005. @var{START}[-@var{END}] @var{COMMANDS};
  24006. @end example
  24007. The time interval is specified by the @var{START} and @var{END} times.
  24008. @var{END} is optional and defaults to the maximum time.
  24009. The current frame time is considered within the specified interval if
  24010. it is included in the interval [@var{START}, @var{END}), that is when
  24011. the time is greater or equal to @var{START} and is lesser than
  24012. @var{END}.
  24013. @var{COMMANDS} consists of a sequence of one or more command
  24014. specifications, separated by ",", relating to that interval. The
  24015. syntax of a command specification is given by:
  24016. @example
  24017. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  24018. @end example
  24019. @var{FLAGS} is optional and specifies the type of events relating to
  24020. the time interval which enable sending the specified command, and must
  24021. be a non-null sequence of identifier flags separated by "+" or "|" and
  24022. enclosed between "[" and "]".
  24023. The following flags are recognized:
  24024. @table @option
  24025. @item enter
  24026. The command is sent when the current frame timestamp enters the
  24027. specified interval. In other words, the command is sent when the
  24028. previous frame timestamp was not in the given interval, and the
  24029. current is.
  24030. @item leave
  24031. The command is sent when the current frame timestamp leaves the
  24032. specified interval. In other words, the command is sent when the
  24033. previous frame timestamp was in the given interval, and the
  24034. current is not.
  24035. @item expr
  24036. The command @var{ARG} is interpreted as expression and result of
  24037. expression is passed as @var{ARG}.
  24038. The expression is evaluated through the eval API and can contain the following
  24039. constants:
  24040. @table @option
  24041. @item POS
  24042. Original position in the file of the frame, or undefined if undefined
  24043. for the current frame. Deprecated, do not use.
  24044. @item PTS
  24045. The presentation timestamp in input.
  24046. @item N
  24047. The count of the input frame for video or audio, starting from 0.
  24048. @item T
  24049. The time in seconds of the current frame.
  24050. @item TS
  24051. The start time in seconds of the current command interval.
  24052. @item TE
  24053. The end time in seconds of the current command interval.
  24054. @item TI
  24055. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  24056. @item W
  24057. The video frame width.
  24058. @item H
  24059. The video frame height.
  24060. @end table
  24061. @end table
  24062. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  24063. assumed.
  24064. @var{TARGET} specifies the target of the command, usually the name of
  24065. the filter class or a specific filter instance name.
  24066. @var{COMMAND} specifies the name of the command for the target filter.
  24067. @var{ARG} is optional and specifies the optional list of argument for
  24068. the given @var{COMMAND}.
  24069. Between one interval specification and another, whitespaces, or
  24070. sequences of characters starting with @code{#} until the end of line,
  24071. are ignored and can be used to annotate comments.
  24072. A simplified BNF description of the commands specification syntax
  24073. follows:
  24074. @example
  24075. @var{COMMAND_FLAG} ::= "enter" | "leave"
  24076. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  24077. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  24078. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  24079. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  24080. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  24081. @end example
  24082. @subsection Examples
  24083. @itemize
  24084. @item
  24085. Specify audio tempo change at second 4:
  24086. @example
  24087. asendcmd=c='4.0 atempo tempo 1.5',atempo
  24088. @end example
  24089. @item
  24090. Target a specific filter instance:
  24091. @example
  24092. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  24093. @end example
  24094. @item
  24095. Specify a list of drawtext and hue commands in a file.
  24096. @example
  24097. # show text in the interval 5-10
  24098. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  24099. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  24100. # desaturate the image in the interval 15-20
  24101. 15.0-20.0 [enter] hue s 0,
  24102. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  24103. [leave] hue s 1,
  24104. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  24105. # apply an exponential saturation fade-out effect, starting from time 25
  24106. 25 [enter] hue s exp(25-t)
  24107. @end example
  24108. A filtergraph allowing to read and process the above command list
  24109. stored in a file @file{test.cmd}, can be specified with:
  24110. @example
  24111. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  24112. @end example
  24113. @end itemize
  24114. @anchor{setpts}
  24115. @section setpts, asetpts
  24116. Change the PTS (presentation timestamp) of the input frames.
  24117. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  24118. This filter accepts the following options:
  24119. @table @option
  24120. @item expr
  24121. The expression which is evaluated for each frame to construct its timestamp.
  24122. @item strip_fps (@emph{video only})
  24123. Boolean option which determines if the original framerate metadata is unset.
  24124. If set to true, be advised that a sane frame rate should be explicitly
  24125. specified if output is sent to a constant frame rate muxer.
  24126. Default is @code{false}.
  24127. @end table
  24128. The expression is evaluated through the eval API and can contain the following
  24129. constants:
  24130. @table @option
  24131. @item FRAME_RATE, FR
  24132. frame rate, only defined for constant frame-rate video
  24133. @item PTS
  24134. The presentation timestamp in input
  24135. @item N
  24136. The count of the input frame for video or the number of consumed samples,
  24137. not including the current frame for audio, starting from 0.
  24138. @item NB_CONSUMED_SAMPLES
  24139. The number of consumed samples, not including the current frame (only
  24140. audio)
  24141. @item NB_SAMPLES, S
  24142. The number of samples in the current frame (only audio)
  24143. @item SAMPLE_RATE, SR
  24144. The audio sample rate.
  24145. @item STARTPTS
  24146. The PTS of the first frame.
  24147. @item STARTT
  24148. the time in seconds of the first frame
  24149. @item INTERLACED
  24150. State whether the current frame is interlaced.
  24151. @item T
  24152. the time in seconds of the current frame
  24153. @item POS
  24154. original position in the file of the frame, or undefined if undefined
  24155. for the current frame; deprecated, do not use
  24156. @item PREV_INPTS
  24157. The previous input PTS.
  24158. @item PREV_INT
  24159. previous input time in seconds
  24160. @item PREV_OUTPTS
  24161. The previous output PTS.
  24162. @item PREV_OUTT
  24163. previous output time in seconds
  24164. @item RTCTIME
  24165. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  24166. instead.
  24167. @item RTCSTART
  24168. The wallclock (RTC) time at the start of the movie in microseconds.
  24169. @item TB
  24170. The timebase of the input timestamps.
  24171. @item T_CHANGE
  24172. Time of the first frame after command was applied or time of the first frame if no commands.
  24173. @end table
  24174. @subsection Examples
  24175. @itemize
  24176. @item
  24177. Start counting PTS from zero
  24178. @example
  24179. setpts=PTS-STARTPTS
  24180. @end example
  24181. @item
  24182. Apply fast motion effect:
  24183. @example
  24184. setpts=0.5*PTS
  24185. @end example
  24186. @item
  24187. Apply slow motion effect:
  24188. @example
  24189. setpts=2.0*PTS
  24190. @end example
  24191. @item
  24192. Set fixed rate of 25 frames per second:
  24193. @example
  24194. setpts=N/(25*TB)
  24195. @end example
  24196. @item
  24197. Apply a random jitter effect of +/-100 TB units:
  24198. @example
  24199. setpts=PTS+randomi(0, -100\,100)
  24200. @end example
  24201. @item
  24202. Set fixed rate 25 fps with some jitter:
  24203. @example
  24204. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  24205. @end example
  24206. @item
  24207. Apply an offset of 10 seconds to the input PTS:
  24208. @example
  24209. setpts=PTS+10/TB
  24210. @end example
  24211. @item
  24212. Generate timestamps from a "live source" and rebase onto the current timebase:
  24213. @example
  24214. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  24215. @end example
  24216. @item
  24217. Generate timestamps by counting samples:
  24218. @example
  24219. asetpts=N/SR/TB
  24220. @end example
  24221. @end itemize
  24222. @subsection Commands
  24223. Both filters support all above options as @ref{commands}.
  24224. @section setrange
  24225. Force color range for the output video frame.
  24226. The @code{setrange} filter marks the color range property for the
  24227. output frames. It does not change the input frame, but only sets the
  24228. corresponding property, which affects how the frame is treated by
  24229. following filters.
  24230. The filter accepts the following options:
  24231. @table @option
  24232. @item range
  24233. Available values are:
  24234. @table @samp
  24235. @item auto
  24236. Keep the same color range property.
  24237. @item unspecified, unknown
  24238. Set the color range as unspecified.
  24239. @item limited, tv, mpeg
  24240. Set the color range as limited.
  24241. @item full, pc, jpeg
  24242. Set the color range as full.
  24243. @end table
  24244. @end table
  24245. @section settb, asettb
  24246. Set the timebase to use for the output frames timestamps.
  24247. It is mainly useful for testing timebase configuration.
  24248. It accepts the following parameters:
  24249. @table @option
  24250. @item expr, tb
  24251. The expression which is evaluated into the output timebase.
  24252. @end table
  24253. The value for @option{tb} is an arithmetic expression representing a
  24254. rational. The expression can contain the constants "AVTB" (the default
  24255. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  24256. audio only). Default value is "intb".
  24257. @subsection Examples
  24258. @itemize
  24259. @item
  24260. Set the timebase to 1/25:
  24261. @example
  24262. settb=expr=1/25
  24263. @end example
  24264. @item
  24265. Set the timebase to 1/10:
  24266. @example
  24267. settb=expr=0.1
  24268. @end example
  24269. @item
  24270. Set the timebase to 1001/1000:
  24271. @example
  24272. settb=1+0.001
  24273. @end example
  24274. @item
  24275. Set the timebase to 2*intb:
  24276. @example
  24277. settb=2*intb
  24278. @end example
  24279. @item
  24280. Set the default timebase value:
  24281. @example
  24282. settb=AVTB
  24283. @end example
  24284. @end itemize
  24285. @section showcqt
  24286. Convert input audio to a video output representing frequency spectrum
  24287. logarithmically using Brown-Puckette constant Q transform algorithm with
  24288. direct frequency domain coefficient calculation (but the transform itself
  24289. is not really constant Q, instead the Q factor is actually variable/clamped),
  24290. with musical tone scale, from E0 to D#10.
  24291. The filter accepts the following options:
  24292. @table @option
  24293. @item size, s
  24294. Specify the video size for the output. It must be even. For the syntax of this option,
  24295. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24296. Default value is @code{1920x1080}.
  24297. @item fps, rate, r
  24298. Set the output frame rate. Default value is @code{25}.
  24299. @item bar_h
  24300. Set the bargraph height. It must be even. Default value is @code{-1} which
  24301. computes the bargraph height automatically.
  24302. @item axis_h
  24303. Set the axis height. It must be even. Default value is @code{-1} which computes
  24304. the axis height automatically.
  24305. @item sono_h
  24306. Set the sonogram height. It must be even. Default value is @code{-1} which
  24307. computes the sonogram height automatically.
  24308. @item fullhd
  24309. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  24310. instead. Default value is @code{1}.
  24311. @item sono_v, volume
  24312. Specify the sonogram volume expression. It can contain variables:
  24313. @table @option
  24314. @item bar_v
  24315. the @var{bar_v} evaluated expression
  24316. @item frequency, freq, f
  24317. the frequency where it is evaluated
  24318. @item timeclamp, tc
  24319. the value of @var{timeclamp} option
  24320. @end table
  24321. and functions:
  24322. @table @option
  24323. @item a_weighting(f)
  24324. A-weighting of equal loudness
  24325. @item b_weighting(f)
  24326. B-weighting of equal loudness
  24327. @item c_weighting(f)
  24328. C-weighting of equal loudness.
  24329. @end table
  24330. Default value is @code{16}.
  24331. @item bar_v, volume2
  24332. Specify the bargraph volume expression. It can contain variables:
  24333. @table @option
  24334. @item sono_v
  24335. the @var{sono_v} evaluated expression
  24336. @item frequency, freq, f
  24337. the frequency where it is evaluated
  24338. @item timeclamp, tc
  24339. the value of @var{timeclamp} option
  24340. @end table
  24341. and functions:
  24342. @table @option
  24343. @item a_weighting(f)
  24344. A-weighting of equal loudness
  24345. @item b_weighting(f)
  24346. B-weighting of equal loudness
  24347. @item c_weighting(f)
  24348. C-weighting of equal loudness.
  24349. @end table
  24350. Default value is @code{sono_v}.
  24351. @item sono_g, gamma
  24352. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  24353. higher gamma makes the spectrum having more range. Default value is @code{3}.
  24354. Acceptable range is @code{[1, 7]}.
  24355. @item bar_g, gamma2
  24356. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  24357. @code{[1, 7]}.
  24358. @item bar_t
  24359. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  24360. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  24361. @item timeclamp, tc
  24362. Specify the transform timeclamp. At low frequency, there is trade-off between
  24363. accuracy in time domain and frequency domain. If timeclamp is lower,
  24364. event in time domain is represented more accurately (such as fast bass drum),
  24365. otherwise event in frequency domain is represented more accurately
  24366. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  24367. @item attack
  24368. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  24369. limits future samples by applying asymmetric windowing in time domain, useful
  24370. when low latency is required. Accepted range is @code{[0, 1]}.
  24371. @item basefreq
  24372. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  24373. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  24374. @item endfreq
  24375. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  24376. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  24377. @item coeffclamp
  24378. This option is deprecated and ignored.
  24379. @item tlength
  24380. Specify the transform length in time domain. Use this option to control accuracy
  24381. trade-off between time domain and frequency domain at every frequency sample.
  24382. It can contain variables:
  24383. @table @option
  24384. @item frequency, freq, f
  24385. the frequency where it is evaluated
  24386. @item timeclamp, tc
  24387. the value of @var{timeclamp} option.
  24388. @end table
  24389. Default value is @code{384*tc/(384+tc*f)}.
  24390. @item count
  24391. Specify the transform count for every video frame. Default value is @code{6}.
  24392. Acceptable range is @code{[1, 30]}.
  24393. @item fcount
  24394. Specify the transform count for every single pixel. Default value is @code{0},
  24395. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  24396. @item fontfile
  24397. Specify font file for use with freetype to draw the axis. If not specified,
  24398. use embedded font. Note that drawing with font file or embedded font is not
  24399. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  24400. option instead.
  24401. @item font
  24402. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  24403. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  24404. escaping.
  24405. @item fontcolor
  24406. Specify font color expression. This is arithmetic expression that should return
  24407. integer value 0xRRGGBB. It can contain variables:
  24408. @table @option
  24409. @item frequency, freq, f
  24410. the frequency where it is evaluated
  24411. @item timeclamp, tc
  24412. the value of @var{timeclamp} option
  24413. @end table
  24414. and functions:
  24415. @table @option
  24416. @item midi(f)
  24417. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  24418. @item r(x), g(x), b(x)
  24419. red, green, and blue value of intensity x.
  24420. @end table
  24421. Default value is @code{st(0, (midi(f)-59.5)/12);
  24422. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  24423. r(1-ld(1)) + b(ld(1))}.
  24424. @item axisfile
  24425. Specify image file to draw the axis. This option override @var{fontfile} and
  24426. @var{fontcolor} option.
  24427. @item axis, text
  24428. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  24429. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  24430. Default value is @code{1}.
  24431. @item csp
  24432. Set colorspace. The accepted values are:
  24433. @table @samp
  24434. @item unspecified
  24435. Unspecified (default)
  24436. @item bt709
  24437. BT.709
  24438. @item fcc
  24439. FCC
  24440. @item bt470bg
  24441. BT.470BG or BT.601-6 625
  24442. @item smpte170m
  24443. SMPTE-170M or BT.601-6 525
  24444. @item smpte240m
  24445. SMPTE-240M
  24446. @item bt2020ncl
  24447. BT.2020 with non-constant luminance
  24448. @end table
  24449. @item cscheme
  24450. Set spectrogram color scheme. This is list of floating point values with format
  24451. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  24452. The default is @code{1|0.5|0|0|0.5|1}.
  24453. @end table
  24454. @subsection Examples
  24455. @itemize
  24456. @item
  24457. Playing audio while showing the spectrum:
  24458. @example
  24459. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  24460. @end example
  24461. @item
  24462. Same as above, but with frame rate 30 fps:
  24463. @example
  24464. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  24465. @end example
  24466. @item
  24467. Playing at 1280x720:
  24468. @example
  24469. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  24470. @end example
  24471. @item
  24472. Disable sonogram display:
  24473. @example
  24474. sono_h=0
  24475. @end example
  24476. @item
  24477. A1 and its harmonics: A1, A2, (near)E3, A3:
  24478. @example
  24479. 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),
  24480. asplit[a][out1]; [a] showcqt [out0]'
  24481. @end example
  24482. @item
  24483. Same as above, but with more accuracy in frequency domain:
  24484. @example
  24485. 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),
  24486. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  24487. @end example
  24488. @item
  24489. Custom volume:
  24490. @example
  24491. bar_v=10:sono_v=bar_v*a_weighting(f)
  24492. @end example
  24493. @item
  24494. Custom gamma, now spectrum is linear to the amplitude.
  24495. @example
  24496. bar_g=2:sono_g=2
  24497. @end example
  24498. @item
  24499. Custom tlength equation:
  24500. @example
  24501. 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)))'
  24502. @end example
  24503. @item
  24504. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  24505. @example
  24506. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  24507. @end example
  24508. @item
  24509. Custom font using fontconfig:
  24510. @example
  24511. font='Courier New,Monospace,mono|bold'
  24512. @end example
  24513. @item
  24514. Custom frequency range with custom axis using image file:
  24515. @example
  24516. axisfile=myaxis.png:basefreq=40:endfreq=10000
  24517. @end example
  24518. @end itemize
  24519. @section showcwt
  24520. Convert input audio to video output representing frequency spectrum
  24521. using Continuous Wavelet Transform and Morlet wavelet.
  24522. The filter accepts the following options:
  24523. @table @option
  24524. @item size, s
  24525. Specify the video size for the output. For the syntax of this option,
  24526. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24527. Default value is @code{640x512}.
  24528. @item rate, r
  24529. Set the output frame rate. Default value is @code{25}.
  24530. @item scale
  24531. Set the frequency scale used. Allowed values are:
  24532. @table @option
  24533. @item linear
  24534. @item log
  24535. @item bark
  24536. @item mel
  24537. @item erbs
  24538. @item sqrt
  24539. @item cbrt
  24540. @item qdrt
  24541. @item fm
  24542. @end table
  24543. Default value is @code{linear}.
  24544. @item iscale
  24545. Set the intensity scale used. Allowed values are:
  24546. @table @option
  24547. @item linear
  24548. @item log
  24549. @item sqrt
  24550. @item cbrt
  24551. @item qdrt
  24552. @end table
  24553. Default value is @code{log}.
  24554. @item min
  24555. Set the minimum frequency that will be used in output.
  24556. Default is @code{20} Hz.
  24557. @item max
  24558. Set the maximum frequency that will be used in output.
  24559. Default is @code{20000} Hz. The real frequency upper limit
  24560. depends on input audio's sample rate and such will be enforced
  24561. on this value when it is set to value greater than Nyquist frequency.
  24562. @item imin
  24563. Set the minimum intensity that will be used in output.
  24564. @item imax
  24565. Set the maximum intensity that will be used in output.
  24566. @item logb
  24567. Set the logarithmic basis for brightness strength when
  24568. mapping calculated magnitude values to pixel values.
  24569. Allowed range is from @code{0} to @code{1}.
  24570. Default value is @code{0.0001}.
  24571. @item deviation
  24572. Set the frequency deviation.
  24573. Lower values than @code{1} are more frequency oriented,
  24574. while higher values than @code{1} are more time oriented.
  24575. Allowed range is from @code{0} to @code{10}.
  24576. Default value is @code{1}.
  24577. @item pps
  24578. Set the number of pixel output per each second in one row.
  24579. Allowed range is from @code{1} to @code{1024}.
  24580. Default value is @code{64}.
  24581. @item mode
  24582. Set the output visual mode. Allowed values are:
  24583. @table @option
  24584. @item magnitude
  24585. Show magnitude.
  24586. @item phase
  24587. Show only phase.
  24588. @item magphase
  24589. Show combination of magnitude and phase.
  24590. Magnitude is mapped to brightness and phase to color.
  24591. @item channel
  24592. Show unique color per channel magnitude.
  24593. @item stereo
  24594. Show unique color per stereo difference.
  24595. @end table
  24596. Default value is @code{magnitude}.
  24597. @item slide
  24598. Set the output slide method. Allowed values are:
  24599. @table @option
  24600. @item replace
  24601. @item scroll
  24602. @item frame
  24603. @end table
  24604. @item direction
  24605. Set the direction method for output slide method. Allowed values are:
  24606. @table @option
  24607. @item lr
  24608. Direction from left to right.
  24609. @item rl
  24610. Direction from right to left.
  24611. @item ud
  24612. Direction from up to down.
  24613. @item du
  24614. Direction from down to up.
  24615. @end table
  24616. @item bar
  24617. Set the ratio of bargraph display to display size. Default is 0.
  24618. @item rotation
  24619. Set color rotation, must be in [-1.0, 1.0] range.
  24620. Default value is @code{0}.
  24621. @end table
  24622. @section showfreqs
  24623. Convert input audio to video output representing the audio power spectrum.
  24624. Audio amplitude is on Y-axis while frequency is on X-axis.
  24625. The filter accepts the following options:
  24626. @table @option
  24627. @item size, s
  24628. Specify size of video. For the syntax of this option, check the
  24629. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24630. Default is @code{1024x512}.
  24631. @item rate, r
  24632. Set video rate. Default is @code{25}.
  24633. @item mode
  24634. Set display mode.
  24635. This set how each frequency bin will be represented.
  24636. It accepts the following values:
  24637. @table @samp
  24638. @item line
  24639. @item bar
  24640. @item dot
  24641. @end table
  24642. Default is @code{bar}.
  24643. @item ascale
  24644. Set amplitude scale.
  24645. It accepts the following values:
  24646. @table @samp
  24647. @item lin
  24648. Linear scale.
  24649. @item sqrt
  24650. Square root scale.
  24651. @item cbrt
  24652. Cubic root scale.
  24653. @item log
  24654. Logarithmic scale.
  24655. @end table
  24656. Default is @code{log}.
  24657. @item fscale
  24658. Set frequency scale.
  24659. It accepts the following values:
  24660. @table @samp
  24661. @item lin
  24662. Linear scale.
  24663. @item log
  24664. Logarithmic scale.
  24665. @item rlog
  24666. Reverse logarithmic scale.
  24667. @end table
  24668. Default is @code{lin}.
  24669. @item win_size
  24670. Set window size. Allowed range is from 16 to 65536.
  24671. Default is @code{2048}
  24672. @item win_func
  24673. Set windowing function.
  24674. It accepts the following values:
  24675. @table @samp
  24676. @item rect
  24677. @item bartlett
  24678. @item hanning
  24679. @item hamming
  24680. @item blackman
  24681. @item welch
  24682. @item flattop
  24683. @item bharris
  24684. @item bnuttall
  24685. @item bhann
  24686. @item sine
  24687. @item nuttall
  24688. @item lanczos
  24689. @item gauss
  24690. @item tukey
  24691. @item dolph
  24692. @item cauchy
  24693. @item parzen
  24694. @item poisson
  24695. @item bohman
  24696. @item kaiser
  24697. @end table
  24698. Default is @code{hanning}.
  24699. @item overlap
  24700. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  24701. which means optimal overlap for selected window function will be picked.
  24702. @item averaging
  24703. Set time averaging. Setting this to 0 will display current maximal peaks.
  24704. Default is @code{1}, which means time averaging is disabled.
  24705. @item colors
  24706. Specify list of colors separated by space or by '|' which will be used to
  24707. draw channel frequencies. Unrecognized or missing colors will be replaced
  24708. by white color.
  24709. @item cmode
  24710. Set channel display mode.
  24711. It accepts the following values:
  24712. @table @samp
  24713. @item combined
  24714. @item separate
  24715. @end table
  24716. Default is @code{combined}.
  24717. @item minamp
  24718. Set minimum amplitude used in @code{log} amplitude scaler.
  24719. @item data
  24720. Set data display mode.
  24721. It accepts the following values:
  24722. @table @samp
  24723. @item magnitude
  24724. @item phase
  24725. @item delay
  24726. @end table
  24727. Default is @code{magnitude}.
  24728. @item channels
  24729. Set channels to use when processing audio. By default all are processed.
  24730. @end table
  24731. @section showspatial
  24732. Convert stereo input audio to a video output, representing the spatial relationship
  24733. between two channels.
  24734. The filter accepts the following options:
  24735. @table @option
  24736. @item size, s
  24737. Specify the video size for the output. For the syntax of this option, check the
  24738. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24739. Default value is @code{512x512}.
  24740. @item win_size
  24741. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  24742. @item win_func
  24743. Set window function.
  24744. It accepts the following values:
  24745. @table @samp
  24746. @item rect
  24747. @item bartlett
  24748. @item hann
  24749. @item hanning
  24750. @item hamming
  24751. @item blackman
  24752. @item welch
  24753. @item flattop
  24754. @item bharris
  24755. @item bnuttall
  24756. @item bhann
  24757. @item sine
  24758. @item nuttall
  24759. @item lanczos
  24760. @item gauss
  24761. @item tukey
  24762. @item dolph
  24763. @item cauchy
  24764. @item parzen
  24765. @item poisson
  24766. @item bohman
  24767. @item kaiser
  24768. @end table
  24769. Default value is @code{hann}.
  24770. @item rate, r
  24771. Set output framerate.
  24772. @end table
  24773. @anchor{showspectrum}
  24774. @section showspectrum
  24775. Convert input audio to a video output, representing the audio frequency
  24776. spectrum.
  24777. The filter accepts the following options:
  24778. @table @option
  24779. @item size, s
  24780. Specify the video size for the output. For the syntax of this option, check the
  24781. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24782. Default value is @code{640x512}.
  24783. @item slide
  24784. Specify how the spectrum should slide along the window.
  24785. It accepts the following values:
  24786. @table @samp
  24787. @item replace
  24788. the samples start again on the left when they reach the right
  24789. @item scroll
  24790. the samples scroll from right to left
  24791. @item fullframe
  24792. frames are only produced when the samples reach the right
  24793. @item rscroll
  24794. the samples scroll from left to right
  24795. @item lreplace
  24796. the samples start again on the right when they reach the left
  24797. @end table
  24798. Default value is @code{replace}.
  24799. @item mode
  24800. Specify display mode.
  24801. It accepts the following values:
  24802. @table @samp
  24803. @item combined
  24804. all channels are displayed in the same row
  24805. @item separate
  24806. all channels are displayed in separate rows
  24807. @end table
  24808. Default value is @samp{combined}.
  24809. @item color
  24810. Specify display color mode.
  24811. It accepts the following values:
  24812. @table @samp
  24813. @item channel
  24814. each channel is displayed in a separate color
  24815. @item intensity
  24816. each channel is displayed using the same color scheme
  24817. @item rainbow
  24818. each channel is displayed using the rainbow color scheme
  24819. @item moreland
  24820. each channel is displayed using the moreland color scheme
  24821. @item nebulae
  24822. each channel is displayed using the nebulae color scheme
  24823. @item fire
  24824. each channel is displayed using the fire color scheme
  24825. @item fiery
  24826. each channel is displayed using the fiery color scheme
  24827. @item fruit
  24828. each channel is displayed using the fruit color scheme
  24829. @item cool
  24830. each channel is displayed using the cool color scheme
  24831. @item magma
  24832. each channel is displayed using the magma color scheme
  24833. @item green
  24834. each channel is displayed using the green color scheme
  24835. @item viridis
  24836. each channel is displayed using the viridis color scheme
  24837. @item plasma
  24838. each channel is displayed using the plasma color scheme
  24839. @item cividis
  24840. each channel is displayed using the cividis color scheme
  24841. @item terrain
  24842. each channel is displayed using the terrain color scheme
  24843. @end table
  24844. Default value is @samp{channel}.
  24845. @item scale
  24846. Specify scale used for calculating intensity color values.
  24847. It accepts the following values:
  24848. @table @samp
  24849. @item lin
  24850. linear
  24851. @item sqrt
  24852. square root, default
  24853. @item cbrt
  24854. cubic root
  24855. @item log
  24856. logarithmic
  24857. @item 4thrt
  24858. 4th root
  24859. @item 5thrt
  24860. 5th root
  24861. @end table
  24862. Default value is @samp{sqrt}.
  24863. @item fscale
  24864. Specify frequency scale.
  24865. It accepts the following values:
  24866. @table @samp
  24867. @item lin
  24868. linear
  24869. @item log
  24870. logarithmic
  24871. @end table
  24872. Default value is @samp{lin}.
  24873. @item saturation
  24874. Set saturation modifier for displayed colors. Negative values provide
  24875. alternative color scheme. @code{0} is no saturation at all.
  24876. Saturation must be in [-10.0, 10.0] range.
  24877. Default value is @code{1}.
  24878. @item win_func
  24879. Set window function.
  24880. It accepts the following values:
  24881. @table @samp
  24882. @item rect
  24883. @item bartlett
  24884. @item hann
  24885. @item hanning
  24886. @item hamming
  24887. @item blackman
  24888. @item welch
  24889. @item flattop
  24890. @item bharris
  24891. @item bnuttall
  24892. @item bhann
  24893. @item sine
  24894. @item nuttall
  24895. @item lanczos
  24896. @item gauss
  24897. @item tukey
  24898. @item dolph
  24899. @item cauchy
  24900. @item parzen
  24901. @item poisson
  24902. @item bohman
  24903. @item kaiser
  24904. @end table
  24905. Default value is @code{hann}.
  24906. @item orientation
  24907. Set orientation of time vs frequency axis. Can be @code{vertical} or
  24908. @code{horizontal}. Default is @code{vertical}.
  24909. @item overlap
  24910. Set ratio of overlap window. Default value is @code{0}.
  24911. When value is @code{1} overlap is set to recommended size for specific
  24912. window function currently used.
  24913. @item gain
  24914. Set scale gain for calculating intensity color values.
  24915. Default value is @code{1}.
  24916. @item data
  24917. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  24918. or unwrapped phase: @code{uphase}.
  24919. @item rotation
  24920. Set color rotation, must be in [-1.0, 1.0] range.
  24921. Default value is @code{0}.
  24922. @item start
  24923. Set start frequency from which to display spectrogram. Default is @code{0}.
  24924. @item stop
  24925. Set stop frequency to which to display spectrogram. Default is @code{0}.
  24926. @item fps
  24927. Set upper frame rate limit. Default is @code{auto}, unlimited.
  24928. @item legend
  24929. Draw time and frequency axes and legends. Default is disabled.
  24930. @item drange
  24931. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  24932. Allowed range is from 10 to 200.
  24933. @item limit
  24934. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  24935. Allowed range is from -100 to 100.
  24936. @item opacity
  24937. Set opacity strength when using pixel format output with alpha component.
  24938. @end table
  24939. The usage is very similar to the showwaves filter; see the examples in that
  24940. section.
  24941. @subsection Examples
  24942. @itemize
  24943. @item
  24944. Large window with logarithmic color scaling:
  24945. @example
  24946. showspectrum=s=1280x480:scale=log
  24947. @end example
  24948. @item
  24949. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  24950. @example
  24951. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  24952. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  24953. @end example
  24954. @end itemize
  24955. @section showspectrumpic
  24956. Convert input audio to a single video frame, representing the audio frequency
  24957. spectrum.
  24958. The filter accepts the following options:
  24959. @table @option
  24960. @item size, s
  24961. Specify the video size for the output. For the syntax of this option, check the
  24962. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24963. Default value is @code{4096x2048}.
  24964. @item mode
  24965. Specify display mode.
  24966. It accepts the following values:
  24967. @table @samp
  24968. @item combined
  24969. all channels are displayed in the same row
  24970. @item separate
  24971. all channels are displayed in separate rows
  24972. @end table
  24973. Default value is @samp{combined}.
  24974. @item color
  24975. Specify display color mode.
  24976. It accepts the following values:
  24977. @table @samp
  24978. @item channel
  24979. each channel is displayed in a separate color
  24980. @item intensity
  24981. each channel is displayed using the same color scheme
  24982. @item rainbow
  24983. each channel is displayed using the rainbow color scheme
  24984. @item moreland
  24985. each channel is displayed using the moreland color scheme
  24986. @item nebulae
  24987. each channel is displayed using the nebulae color scheme
  24988. @item fire
  24989. each channel is displayed using the fire color scheme
  24990. @item fiery
  24991. each channel is displayed using the fiery color scheme
  24992. @item fruit
  24993. each channel is displayed using the fruit color scheme
  24994. @item cool
  24995. each channel is displayed using the cool color scheme
  24996. @item magma
  24997. each channel is displayed using the magma color scheme
  24998. @item green
  24999. each channel is displayed using the green color scheme
  25000. @item viridis
  25001. each channel is displayed using the viridis color scheme
  25002. @item plasma
  25003. each channel is displayed using the plasma color scheme
  25004. @item cividis
  25005. each channel is displayed using the cividis color scheme
  25006. @item terrain
  25007. each channel is displayed using the terrain color scheme
  25008. @end table
  25009. Default value is @samp{intensity}.
  25010. @item scale
  25011. Specify scale used for calculating intensity color values.
  25012. It accepts the following values:
  25013. @table @samp
  25014. @item lin
  25015. linear
  25016. @item sqrt
  25017. square root, default
  25018. @item cbrt
  25019. cubic root
  25020. @item log
  25021. logarithmic
  25022. @item 4thrt
  25023. 4th root
  25024. @item 5thrt
  25025. 5th root
  25026. @end table
  25027. Default value is @samp{log}.
  25028. @item fscale
  25029. Specify frequency scale.
  25030. It accepts the following values:
  25031. @table @samp
  25032. @item lin
  25033. linear
  25034. @item log
  25035. logarithmic
  25036. @end table
  25037. Default value is @samp{lin}.
  25038. @item saturation
  25039. Set saturation modifier for displayed colors. Negative values provide
  25040. alternative color scheme. @code{0} is no saturation at all.
  25041. Saturation must be in [-10.0, 10.0] range.
  25042. Default value is @code{1}.
  25043. @item win_func
  25044. Set window function.
  25045. It accepts the following values:
  25046. @table @samp
  25047. @item rect
  25048. @item bartlett
  25049. @item hann
  25050. @item hanning
  25051. @item hamming
  25052. @item blackman
  25053. @item welch
  25054. @item flattop
  25055. @item bharris
  25056. @item bnuttall
  25057. @item bhann
  25058. @item sine
  25059. @item nuttall
  25060. @item lanczos
  25061. @item gauss
  25062. @item tukey
  25063. @item dolph
  25064. @item cauchy
  25065. @item parzen
  25066. @item poisson
  25067. @item bohman
  25068. @item kaiser
  25069. @end table
  25070. Default value is @code{hann}.
  25071. @item orientation
  25072. Set orientation of time vs frequency axis. Can be @code{vertical} or
  25073. @code{horizontal}. Default is @code{vertical}.
  25074. @item gain
  25075. Set scale gain for calculating intensity color values.
  25076. Default value is @code{1}.
  25077. @item legend
  25078. Draw time and frequency axes and legends. Default is enabled.
  25079. @item rotation
  25080. Set color rotation, must be in [-1.0, 1.0] range.
  25081. Default value is @code{0}.
  25082. @item start
  25083. Set start frequency from which to display spectrogram. Default is @code{0}.
  25084. @item stop
  25085. Set stop frequency to which to display spectrogram. Default is @code{0}.
  25086. @item drange
  25087. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  25088. Allowed range is from 10 to 200.
  25089. @item limit
  25090. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  25091. Allowed range is from -100 to 100.
  25092. @item opacity
  25093. Set opacity strength when using pixel format output with alpha component.
  25094. @end table
  25095. @subsection Examples
  25096. @itemize
  25097. @item
  25098. Extract an audio spectrogram of a whole audio track
  25099. in a 1024x1024 picture using @command{ffmpeg}:
  25100. @example
  25101. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  25102. @end example
  25103. @end itemize
  25104. @section showvolume
  25105. Convert input audio volume to a video output.
  25106. The filter accepts the following options:
  25107. @table @option
  25108. @item rate, r
  25109. Set video rate.
  25110. @item b
  25111. Set border width, allowed range is [0, 5]. Default is 1.
  25112. @item w
  25113. Set channel width, allowed range is [80, 8192]. Default is 400.
  25114. @item h
  25115. Set channel height, allowed range is [1, 900]. Default is 20.
  25116. @item f
  25117. Set fade, allowed range is [0, 1]. Default is 0.95.
  25118. @item c
  25119. Set volume color expression.
  25120. The expression can use the following variables:
  25121. @table @option
  25122. @item VOLUME
  25123. Current max volume of channel in dB.
  25124. @item PEAK
  25125. Current peak.
  25126. @item CHANNEL
  25127. Current channel number, starting from 0.
  25128. @end table
  25129. @item t
  25130. If set, displays channel names. Default is enabled.
  25131. @item v
  25132. If set, displays volume values. Default is enabled.
  25133. @item o
  25134. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  25135. default is @code{h}.
  25136. @item s
  25137. Set step size, allowed range is [0, 5]. Default is 0, which means
  25138. step is disabled.
  25139. @item p
  25140. Set background opacity, allowed range is [0, 1]. Default is 0.
  25141. @item m
  25142. Set metering mode, can be peak: @code{p} or rms: @code{r},
  25143. default is @code{p}.
  25144. @item ds
  25145. Set display scale, can be linear: @code{lin} or log: @code{log},
  25146. default is @code{lin}.
  25147. @item dm
  25148. In second.
  25149. If set to > 0., display a line for the max level
  25150. in the previous seconds.
  25151. default is disabled: @code{0.}
  25152. @item dmc
  25153. The color of the max line. Use when @code{dm} option is set to > 0.
  25154. default is: @code{orange}
  25155. @end table
  25156. @section showwaves
  25157. Convert input audio to a video output, representing the samples waves.
  25158. The filter accepts the following options:
  25159. @table @option
  25160. @item size, s
  25161. Specify the video size for the output. For the syntax of this option, check the
  25162. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  25163. Default value is @code{600x240}.
  25164. @item mode
  25165. Set display mode.
  25166. Available values are:
  25167. @table @samp
  25168. @item point
  25169. Draw a point for each sample.
  25170. @item line
  25171. Draw a vertical line for each sample.
  25172. @item p2p
  25173. Draw a point for each sample and a line between them.
  25174. @item cline
  25175. Draw a centered vertical line for each sample.
  25176. @end table
  25177. Default value is @code{point}.
  25178. @item n
  25179. Set the number of samples which are printed on the same column. A
  25180. larger value will decrease the frame rate. Must be a positive
  25181. integer. This option can be set only if the value for @var{rate}
  25182. is not explicitly specified.
  25183. @item rate, r
  25184. Set the (approximate) output frame rate. This is done by setting the
  25185. option @var{n}. Default value is "25".
  25186. @item split_channels
  25187. Set if channels should be drawn separately or overlap. Default value is 0.
  25188. @item colors
  25189. Set colors separated by '|' which are going to be used for drawing of each channel.
  25190. @item scale
  25191. Set amplitude scale.
  25192. Available values are:
  25193. @table @samp
  25194. @item lin
  25195. Linear.
  25196. @item log
  25197. Logarithmic.
  25198. @item sqrt
  25199. Square root.
  25200. @item cbrt
  25201. Cubic root.
  25202. @end table
  25203. Default is linear.
  25204. @item draw
  25205. Set the draw mode. This is mostly useful to set for high @var{n}.
  25206. Available values are:
  25207. @table @samp
  25208. @item scale
  25209. Scale pixel values for each drawn sample.
  25210. @item full
  25211. Draw every sample directly.
  25212. @end table
  25213. Default value is @code{scale}.
  25214. @end table
  25215. @subsection Examples
  25216. @itemize
  25217. @item
  25218. Output the input file audio and the corresponding video representation
  25219. at the same time:
  25220. @example
  25221. amovie=a.mp3,asplit[out0],showwaves[out1]
  25222. @end example
  25223. @item
  25224. Create a synthetic signal and show it with showwaves, forcing a
  25225. frame rate of 30 frames per second:
  25226. @example
  25227. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  25228. @end example
  25229. @end itemize
  25230. @section showwavespic
  25231. Convert input audio to a single video frame, representing the samples waves.
  25232. The filter accepts the following options:
  25233. @table @option
  25234. @item size, s
  25235. Specify the video size for the output. For the syntax of this option, check the
  25236. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  25237. Default value is @code{600x240}.
  25238. @item split_channels
  25239. Set if channels should be drawn separately or overlap. Default value is 0.
  25240. @item colors
  25241. Set colors separated by '|' which are going to be used for drawing of each channel.
  25242. @item scale
  25243. Set amplitude scale.
  25244. Available values are:
  25245. @table @samp
  25246. @item lin
  25247. Linear.
  25248. @item log
  25249. Logarithmic.
  25250. @item sqrt
  25251. Square root.
  25252. @item cbrt
  25253. Cubic root.
  25254. @end table
  25255. Default is linear.
  25256. @item draw
  25257. Set the draw mode.
  25258. Available values are:
  25259. @table @samp
  25260. @item scale
  25261. Scale pixel values for each drawn sample.
  25262. @item full
  25263. Draw every sample directly.
  25264. @end table
  25265. Default value is @code{scale}.
  25266. @item filter
  25267. Set the filter mode.
  25268. Available values are:
  25269. @table @samp
  25270. @item average
  25271. Use average samples values for each drawn sample.
  25272. @item peak
  25273. Use peak samples values for each drawn sample.
  25274. @end table
  25275. Default value is @code{average}.
  25276. @end table
  25277. @subsection Examples
  25278. @itemize
  25279. @item
  25280. Extract a channel split representation of the wave form of a whole audio track
  25281. in a 1024x800 picture using @command{ffmpeg}:
  25282. @example
  25283. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  25284. @end example
  25285. @end itemize
  25286. @section sidedata, asidedata
  25287. Delete frame side data, or select frames based on it.
  25288. This filter accepts the following options:
  25289. @table @option
  25290. @item mode
  25291. Set mode of operation of the filter.
  25292. Can be one of the following:
  25293. @table @samp
  25294. @item select
  25295. Select every frame with side data of @code{type}.
  25296. @item delete
  25297. Delete side data of @code{type}. If @code{type} is not set, delete all side
  25298. data in the frame.
  25299. @end table
  25300. @item type
  25301. Set side data type used with all modes. Must be set for @code{select} mode. For
  25302. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  25303. in @file{libavutil/frame.h}. For example, to choose
  25304. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  25305. @end table
  25306. @section spectrumsynth
  25307. Synthesize audio from 2 input video spectrums, first input stream represents
  25308. magnitude across time and second represents phase across time.
  25309. The filter will transform from frequency domain as displayed in videos back
  25310. to time domain as presented in audio output.
  25311. This filter is primarily created for reversing processed @ref{showspectrum}
  25312. filter outputs, but can synthesize sound from other spectrograms too.
  25313. But in such case results are going to be poor if the phase data is not
  25314. available, because in such cases phase data need to be recreated, usually
  25315. it's just recreated from random noise.
  25316. For best results use gray only output (@code{channel} color mode in
  25317. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  25318. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  25319. @code{data} option. Inputs videos should generally use @code{fullframe}
  25320. slide mode as that saves resources needed for decoding video.
  25321. The filter accepts the following options:
  25322. @table @option
  25323. @item sample_rate
  25324. Specify sample rate of output audio, the sample rate of audio from which
  25325. spectrum was generated may differ.
  25326. @item channels
  25327. Set number of channels represented in input video spectrums.
  25328. @item scale
  25329. Set scale which was used when generating magnitude input spectrum.
  25330. Can be @code{lin} or @code{log}. Default is @code{log}.
  25331. @item slide
  25332. Set slide which was used when generating inputs spectrums.
  25333. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  25334. Default is @code{fullframe}.
  25335. @item win_func
  25336. Set window function used for resynthesis.
  25337. @item overlap
  25338. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  25339. which means optimal overlap for selected window function will be picked.
  25340. @item orientation
  25341. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  25342. Default is @code{vertical}.
  25343. @end table
  25344. @subsection Examples
  25345. @itemize
  25346. @item
  25347. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  25348. then resynthesize videos back to audio with spectrumsynth:
  25349. @example
  25350. 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
  25351. 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
  25352. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  25353. @end example
  25354. @end itemize
  25355. @section split, asplit
  25356. Split input into several identical outputs.
  25357. @code{asplit} works with audio input, @code{split} with video.
  25358. The filter accepts a single parameter which specifies the number of outputs. If
  25359. unspecified, it defaults to 2.
  25360. @subsection Examples
  25361. @itemize
  25362. @item
  25363. Create two separate outputs from the same input:
  25364. @example
  25365. [in] split [out0][out1]
  25366. @end example
  25367. @item
  25368. To create 3 or more outputs, you need to specify the number of
  25369. outputs, like in:
  25370. @example
  25371. [in] asplit=3 [out0][out1][out2]
  25372. @end example
  25373. @item
  25374. Create two separate outputs from the same input, one cropped and
  25375. one padded:
  25376. @example
  25377. [in] split [splitout1][splitout2];
  25378. [splitout1] crop=100:100:0:0 [cropout];
  25379. [splitout2] pad=200:200:100:100 [padout];
  25380. @end example
  25381. @item
  25382. Create 5 copies of the input audio with @command{ffmpeg}:
  25383. @example
  25384. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  25385. @end example
  25386. @end itemize
  25387. @section zmq, azmq
  25388. Receive commands sent through a libzmq client, and forward them to
  25389. filters in the filtergraph.
  25390. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  25391. must be inserted between two video filters, @code{azmq} between two
  25392. audio filters. Both are capable to send messages to any filter type.
  25393. To enable these filters you need to install the libzmq library and
  25394. headers and configure FFmpeg with @code{--enable-libzmq}.
  25395. For more information about libzmq see:
  25396. @url{http://www.zeromq.org/}
  25397. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  25398. receives messages sent through a network interface defined by the
  25399. @option{bind_address} (or the abbreviation "@option{b}") option.
  25400. Default value of this option is @file{tcp://localhost:5555}. You may
  25401. want to alter this value to your needs, but do not forget to escape any
  25402. ':' signs (see @ref{filtergraph escaping}).
  25403. The received message must be in the form:
  25404. @example
  25405. @var{TARGET} @var{COMMAND} [@var{ARG}]
  25406. @end example
  25407. @var{TARGET} specifies the target of the command, usually the name of
  25408. the filter class or a specific filter instance name. The default
  25409. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  25410. but you can override this by using the @samp{filter_name@@id} syntax
  25411. (see @ref{Filtergraph syntax}).
  25412. @var{COMMAND} specifies the name of the command for the target filter.
  25413. @var{ARG} is optional and specifies the optional argument list for the
  25414. given @var{COMMAND}.
  25415. Upon reception, the message is processed and the corresponding command
  25416. is injected into the filtergraph. Depending on the result, the filter
  25417. will send a reply to the client, adopting the format:
  25418. @example
  25419. @var{ERROR_CODE} @var{ERROR_REASON}
  25420. @var{MESSAGE}
  25421. @end example
  25422. @var{MESSAGE} is optional.
  25423. @subsection Examples
  25424. Look at @file{tools/zmqsend} for an example of a zmq client which can
  25425. be used to send commands processed by these filters.
  25426. Consider the following filtergraph generated by @command{ffplay}.
  25427. In this example the last overlay filter has an instance name. All other
  25428. filters will have default instance names.
  25429. @example
  25430. ffplay -dumpgraph 1 -f lavfi "
  25431. color=s=100x100:c=red [l];
  25432. color=s=100x100:c=blue [r];
  25433. nullsrc=s=200x100, zmq [bg];
  25434. [bg][l] overlay [bg+l];
  25435. [bg+l][r] overlay@@my=x=100 "
  25436. @end example
  25437. To change the color of the left side of the video, the following
  25438. command can be used:
  25439. @example
  25440. echo Parsed_color_0 c yellow | tools/zmqsend
  25441. @end example
  25442. To change the right side:
  25443. @example
  25444. echo Parsed_color_1 c pink | tools/zmqsend
  25445. @end example
  25446. To change the position of the right side:
  25447. @example
  25448. echo overlay@@my x 150 | tools/zmqsend
  25449. @end example
  25450. @c man end MULTIMEDIA FILTERS
  25451. @chapter Multimedia Sources
  25452. @c man begin MULTIMEDIA SOURCES
  25453. Below is a description of the currently available multimedia sources.
  25454. @section amovie
  25455. This is the same as @ref{movie} source, except it selects an audio
  25456. stream by default.
  25457. @section avsynctest
  25458. Generate an Audio/Video Sync Test.
  25459. Generated stream periodically shows flash video frame and emits beep in audio.
  25460. Useful to inspect A/V sync issues.
  25461. It accepts the following options:
  25462. @table @option
  25463. @item size, s
  25464. Set output video size. Default value is @code{hd720}.
  25465. @item framerate, fr
  25466. Set output video frame rate. Default value is @code{30}.
  25467. @item samplerate, sr
  25468. Set output audio sample rate. Default value is @code{44100}.
  25469. @item amplitude, a
  25470. Set output audio beep amplitude. Default value is @code{0.7}.
  25471. @item period, p
  25472. Set output audio beep period in seconds. Default value is @code{3}.
  25473. @item delay, dl
  25474. Set output video flash delay in number of frames. Default value is @code{0}.
  25475. @item cycle, c
  25476. Enable cycling of video delays, by default is disabled.
  25477. @item duration, d
  25478. Set stream output duration. By default duration is unlimited.
  25479. @item fg, bg, ag
  25480. Set foreground/background/additional color.
  25481. @end table
  25482. @subsection Commands
  25483. This source supports the some above options as @ref{commands}.
  25484. @anchor{movie}
  25485. @section movie
  25486. Read audio and/or video stream(s) from a movie container.
  25487. It accepts the following parameters:
  25488. @table @option
  25489. @item filename
  25490. The name of the resource to read (not necessarily a file; it can also be a
  25491. device or a stream accessed through some protocol).
  25492. @item format_name, f
  25493. Specifies the format assumed for the movie to read, and can be either
  25494. the name of a container or an input device. If not specified, the
  25495. format is guessed from @var{movie_name} or by probing.
  25496. @item seek_point, sp
  25497. Specifies the seek point in seconds. The frames will be output
  25498. starting from this seek point. The parameter is evaluated with
  25499. @code{av_strtod}, so the numerical value may be suffixed by an IS
  25500. postfix. The default value is "0".
  25501. @item streams, s
  25502. Specifies the streams to read. Several streams can be specified,
  25503. separated by "+". The source will then have as many outputs, in the
  25504. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  25505. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  25506. respectively the default (best suited) video and audio stream. Default
  25507. is "dv", or "da" if the filter is called as "amovie".
  25508. @item stream_index, si
  25509. Specifies the index of the video stream to read. If the value is -1,
  25510. the most suitable video stream will be automatically selected. The default
  25511. value is "-1". Deprecated. If the filter is called "amovie", it will select
  25512. audio instead of video.
  25513. @item loop
  25514. Specifies how many times to read the stream in sequence.
  25515. If the value is 0, the stream will be looped infinitely.
  25516. Default value is "1".
  25517. Note that when the movie is looped the source timestamps are not
  25518. changed, so it will generate non monotonically increasing timestamps.
  25519. @item discontinuity
  25520. Specifies the time difference between frames above which the point is
  25521. considered a timestamp discontinuity which is removed by adjusting the later
  25522. timestamps.
  25523. @item dec_threads
  25524. Specifies the number of threads for decoding
  25525. @item format_opts
  25526. Specify format options for the opened file. Format options can be specified
  25527. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  25528. shows how to add protocol_whitelist and protocol_blacklist options:
  25529. @example
  25530. ffplay -f lavfi
  25531. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  25532. @end example
  25533. @end table
  25534. It allows overlaying a second video on top of the main input of
  25535. a filtergraph, as shown in this graph:
  25536. @example
  25537. input -----------> deltapts0 --> overlay --> output
  25538. ^
  25539. |
  25540. movie --> scale--> deltapts1 -------+
  25541. @end example
  25542. @subsection Examples
  25543. @itemize
  25544. @item
  25545. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  25546. on top of the input labelled "in":
  25547. @example
  25548. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25549. [in] setpts=PTS-STARTPTS [main];
  25550. [main][over] overlay=16:16 [out]
  25551. @end example
  25552. @item
  25553. Read from a video4linux2 device, and overlay it on top of the input
  25554. labelled "in":
  25555. @example
  25556. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25557. [in] setpts=PTS-STARTPTS [main];
  25558. [main][over] overlay=16:16 [out]
  25559. @end example
  25560. @item
  25561. Read the first video stream and the audio stream with id 0x81 from
  25562. dvd.vob; the video is connected to the pad named "video" and the audio is
  25563. connected to the pad named "audio":
  25564. @example
  25565. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  25566. @end example
  25567. @end itemize
  25568. @subsection Commands
  25569. Both movie and amovie support the following commands:
  25570. @table @option
  25571. @item seek
  25572. Perform seek using "av_seek_frame".
  25573. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  25574. @itemize
  25575. @item
  25576. @var{stream_index}: If stream_index is -1, a default
  25577. stream is selected, and @var{timestamp} is automatically converted
  25578. from AV_TIME_BASE units to the stream specific time_base.
  25579. @item
  25580. @var{timestamp}: Timestamp in AVStream.time_base units
  25581. or, if no stream is specified, in AV_TIME_BASE units.
  25582. @item
  25583. @var{flags}: Flags which select direction and seeking mode.
  25584. @end itemize
  25585. @item get_duration
  25586. Get movie duration in AV_TIME_BASE units.
  25587. @end table
  25588. @c man end MULTIMEDIA SOURCES