filters.texi 889 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142
  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. A special syntax implemented in the @command{ffmpeg} CLI tool allows loading
  138. option values from files. This is done be prepending a slash '/' to the option
  139. name, then the supplied value is interpreted as a path from which the actual
  140. value is loaded. E.g.
  141. @example
  142. ffmpeg -i <INPUT> -vf drawtext=/text=/tmp/some_text <OUTPUT>
  143. @end example
  144. will load the text to be drawn from @file{/tmp/some_text}. API users wishing to
  145. implement a similar feature should use the @code{avfilter_graph_segment_*()}
  146. functions together with custom IO code.
  147. The name and arguments of the filter are optionally preceded and
  148. followed by a list of link labels.
  149. A link label allows one to name a link and associate it to a filter output
  150. or input pad. The preceding labels @var{in_link_1}
  151. ... @var{in_link_N}, are associated to the filter input pads,
  152. the following labels @var{out_link_1} ... @var{out_link_M}, are
  153. associated to the output pads.
  154. When two link labels with the same name are found in the
  155. filtergraph, a link between the corresponding input and output pad is
  156. created.
  157. If an output pad is not labelled, it is linked by default to the first
  158. unlabelled input pad of the next filter in the filterchain.
  159. For example in the filterchain
  160. @example
  161. nullsrc, split[L1], [L2]overlay, nullsink
  162. @end example
  163. the split filter instance has two output pads, and the overlay filter
  164. instance two input pads. The first output pad of split is labelled
  165. "L1", the first input pad of overlay is labelled "L2", and the second
  166. output pad of split is linked to the second input pad of overlay,
  167. which are both unlabelled.
  168. In a filter description, if the input label of the first filter is not
  169. specified, "in" is assumed; if the output label of the last filter is not
  170. specified, "out" is assumed.
  171. In a complete filterchain all the unlabelled filter input and output
  172. pads must be connected. A filtergraph is considered valid if all the
  173. filter input and output pads of all the filterchains are connected.
  174. Leading and trailing whitespaces (space, tabs, or line feeds) separating tokens
  175. in the filtergraph specification are ignored. This means that the filtergraph
  176. can be expressed using empty lines and spaces to improve redability.
  177. For example, the filtergraph:
  178. @example
  179. testsrc,split[L1],hflip[L2];[L1][L2] hstack
  180. @end example
  181. can be represented as:
  182. @example
  183. testsrc,
  184. split [L1], hflip [L2];
  185. [L1][L2] hstack
  186. @end example
  187. Libavfilter will automatically insert @ref{scale} filters where format
  188. conversion is required. It is possible to specify swscale flags
  189. for those automatically inserted scalers by prepending
  190. @code{sws_flags=@var{flags};}
  191. to the filtergraph description.
  192. Here is a BNF description of the filtergraph syntax:
  193. @example
  194. @var{NAME} ::= sequence of alphanumeric characters and '_'
  195. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  196. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  197. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  198. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  199. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  200. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  201. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  202. @end example
  203. @anchor{filtergraph escaping}
  204. @section Notes on filtergraph escaping
  205. Filtergraph description composition entails several levels of
  206. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  207. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  208. information about the employed escaping procedure.
  209. A first level escaping affects the content of each filter option
  210. value, which may contain the special character @code{:} used to
  211. separate values, or one of the escaping characters @code{\'}.
  212. A second level escaping affects the whole filter description, which
  213. may contain the escaping characters @code{\'} or the special
  214. characters @code{[],;} used by the filtergraph description.
  215. Finally, when you specify a filtergraph on a shell commandline, you
  216. need to perform a third level escaping for the shell special
  217. characters contained within it.
  218. For example, consider the following string to be embedded in
  219. the @ref{drawtext} filter description @option{text} value:
  220. @example
  221. this is a 'string': may contain one, or more, special characters
  222. @end example
  223. This string contains the @code{'} special escaping character, and the
  224. @code{:} special character, so it needs to be escaped in this way:
  225. @example
  226. text=this is a \'string\'\: may contain one, or more, special characters
  227. @end example
  228. A second level of escaping is required when embedding the filter
  229. description in a filtergraph description, in order to escape all the
  230. filtergraph special characters. Thus the example above becomes:
  231. @example
  232. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  233. @end example
  234. (note that in addition to the @code{\'} escaping special characters,
  235. also @code{,} needs to be escaped).
  236. Finally an additional level of escaping is needed when writing the
  237. filtergraph description in a shell command, which depends on the
  238. escaping rules of the adopted shell. For example, assuming that
  239. @code{\} is special and needs to be escaped with another @code{\}, the
  240. previous string will finally result in:
  241. @example
  242. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  243. @end example
  244. In order to avoid cumbersome escaping when using a commandline tool accepting a
  245. filter specification as input, it is advisable to avoid direct inclusion of the
  246. filter or options specification in the shell.
  247. For example, in case of the @ref{drawtext,,drawtext filter}, you might prefer to
  248. use the @option{textfile} option in place of @option{text} to specify the text
  249. to render.
  250. @chapter Timeline editing
  251. Some filters support a generic @option{enable} option. For the filters
  252. supporting timeline editing, this option can be set to an expression which is
  253. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  254. the filter will be enabled, otherwise the frame will be sent unchanged to the
  255. next filter in the filtergraph.
  256. The expression accepts the following values:
  257. @table @samp
  258. @item t
  259. timestamp expressed in seconds, NAN if the input timestamp is unknown
  260. @item n
  261. sequential number of the input frame, starting from 0
  262. @item pos
  263. the position in the file of the input frame, NAN if unknown; deprecated, do
  264. not use
  265. @item w
  266. @item h
  267. width and height of the input frame if video
  268. @end table
  269. Additionally, these filters support an @option{enable} command that can be used
  270. to re-define the expression.
  271. Like any other filtering option, the @option{enable} option follows the same
  272. rules.
  273. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  274. minutes, and a @ref{curves} filter starting at 3 seconds:
  275. @example
  276. smartblur = enable='between(t,10,3*60)',
  277. curves = enable='gte(t,3)' : preset=cross_process
  278. @end example
  279. See @code{ffmpeg -filters} to view which filters have timeline support.
  280. @c man end FILTERGRAPH DESCRIPTION
  281. @anchor{commands}
  282. @chapter Changing options at runtime with a command
  283. Some options can be changed during the operation of the filter using
  284. a command. These options are marked 'T' on the output of
  285. @command{ffmpeg} @option{-h filter=<name of filter>}.
  286. The name of the command is the name of the option and the argument is
  287. the new value.
  288. @anchor{framesync}
  289. @chapter Options for filters with several inputs (framesync)
  290. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  291. Some filters with several inputs support a common set of options.
  292. These options can only be set by name, not with the short notation.
  293. @table @option
  294. @item eof_action
  295. The action to take when EOF is encountered on the secondary input; it accepts
  296. one of the following values:
  297. @table @option
  298. @item repeat
  299. Repeat the last frame (the default).
  300. @item endall
  301. End both streams.
  302. @item pass
  303. Pass the main input through.
  304. @end table
  305. @item shortest
  306. If set to 1, force the output to terminate when the shortest input
  307. terminates. Default value is 0.
  308. @item repeatlast
  309. If set to 1, force the filter to extend the last frame of secondary streams
  310. until the end of the primary stream. A value of 0 disables this behavior.
  311. Default value is 1.
  312. @item ts_sync_mode
  313. How strictly to sync streams based on secondary input timestamps; it accepts
  314. one of the following values:
  315. @table @option
  316. @item default
  317. Frame from secondary input with the nearest lower or equal timestamp to the
  318. primary input frame.
  319. @item nearest
  320. Frame from secondary input with the absolute nearest timestamp to the primary
  321. input frame.
  322. @end table
  323. @end table
  324. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  325. @chapter Audio Filters
  326. @c man begin AUDIO FILTERS
  327. When you configure your FFmpeg build, you can disable any of the
  328. existing filters using @code{--disable-filters}.
  329. The configure output will show the audio filters included in your
  330. build.
  331. Below is a description of the currently available audio filters.
  332. @section aap
  333. Apply Affine Projection algorithm to the first audio stream using the second audio stream.
  334. This adaptive filter is used to estimate unknown audio based on multiple input audio samples.
  335. Affine projection algorithm can make trade-offs between computation complexity with convergence speed.
  336. A description of the accepted options follows.
  337. @table @option
  338. @item order
  339. Set the filter order.
  340. @item projection
  341. Set the projection order.
  342. @item mu
  343. Set the filter mu.
  344. @item delta
  345. Set the coefficient to initialize internal covariance matrix.
  346. @item out_mode
  347. Set the filter output samples. It accepts the following values:
  348. @table @option
  349. @item i
  350. Pass the 1st input.
  351. @item d
  352. Pass the 2nd input.
  353. @item o
  354. Pass difference between desired, 2nd input and error signal estimate.
  355. @item n
  356. Pass difference between input, 1st input and error signal estimate.
  357. @item e
  358. Pass error signal estimated samples.
  359. Default value is @var{o}.
  360. @end table
  361. @item precision
  362. Set which precision to use when processing samples.
  363. @table @option
  364. @item auto
  365. Auto pick internal sample format depending on other filters.
  366. @item float
  367. Always use single-floating point precision sample format.
  368. @item double
  369. Always use double-floating point precision sample format.
  370. @end table
  371. @end table
  372. @section acompressor
  373. A compressor is mainly used to reduce the dynamic range of a signal.
  374. Especially modern music is mostly compressed at a high ratio to
  375. improve the overall loudness. It's done to get the highest attention
  376. of a listener, "fatten" the sound and bring more "power" to the track.
  377. If a signal is compressed too much it may sound dull or "dead"
  378. afterwards or it may start to "pump" (which could be a powerful effect
  379. but can also destroy a track completely).
  380. The right compression is the key to reach a professional sound and is
  381. the high art of mixing and mastering. Because of its complex settings
  382. it may take a long time to get the right feeling for this kind of effect.
  383. Compression is done by detecting the volume above a chosen level
  384. @code{threshold} and dividing it by the factor set with @code{ratio}.
  385. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  386. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  387. the signal would cause distortion of the waveform the reduction can be
  388. levelled over the time. This is done by setting "Attack" and "Release".
  389. @code{attack} determines how long the signal has to rise above the threshold
  390. before any reduction will occur and @code{release} sets the time the signal
  391. has to fall below the threshold to reduce the reduction again. Shorter signals
  392. than the chosen attack time will be left untouched.
  393. The overall reduction of the signal can be made up afterwards with the
  394. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  395. raising the makeup to this level results in a signal twice as loud than the
  396. source. To gain a softer entry in the compression the @code{knee} flattens the
  397. hard edge at the threshold in the range of the chosen decibels.
  398. The filter accepts the following options:
  399. @table @option
  400. @item level_in
  401. Set input gain. Default is 1. Range is between 0.015625 and 64.
  402. @item mode
  403. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  404. Default is @code{downward}.
  405. @item threshold
  406. If a signal of stream rises above this level it will affect the gain
  407. reduction.
  408. By default it is 0.125. Range is between 0.00097563 and 1.
  409. @item ratio
  410. Set a ratio by which the signal is reduced. 1:2 means that if the level
  411. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  412. Default is 2. Range is between 1 and 20.
  413. @item attack
  414. Amount of milliseconds the signal has to rise above the threshold before gain
  415. reduction starts. Default is 20. Range is between 0.01 and 2000.
  416. @item release
  417. Amount of milliseconds the signal has to fall below the threshold before
  418. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  419. @item makeup
  420. Set the amount by how much signal will be amplified after processing.
  421. Default is 1. Range is from 1 to 64.
  422. @item knee
  423. Curve the sharp knee around the threshold to enter gain reduction more softly.
  424. Default is 2.82843. Range is between 1 and 8.
  425. @item link
  426. Choose if the @code{average} level between all channels of input stream
  427. or the louder(@code{maximum}) channel of input stream affects the
  428. reduction. Default is @code{average}.
  429. @item detection
  430. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  431. of @code{rms}. Default is @code{rms} which is mostly smoother.
  432. @item mix
  433. How much to use compressed signal in output. Default is 1.
  434. Range is between 0 and 1.
  435. @end table
  436. @subsection Commands
  437. This filter supports the all above options as @ref{commands}.
  438. @section acontrast
  439. Simple audio dynamic range compression/expansion filter.
  440. The filter accepts the following options:
  441. @table @option
  442. @item contrast
  443. Set contrast. Default is 33. Allowed range is between 0 and 100.
  444. @end table
  445. @section acopy
  446. Copy the input audio source unchanged to the output. This is mainly useful for
  447. testing purposes.
  448. @section acrossfade
  449. Apply cross fade from one input audio stream to another input audio stream.
  450. The cross fade is applied for specified duration near the end of first stream.
  451. The filter accepts the following options:
  452. @table @option
  453. @item nb_samples, ns
  454. Specify the number of samples for which the cross fade effect has to last.
  455. At the end of the cross fade effect the first input audio will be completely
  456. silent. Default is 44100.
  457. @item duration, d
  458. Specify the duration of the cross fade effect. See
  459. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  460. for the accepted syntax.
  461. By default the duration is determined by @var{nb_samples}.
  462. If set this option is used instead of @var{nb_samples}.
  463. @item overlap, o
  464. Should first stream end overlap with second stream start. Default is enabled.
  465. @item curve1
  466. Set curve for cross fade transition for first stream.
  467. @item curve2
  468. Set curve for cross fade transition for second stream.
  469. For description of available curve types see @ref{afade} filter description.
  470. @end table
  471. @subsection Examples
  472. @itemize
  473. @item
  474. Cross fade from one input to another:
  475. @example
  476. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  477. @end example
  478. @item
  479. Cross fade from one input to another but without overlapping:
  480. @example
  481. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  482. @end example
  483. @end itemize
  484. @section acrossover
  485. Split audio stream into several bands.
  486. This filter splits audio stream into two or more frequency ranges.
  487. Summing all streams back will give flat output.
  488. The filter accepts the following options:
  489. @table @option
  490. @item split
  491. Set split frequencies. Those must be positive and increasing.
  492. @item order
  493. Set filter order for each band split. This controls filter roll-off or steepness
  494. of filter transfer function.
  495. Available values are:
  496. @table @samp
  497. @item 2nd
  498. 12 dB per octave.
  499. @item 4th
  500. 24 dB per octave.
  501. @item 6th
  502. 36 dB per octave.
  503. @item 8th
  504. 48 dB per octave.
  505. @item 10th
  506. 60 dB per octave.
  507. @item 12th
  508. 72 dB per octave.
  509. @item 14th
  510. 84 dB per octave.
  511. @item 16th
  512. 96 dB per octave.
  513. @item 18th
  514. 108 dB per octave.
  515. @item 20th
  516. 120 dB per octave.
  517. @end table
  518. Default is @var{4th}.
  519. @item level
  520. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  521. @item gains
  522. Set output gain for each band. Default value is 1 for all bands.
  523. @item precision
  524. Set which precision to use when processing samples.
  525. @table @option
  526. @item auto
  527. Auto pick internal sample format depending on other filters.
  528. @item float
  529. Always use single-floating point precision sample format.
  530. @item double
  531. Always use double-floating point precision sample format.
  532. @end table
  533. Default value is @code{auto}.
  534. @end table
  535. @subsection Examples
  536. @itemize
  537. @item
  538. Split input audio stream into two bands (low and high) with split frequency of 1500 Hz,
  539. each band will be in separate stream:
  540. @example
  541. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  542. @end example
  543. @item
  544. Same as above, but with higher filter order:
  545. @example
  546. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500:order=8th[LOW][HIGH]' -map '[LOW]' low.wav -map '[HIGH]' high.wav
  547. @end example
  548. @item
  549. Same as above, but also with additional middle band (frequencies between 1500 and 8000):
  550. @example
  551. ffmpeg -i in.flac -filter_complex 'acrossover=split=1500 8000:order=8th[LOW][MID][HIGH]' -map '[LOW]' low.wav -map '[MID]' mid.wav -map '[HIGH]' high.wav
  552. @end example
  553. @end itemize
  554. @section acrusher
  555. Reduce audio bit resolution.
  556. This filter is bit crusher with enhanced functionality. A bit crusher
  557. is used to audibly reduce number of bits an audio signal is sampled
  558. with. This doesn't change the bit depth at all, it just produces the
  559. effect. Material reduced in bit depth sounds more harsh and "digital".
  560. This filter is able to even round to continuous values instead of discrete
  561. bit depths.
  562. Additionally it has a D/C offset which results in different crushing of
  563. the lower and the upper half of the signal.
  564. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  565. Another feature of this filter is the logarithmic mode.
  566. This setting switches from linear distances between bits to logarithmic ones.
  567. The result is a much more "natural" sounding crusher which doesn't gate low
  568. signals for example. The human ear has a logarithmic perception,
  569. so this kind of crushing is much more pleasant.
  570. Logarithmic crushing is also able to get anti-aliased.
  571. The filter accepts the following options:
  572. @table @option
  573. @item level_in
  574. Set level in.
  575. @item level_out
  576. Set level out.
  577. @item bits
  578. Set bit reduction.
  579. @item mix
  580. Set mixing amount.
  581. @item mode
  582. Can be linear: @code{lin} or logarithmic: @code{log}.
  583. @item dc
  584. Set DC.
  585. @item aa
  586. Set anti-aliasing.
  587. @item samples
  588. Set sample reduction.
  589. @item lfo
  590. Enable LFO. By default disabled.
  591. @item lforange
  592. Set LFO range.
  593. @item lforate
  594. Set LFO rate.
  595. @end table
  596. @subsection Commands
  597. This filter supports the all above options as @ref{commands}.
  598. @section acue
  599. Delay audio filtering until a given wallclock timestamp. See the @ref{cue}
  600. filter.
  601. @section adeclick
  602. Remove impulsive noise from input audio.
  603. Samples detected as impulsive noise are replaced by interpolated samples using
  604. autoregressive modelling.
  605. @table @option
  606. @item window, w
  607. Set window size, in milliseconds. Allowed range is from @code{10} to
  608. @code{100}. Default value is @code{55} milliseconds.
  609. This sets size of window which will be processed at once.
  610. @item overlap, o
  611. Set window overlap, in percentage of window size. Allowed range is from
  612. @code{50} to @code{95}. Default value is @code{75} percent.
  613. Setting this to a very high value increases impulsive noise removal but makes
  614. whole process much slower.
  615. @item arorder, a
  616. Set autoregression order, in percentage of window size. Allowed range is from
  617. @code{0} to @code{25}. Default value is @code{2} percent. This option also
  618. controls quality of interpolated samples using neighbour good samples.
  619. @item threshold, t
  620. Set threshold value. Allowed range is from @code{1} to @code{100}.
  621. Default value is @code{2}.
  622. This controls the strength of impulsive noise which is going to be removed.
  623. The lower value, the more samples will be detected as impulsive noise.
  624. @item burst, b
  625. Set burst fusion, in percentage of window size. Allowed range is @code{0} to
  626. @code{10}. Default value is @code{2}.
  627. If any two samples detected as noise are spaced less than this value then any
  628. sample between those two samples will be also detected as noise.
  629. @item method, m
  630. Set overlap method.
  631. It accepts the following values:
  632. @table @option
  633. @item add, a
  634. Select overlap-add method. Even not interpolated samples are slightly
  635. changed with this method.
  636. @item save, s
  637. Select overlap-save method. Not interpolated samples remain unchanged.
  638. @end table
  639. Default value is @code{a}.
  640. @end table
  641. @section adeclip
  642. Remove clipped samples from input audio.
  643. Samples detected as clipped are replaced by interpolated samples using
  644. autoregressive modelling.
  645. @table @option
  646. @item window, w
  647. Set window size, in milliseconds. Allowed range is from @code{10} to @code{100}.
  648. Default value is @code{55} milliseconds.
  649. This sets size of window which will be processed at once.
  650. @item overlap, o
  651. Set window overlap, in percentage of window size. Allowed range is from @code{50}
  652. to @code{95}. Default value is @code{75} percent.
  653. @item arorder, a
  654. Set autoregression order, in percentage of window size. Allowed range is from
  655. @code{0} to @code{25}. Default value is @code{8} percent. This option also controls
  656. quality of interpolated samples using neighbour good samples.
  657. @item threshold, t
  658. Set threshold value. Allowed range is from @code{1} to @code{100}.
  659. Default value is @code{10}. Higher values make clip detection less aggressive.
  660. @item hsize, n
  661. Set size of histogram used to detect clips. Allowed range is from @code{100} to @code{9999}.
  662. Default value is @code{1000}. Higher values make clip detection less aggressive.
  663. @item method, m
  664. Set overlap method.
  665. It accepts the following values:
  666. @table @option
  667. @item add, a
  668. Select overlap-add method. Even not interpolated samples are slightly changed
  669. with this method.
  670. @item save, s
  671. Select overlap-save method. Not interpolated samples remain unchanged.
  672. @end table
  673. Default value is @code{a}.
  674. @end table
  675. @section adecorrelate
  676. Apply decorrelation to input audio stream.
  677. The filter accepts the following options:
  678. @table @option
  679. @item stages
  680. Set decorrelation stages of filtering. Allowed
  681. range is from 1 to 16. Default value is 6.
  682. @item seed
  683. Set random seed used for setting delay in samples across channels.
  684. @end table
  685. @section adelay
  686. Delay one or more audio channels.
  687. Samples in delayed channel are filled with silence.
  688. The filter accepts the following option:
  689. @table @option
  690. @item delays
  691. Set list of delays in milliseconds for each channel separated by '|'.
  692. Unused delays will be silently ignored. If number of given delays is
  693. smaller than number of channels all remaining channels will not be delayed.
  694. If you want to delay exact number of samples, append 'S' to number.
  695. If you want instead to delay in seconds, append 's' to number.
  696. @item all
  697. Use last set delay for all remaining channels. By default is disabled.
  698. This option if enabled changes how option @code{delays} is interpreted.
  699. @end table
  700. @subsection Examples
  701. @itemize
  702. @item
  703. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  704. the second channel (and any other channels that may be present) unchanged.
  705. @example
  706. adelay=1500|0|500
  707. @end example
  708. @item
  709. Delay second channel by 500 samples, the third channel by 700 samples and leave
  710. the first channel (and any other channels that may be present) unchanged.
  711. @example
  712. adelay=0|500S|700S
  713. @end example
  714. @item
  715. Delay all channels by same number of samples:
  716. @example
  717. adelay=delays=64S:all=1
  718. @end example
  719. @end itemize
  720. @section adenorm
  721. Remedy denormals in audio by adding extremely low-level noise.
  722. This filter shall be placed before any filter that can produce denormals.
  723. A description of the accepted parameters follows.
  724. @table @option
  725. @item level
  726. Set level of added noise in dB. Default is @code{-351}.
  727. Allowed range is from -451 to -90.
  728. @item type
  729. Set type of added noise.
  730. @table @option
  731. @item dc
  732. Add DC signal.
  733. @item ac
  734. Add AC signal.
  735. @item square
  736. Add square signal.
  737. @item pulse
  738. Add pulse signal.
  739. @end table
  740. Default is @code{dc}.
  741. @end table
  742. @subsection Commands
  743. This filter supports the all above options as @ref{commands}.
  744. @section aderivative, aintegral
  745. Compute derivative/integral of audio stream.
  746. Applying both filters one after another produces original audio.
  747. @section adrc
  748. Apply spectral dynamic range controller filter to input audio stream.
  749. A description of the accepted options follows.
  750. @table @option
  751. @item transfer
  752. Set the transfer expression.
  753. The expression can contain the following constants:
  754. @table @option
  755. @item ch
  756. current channel number
  757. @item sn
  758. current sample number
  759. @item nb_channels
  760. number of channels
  761. @item t
  762. timestamp expressed in seconds
  763. @item sr
  764. sample rate
  765. @item p
  766. current frequency power value, in dB
  767. @item f
  768. current frequency in Hz
  769. @end table
  770. Default value is @code{p}.
  771. @item attack
  772. Set the attack in milliseconds. Default is @code{50} milliseconds.
  773. Allowed range is from 1 to 1000 milliseconds.
  774. @item release
  775. Set the release in milliseconds. Default is @code{100} milliseconds.
  776. Allowed range is from 5 to 2000 milliseconds.
  777. @item channels
  778. Set which channels to filter, by default @code{all} channels in audio stream are filtered.
  779. @end table
  780. @subsection Commands
  781. This filter supports the all above options as @ref{commands}.
  782. @subsection Examples
  783. @itemize
  784. @item
  785. Apply spectral compression to all frequencies with threshold of -50 dB and 1:6 ratio:
  786. @example
  787. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/6,p)':attack=50:release=100
  788. @end example
  789. @item
  790. Similar to above but with 1:2 ratio and filtering only front center channel:
  791. @example
  792. adrc=transfer='if(gt(p,-50),-50+(p-(-50))/2,p)':attack=50:release=100:channels=FC
  793. @end example
  794. @item
  795. Apply spectral noise gate to all frequencies with threshold of -85 dB and with short attack time and short release time:
  796. @example
  797. adrc=transfer='if(lte(p,-85),p-800,p)':attack=1:release=5
  798. @end example
  799. @item
  800. Apply spectral expansion to all frequencies with threshold of -10 dB and 1:2 ratio:
  801. @example
  802. adrc=transfer='if(lt(p,-10),-10+(p-(-10))*2,p)':attack=50:release=100
  803. @end example
  804. @item
  805. Apply limiter to max -60 dB to all frequencies, with attack of 2 ms and release of 10 ms:
  806. @example
  807. adrc=transfer='min(p,-60)':attack=2:release=10
  808. @end example
  809. @end itemize
  810. @section adynamicequalizer
  811. Apply dynamic equalization to input audio stream.
  812. A description of the accepted options follows.
  813. @table @option
  814. @item threshold
  815. Set the detection threshold used to trigger equalization.
  816. Threshold detection is using detection filter.
  817. Default value is 0. Allowed range is from 0 to 100.
  818. @item dfrequency
  819. Set the detection frequency in Hz used for detection filter used to trigger equalization.
  820. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  821. @item dqfactor
  822. Set the detection resonance factor for detection filter used to trigger equalization.
  823. Default value is 1. Allowed range is from 0.001 to 1000.
  824. @item tfrequency
  825. Set the target frequency of equalization filter.
  826. Default value is 1000 Hz. Allowed range is between 2 and 1000000 Hz.
  827. @item tqfactor
  828. Set the target resonance factor for target equalization filter.
  829. Default value is 1. Allowed range is from 0.001 to 1000.
  830. @item attack
  831. Set the amount of milliseconds the signal from detection has to rise above
  832. the detection threshold before equalization starts.
  833. Default is 20. Allowed range is between 1 and 2000.
  834. @item release
  835. Set the amount of milliseconds the signal from detection has to fall below the
  836. detection threshold before equalization ends.
  837. Default is 200. Allowed range is between 1 and 2000.
  838. @item ratio
  839. Set the ratio by which the equalization gain is raised.
  840. Default is 1. Allowed range is between 0 and 30.
  841. @item makeup
  842. Set the makeup offset by which the equalization gain is raised.
  843. Default is 0. Allowed range is between 0 and 100.
  844. @item range
  845. Set the max allowed cut/boost amount. Default is 50.
  846. Allowed range is from 1 to 200.
  847. @item mode
  848. Set the mode of filter operation, can be one of the following:
  849. @table @samp
  850. @item listen
  851. Output only isolated detection signal.
  852. @item cutbelow
  853. Cut frequencies below detection threshold.
  854. @item cutabove
  855. Cut frequencies above detection threshold.
  856. @item boostbelow
  857. Boost frequencies below detection threshold.
  858. @item boostabove
  859. Boost frequencies above detection threshold.
  860. @end table
  861. Default mode is @samp{cutbelow}.
  862. @item dftype
  863. Set the type of detection filter, can be one of the following:
  864. @table @samp
  865. @item bandpass
  866. @item lowpass
  867. @item highpass
  868. @item peak
  869. @end table
  870. Default type is @samp{bandpass}.
  871. @item tftype
  872. Set the type of target filter, can be one of the following:
  873. @table @samp
  874. @item bell
  875. @item lowshelf
  876. @item highshelf
  877. @end table
  878. Default type is @samp{bell}.
  879. @item auto
  880. Automatically gather threshold from detection filter. By default
  881. is @samp{disabled}.
  882. This option is useful to detect threshold in certain time frame of
  883. input audio stream, in such case option value is changed at runtime.
  884. Available values are:
  885. @table @samp
  886. @item disabled
  887. Disable using automatically gathered threshold value.
  888. @item off
  889. Stop picking threshold value.
  890. @item on
  891. Start picking threshold value.
  892. @item adaptive
  893. Adaptively pick threshold value, by calculating sliding window entropy.
  894. @end table
  895. @item precision
  896. Set which precision to use when processing samples.
  897. @table @option
  898. @item auto
  899. Auto pick internal sample format depending on other filters.
  900. @item float
  901. Always use single-floating point precision sample format.
  902. @item double
  903. Always use double-floating point precision sample format.
  904. @end table
  905. @end table
  906. @subsection Commands
  907. This filter supports the all above options as @ref{commands}.
  908. @section adynamicsmooth
  909. Apply dynamic smoothing to input audio stream.
  910. A description of the accepted options follows.
  911. @table @option
  912. @item sensitivity
  913. Set an amount of sensitivity to frequency fluctations. Default is 2.
  914. Allowed range is from 0 to 1e+06.
  915. @item basefreq
  916. Set a base frequency for smoothing. Default value is 22050.
  917. Allowed range is from 2 to 1e+06.
  918. @end table
  919. @subsection Commands
  920. This filter supports the all above options as @ref{commands}.
  921. @section aecho
  922. Apply echoing to the input audio.
  923. Echoes are reflected sound and can occur naturally amongst mountains
  924. (and sometimes large buildings) when talking or shouting; digital echo
  925. effects emulate this behaviour and are often used to help fill out the
  926. sound of a single instrument or vocal. The time difference between the
  927. original signal and the reflection is the @code{delay}, and the
  928. loudness of the reflected signal is the @code{decay}.
  929. Multiple echoes can have different delays and decays.
  930. A description of the accepted parameters follows.
  931. @table @option
  932. @item in_gain
  933. Set input gain of reflected signal. Default is @code{0.6}.
  934. @item out_gain
  935. Set output gain of reflected signal. Default is @code{0.3}.
  936. @item delays
  937. Set list of time intervals in milliseconds between original signal and reflections
  938. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  939. Default is @code{1000}.
  940. @item decays
  941. Set list of loudness of reflected signals separated by '|'.
  942. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  943. Default is @code{0.5}.
  944. @end table
  945. @subsection Examples
  946. @itemize
  947. @item
  948. Make it sound as if there are twice as many instruments as are actually playing:
  949. @example
  950. aecho=0.8:0.88:60:0.4
  951. @end example
  952. @item
  953. If delay is very short, then it sounds like a (metallic) robot playing music:
  954. @example
  955. aecho=0.8:0.88:6:0.4
  956. @end example
  957. @item
  958. A longer delay will sound like an open air concert in the mountains:
  959. @example
  960. aecho=0.8:0.9:1000:0.3
  961. @end example
  962. @item
  963. Same as above but with one more mountain:
  964. @example
  965. aecho=0.8:0.9:1000|1800:0.3|0.25
  966. @end example
  967. @end itemize
  968. @section aemphasis
  969. Audio emphasis filter creates or restores material directly taken from LPs or
  970. emphased CDs with different filter curves. E.g. to store music on vinyl the
  971. signal has to be altered by a filter first to even out the disadvantages of
  972. this recording medium.
  973. Once the material is played back the inverse filter has to be applied to
  974. restore the distortion of the frequency response.
  975. The filter accepts the following options:
  976. @table @option
  977. @item level_in
  978. Set input gain.
  979. @item level_out
  980. Set output gain.
  981. @item mode
  982. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  983. use @code{production} mode. Default is @code{reproduction} mode.
  984. @item type
  985. Set filter type. Selects medium. Can be one of the following:
  986. @table @option
  987. @item col
  988. select Columbia.
  989. @item emi
  990. select EMI.
  991. @item bsi
  992. select BSI (78RPM).
  993. @item riaa
  994. select RIAA.
  995. @item cd
  996. select Compact Disc (CD).
  997. @item 50fm
  998. select 50µs (FM).
  999. @item 75fm
  1000. select 75µs (FM).
  1001. @item 50kf
  1002. select 50µs (FM-KF).
  1003. @item 75kf
  1004. select 75µs (FM-KF).
  1005. @end table
  1006. @end table
  1007. @subsection Commands
  1008. This filter supports the all above options as @ref{commands}.
  1009. @section aeval
  1010. Modify an audio signal according to the specified expressions.
  1011. This filter accepts one or more expressions (one for each channel),
  1012. which are evaluated and used to modify a corresponding audio signal.
  1013. It accepts the following parameters:
  1014. @table @option
  1015. @item exprs
  1016. Set the '|'-separated expressions list for each separate channel. If
  1017. the number of input channels is greater than the number of
  1018. expressions, the last specified expression is used for the remaining
  1019. output channels.
  1020. @item channel_layout, c
  1021. Set output channel layout. If not specified, the channel layout is
  1022. specified by the number of expressions. If set to @samp{same}, it will
  1023. use by default the same input channel layout.
  1024. @end table
  1025. Each expression in @var{exprs} can contain the following constants and functions:
  1026. @table @option
  1027. @item ch
  1028. channel number of the current expression
  1029. @item n
  1030. number of the evaluated sample, starting from 0
  1031. @item s
  1032. sample rate
  1033. @item t
  1034. time of the evaluated sample expressed in seconds
  1035. @item nb_in_channels
  1036. @item nb_out_channels
  1037. input and output number of channels
  1038. @item val(CH)
  1039. the value of input channel with number @var{CH}
  1040. @end table
  1041. Note: this filter is slow. For faster processing you should use a
  1042. dedicated filter.
  1043. @subsection Examples
  1044. @itemize
  1045. @item
  1046. Half volume:
  1047. @example
  1048. aeval=val(ch)/2:c=same
  1049. @end example
  1050. @item
  1051. Invert phase of the second channel:
  1052. @example
  1053. aeval=val(0)|-val(1)
  1054. @end example
  1055. @end itemize
  1056. @section aexciter
  1057. An exciter is used to produce high sound that is not present in the
  1058. original signal. This is done by creating harmonic distortions of the
  1059. signal which are restricted in range and added to the original signal.
  1060. An Exciter raises the upper end of an audio signal without simply raising
  1061. the higher frequencies like an equalizer would do to create a more
  1062. "crisp" or "brilliant" sound.
  1063. The filter accepts the following options:
  1064. @table @option
  1065. @item level_in
  1066. Set input level prior processing of signal.
  1067. Allowed range is from 0 to 64.
  1068. Default value is 1.
  1069. @item level_out
  1070. Set output level after processing of signal.
  1071. Allowed range is from 0 to 64.
  1072. Default value is 1.
  1073. @item amount
  1074. Set the amount of harmonics added to original signal.
  1075. Allowed range is from 0 to 64.
  1076. Default value is 1.
  1077. @item drive
  1078. Set the amount of newly created harmonics.
  1079. Allowed range is from 0.1 to 10.
  1080. Default value is 8.5.
  1081. @item blend
  1082. Set the octave of newly created harmonics.
  1083. Allowed range is from -10 to 10.
  1084. Default value is 0.
  1085. @item freq
  1086. Set the lower frequency limit of producing harmonics in Hz.
  1087. Allowed range is from 2000 to 12000 Hz.
  1088. Default is 7500 Hz.
  1089. @item ceil
  1090. Set the upper frequency limit of producing harmonics.
  1091. Allowed range is from 9999 to 20000 Hz.
  1092. If value is lower than 10000 Hz no limit is applied.
  1093. @item listen
  1094. Mute the original signal and output only added harmonics.
  1095. By default is disabled.
  1096. @end table
  1097. @subsection Commands
  1098. This filter supports the all above options as @ref{commands}.
  1099. @anchor{afade}
  1100. @section afade
  1101. Apply fade-in/out effect to input audio.
  1102. A description of the accepted parameters follows.
  1103. @table @option
  1104. @item type, t
  1105. Specify the effect type, can be either @code{in} for fade-in, or
  1106. @code{out} for a fade-out effect. Default is @code{in}.
  1107. @item start_sample, ss
  1108. Specify the number of the start sample for starting to apply the fade
  1109. effect. Default is 0.
  1110. @item nb_samples, ns
  1111. Specify the number of samples for which the fade effect has to last. At
  1112. the end of the fade-in effect the output audio will have the same
  1113. volume as the input audio, at the end of the fade-out transition
  1114. the output audio will be silence. Default is 44100.
  1115. @item start_time, st
  1116. Specify the start time of the fade effect. Default is 0.
  1117. The value must be specified as a time duration; see
  1118. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1119. for the accepted syntax.
  1120. If set this option is used instead of @var{start_sample}.
  1121. @item duration, d
  1122. Specify the duration of the fade effect. See
  1123. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1124. for the accepted syntax.
  1125. At the end of the fade-in effect the output audio will have the same
  1126. volume as the input audio, at the end of the fade-out transition
  1127. the output audio will be silence.
  1128. By default the duration is determined by @var{nb_samples}.
  1129. If set this option is used instead of @var{nb_samples}.
  1130. @item curve
  1131. Set curve for fade transition.
  1132. It accepts the following values:
  1133. @table @option
  1134. @item tri
  1135. select triangular, linear slope (default)
  1136. @item qsin
  1137. select quarter of sine wave
  1138. @item hsin
  1139. select half of sine wave
  1140. @item esin
  1141. select exponential sine wave
  1142. @item log
  1143. select logarithmic
  1144. @item ipar
  1145. select inverted parabola
  1146. @item qua
  1147. select quadratic
  1148. @item cub
  1149. select cubic
  1150. @item squ
  1151. select square root
  1152. @item cbr
  1153. select cubic root
  1154. @item par
  1155. select parabola
  1156. @item exp
  1157. select exponential
  1158. @item iqsin
  1159. select inverted quarter of sine wave
  1160. @item ihsin
  1161. select inverted half of sine wave
  1162. @item dese
  1163. select double-exponential seat
  1164. @item desi
  1165. select double-exponential sigmoid
  1166. @item losi
  1167. select logistic sigmoid
  1168. @item sinc
  1169. select sine cardinal function
  1170. @item isinc
  1171. select inverted sine cardinal function
  1172. @item quat
  1173. select quartic
  1174. @item quatr
  1175. select quartic root
  1176. @item qsin2
  1177. select squared quarter of sine wave
  1178. @item hsin2
  1179. select squared half of sine wave
  1180. @item nofade
  1181. no fade applied
  1182. @end table
  1183. @item silence
  1184. Set the initial gain for fade-in or final gain for fade-out.
  1185. Default value is @code{0.0}.
  1186. @item unity
  1187. Set the initial gain for fade-out or final gain for fade-in.
  1188. Default value is @code{1.0}.
  1189. @end table
  1190. @subsection Commands
  1191. This filter supports the all above options as @ref{commands}.
  1192. @subsection Examples
  1193. @itemize
  1194. @item
  1195. Fade in first 15 seconds of audio:
  1196. @example
  1197. afade=t=in:ss=0:d=15
  1198. @end example
  1199. @item
  1200. Fade out last 25 seconds of a 900 seconds audio:
  1201. @example
  1202. afade=t=out:st=875:d=25
  1203. @end example
  1204. @end itemize
  1205. @section afftdn
  1206. Denoise audio samples with FFT.
  1207. A description of the accepted parameters follows.
  1208. @table @option
  1209. @item noise_reduction, nr
  1210. Set the noise reduction in dB, allowed range is 0.01 to 97.
  1211. Default value is 12 dB.
  1212. @item noise_floor, nf
  1213. Set the noise floor in dB, allowed range is -80 to -20.
  1214. Default value is -50 dB.
  1215. @item noise_type, nt
  1216. Set the noise type.
  1217. It accepts the following values:
  1218. @table @option
  1219. @item white, w
  1220. Select white noise.
  1221. @item vinyl, v
  1222. Select vinyl noise.
  1223. @item shellac, s
  1224. Select shellac noise.
  1225. @item custom, c
  1226. Select custom noise, defined in @code{bn} option.
  1227. Default value is white noise.
  1228. @end table
  1229. @item band_noise, bn
  1230. Set custom band noise profile for every one of 15 bands.
  1231. Bands are separated by ' ' or '|'.
  1232. @item residual_floor, rf
  1233. Set the residual floor in dB, allowed range is -80 to -20.
  1234. Default value is -38 dB.
  1235. @item track_noise, tn
  1236. Enable noise floor tracking. By default is disabled.
  1237. With this enabled, noise floor is automatically adjusted.
  1238. @item track_residual, tr
  1239. Enable residual tracking. By default is disabled.
  1240. @item output_mode, om
  1241. Set the output mode.
  1242. It accepts the following values:
  1243. @table @option
  1244. @item input, i
  1245. Pass input unchanged.
  1246. @item output, o
  1247. Pass noise filtered out.
  1248. @item noise, n
  1249. Pass only noise.
  1250. Default value is @var{output}.
  1251. @end table
  1252. @item adaptivity, ad
  1253. Set the adaptivity factor, used how fast to adapt gains adjustments per
  1254. each frequency bin. Value @var{0} enables instant adaptation, while higher values
  1255. react much slower.
  1256. Allowed range is from @var{0} to @var{1}. Default value is @var{0.5}.
  1257. @item floor_offset, fo
  1258. Set the noise floor offset factor. This option is used to adjust offset applied to measured
  1259. noise floor. It is only effective when noise floor tracking is enabled.
  1260. Allowed range is from @var{-2.0} to @var{2.0}. Default value is @var{1.0}.
  1261. @item noise_link, nl
  1262. Set the noise link used for multichannel audio.
  1263. It accepts the following values:
  1264. @table @option
  1265. @item none
  1266. Use unchanged channel's noise floor.
  1267. @item min
  1268. Use measured min noise floor of all channels.
  1269. @item max
  1270. Use measured max noise floor of all channels.
  1271. @item average
  1272. Use measured average noise floor of all channels.
  1273. Default value is @var{min}.
  1274. @end table
  1275. @item band_multiplier, bm
  1276. Set the band multiplier factor, used how much to spread bands across frequency bins.
  1277. Allowed range is from @var{0.2} to @var{5}. Default value is @var{1.25}.
  1278. @item sample_noise, sn
  1279. Toggle capturing and measurement of noise profile from input audio.
  1280. It accepts the following values:
  1281. @table @option
  1282. @item start, begin
  1283. Start sample noise capture.
  1284. @item stop, end
  1285. Stop sample noise capture and measure new noise band profile.
  1286. Default value is @code{none}.
  1287. @end table
  1288. @item gain_smooth, gs
  1289. Set gain smooth spatial radius, used to smooth gains applied to each frequency bin.
  1290. Useful to reduce random music noise artefacts.
  1291. Higher values increases smoothing of gains.
  1292. Allowed range is from @code{0} to @code{50}.
  1293. Default value is @code{0}.
  1294. @end table
  1295. @subsection Commands
  1296. This filter supports the some above mentioned options as @ref{commands}.
  1297. @subsection Examples
  1298. @itemize
  1299. @item
  1300. Reduce white noise by 10dB, and use previously measured noise floor of -40dB:
  1301. @example
  1302. afftdn=nr=10:nf=-40
  1303. @end example
  1304. @item
  1305. Reduce white noise by 10dB, also set initial noise floor to -80dB and enable automatic
  1306. tracking of noise floor so noise floor will gradually change during processing:
  1307. @example
  1308. afftdn=nr=10:nf=-80:tn=1
  1309. @end example
  1310. @item
  1311. Reduce noise by 20dB, using noise floor of -40dB and using commands to take noise profile
  1312. of first 0.4 seconds of input audio:
  1313. @example
  1314. asendcmd=0.0 afftdn sn start,asendcmd=0.4 afftdn sn stop,afftdn=nr=20:nf=-40
  1315. @end example
  1316. @end itemize
  1317. @section afftfilt
  1318. Apply arbitrary expressions to samples in frequency domain.
  1319. @table @option
  1320. @item real
  1321. Set frequency domain real expression for each separate channel separated
  1322. by '|'. Default is "re".
  1323. If the number of input channels is greater than the number of
  1324. expressions, the last specified expression is used for the remaining
  1325. output channels.
  1326. @item imag
  1327. Set frequency domain imaginary expression for each separate channel
  1328. separated by '|'. Default is "im".
  1329. Each expression in @var{real} and @var{imag} can contain the following
  1330. constants and functions:
  1331. @table @option
  1332. @item sr
  1333. sample rate
  1334. @item b
  1335. current frequency bin number
  1336. @item nb
  1337. number of available bins
  1338. @item ch
  1339. channel number of the current expression
  1340. @item chs
  1341. number of channels
  1342. @item pts
  1343. current frame pts
  1344. @item re
  1345. current real part of frequency bin of current channel
  1346. @item im
  1347. current imaginary part of frequency bin of current channel
  1348. @item real(b, ch)
  1349. Return the value of real part of frequency bin at location (@var{bin},@var{channel})
  1350. @item imag(b, ch)
  1351. Return the value of imaginary part of frequency bin at location (@var{bin},@var{channel})
  1352. @end table
  1353. @item win_size
  1354. Set window size. Allowed range is from 16 to 131072.
  1355. Default is @code{4096}
  1356. @item win_func
  1357. Set window function.
  1358. It accepts the following values:
  1359. @table @samp
  1360. @item rect
  1361. @item bartlett
  1362. @item hann, hanning
  1363. @item hamming
  1364. @item blackman
  1365. @item welch
  1366. @item flattop
  1367. @item bharris
  1368. @item bnuttall
  1369. @item bhann
  1370. @item sine
  1371. @item nuttall
  1372. @item lanczos
  1373. @item gauss
  1374. @item tukey
  1375. @item dolph
  1376. @item cauchy
  1377. @item parzen
  1378. @item poisson
  1379. @item bohman
  1380. @item kaiser
  1381. @end table
  1382. Default is @code{hann}.
  1383. @item overlap
  1384. Set window overlap. If set to 1, the recommended overlap for selected
  1385. window function will be picked. Default is @code{0.75}.
  1386. @end table
  1387. @subsection Examples
  1388. @itemize
  1389. @item
  1390. Leave almost only low frequencies in audio:
  1391. @example
  1392. afftfilt="'real=re * (1-clip((b/nb)*b,0,1))':imag='im * (1-clip((b/nb)*b,0,1))'"
  1393. @end example
  1394. @item
  1395. Apply robotize effect:
  1396. @example
  1397. afftfilt="real='hypot(re,im)*sin(0)':imag='hypot(re,im)*cos(0)':win_size=512:overlap=0.75"
  1398. @end example
  1399. @item
  1400. Apply whisper effect:
  1401. @example
  1402. afftfilt="real='hypot(re,im)*cos((random(0)*2-1)*2*3.14)':imag='hypot(re,im)*sin((random(1)*2-1)*2*3.14)':win_size=128:overlap=0.8"
  1403. @end example
  1404. @item
  1405. Apply phase shift:
  1406. @example
  1407. afftfilt="real=re*cos(1)-im*sin(1):imag=re*sin(1)+im*cos(1)"
  1408. @end example
  1409. @end itemize
  1410. @anchor{afir}
  1411. @section afir
  1412. Apply an arbitrary Finite Impulse Response filter.
  1413. This filter is designed for applying long FIR filters,
  1414. up to 60 seconds long.
  1415. It can be used as component for digital crossover filters,
  1416. room equalization, cross talk cancellation, wavefield synthesis,
  1417. auralization, ambiophonics, ambisonics and spatialization.
  1418. This filter uses the streams higher than first one as FIR coefficients.
  1419. If the non-first stream holds a single channel, it will be used
  1420. for all input channels in the first stream, otherwise
  1421. the number of channels in the non-first stream must be same as
  1422. the number of channels in the first stream.
  1423. It accepts the following parameters:
  1424. @table @option
  1425. @item dry
  1426. Set dry gain. This sets input gain.
  1427. @item wet
  1428. Set wet gain. This sets final output gain.
  1429. @item length
  1430. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  1431. @item gtype
  1432. This option is deprecated, and does nothing.
  1433. @item irnorm
  1434. Set norm to be applied to IR coefficients before filtering.
  1435. Allowed range is from @var{-1} to @var{2}.
  1436. IR coefficients are normalized with calculated vector norm set by this option.
  1437. For negative values, no norm is calculated, and IR coefficients are not modified at all.
  1438. Default is @var{1}.
  1439. @item irlink
  1440. For multichannel IR if this option is set to @var{true}, all IR channels will be
  1441. normalized with maximal measured gain of all IR channels coefficients as set by @code{irnorm} option.
  1442. When disabled, all IR coefficients in each IR channel will be normalized independently.
  1443. Default is @var{true}.
  1444. @item irgain
  1445. Set gain to be applied to IR coefficients before filtering.
  1446. Allowed range is 0 to 1. This gain is applied after any gain applied with @var{irnorm} option.
  1447. @item irfmt
  1448. Set format of IR stream. Can be @code{mono} or @code{input}.
  1449. Default is @code{input}.
  1450. @item maxir
  1451. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  1452. Allowed range is 0.1 to 60 seconds.
  1453. @item response
  1454. This option is deprecated, and does nothing.
  1455. @item channel
  1456. This option is deprecated, and does nothing.
  1457. @item size
  1458. This option is deprecated, and does nothing.
  1459. @item rate
  1460. This option is deprecated, and does nothing.
  1461. @item minp
  1462. Set minimal partition size used for convolution. Default is @var{8192}.
  1463. Allowed range is from @var{1} to @var{65536}.
  1464. Lower values decreases latency at cost of higher CPU usage.
  1465. @item maxp
  1466. Set maximal partition size used for convolution. Default is @var{8192}.
  1467. Allowed range is from @var{8} to @var{65536}.
  1468. Lower values may increase CPU usage.
  1469. @item nbirs
  1470. Set number of input impulse responses streams which will be switchable at runtime.
  1471. Allowed range is from @var{1} to @var{32}. Default is @var{1}.
  1472. @item ir
  1473. Set IR stream which will be used for convolution, starting from @var{0}, should always be
  1474. lower than supplied value by @code{nbirs} option. Default is @var{0}.
  1475. This option can be changed at runtime via @ref{commands}.
  1476. @item precision
  1477. Set which precision to use when processing samples.
  1478. @table @option
  1479. @item auto
  1480. Auto pick internal sample format depending on other filters.
  1481. @item float
  1482. Always use single-floating point precision sample format.
  1483. @item double
  1484. Always use double-floating point precision sample format.
  1485. @end table
  1486. Default value is auto.
  1487. @item irload
  1488. Set when to load IR stream. Can be @code{init} or @code{access}.
  1489. First one load and prepares all IRs on initialization, second one
  1490. once on first access of specific IR.
  1491. Default is @code{init}.
  1492. @end table
  1493. @subsection Examples
  1494. @itemize
  1495. @item
  1496. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  1497. @example
  1498. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  1499. @end example
  1500. @item
  1501. Apply true stereo processing given input stereo stream, and two stereo impulse responses for left and right channel,
  1502. the impulse response files are files with names l_ir.wav and r_ir.wav, and setting irnorm option value:
  1503. @example
  1504. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:irnorm=1.2,pan=stereo|FL<c0+c2|FR<c1+c3"
  1505. @end example
  1506. @item
  1507. Similar to above example, but with @code{irgain} explicitly set to estimated value and with @code{irnorm} disabled:
  1508. @example
  1509. "pan=4C|c0=FL|c1=FL|c2=FR|c3=FR[a];amovie=l_ir.wav[LIR];amovie=r_ir.wav[RIR];[LIR][RIR]amerge[ir];[a][ir]afir=irfmt=input:irgain=-5dB:irnom=-1,pan=stereo|FL<c0+c2|FR<c1+c3"
  1510. @end example
  1511. @end itemize
  1512. @anchor{aformat}
  1513. @section aformat
  1514. Set output format constraints for the input audio. The framework will
  1515. negotiate the most appropriate format to minimize conversions.
  1516. It accepts the following parameters:
  1517. @table @option
  1518. @item sample_fmts, f
  1519. A '|'-separated list of requested sample formats.
  1520. @item sample_rates, r
  1521. A '|'-separated list of requested sample rates.
  1522. @item channel_layouts, cl
  1523. A '|'-separated list of requested channel layouts.
  1524. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1525. for the required syntax.
  1526. @end table
  1527. If a parameter is omitted, all values are allowed.
  1528. Force the output to either unsigned 8-bit or signed 16-bit stereo
  1529. @example
  1530. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  1531. @end example
  1532. @section afreqshift
  1533. Apply frequency shift to input audio samples.
  1534. The filter accepts the following options:
  1535. @table @option
  1536. @item shift
  1537. Specify frequency shift. Allowed range is -INT_MAX to INT_MAX.
  1538. Default value is 0.0.
  1539. @item level
  1540. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  1541. Default value is 1.0.
  1542. @item order
  1543. Set filter order used for filtering. Allowed range is from 1 to 16.
  1544. Default value is 8.
  1545. @end table
  1546. @subsection Commands
  1547. This filter supports the all above options as @ref{commands}.
  1548. @section afwtdn
  1549. Reduce broadband noise from input samples using Wavelets.
  1550. A description of the accepted options follows.
  1551. @table @option
  1552. @item sigma
  1553. Set the noise sigma, allowed range is from 0 to 1.
  1554. Default value is 0.
  1555. This option controls strength of denoising applied to input samples.
  1556. Most useful way to set this option is via decibels, eg. -45dB.
  1557. @item levels
  1558. Set the number of wavelet levels of decomposition.
  1559. Allowed range is from 1 to 12.
  1560. Default value is 10.
  1561. Setting this too low make denoising performance very poor.
  1562. @item wavet
  1563. Set wavelet type for decomposition of input frame.
  1564. They are sorted by number of coefficients, from lowest to highest.
  1565. More coefficients means worse filtering speed, but overall better quality.
  1566. Available wavelets are:
  1567. @table @samp
  1568. @item sym2
  1569. @item sym4
  1570. @item rbior68
  1571. @item deb10
  1572. @item sym10
  1573. @item coif5
  1574. @item bl3
  1575. @end table
  1576. @item percent
  1577. Set percent of full denoising. Allowed range is from 0 to 100 percent.
  1578. Default value is 85 percent or partial denoising.
  1579. @item profile
  1580. If enabled, first input frame will be used as noise profile.
  1581. If first frame samples contain non-noise performance will be very poor.
  1582. @item adaptive
  1583. If enabled, input frames are analyzed for presence of noise.
  1584. If noise is detected with high possibility then input frame profile will be
  1585. used for processing following frames, until new noise frame is detected.
  1586. @item samples
  1587. Set size of single frame in number of samples. Allowed range is from 512 to
  1588. 65536. Default frame size is 8192 samples.
  1589. @item softness
  1590. Set softness applied inside thresholding function. Allowed range is from 0 to
  1591. 10. Default softness is 1.
  1592. @end table
  1593. @subsection Commands
  1594. This filter supports the all above options as @ref{commands}.
  1595. @section agate
  1596. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  1597. processing reduces disturbing noise between useful signals.
  1598. Gating is done by detecting the volume below a chosen level @var{threshold}
  1599. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  1600. floor is set via @var{range}. Because an exact manipulation of the signal
  1601. would cause distortion of the waveform the reduction can be levelled over
  1602. time. This is done by setting @var{attack} and @var{release}.
  1603. @var{attack} determines how long the signal has to fall below the threshold
  1604. before any reduction will occur and @var{release} sets the time the signal
  1605. has to rise above the threshold to reduce the reduction again.
  1606. Shorter signals than the chosen attack time will be left untouched.
  1607. @table @option
  1608. @item level_in
  1609. Set input level before filtering.
  1610. Default is 1. Allowed range is from 0.015625 to 64.
  1611. @item mode
  1612. Set the mode of operation. Can be @code{upward} or @code{downward}.
  1613. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  1614. will be amplified, expanding dynamic range in upward direction.
  1615. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  1616. @item range
  1617. Set the level of gain reduction when the signal is below the threshold.
  1618. Default is 0.06125. Allowed range is from 0 to 1.
  1619. Setting this to 0 disables reduction and then filter behaves like expander.
  1620. @item threshold
  1621. If a signal rises above this level the gain reduction is released.
  1622. Default is 0.125. Allowed range is from 0 to 1.
  1623. @item ratio
  1624. Set a ratio by which the signal is reduced.
  1625. Default is 2. Allowed range is from 1 to 9000.
  1626. @item attack
  1627. Amount of milliseconds the signal has to rise above the threshold before gain
  1628. reduction stops.
  1629. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  1630. @item release
  1631. Amount of milliseconds the signal has to fall below the threshold before the
  1632. reduction is increased again. Default is 250 milliseconds.
  1633. Allowed range is from 0.01 to 9000.
  1634. @item makeup
  1635. Set amount of amplification of signal after processing.
  1636. Default is 1. Allowed range is from 1 to 64.
  1637. @item knee
  1638. Curve the sharp knee around the threshold to enter gain reduction more softly.
  1639. Default is 2.828427125. Allowed range is from 1 to 8.
  1640. @item detection
  1641. Choose if exact signal should be taken for detection or an RMS like one.
  1642. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  1643. @item link
  1644. Choose if the average level between all channels or the louder channel affects
  1645. the reduction.
  1646. Default is @code{average}. Can be @code{average} or @code{maximum}.
  1647. @end table
  1648. @subsection Commands
  1649. This filter supports the all above options as @ref{commands}.
  1650. @section aiir
  1651. Apply an arbitrary Infinite Impulse Response filter.
  1652. It accepts the following parameters:
  1653. @table @option
  1654. @item zeros, z
  1655. Set B/numerator/zeros/reflection coefficients.
  1656. @item poles, p
  1657. Set A/denominator/poles/ladder coefficients.
  1658. @item gains, k
  1659. Set channels gains.
  1660. @item dry_gain
  1661. Set input gain.
  1662. @item wet_gain
  1663. Set output gain.
  1664. @item format, f
  1665. Set coefficients format.
  1666. @table @samp
  1667. @item ll
  1668. lattice-ladder function
  1669. @item sf
  1670. analog transfer function
  1671. @item tf
  1672. digital transfer function
  1673. @item zp
  1674. Z-plane zeros/poles, cartesian (default)
  1675. @item pr
  1676. Z-plane zeros/poles, polar radians
  1677. @item pd
  1678. Z-plane zeros/poles, polar degrees
  1679. @item sp
  1680. S-plane zeros/poles
  1681. @end table
  1682. @item process, r
  1683. Set type of processing.
  1684. @table @samp
  1685. @item d
  1686. direct processing
  1687. @item s
  1688. serial processing
  1689. @item p
  1690. parallel processing
  1691. @end table
  1692. @item precision, e
  1693. Set filtering precision.
  1694. @table @samp
  1695. @item dbl
  1696. double-precision floating-point (default)
  1697. @item flt
  1698. single-precision floating-point
  1699. @item i32
  1700. 32-bit integers
  1701. @item i16
  1702. 16-bit integers
  1703. @end table
  1704. @item normalize, n
  1705. Normalize filter coefficients, by default is enabled.
  1706. Enabling it will normalize magnitude response at DC to 0dB.
  1707. @item mix
  1708. How much to use filtered signal in output. Default is 1.
  1709. Range is between 0 and 1.
  1710. @item response
  1711. Show IR frequency response, magnitude(magenta), phase(green) and group delay(yellow) in additional video stream.
  1712. By default it is disabled.
  1713. @item channel
  1714. Set for which IR channel to display frequency response. By default is first channel
  1715. displayed. This option is used only when @var{response} is enabled.
  1716. @item size
  1717. Set video stream size. This option is used only when @var{response} is enabled.
  1718. @end table
  1719. Coefficients in @code{tf} and @code{sf} format are separated by spaces and are in ascending
  1720. order.
  1721. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  1722. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  1723. imaginary unit.
  1724. Different coefficients and gains can be provided for every channel, in such case
  1725. use '|' to separate coefficients or gains. Last provided coefficients will be
  1726. used for all remaining channels.
  1727. @subsection Examples
  1728. @itemize
  1729. @item
  1730. Apply 2 pole elliptic notch at around 5000Hz for 48000 Hz sample rate:
  1731. @example
  1732. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  1733. @end example
  1734. @item
  1735. Same as above but in @code{zp} format:
  1736. @example
  1737. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  1738. @end example
  1739. @item
  1740. Apply 3-rd order analog normalized Butterworth low-pass filter, using analog transfer function format:
  1741. @example
  1742. aiir=z=1.3057 0 0 0:p=1.3057 2.3892 2.1860 1:f=sf:r=d
  1743. @end example
  1744. @end itemize
  1745. @section alimiter
  1746. The limiter prevents an input signal from rising over a desired threshold.
  1747. This limiter uses lookahead technology to prevent your signal from distorting.
  1748. It means that there is a small delay after the signal is processed. Keep in mind
  1749. that the delay it produces is the attack time you set.
  1750. The filter accepts the following options:
  1751. @table @option
  1752. @item level_in
  1753. Set input gain. Default is 1.
  1754. @item level_out
  1755. Set output gain. Default is 1.
  1756. @item limit
  1757. Don't let signals above this level pass the limiter. Default is 1.
  1758. @item attack
  1759. The limiter will reach its attenuation level in this amount of time in
  1760. milliseconds. Default is 5 milliseconds.
  1761. @item release
  1762. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  1763. Default is 50 milliseconds.
  1764. @item asc
  1765. When gain reduction is always needed ASC takes care of releasing to an
  1766. average reduction level rather than reaching a reduction of 0 in the release
  1767. time.
  1768. @item asc_level
  1769. Select how much the release time is affected by ASC, 0 means nearly no changes
  1770. in release time while 1 produces higher release times.
  1771. @item level
  1772. Auto level output signal. Default is enabled.
  1773. This normalizes audio back to 0dB if enabled.
  1774. @item latency
  1775. Compensate the delay introduced by using the lookahead buffer set with attack
  1776. parameter. Also flush the valid audio data in the lookahead buffer when the
  1777. stream hits EOF.
  1778. @end table
  1779. Depending on picked setting it is recommended to upsample input 2x or 4x times
  1780. with @ref{aresample} before applying this filter.
  1781. @section allpass
  1782. Apply a two-pole all-pass filter with central frequency (in Hz)
  1783. @var{frequency}, and filter-width @var{width}.
  1784. An all-pass filter changes the audio's frequency to phase relationship
  1785. without changing its frequency to amplitude relationship.
  1786. The filter accepts the following options:
  1787. @table @option
  1788. @item frequency, f
  1789. Set frequency in Hz.
  1790. @item width_type, t
  1791. Set method to specify band-width of filter.
  1792. @table @option
  1793. @item h
  1794. Hz
  1795. @item q
  1796. Q-Factor
  1797. @item o
  1798. octave
  1799. @item s
  1800. slope
  1801. @item k
  1802. kHz
  1803. @end table
  1804. @item width, w
  1805. Specify the band-width of a filter in width_type units.
  1806. @item mix, m
  1807. How much to use filtered signal in output. Default is 1.
  1808. Range is between 0 and 1.
  1809. @item channels, c
  1810. Specify which channels to filter, by default all available are filtered.
  1811. @item normalize, n
  1812. Normalize biquad coefficients, by default is disabled.
  1813. Enabling it will normalize magnitude response at DC to 0dB.
  1814. @item order, o
  1815. Set the filter order, can be 1 or 2. Default is 2.
  1816. @item transform, a
  1817. Set transform type of IIR filter.
  1818. @table @option
  1819. @item di
  1820. @item dii
  1821. @item tdi
  1822. @item tdii
  1823. @item latt
  1824. @item svf
  1825. @item zdf
  1826. @end table
  1827. @item precision, r
  1828. Set precision of filtering.
  1829. @table @option
  1830. @item auto
  1831. Pick automatic sample format depending on surround filters.
  1832. @item s16
  1833. Always use signed 16-bit.
  1834. @item s32
  1835. Always use signed 32-bit.
  1836. @item f32
  1837. Always use float 32-bit.
  1838. @item f64
  1839. Always use float 64-bit.
  1840. @end table
  1841. @end table
  1842. @subsection Commands
  1843. This filter supports the following commands:
  1844. @table @option
  1845. @item frequency, f
  1846. Change allpass frequency.
  1847. Syntax for the command is : "@var{frequency}"
  1848. @item width_type, t
  1849. Change allpass width_type.
  1850. Syntax for the command is : "@var{width_type}"
  1851. @item width, w
  1852. Change allpass width.
  1853. Syntax for the command is : "@var{width}"
  1854. @item mix, m
  1855. Change allpass mix.
  1856. Syntax for the command is : "@var{mix}"
  1857. @end table
  1858. @section aloop
  1859. Loop audio samples.
  1860. The filter accepts the following options:
  1861. @table @option
  1862. @item loop
  1863. Set the number of loops. Setting this value to -1 will result in infinite loops.
  1864. Default is 0.
  1865. @item size
  1866. Set maximal number of samples. Default is 0.
  1867. @item start
  1868. Set first sample of loop. Default is 0.
  1869. @item time
  1870. Set the time of loop start in seconds.
  1871. Only used if option named @var{start} is set to @code{-1}.
  1872. @end table
  1873. @anchor{amerge}
  1874. @section amerge
  1875. Merge two or more audio streams into a single multi-channel stream.
  1876. The filter accepts the following options:
  1877. @table @option
  1878. @item inputs
  1879. Set the number of inputs. Default is 2.
  1880. @end table
  1881. If the channel layouts of the inputs are disjoint, and therefore compatible,
  1882. the channel layout of the output will be set accordingly and the channels
  1883. will be reordered as necessary. If the channel layouts of the inputs are not
  1884. disjoint, the output will have all the channels of the first input then all
  1885. the channels of the second input, in that order, and the channel layout of
  1886. the output will be the default value corresponding to the total number of
  1887. channels.
  1888. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1889. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1890. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1891. first input, b1 is the first channel of the second input).
  1892. On the other hand, if both input are in stereo, the output channels will be
  1893. in the default order: a1, a2, b1, b2, and the channel layout will be
  1894. arbitrarily set to 4.0, which may or may not be the expected value.
  1895. All inputs must have the same sample rate, and format.
  1896. If inputs do not have the same duration, the output will stop with the
  1897. shortest.
  1898. @subsection Examples
  1899. @itemize
  1900. @item
  1901. Merge two mono files into a stereo stream:
  1902. @example
  1903. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1904. @end example
  1905. @item
  1906. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1907. @example
  1908. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1909. @end example
  1910. @end itemize
  1911. @section amix
  1912. Mixes multiple audio inputs into a single output.
  1913. Note that this filter only supports float samples (the @var{amerge}
  1914. and @var{pan} audio filters support many formats). If the @var{amix}
  1915. input has integer samples then @ref{aresample} will be automatically
  1916. inserted to perform the conversion to float samples.
  1917. It accepts the following parameters:
  1918. @table @option
  1919. @item inputs
  1920. The number of inputs. If unspecified, it defaults to 2.
  1921. @item duration
  1922. How to determine the end-of-stream.
  1923. @table @option
  1924. @item longest
  1925. The duration of the longest input. (default)
  1926. @item shortest
  1927. The duration of the shortest input.
  1928. @item first
  1929. The duration of the first input.
  1930. @end table
  1931. @item dropout_transition
  1932. The transition time, in seconds, for volume renormalization when an input
  1933. stream ends. The default value is 2 seconds.
  1934. @item weights
  1935. Specify weight of each input audio stream as a sequence of numbers separated
  1936. by a space. If fewer weights are specified compared to number of inputs, the
  1937. last weight is assigned to the remaining inputs.
  1938. Default weight for each input is 1.
  1939. @item normalize
  1940. Always scale inputs instead of only doing summation of samples.
  1941. Beware of heavy clipping if inputs are not normalized prior or after filtering
  1942. by this filter if this option is disabled. By default is enabled.
  1943. @end table
  1944. @subsection Examples
  1945. @itemize
  1946. @item
  1947. This will mix 3 input audio streams to a single output with the same duration as the
  1948. first input and a dropout transition time of 3 seconds:
  1949. @example
  1950. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1951. @end example
  1952. @item
  1953. This will mix one vocal and one music input audio stream to a single output with the same duration as the
  1954. longest input. The music will have quarter the weight as the vocals, and the inputs are not normalized:
  1955. @example
  1956. ffmpeg -i VOCALS -i MUSIC -filter_complex amix=inputs=2:duration=longest:dropout_transition=0:weights="1 0.25":normalize=0 OUTPUT
  1957. @end example
  1958. @end itemize
  1959. @subsection Commands
  1960. This filter supports the following commands:
  1961. @table @option
  1962. @item weights
  1963. @item normalize
  1964. Syntax is same as option with same name.
  1965. @end table
  1966. @section amultiply
  1967. Multiply first audio stream with second audio stream and store result
  1968. in output audio stream. Multiplication is done by multiplying each
  1969. sample from first stream with sample at same position from second stream.
  1970. With this element-wise multiplication one can create amplitude fades and
  1971. amplitude modulations.
  1972. @section anequalizer
  1973. High-order parametric multiband equalizer for each channel.
  1974. It accepts the following parameters:
  1975. @table @option
  1976. @item params
  1977. This option string is in format:
  1978. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1979. Each equalizer band is separated by '|'.
  1980. @table @option
  1981. @item chn
  1982. Set channel number to which equalization will be applied.
  1983. If input doesn't have that channel the entry is ignored.
  1984. @item f
  1985. Set central frequency for band.
  1986. If input doesn't have that frequency the entry is ignored.
  1987. @item w
  1988. Set band width in Hertz.
  1989. @item g
  1990. Set band gain in dB.
  1991. @item t
  1992. Set filter type for band, optional, can be:
  1993. @table @samp
  1994. @item 0
  1995. Butterworth, this is default.
  1996. @item 1
  1997. Chebyshev type 1.
  1998. @item 2
  1999. Chebyshev type 2.
  2000. @end table
  2001. @end table
  2002. @item curves
  2003. With this option activated frequency response of anequalizer is displayed
  2004. in video stream.
  2005. @item size
  2006. Set video stream size. Only useful if curves option is activated.
  2007. @item mgain
  2008. Set max gain that will be displayed. Only useful if curves option is activated.
  2009. Setting this to a reasonable value makes it possible to display gain which is derived from
  2010. neighbour bands which are too close to each other and thus produce higher gain
  2011. when both are activated.
  2012. @item fscale
  2013. Set frequency scale used to draw frequency response in video output.
  2014. Can be linear or logarithmic. Default is logarithmic.
  2015. @item colors
  2016. Set color for each channel curve which is going to be displayed in video stream.
  2017. This is list of color names separated by space or by '|'.
  2018. Unrecognised or missing colors will be replaced by white color.
  2019. @end table
  2020. @subsection Examples
  2021. @itemize
  2022. @item
  2023. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  2024. for first 2 channels using Chebyshev type 1 filter:
  2025. @example
  2026. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  2027. @end example
  2028. @end itemize
  2029. @subsection Commands
  2030. This filter supports the following commands:
  2031. @table @option
  2032. @item change
  2033. Alter existing filter parameters.
  2034. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  2035. @var{fN} is existing filter number, starting from 0, if no such filter is available
  2036. error is returned.
  2037. @var{freq} set new frequency parameter.
  2038. @var{width} set new width parameter in Hertz.
  2039. @var{gain} set new gain parameter in dB.
  2040. Full filter invocation with asendcmd may look like this:
  2041. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  2042. @end table
  2043. @section anlmdn
  2044. Reduce broadband noise in audio samples using Non-Local Means algorithm.
  2045. Each sample is adjusted by looking for other samples with similar contexts. This
  2046. context similarity is defined by comparing their surrounding patches of size
  2047. @option{p}. Patches are searched in an area of @option{r} around the sample.
  2048. The filter accepts the following options:
  2049. @table @option
  2050. @item strength, s
  2051. Set denoising strength. Allowed range is from 0.00001 to 10000. Default value is 0.00001.
  2052. @item patch, p
  2053. Set patch radius duration. Allowed range is from 1 to 100 milliseconds.
  2054. Default value is 2 milliseconds.
  2055. @item research, r
  2056. Set research radius duration. Allowed range is from 2 to 300 milliseconds.
  2057. Default value is 6 milliseconds.
  2058. @item output, o
  2059. Set the output mode.
  2060. It accepts the following values:
  2061. @table @option
  2062. @item i
  2063. Pass input unchanged.
  2064. @item o
  2065. Pass noise filtered out.
  2066. @item n
  2067. Pass only noise.
  2068. Default value is @var{o}.
  2069. @end table
  2070. @item smooth, m
  2071. Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{1000}.
  2072. @end table
  2073. @subsection Commands
  2074. This filter supports the all above options as @ref{commands}.
  2075. @section anlmf, anlms
  2076. Apply Normalized Least-Mean-(Squares|Fourth) algorithm to the first audio stream using the second audio stream.
  2077. This adaptive filter is used to mimic a desired filter by finding the filter coefficients that
  2078. relate to producing the least mean square of the error signal (difference between the desired,
  2079. 2nd input audio stream and the actual signal, the 1st input audio stream).
  2080. A description of the accepted options follows.
  2081. @table @option
  2082. @item order
  2083. Set filter order.
  2084. @item mu
  2085. Set filter mu.
  2086. @item eps
  2087. Set the filter eps.
  2088. @item leakage
  2089. Set the filter leakage.
  2090. @item out_mode
  2091. It accepts the following values:
  2092. @table @option
  2093. @item i
  2094. Pass the 1st input.
  2095. @item d
  2096. Pass the 2nd input.
  2097. @item o
  2098. Pass difference between desired, 2nd input and error signal estimate.
  2099. @item n
  2100. Pass difference between input, 1st input and error signal estimate.
  2101. @item e
  2102. Pass error signal estimated samples.
  2103. Default value is @var{o}.
  2104. @end table
  2105. @item precision
  2106. Set which precision to use when processing samples.
  2107. @table @option
  2108. @item auto
  2109. Auto pick internal sample format depending on other filters.
  2110. @item float
  2111. Always use single-floating point precision sample format.
  2112. @item double
  2113. Always use double-floating point precision sample format.
  2114. @end table
  2115. @end table
  2116. @subsection Examples
  2117. @itemize
  2118. @item
  2119. One of many usages of this filter is noise reduction, input audio is filtered
  2120. with same samples that are delayed by fixed amount, one such example for stereo audio is:
  2121. @example
  2122. asplit[a][b],[a]adelay=32S|32S[a],[b][a]anlms=order=128:leakage=0.0005:mu=.5:out_mode=o
  2123. @end example
  2124. @end itemize
  2125. @subsection Commands
  2126. This filter supports the same commands as options, excluding option @code{order}.
  2127. @section anull
  2128. Pass the audio source unchanged to the output.
  2129. @section apad
  2130. Pad the end of an audio stream with silence.
  2131. This can be used together with @command{ffmpeg} @option{-shortest} to
  2132. extend audio streams to the same length as the video stream.
  2133. A description of the accepted options follows.
  2134. @table @option
  2135. @item packet_size
  2136. Set silence packet size. Default value is 4096.
  2137. @item pad_len
  2138. Set the number of samples of silence to add to the end. After the
  2139. value is reached, the stream is terminated. This option is mutually
  2140. exclusive with @option{whole_len}.
  2141. @item whole_len
  2142. Set the minimum total number of samples in the output audio stream. If
  2143. the value is longer than the input audio length, silence is added to
  2144. the end, until the value is reached. This option is mutually exclusive
  2145. with @option{pad_len}.
  2146. @item pad_dur
  2147. Specify the duration of samples of silence to add. See
  2148. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2149. for the accepted syntax. Used only if set to non-negative value.
  2150. @item whole_dur
  2151. Specify the minimum total duration in the output audio stream. See
  2152. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2153. for the accepted syntax. Used only if set to non-negative value. If the value is longer than
  2154. the input audio length, silence is added to the end, until the value is reached.
  2155. This option is mutually exclusive with @option{pad_dur}
  2156. @end table
  2157. If neither the @option{pad_len} nor the @option{whole_len} nor @option{pad_dur}
  2158. nor @option{whole_dur} option is set, the filter will add silence to the end of
  2159. the input stream indefinitely.
  2160. Note that for ffmpeg 4.4 and earlier a zero @option{pad_dur} or
  2161. @option{whole_dur} also caused the filter to add silence indefinitely.
  2162. @subsection Examples
  2163. @itemize
  2164. @item
  2165. Add 1024 samples of silence to the end of the input:
  2166. @example
  2167. apad=pad_len=1024
  2168. @end example
  2169. @item
  2170. Make sure the audio output will contain at least 10000 samples, pad
  2171. the input with silence if required:
  2172. @example
  2173. apad=whole_len=10000
  2174. @end example
  2175. @item
  2176. Use @command{ffmpeg} to pad the audio input with silence, so that the
  2177. video stream will always result the shortest and will be converted
  2178. until the end in the output file when using the @option{shortest}
  2179. option:
  2180. @example
  2181. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  2182. @end example
  2183. @end itemize
  2184. @section aphaser
  2185. Add a phasing effect to the input audio.
  2186. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  2187. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  2188. A description of the accepted parameters follows.
  2189. @table @option
  2190. @item in_gain
  2191. Set input gain. Default is 0.4.
  2192. @item out_gain
  2193. Set output gain. Default is 0.74
  2194. @item delay
  2195. Set delay in milliseconds. Default is 3.0.
  2196. @item decay
  2197. Set decay. Default is 0.4.
  2198. @item speed
  2199. Set modulation speed in Hz. Default is 0.5.
  2200. @item type
  2201. Set modulation type. Default is triangular.
  2202. It accepts the following values:
  2203. @table @samp
  2204. @item triangular, t
  2205. @item sinusoidal, s
  2206. @end table
  2207. @end table
  2208. @section aphaseshift
  2209. Apply phase shift to input audio samples.
  2210. The filter accepts the following options:
  2211. @table @option
  2212. @item shift
  2213. Specify phase shift. Allowed range is from -1.0 to 1.0.
  2214. Default value is 0.0.
  2215. @item level
  2216. Set output gain applied to final output. Allowed range is from 0.0 to 1.0.
  2217. Default value is 1.0.
  2218. @item order
  2219. Set filter order used for filtering. Allowed range is from 1 to 16.
  2220. Default value is 8.
  2221. @end table
  2222. @subsection Commands
  2223. This filter supports the all above options as @ref{commands}.
  2224. @section apsnr
  2225. Measure Audio Peak Signal-to-Noise Ratio.
  2226. This filter takes two audio streams for input, and outputs first
  2227. audio stream.
  2228. Results are in dB per channel at end of either input.
  2229. @section apsyclip
  2230. Apply Psychoacoustic clipper to input audio stream.
  2231. The filter accepts the following options:
  2232. @table @option
  2233. @item level_in
  2234. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2235. @item level_out
  2236. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2237. @item clip
  2238. Set the clipping start value. Default value is 0dBFS or 1.
  2239. @item diff
  2240. Output only difference samples, useful to hear introduced distortions.
  2241. By default is disabled.
  2242. @item adaptive
  2243. Set strength of adaptive distortion applied. Default value is 0.5.
  2244. Allowed range is from 0 to 1.
  2245. @item iterations
  2246. Set number of iterations of psychoacoustic clipper.
  2247. Allowed range is from 1 to 20. Default value is 10.
  2248. @item level
  2249. Auto level output signal. Default is disabled.
  2250. This normalizes audio back to 0dBFS if enabled.
  2251. @end table
  2252. @subsection Commands
  2253. This filter supports the all above options as @ref{commands}.
  2254. @section apulsator
  2255. Audio pulsator is something between an autopanner and a tremolo.
  2256. But it can produce funny stereo effects as well. Pulsator changes the volume
  2257. of the left and right channel based on a LFO (low frequency oscillator) with
  2258. different waveforms and shifted phases.
  2259. This filter have the ability to define an offset between left and right
  2260. channel. An offset of 0 means that both LFO shapes match each other.
  2261. The left and right channel are altered equally - a conventional tremolo.
  2262. An offset of 50% means that the shape of the right channel is exactly shifted
  2263. in phase (or moved backwards about half of the frequency) - pulsator acts as
  2264. an autopanner. At 1 both curves match again. Every setting in between moves the
  2265. phase shift gapless between all stages and produces some "bypassing" sounds with
  2266. sine and triangle waveforms. The more you set the offset near 1 (starting from
  2267. the 0.5) the faster the signal passes from the left to the right speaker.
  2268. The filter accepts the following options:
  2269. @table @option
  2270. @item level_in
  2271. Set input gain. By default it is 1. Range is [0.015625 - 64].
  2272. @item level_out
  2273. Set output gain. By default it is 1. Range is [0.015625 - 64].
  2274. @item mode
  2275. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  2276. sawup or sawdown. Default is sine.
  2277. @item amount
  2278. Set modulation. Define how much of original signal is affected by the LFO.
  2279. @item offset_l
  2280. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  2281. @item offset_r
  2282. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  2283. @item width
  2284. Set pulse width. Default is 1. Allowed range is [0 - 2].
  2285. @item timing
  2286. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  2287. @item bpm
  2288. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  2289. is set to bpm.
  2290. @item ms
  2291. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  2292. is set to ms.
  2293. @item hz
  2294. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  2295. if timing is set to hz.
  2296. @end table
  2297. @anchor{aresample}
  2298. @section aresample
  2299. Resample the input audio to the specified parameters, using the
  2300. libswresample library. If none are specified then the filter will
  2301. automatically convert between its input and output.
  2302. This filter is also able to stretch/squeeze the audio data to make it match
  2303. the timestamps or to inject silence / cut out audio to make it match the
  2304. timestamps, do a combination of both or do neither.
  2305. The filter accepts the syntax
  2306. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  2307. expresses a sample rate and @var{resampler_options} is a list of
  2308. @var{key}=@var{value} pairs, separated by ":". See the
  2309. @ref{Resampler Options,,"Resampler Options" section in the
  2310. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  2311. for the complete list of supported options.
  2312. @subsection Examples
  2313. @itemize
  2314. @item
  2315. Resample the input audio to 44100Hz:
  2316. @example
  2317. aresample=44100
  2318. @end example
  2319. @item
  2320. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  2321. samples per second compensation:
  2322. @example
  2323. aresample=async=1000
  2324. @end example
  2325. @end itemize
  2326. @section areverse
  2327. Reverse an audio clip.
  2328. Warning: This filter requires memory to buffer the entire clip, so trimming
  2329. is suggested.
  2330. @subsection Examples
  2331. @itemize
  2332. @item
  2333. Take the first 5 seconds of a clip, and reverse it.
  2334. @example
  2335. atrim=end=5,areverse
  2336. @end example
  2337. @end itemize
  2338. @section arls
  2339. Apply Recursive Least Squares algorithm to the first audio stream using the second audio stream.
  2340. This adaptive filter is used to mimic a desired filter by recursively finding the filter coefficients that
  2341. relate to producing the minimal weighted linear least squares cost function of the error signal (difference
  2342. between the desired, 2nd input audio stream and the actual signal, the 1st input audio stream).
  2343. A description of the accepted options follows.
  2344. @table @option
  2345. @item order
  2346. Set the filter order.
  2347. @item lambda
  2348. Set the forgetting factor.
  2349. @item delta
  2350. Set the coefficient to initialize internal covariance matrix.
  2351. @item out_mode
  2352. Set the filter output samples. It accepts the following values:
  2353. @table @option
  2354. @item i
  2355. Pass the 1st input.
  2356. @item d
  2357. Pass the 2nd input.
  2358. @item o
  2359. Pass difference between desired, 2nd input and error signal estimate.
  2360. @item n
  2361. Pass difference between input, 1st input and error signal estimate.
  2362. @item e
  2363. Pass error signal estimated samples.
  2364. Default value is @var{o}.
  2365. @end table
  2366. @item precision
  2367. Set which precision to use when processing samples.
  2368. @table @option
  2369. @item auto
  2370. Auto pick internal sample format depending on other filters.
  2371. @item float
  2372. Always use single-floating point precision sample format.
  2373. @item double
  2374. Always use double-floating point precision sample format.
  2375. @end table
  2376. @end table
  2377. @section arnndn
  2378. Reduce noise from speech using Recurrent Neural Networks.
  2379. This filter accepts the following options:
  2380. @table @option
  2381. @item model, m
  2382. Set train model file to load. This option is always required.
  2383. @item mix
  2384. Set how much to mix filtered samples into final output.
  2385. Allowed range is from -1 to 1. Default value is 1.
  2386. Negative values are special, they set how much to keep filtered noise
  2387. in the final filter output. Set this option to -1 to hear actual
  2388. noise removed from input signal.
  2389. @end table
  2390. @subsection Commands
  2391. This filter supports the all above options as @ref{commands}.
  2392. @section asdr
  2393. Measure Audio Signal-to-Distortion Ratio.
  2394. This filter takes two audio streams for input, and outputs first
  2395. audio stream.
  2396. Results are in dB per channel at end of either input.
  2397. @section asetnsamples
  2398. Set the number of samples per each output audio frame.
  2399. The last output packet may contain a different number of samples, as
  2400. the filter will flush all the remaining samples when the input audio
  2401. signals its end.
  2402. The filter accepts the following options:
  2403. @table @option
  2404. @item nb_out_samples, n
  2405. Set the number of frames per each output audio frame. The number is
  2406. intended as the number of samples @emph{per each channel}.
  2407. Default value is 1024.
  2408. @item pad, p
  2409. If set to 1, the filter will pad the last audio frame with zeroes, so
  2410. that the last frame will contain the same number of samples as the
  2411. previous ones. Default value is 1.
  2412. @end table
  2413. For example, to set the number of per-frame samples to 1234 and
  2414. disable padding for the last frame, use:
  2415. @example
  2416. asetnsamples=n=1234:p=0
  2417. @end example
  2418. @section asetrate
  2419. Set the sample rate without altering the PCM data.
  2420. This will result in a change of speed and pitch.
  2421. The filter accepts the following options:
  2422. @table @option
  2423. @item sample_rate, r
  2424. Set the output sample rate. Default is 44100 Hz.
  2425. @end table
  2426. @section ashowinfo
  2427. Show a line containing various information for each input audio frame.
  2428. The input audio is not modified.
  2429. The shown line contains a sequence of key/value pairs of the form
  2430. @var{key}:@var{value}.
  2431. The following values are shown in the output:
  2432. @table @option
  2433. @item n
  2434. The (sequential) number of the input frame, starting from 0.
  2435. @item pts
  2436. The presentation timestamp of the input frame, in time base units; the time base
  2437. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  2438. @item pts_time
  2439. The presentation timestamp of the input frame in seconds.
  2440. @item fmt
  2441. The sample format.
  2442. @item chlayout
  2443. The channel layout.
  2444. @item rate
  2445. The sample rate for the audio frame.
  2446. @item nb_samples
  2447. The number of samples (per channel) in the frame.
  2448. @item checksum
  2449. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  2450. audio, the data is treated as if all the planes were concatenated.
  2451. @item plane_checksums
  2452. A list of Adler-32 checksums for each data plane.
  2453. @end table
  2454. @section asisdr
  2455. Measure Audio Scaled-Invariant Signal-to-Distortion Ratio.
  2456. This filter takes two audio streams for input, and outputs first
  2457. audio stream.
  2458. Results are in dB per channel at end of either input.
  2459. @section asoftclip
  2460. Apply audio soft clipping.
  2461. Soft clipping is a type of distortion effect where the amplitude of a signal is saturated
  2462. along a smooth curve, rather than the abrupt shape of hard-clipping.
  2463. This filter accepts the following options:
  2464. @table @option
  2465. @item type
  2466. Set type of soft-clipping.
  2467. It accepts the following values:
  2468. @table @option
  2469. @item hard
  2470. @item tanh
  2471. @item atan
  2472. @item cubic
  2473. @item exp
  2474. @item alg
  2475. @item quintic
  2476. @item sin
  2477. @item erf
  2478. @end table
  2479. @item threshold
  2480. Set threshold from where to start clipping. Default value is 0dB or 1.
  2481. @item output
  2482. Set gain applied to output. Default value is 0dB or 1.
  2483. @item param
  2484. Set additional parameter which controls sigmoid function.
  2485. @item oversample
  2486. Set oversampling factor.
  2487. @end table
  2488. @subsection Commands
  2489. This filter supports the all above options as @ref{commands}.
  2490. @section aspectralstats
  2491. Display frequency domain statistical information about the audio channels.
  2492. Statistics are calculated and stored as metadata for each audio channel and for each audio frame.
  2493. It accepts the following option:
  2494. @table @option
  2495. @item win_size
  2496. Set the window length in samples. Default value is 2048.
  2497. Allowed range is from 32 to 65536.
  2498. @item win_func
  2499. Set window function.
  2500. It accepts the following values:
  2501. @table @samp
  2502. @item rect
  2503. @item bartlett
  2504. @item hann, hanning
  2505. @item hamming
  2506. @item blackman
  2507. @item welch
  2508. @item flattop
  2509. @item bharris
  2510. @item bnuttall
  2511. @item bhann
  2512. @item sine
  2513. @item nuttall
  2514. @item lanczos
  2515. @item gauss
  2516. @item tukey
  2517. @item dolph
  2518. @item cauchy
  2519. @item parzen
  2520. @item poisson
  2521. @item bohman
  2522. @item kaiser
  2523. @end table
  2524. Default is @code{hann}.
  2525. @item overlap
  2526. Set window overlap. Allowed range is from @code{0}
  2527. to @code{1}. Default value is @code{0.5}.
  2528. @item measure
  2529. Select the parameters which are measured. The metadata keys can
  2530. be used as flags, default is @option{all} which measures everything.
  2531. @option{none} disables all measurement.
  2532. @end table
  2533. A list of each metadata key follows:
  2534. @table @option
  2535. @item mean
  2536. @item variance
  2537. @item centroid
  2538. @item spread
  2539. @item skewness
  2540. @item kurtosis
  2541. @item entropy
  2542. @item flatness
  2543. @item crest
  2544. @item flux
  2545. @item slope
  2546. @item decrease
  2547. @item rolloff
  2548. @end table
  2549. @section asr
  2550. Automatic Speech Recognition
  2551. This filter uses PocketSphinx for speech recognition. To enable
  2552. compilation of this filter, you need to configure FFmpeg with
  2553. @code{--enable-pocketsphinx}.
  2554. It accepts the following options:
  2555. @table @option
  2556. @item rate
  2557. Set sampling rate of input audio. Defaults is @code{16000}.
  2558. This need to match speech models, otherwise one will get poor results.
  2559. @item hmm
  2560. Set dictionary containing acoustic model files.
  2561. @item dict
  2562. Set pronunciation dictionary.
  2563. @item lm
  2564. Set language model file.
  2565. @item lmctl
  2566. Set language model set.
  2567. @item lmname
  2568. Set which language model to use.
  2569. @item logfn
  2570. Set output for log messages.
  2571. @end table
  2572. The filter exports recognized speech as the frame metadata @code{lavfi.asr.text}.
  2573. @anchor{astats}
  2574. @section astats
  2575. Display time domain statistical information about the audio channels.
  2576. Statistics are calculated and displayed for each audio channel and,
  2577. where applicable, an overall figure is also given.
  2578. It accepts the following option:
  2579. @table @option
  2580. @item length
  2581. Short window length in seconds, used for peak and trough RMS measurement.
  2582. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0 - 10]}.
  2583. @item metadata
  2584. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  2585. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  2586. disabled.
  2587. Available keys for each channel are:
  2588. @var{Bit_depth}
  2589. @var{Crest_factor}
  2590. @var{DC_offset}
  2591. @var{Dynamic_range}
  2592. @var{Entropy}
  2593. @var{Flat_factor}
  2594. @var{Max_difference}
  2595. @var{Max_level}
  2596. @var{Mean_difference}
  2597. @var{Min_difference}
  2598. @var{Min_level}
  2599. @var{Noise_floor}
  2600. @var{Noise_floor_count}
  2601. @var{Number_of_Infs}
  2602. @var{Number_of_NaNs}
  2603. @var{Number_of_denormals}
  2604. @var{Peak_count}
  2605. @var{Abs_Peak_count}
  2606. @var{Peak_level}
  2607. @var{RMS_difference}
  2608. @var{RMS_peak}
  2609. @var{RMS_trough}
  2610. @var{Zero_crossings}
  2611. @var{Zero_crossings_rate}
  2612. and for @code{Overall}:
  2613. @var{Bit_depth}
  2614. @var{DC_offset}
  2615. @var{Entropy}
  2616. @var{Flat_factor}
  2617. @var{Max_difference}
  2618. @var{Max_level}
  2619. @var{Mean_difference}
  2620. @var{Min_difference}
  2621. @var{Min_level}
  2622. @var{Noise_floor}
  2623. @var{Noise_floor_count}
  2624. @var{Number_of_Infs}
  2625. @var{Number_of_NaNs}
  2626. @var{Number_of_denormals}
  2627. @var{Number_of_samples}
  2628. @var{Peak_count}
  2629. @var{Abs_Peak_count}
  2630. @var{Peak_level}
  2631. @var{RMS_difference}
  2632. @var{RMS_level}
  2633. @var{RMS_peak}
  2634. @var{RMS_trough}
  2635. For example, a full key looks like @code{lavfi.astats.1.DC_offset} or
  2636. @code{lavfi.astats.Overall.Peak_count}.
  2637. Read below for the description of the keys.
  2638. @item reset
  2639. Set the number of frames over which cumulative stats are calculated before
  2640. being reset. Default is disabled.
  2641. @item measure_perchannel
  2642. Select the parameters which are measured per channel. The metadata keys can
  2643. be used as flags, default is @option{all} which measures everything.
  2644. @option{none} disables all per channel measurement.
  2645. @item measure_overall
  2646. Select the parameters which are measured overall. The metadata keys can
  2647. be used as flags, default is @option{all} which measures everything.
  2648. @option{none} disables all overall measurement.
  2649. @end table
  2650. A description of the measure keys follow:
  2651. @table @option
  2652. @item none
  2653. no measures
  2654. @item all
  2655. all measures
  2656. @item Bit_depth
  2657. overall bit depth of audio, i.e. number of bits used for each sample
  2658. @item Crest_factor
  2659. standard ratio of peak to RMS level (note: not in dB)
  2660. @item DC_offset
  2661. mean amplitude displacement from zero
  2662. @item Dynamic_range
  2663. measured dynamic range of audio in dB
  2664. @item Entropy
  2665. entropy measured across whole audio, entropy of value near 1.0 is typically measured for white noise
  2666. @item Flat_factor
  2667. flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  2668. (i.e. either @var{Min_level} or @var{Max_level})
  2669. @item Max_difference
  2670. maximal difference between two consecutive samples
  2671. @item Max_level
  2672. maximal sample level
  2673. @item Mean_difference
  2674. mean difference between two consecutive samples, i.e. the average of each difference between two consecutive samples
  2675. @item Min_difference
  2676. minimal difference between two consecutive samples
  2677. @item Min_level
  2678. minimal sample level
  2679. @item Noise_floor
  2680. minimum local peak measured in dBFS over a short window
  2681. @item Noise_floor_count
  2682. number of occasions (not the number of samples) that the signal attained
  2683. @var{Noise floor}
  2684. @item Number_of_Infs
  2685. number of samples with an infinite value
  2686. @item Number_of_NaNs
  2687. number of samples with a NaN (not a number) value
  2688. @item Number_of_denormals
  2689. number of samples with a subnormal value
  2690. @item Number_of_samples
  2691. number of samples
  2692. @item Peak_count
  2693. number of occasions (not the number of samples) that the signal attained either
  2694. @var{Min_level} or @var{Max_level}
  2695. @item Abs_Peak_count
  2696. number of occasions that the absolute samples taken from the signal attained
  2697. max absolute value of @var{Min_level} and @var{Max_level}
  2698. @item Peak_level
  2699. standard peak level measured in dBFS
  2700. @item RMS_difference
  2701. Root Mean Square difference between two consecutive samples
  2702. @item RMS_level
  2703. standard RMS level measured in dBFS
  2704. @item RMS_peak
  2705. @item RMS_trough
  2706. peak and trough values for RMS level measured over a short window,
  2707. measured in dBFS.
  2708. @item Zero crossings
  2709. number of points where the waveform crosses the zero level axis
  2710. @item Zero crossings rate
  2711. rate of Zero crossings and number of audio samples
  2712. @end table
  2713. @section asubboost
  2714. Boost subwoofer frequencies.
  2715. The filter accepts the following options:
  2716. @table @option
  2717. @item dry
  2718. Set dry gain, how much of original signal is kept. Allowed range is from 0 to 1.
  2719. Default value is 1.0.
  2720. @item wet
  2721. Set wet gain, how much of filtered signal is kept. Allowed range is from 0 to 1.
  2722. Default value is 1.0.
  2723. @item boost
  2724. Set max boost factor. Allowed range is from 1 to 12. Default value is 2.
  2725. @item decay
  2726. Set delay line decay gain value. Allowed range is from 0 to 1.
  2727. Default value is 0.0.
  2728. @item feedback
  2729. Set delay line feedback gain value. Allowed range is from 0 to 1.
  2730. Default value is 0.9.
  2731. @item cutoff
  2732. Set cutoff frequency in Hertz. Allowed range is 50 to 900.
  2733. Default value is 100.
  2734. @item slope
  2735. Set slope amount for cutoff frequency. Allowed range is 0.0001 to 1.
  2736. Default value is 0.5.
  2737. @item delay
  2738. Set delay. Allowed range is from 1 to 100.
  2739. Default value is 20.
  2740. @item channels
  2741. Set the channels to process. Default value is all available.
  2742. @end table
  2743. @subsection Commands
  2744. This filter supports the all above options as @ref{commands}.
  2745. @section asubcut
  2746. Cut subwoofer frequencies.
  2747. This filter allows to set custom, steeper
  2748. roll off than highpass filter, and thus is able to more attenuate
  2749. frequency content in stop-band.
  2750. The filter accepts the following options:
  2751. @table @option
  2752. @item cutoff
  2753. Set cutoff frequency in Hertz. Allowed range is 2 to 200.
  2754. Default value is 20.
  2755. @item order
  2756. Set filter order. Available values are from 3 to 20.
  2757. Default value is 10.
  2758. @item level
  2759. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2760. @end table
  2761. @subsection Commands
  2762. This filter supports the all above options as @ref{commands}.
  2763. @section asupercut
  2764. Cut super frequencies.
  2765. The filter accepts the following options:
  2766. @table @option
  2767. @item cutoff
  2768. Set cutoff frequency in Hertz. Allowed range is 20000 to 192000.
  2769. Default value is 20000.
  2770. @item order
  2771. Set filter order. Available values are from 3 to 20.
  2772. Default value is 10.
  2773. @item level
  2774. Set input gain level. Allowed range is from 0 to 1. Default value is 1.
  2775. @end table
  2776. @subsection Commands
  2777. This filter supports the all above options as @ref{commands}.
  2778. @section asuperpass
  2779. Apply high order Butterworth band-pass filter.
  2780. The filter accepts the following options:
  2781. @table @option
  2782. @item centerf
  2783. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2784. Default value is 1000.
  2785. @item order
  2786. Set filter order. Available values are from 4 to 20.
  2787. Default value is 4.
  2788. @item qfactor
  2789. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2790. @item level
  2791. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2792. @end table
  2793. @subsection Commands
  2794. This filter supports the all above options as @ref{commands}.
  2795. @section asuperstop
  2796. Apply high order Butterworth band-stop filter.
  2797. The filter accepts the following options:
  2798. @table @option
  2799. @item centerf
  2800. Set center frequency in Hertz. Allowed range is 2 to 999999.
  2801. Default value is 1000.
  2802. @item order
  2803. Set filter order. Available values are from 4 to 20.
  2804. Default value is 4.
  2805. @item qfactor
  2806. Set Q-factor. Allowed range is from 0.01 to 100. Default value is 1.
  2807. @item level
  2808. Set input gain level. Allowed range is from 0 to 2. Default value is 1.
  2809. @end table
  2810. @subsection Commands
  2811. This filter supports the all above options as @ref{commands}.
  2812. @section atempo
  2813. Adjust audio tempo.
  2814. The filter accepts exactly one parameter, the audio tempo. If not
  2815. specified then the filter will assume nominal 1.0 tempo. Tempo must
  2816. be in the [0.5, 100.0] range.
  2817. Note that tempo greater than 2 will skip some samples rather than
  2818. blend them in. If for any reason this is a concern it is always
  2819. possible to daisy-chain several instances of atempo to achieve the
  2820. desired product tempo.
  2821. @subsection Examples
  2822. @itemize
  2823. @item
  2824. Slow down audio to 80% tempo:
  2825. @example
  2826. atempo=0.8
  2827. @end example
  2828. @item
  2829. To speed up audio to 300% tempo:
  2830. @example
  2831. atempo=3
  2832. @end example
  2833. @item
  2834. To speed up audio to 300% tempo by daisy-chaining two atempo instances:
  2835. @example
  2836. atempo=sqrt(3),atempo=sqrt(3)
  2837. @end example
  2838. @end itemize
  2839. @subsection Commands
  2840. This filter supports the following commands:
  2841. @table @option
  2842. @item tempo
  2843. Change filter tempo scale factor.
  2844. Syntax for the command is : "@var{tempo}"
  2845. @end table
  2846. @section atilt
  2847. Apply spectral tilt filter to audio stream.
  2848. This filter apply any spectral roll-off slope over any specified frequency band.
  2849. The filter accepts the following options:
  2850. @table @option
  2851. @item freq
  2852. Set central frequency of tilt in Hz. Default is 10000 Hz.
  2853. @item slope
  2854. Set slope direction of tilt. Default is 0. Allowed range is from -1 to 1.
  2855. @item width
  2856. Set width of tilt. Default is 1000. Allowed range is from 100 to 10000.
  2857. @item order
  2858. Set order of tilt filter.
  2859. @item level
  2860. Set input volume level. Allowed range is from 0 to 4.
  2861. Default is 1.
  2862. @end table
  2863. @subsection Commands
  2864. This filter supports the all above options as @ref{commands}.
  2865. @section atrim
  2866. Trim the input so that the output contains one continuous subpart of the input.
  2867. It accepts the following parameters:
  2868. @table @option
  2869. @item start
  2870. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  2871. sample with the timestamp @var{start} will be the first sample in the output.
  2872. @item end
  2873. Specify time of the first audio sample that will be dropped, i.e. the
  2874. audio sample immediately preceding the one with the timestamp @var{end} will be
  2875. the last sample in the output.
  2876. @item start_pts
  2877. Same as @var{start}, except this option sets the start timestamp in samples
  2878. instead of seconds.
  2879. @item end_pts
  2880. Same as @var{end}, except this option sets the end timestamp in samples instead
  2881. of seconds.
  2882. @item duration
  2883. The maximum duration of the output in seconds.
  2884. @item start_sample
  2885. The number of the first sample that should be output.
  2886. @item end_sample
  2887. The number of the first sample that should be dropped.
  2888. @end table
  2889. @option{start}, @option{end}, and @option{duration} are expressed as time
  2890. duration specifications; see
  2891. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  2892. Note that the first two sets of the start/end options and the @option{duration}
  2893. option look at the frame timestamp, while the _sample options simply count the
  2894. samples that pass through the filter. So start/end_pts and start/end_sample will
  2895. give different results when the timestamps are wrong, inexact or do not start at
  2896. zero. Also note that this filter does not modify the timestamps. If you wish
  2897. to have the output timestamps start at zero, insert the asetpts filter after the
  2898. atrim filter.
  2899. If multiple start or end options are set, this filter tries to be greedy and
  2900. keep all samples that match at least one of the specified constraints. To keep
  2901. only the part that matches all the constraints at once, chain multiple atrim
  2902. filters.
  2903. The defaults are such that all the input is kept. So it is possible to set e.g.
  2904. just the end values to keep everything before the specified time.
  2905. Examples:
  2906. @itemize
  2907. @item
  2908. Drop everything except the second minute of input:
  2909. @example
  2910. ffmpeg -i INPUT -af atrim=60:120
  2911. @end example
  2912. @item
  2913. Keep only the first 1000 samples:
  2914. @example
  2915. ffmpeg -i INPUT -af atrim=end_sample=1000
  2916. @end example
  2917. @end itemize
  2918. @section axcorrelate
  2919. Calculate normalized windowed cross-correlation between two input audio streams.
  2920. Resulted samples are always between -1 and 1 inclusive.
  2921. If result is 1 it means two input samples are highly correlated in that selected segment.
  2922. Result 0 means they are not correlated at all.
  2923. If result is -1 it means two input samples are out of phase, which means they cancel each
  2924. other.
  2925. The filter accepts the following options:
  2926. @table @option
  2927. @item size
  2928. Set size of segment over which cross-correlation is calculated.
  2929. Default is 256. Allowed range is from 2 to 131072.
  2930. @item algo
  2931. Set algorithm for cross-correlation. Can be @code{slow} or @code{fast} or @code{best}.
  2932. Default is @code{best}. Fast algorithm assumes mean values over any given segment
  2933. are always zero and thus need much less calculations to make.
  2934. This is generally not true, but is valid for typical audio streams.
  2935. @end table
  2936. @subsection Examples
  2937. @itemize
  2938. @item
  2939. Calculate correlation between channels in stereo audio stream:
  2940. @example
  2941. ffmpeg -i stereo.wav -af channelsplit,axcorrelate=size=1024:algo=fast correlation.wav
  2942. @end example
  2943. @end itemize
  2944. @section bandpass
  2945. Apply a two-pole Butterworth band-pass filter with central
  2946. frequency @var{frequency}, and (3dB-point) band-width width.
  2947. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  2948. instead of the default: constant 0dB peak gain.
  2949. The filter roll off at 6dB per octave (20dB per decade).
  2950. The filter accepts the following options:
  2951. @table @option
  2952. @item frequency, f
  2953. Set the filter's central frequency. Default is @code{3000}.
  2954. @item csg
  2955. Constant skirt gain if set to 1. Defaults to 0.
  2956. @item width_type, t
  2957. Set method to specify band-width of filter.
  2958. @table @option
  2959. @item h
  2960. Hz
  2961. @item q
  2962. Q-Factor
  2963. @item o
  2964. octave
  2965. @item s
  2966. slope
  2967. @item k
  2968. kHz
  2969. @end table
  2970. @item width, w
  2971. Specify the band-width of a filter in width_type units.
  2972. @item mix, m
  2973. How much to use filtered signal in output. Default is 1.
  2974. Range is between 0 and 1.
  2975. @item channels, c
  2976. Specify which channels to filter, by default all available are filtered.
  2977. @item normalize, n
  2978. Normalize biquad coefficients, by default is disabled.
  2979. Enabling it will normalize magnitude response at DC to 0dB.
  2980. @item transform, a
  2981. Set transform type of IIR filter.
  2982. @table @option
  2983. @item di
  2984. @item dii
  2985. @item tdi
  2986. @item tdii
  2987. @item latt
  2988. @item svf
  2989. @item zdf
  2990. @end table
  2991. @item precision, r
  2992. Set precision of filtering.
  2993. @table @option
  2994. @item auto
  2995. Pick automatic sample format depending on surround filters.
  2996. @item s16
  2997. Always use signed 16-bit.
  2998. @item s32
  2999. Always use signed 32-bit.
  3000. @item f32
  3001. Always use float 32-bit.
  3002. @item f64
  3003. Always use float 64-bit.
  3004. @end table
  3005. @item block_size, b
  3006. Set block size used for reverse IIR processing. If this value is set to high enough
  3007. value (higher than impulse response length truncated when reaches near zero values) filtering
  3008. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3009. Note that filter delay will be exactly this many samples when set to non-zero value.
  3010. @end table
  3011. @subsection Commands
  3012. This filter supports the following commands:
  3013. @table @option
  3014. @item frequency, f
  3015. Change bandpass frequency.
  3016. Syntax for the command is : "@var{frequency}"
  3017. @item width_type, t
  3018. Change bandpass width_type.
  3019. Syntax for the command is : "@var{width_type}"
  3020. @item width, w
  3021. Change bandpass width.
  3022. Syntax for the command is : "@var{width}"
  3023. @item mix, m
  3024. Change bandpass mix.
  3025. Syntax for the command is : "@var{mix}"
  3026. @end table
  3027. @section bandreject
  3028. Apply a two-pole Butterworth band-reject filter with central
  3029. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  3030. The filter roll off at 6dB per octave (20dB per decade).
  3031. The filter accepts the following options:
  3032. @table @option
  3033. @item frequency, f
  3034. Set the filter's central frequency. Default is @code{3000}.
  3035. @item width_type, t
  3036. Set method to specify band-width of filter.
  3037. @table @option
  3038. @item h
  3039. Hz
  3040. @item q
  3041. Q-Factor
  3042. @item o
  3043. octave
  3044. @item s
  3045. slope
  3046. @item k
  3047. kHz
  3048. @end table
  3049. @item width, w
  3050. Specify the band-width of a filter in width_type units.
  3051. @item mix, m
  3052. How much to use filtered signal in output. Default is 1.
  3053. Range is between 0 and 1.
  3054. @item channels, c
  3055. Specify which channels to filter, by default all available are filtered.
  3056. @item normalize, n
  3057. Normalize biquad coefficients, by default is disabled.
  3058. Enabling it will normalize magnitude response at DC to 0dB.
  3059. @item transform, a
  3060. Set transform type of IIR filter.
  3061. @table @option
  3062. @item di
  3063. @item dii
  3064. @item tdi
  3065. @item tdii
  3066. @item latt
  3067. @item svf
  3068. @item zdf
  3069. @end table
  3070. @item precision, r
  3071. Set precision of filtering.
  3072. @table @option
  3073. @item auto
  3074. Pick automatic sample format depending on surround filters.
  3075. @item s16
  3076. Always use signed 16-bit.
  3077. @item s32
  3078. Always use signed 32-bit.
  3079. @item f32
  3080. Always use float 32-bit.
  3081. @item f64
  3082. Always use float 64-bit.
  3083. @end table
  3084. @item block_size, b
  3085. Set block size used for reverse IIR processing. If this value is set to high enough
  3086. value (higher than impulse response length truncated when reaches near zero values) filtering
  3087. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3088. Note that filter delay will be exactly this many samples when set to non-zero value.
  3089. @end table
  3090. @subsection Commands
  3091. This filter supports the following commands:
  3092. @table @option
  3093. @item frequency, f
  3094. Change bandreject frequency.
  3095. Syntax for the command is : "@var{frequency}"
  3096. @item width_type, t
  3097. Change bandreject width_type.
  3098. Syntax for the command is : "@var{width_type}"
  3099. @item width, w
  3100. Change bandreject width.
  3101. Syntax for the command is : "@var{width}"
  3102. @item mix, m
  3103. Change bandreject mix.
  3104. Syntax for the command is : "@var{mix}"
  3105. @end table
  3106. @section bass, lowshelf
  3107. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  3108. shelving filter with a response similar to that of a standard
  3109. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3110. The filter accepts the following options:
  3111. @table @option
  3112. @item gain, g
  3113. Give the gain at 0 Hz. Its useful range is about -20
  3114. (for a large cut) to +20 (for a large boost).
  3115. Beware of clipping when using a positive gain.
  3116. @item frequency, f
  3117. Set the filter's central frequency and so can be used
  3118. to extend or reduce the frequency range to be boosted or cut.
  3119. The default value is @code{100} Hz.
  3120. @item width_type, t
  3121. Set method to specify band-width of filter.
  3122. @table @option
  3123. @item h
  3124. Hz
  3125. @item q
  3126. Q-Factor
  3127. @item o
  3128. octave
  3129. @item s
  3130. slope
  3131. @item k
  3132. kHz
  3133. @end table
  3134. @item width, w
  3135. Determine how steep is the filter's shelf transition.
  3136. @item poles, p
  3137. Set number of poles. Default is 2.
  3138. @item mix, m
  3139. How much to use filtered signal in output. Default is 1.
  3140. Range is between 0 and 1.
  3141. @item channels, c
  3142. Specify which channels to filter, by default all available are filtered.
  3143. @item normalize, n
  3144. Normalize biquad coefficients, by default is disabled.
  3145. Enabling it will normalize magnitude response at DC to 0dB.
  3146. @item transform, a
  3147. Set transform type of IIR filter.
  3148. @table @option
  3149. @item di
  3150. @item dii
  3151. @item tdi
  3152. @item tdii
  3153. @item latt
  3154. @item svf
  3155. @item zdf
  3156. @end table
  3157. @item precision, r
  3158. Set precision of filtering.
  3159. @table @option
  3160. @item auto
  3161. Pick automatic sample format depending on surround filters.
  3162. @item s16
  3163. Always use signed 16-bit.
  3164. @item s32
  3165. Always use signed 32-bit.
  3166. @item f32
  3167. Always use float 32-bit.
  3168. @item f64
  3169. Always use float 64-bit.
  3170. @end table
  3171. @item block_size, b
  3172. Set block size used for reverse IIR processing. If this value is set to high enough
  3173. value (higher than impulse response length truncated when reaches near zero values) filtering
  3174. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3175. Note that filter delay will be exactly this many samples when set to non-zero value.
  3176. @end table
  3177. @subsection Commands
  3178. This filter supports the following commands:
  3179. @table @option
  3180. @item frequency, f
  3181. Change bass frequency.
  3182. Syntax for the command is : "@var{frequency}"
  3183. @item width_type, t
  3184. Change bass width_type.
  3185. Syntax for the command is : "@var{width_type}"
  3186. @item width, w
  3187. Change bass width.
  3188. Syntax for the command is : "@var{width}"
  3189. @item gain, g
  3190. Change bass gain.
  3191. Syntax for the command is : "@var{gain}"
  3192. @item mix, m
  3193. Change bass mix.
  3194. Syntax for the command is : "@var{mix}"
  3195. @end table
  3196. @section biquad
  3197. Apply a biquad IIR filter with the given coefficients.
  3198. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  3199. are the numerator and denominator coefficients respectively.
  3200. and @var{channels}, @var{c} specify which channels to filter, by default all
  3201. available are filtered.
  3202. @subsection Commands
  3203. This filter supports the following commands:
  3204. @table @option
  3205. @item a0
  3206. @item a1
  3207. @item a2
  3208. @item b0
  3209. @item b1
  3210. @item b2
  3211. Change biquad parameter.
  3212. Syntax for the command is : "@var{value}"
  3213. @item mix, m
  3214. How much to use filtered signal in output. Default is 1.
  3215. Range is between 0 and 1.
  3216. @item channels, c
  3217. Specify which channels to filter, by default all available are filtered.
  3218. @item normalize, n
  3219. Normalize biquad coefficients, by default is disabled.
  3220. Enabling it will normalize magnitude response at DC to 0dB.
  3221. @item transform, a
  3222. Set transform type of IIR filter.
  3223. @table @option
  3224. @item di
  3225. @item dii
  3226. @item tdi
  3227. @item tdii
  3228. @item latt
  3229. @item svf
  3230. @item zdf
  3231. @end table
  3232. @item precision, r
  3233. Set precision of filtering.
  3234. @table @option
  3235. @item auto
  3236. Pick automatic sample format depending on surround filters.
  3237. @item s16
  3238. Always use signed 16-bit.
  3239. @item s32
  3240. Always use signed 32-bit.
  3241. @item f32
  3242. Always use float 32-bit.
  3243. @item f64
  3244. Always use float 64-bit.
  3245. @end table
  3246. @item block_size, b
  3247. Set block size used for reverse IIR processing. If this value is set to high enough
  3248. value (higher than impulse response length truncated when reaches near zero values) filtering
  3249. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3250. Note that filter delay will be exactly this many samples when set to non-zero value.
  3251. @end table
  3252. @section bs2b
  3253. Bauer stereo to binaural transformation, which improves headphone listening of
  3254. stereo audio records.
  3255. To enable compilation of this filter you need to configure FFmpeg with
  3256. @code{--enable-libbs2b}.
  3257. It accepts the following parameters:
  3258. @table @option
  3259. @item profile
  3260. Pre-defined crossfeed level.
  3261. @table @option
  3262. @item default
  3263. Default level (fcut=700, feed=50).
  3264. @item cmoy
  3265. Chu Moy circuit (fcut=700, feed=60).
  3266. @item jmeier
  3267. Jan Meier circuit (fcut=650, feed=95).
  3268. @end table
  3269. @item fcut
  3270. Cut frequency (in Hz).
  3271. @item feed
  3272. Feed level (in Hz).
  3273. @end table
  3274. @section channelmap
  3275. Remap input channels to new locations.
  3276. It accepts the following parameters:
  3277. @table @option
  3278. @item map
  3279. Map channels from input to output. The argument is a '|'-separated list of
  3280. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  3281. @code{@var{in_channel}} form. @var{in_channel} can be either the name of the
  3282. input channel (e.g. FL for front left) or its index in the input channel
  3283. layout. @var{out_channel} is the name of the output channel or its index in the
  3284. output channel layout. If @var{out_channel} is not given then it is implicitly
  3285. an index, starting with zero and increasing by one for each mapping. Mixing
  3286. different types of mappings is not allowed and will result in a parse error.
  3287. @item channel_layout
  3288. The channel layout of the output stream. If not specified, then filter will
  3289. guess it based on the @var{out_channel} names or the number of mappings.
  3290. Guessed layouts will not necessarily contain channels in the order of the
  3291. mappings.
  3292. @end table
  3293. If no mapping is present, the filter will implicitly map input channels to
  3294. output channels, preserving indices.
  3295. @subsection Examples
  3296. @itemize
  3297. @item
  3298. For example, assuming a 5.1+downmix input MOV file,
  3299. @example
  3300. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  3301. @end example
  3302. will create an output WAV file tagged as stereo from the downmix channels of
  3303. the input.
  3304. @item
  3305. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  3306. @example
  3307. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  3308. @end example
  3309. @end itemize
  3310. @section channelsplit
  3311. Split each channel from an input audio stream into a separate output stream.
  3312. It accepts the following parameters:
  3313. @table @option
  3314. @item channel_layout
  3315. The channel layout of the input stream. The default is "stereo".
  3316. @item channels
  3317. A channel layout describing the channels to be extracted as separate output streams
  3318. or "all" to extract each input channel as a separate stream. The default is "all".
  3319. Choosing channels not present in channel layout in the input will result in an error.
  3320. @end table
  3321. @subsection Examples
  3322. @itemize
  3323. @item
  3324. For example, assuming a stereo input MP3 file,
  3325. @example
  3326. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  3327. @end example
  3328. will create an output Matroska file with two audio streams, one containing only
  3329. the left channel and the other the right channel.
  3330. @item
  3331. Split a 5.1 WAV file into per-channel files:
  3332. @example
  3333. ffmpeg -i in.wav -filter_complex
  3334. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  3335. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  3336. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  3337. side_right.wav
  3338. @end example
  3339. @item
  3340. Extract only LFE from a 5.1 WAV file:
  3341. @example
  3342. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  3343. -map '[LFE]' lfe.wav
  3344. @end example
  3345. @end itemize
  3346. @section chorus
  3347. Add a chorus effect to the audio.
  3348. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  3349. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  3350. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  3351. The modulation depth defines the range the modulated delay is played before or after
  3352. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  3353. sound tuned around the original one, like in a chorus where some vocals are slightly
  3354. off key.
  3355. It accepts the following parameters:
  3356. @table @option
  3357. @item in_gain
  3358. Set input gain. Default is 0.4.
  3359. @item out_gain
  3360. Set output gain. Default is 0.4.
  3361. @item delays
  3362. Set delays. A typical delay is around 40ms to 60ms.
  3363. @item decays
  3364. Set decays.
  3365. @item speeds
  3366. Set speeds.
  3367. @item depths
  3368. Set depths.
  3369. @end table
  3370. @subsection Examples
  3371. @itemize
  3372. @item
  3373. A single delay:
  3374. @example
  3375. chorus=0.7:0.9:55:0.4:0.25:2
  3376. @end example
  3377. @item
  3378. Two delays:
  3379. @example
  3380. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  3381. @end example
  3382. @item
  3383. Fuller sounding chorus with three delays:
  3384. @example
  3385. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  3386. @end example
  3387. @end itemize
  3388. @section compand
  3389. Compress or expand the audio's dynamic range.
  3390. It accepts the following parameters:
  3391. @table @option
  3392. @item attacks
  3393. @item decays
  3394. A list of times in seconds for each channel over which the instantaneous level
  3395. of the input signal is averaged to determine its volume. @var{attacks} refers to
  3396. increase of volume and @var{decays} refers to decrease of volume. For most
  3397. situations, the attack time (response to the audio getting louder) should be
  3398. shorter than the decay time, because the human ear is more sensitive to sudden
  3399. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  3400. a typical value for decay is 0.8 seconds.
  3401. If specified number of attacks & decays is lower than number of channels, the last
  3402. set attack/decay will be used for all remaining channels.
  3403. @item points
  3404. A list of points for the transfer function, specified in dB relative to the
  3405. maximum possible signal amplitude. Each key points list must be defined using
  3406. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  3407. @code{x0/y0 x1/y1 x2/y2 ....}
  3408. The input values must be in strictly increasing order but the transfer function
  3409. does not have to be monotonically rising. The point @code{0/0} is assumed but
  3410. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  3411. function are @code{-70/-70|-60/-20|1/0}.
  3412. @item soft-knee
  3413. Set the curve radius in dB for all joints. It defaults to 0.01.
  3414. @item gain
  3415. Set the additional gain in dB to be applied at all points on the transfer
  3416. function. This allows for easy adjustment of the overall gain.
  3417. It defaults to 0.
  3418. @item volume
  3419. Set an initial volume, in dB, to be assumed for each channel when filtering
  3420. starts. This permits the user to supply a nominal level initially, so that, for
  3421. example, a very large gain is not applied to initial signal levels before the
  3422. companding has begun to operate. A typical value for audio which is initially
  3423. quiet is -90 dB. It defaults to 0.
  3424. @item delay
  3425. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  3426. delayed before being fed to the volume adjuster. Specifying a delay
  3427. approximately equal to the attack/decay times allows the filter to effectively
  3428. operate in predictive rather than reactive mode. It defaults to 0.
  3429. @end table
  3430. @subsection Examples
  3431. @itemize
  3432. @item
  3433. Make music with both quiet and loud passages suitable for listening to in a
  3434. noisy environment:
  3435. @example
  3436. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  3437. @end example
  3438. Another example for audio with whisper and explosion parts:
  3439. @example
  3440. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  3441. @end example
  3442. @item
  3443. A noise gate for when the noise is at a lower level than the signal:
  3444. @example
  3445. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  3446. @end example
  3447. @item
  3448. Here is another noise gate, this time for when the noise is at a higher level
  3449. than the signal (making it, in some ways, similar to squelch):
  3450. @example
  3451. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  3452. @end example
  3453. @item
  3454. 2:1 compression starting at -6dB:
  3455. @example
  3456. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  3457. @end example
  3458. @item
  3459. 2:1 compression starting at -9dB:
  3460. @example
  3461. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  3462. @end example
  3463. @item
  3464. 2:1 compression starting at -12dB:
  3465. @example
  3466. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  3467. @end example
  3468. @item
  3469. 2:1 compression starting at -18dB:
  3470. @example
  3471. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  3472. @end example
  3473. @item
  3474. 3:1 compression starting at -15dB:
  3475. @example
  3476. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  3477. @end example
  3478. @item
  3479. Compressor/Gate:
  3480. @example
  3481. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  3482. @end example
  3483. @item
  3484. Expander:
  3485. @example
  3486. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  3487. @end example
  3488. @item
  3489. Hard limiter at -6dB:
  3490. @example
  3491. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  3492. @end example
  3493. @item
  3494. Hard limiter at -12dB:
  3495. @example
  3496. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  3497. @end example
  3498. @item
  3499. Hard noise gate at -35 dB:
  3500. @example
  3501. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  3502. @end example
  3503. @item
  3504. Soft limiter:
  3505. @example
  3506. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  3507. @end example
  3508. @end itemize
  3509. @section compensationdelay
  3510. Compensation Delay Line is a metric based delay to compensate differing
  3511. positions of microphones or speakers.
  3512. For example, you have recorded guitar with two microphones placed in
  3513. different locations. Because the front of sound wave has fixed speed in
  3514. normal conditions, the phasing of microphones can vary and depends on
  3515. their location and interposition. The best sound mix can be achieved when
  3516. these microphones are in phase (synchronized). Note that a distance of
  3517. ~30 cm between microphones makes one microphone capture the signal in
  3518. antiphase to the other microphone. That makes the final mix sound moody.
  3519. This filter helps to solve phasing problems by adding different delays
  3520. to each microphone track and make them synchronized.
  3521. The best result can be reached when you take one track as base and
  3522. synchronize other tracks one by one with it.
  3523. Remember that synchronization/delay tolerance depends on sample rate, too.
  3524. Higher sample rates will give more tolerance.
  3525. The filter accepts the following parameters:
  3526. @table @option
  3527. @item mm
  3528. Set millimeters distance. This is compensation distance for fine tuning.
  3529. Default is 0.
  3530. @item cm
  3531. Set cm distance. This is compensation distance for tightening distance setup.
  3532. Default is 0.
  3533. @item m
  3534. Set meters distance. This is compensation distance for hard distance setup.
  3535. Default is 0.
  3536. @item dry
  3537. Set dry amount. Amount of unprocessed (dry) signal.
  3538. Default is 0.
  3539. @item wet
  3540. Set wet amount. Amount of processed (wet) signal.
  3541. Default is 1.
  3542. @item temp
  3543. Set temperature in degrees Celsius. This is the temperature of the environment.
  3544. Default is 20.
  3545. @end table
  3546. @subsection Commands
  3547. This filter supports the all above options as @ref{commands}.
  3548. @section crossfeed
  3549. Apply headphone crossfeed filter.
  3550. Crossfeed is the process of blending the left and right channels of stereo
  3551. audio recording.
  3552. It is mainly used to reduce extreme stereo separation of low frequencies.
  3553. The intent is to produce more speaker like sound to the listener.
  3554. The filter accepts the following options:
  3555. @table @option
  3556. @item strength
  3557. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  3558. This sets gain of low shelf filter for side part of stereo image.
  3559. Default is -6dB. Max allowed is -30db when strength is set to 1.
  3560. @item range
  3561. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  3562. This sets cut off frequency of low shelf filter. Default is cut off near
  3563. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  3564. @item slope
  3565. Set curve slope of low shelf filter. Default is 0.5.
  3566. Allowed range is from 0.01 to 1.
  3567. @item level_in
  3568. Set input gain. Default is 0.9.
  3569. @item level_out
  3570. Set output gain. Default is 1.
  3571. @item block_size
  3572. Set block size used for reverse IIR processing. If this value is set to high enough
  3573. value (higher than impulse response length truncated when reaches near zero values) filtering
  3574. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3575. Note that filter delay will be exactly this many samples when set to non-zero value.
  3576. @end table
  3577. @subsection Commands
  3578. This filter supports the all above options as @ref{commands}.
  3579. @section crystalizer
  3580. Simple algorithm for audio noise sharpening.
  3581. This filter linearly increases differences between each audio sample.
  3582. The filter accepts the following options:
  3583. @table @option
  3584. @item i
  3585. Sets the intensity of effect (default: 2.0). Must be in range between -10.0 to 0
  3586. (unchanged sound) to 10.0 (maximum effect).
  3587. To inverse filtering use negative value.
  3588. @item c
  3589. Enable clipping. By default is enabled.
  3590. @end table
  3591. @subsection Commands
  3592. This filter supports the all above options as @ref{commands}.
  3593. @section dcshift
  3594. Apply a DC shift to the audio.
  3595. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  3596. in the recording chain) from the audio. The effect of a DC offset is reduced
  3597. headroom and hence volume. The @ref{astats} filter can be used to determine if
  3598. a signal has a DC offset.
  3599. @table @option
  3600. @item shift
  3601. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  3602. the audio.
  3603. @item limitergain
  3604. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  3605. used to prevent clipping.
  3606. @end table
  3607. @section deesser
  3608. Apply de-essing to the audio samples.
  3609. @table @option
  3610. @item i
  3611. Set intensity for triggering de-essing. Allowed range is from 0 to 1.
  3612. Default is 0.
  3613. @item m
  3614. Set amount of ducking on treble part of sound. Allowed range is from 0 to 1.
  3615. Default is 0.5.
  3616. @item f
  3617. How much of original frequency content to keep when de-essing. Allowed range is from 0 to 1.
  3618. Default is 0.5.
  3619. @item s
  3620. Set the output mode.
  3621. It accepts the following values:
  3622. @table @option
  3623. @item i
  3624. Pass input unchanged.
  3625. @item o
  3626. Pass ess filtered out.
  3627. @item e
  3628. Pass only ess.
  3629. Default value is @var{o}.
  3630. @end table
  3631. @end table
  3632. @section dialoguenhance
  3633. Enhance dialogue in stereo audio.
  3634. This filter accepts stereo input and produce surround (3.0) channels output.
  3635. The newly produced front center channel have enhanced speech dialogue originally
  3636. available in both stereo channels.
  3637. This filter outputs front left and front right channels same as available in stereo input.
  3638. The filter accepts the following options:
  3639. @table @option
  3640. @item original
  3641. Set the original center factor to keep in front center channel output.
  3642. Allowed range is from 0 to 1. Default value is 1.
  3643. @item enhance
  3644. Set the dialogue enhance factor to put in front center channel output.
  3645. Allowed range is from 0 to 3. Default value is 1.
  3646. @item voice
  3647. Set the voice detection factor.
  3648. Allowed range is from 2 to 32. Default value is 2.
  3649. @end table
  3650. @subsection Commands
  3651. This filter supports the all above options as @ref{commands}.
  3652. @section drmeter
  3653. Measure audio dynamic range.
  3654. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  3655. is found in transition material. And anything less that 8 have very poor dynamics
  3656. and is very compressed.
  3657. The filter accepts the following options:
  3658. @table @option
  3659. @item length
  3660. Set window length in seconds used to split audio into segments of equal length.
  3661. Default is 3 seconds.
  3662. @end table
  3663. @section dynaudnorm
  3664. Dynamic Audio Normalizer.
  3665. This filter applies a certain amount of gain to the input audio in order
  3666. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  3667. contrast to more "simple" normalization algorithms, the Dynamic Audio
  3668. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  3669. This allows for applying extra gain to the "quiet" sections of the audio
  3670. while avoiding distortions or clipping the "loud" sections. In other words:
  3671. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  3672. sections, in the sense that the volume of each section is brought to the
  3673. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  3674. this goal *without* applying "dynamic range compressing". It will retain 100%
  3675. of the dynamic range *within* each section of the audio file.
  3676. @table @option
  3677. @item framelen, f
  3678. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  3679. Default is 500 milliseconds.
  3680. The Dynamic Audio Normalizer processes the input audio in small chunks,
  3681. referred to as frames. This is required, because a peak magnitude has no
  3682. meaning for just a single sample value. Instead, we need to determine the
  3683. peak magnitude for a contiguous sequence of sample values. While a "standard"
  3684. normalizer would simply use the peak magnitude of the complete file, the
  3685. Dynamic Audio Normalizer determines the peak magnitude individually for each
  3686. frame. The length of a frame is specified in milliseconds. By default, the
  3687. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  3688. been found to give good results with most files.
  3689. Note that the exact frame length, in number of samples, will be determined
  3690. automatically, based on the sampling rate of the individual input audio file.
  3691. @item gausssize, g
  3692. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  3693. number. Default is 31.
  3694. Probably the most important parameter of the Dynamic Audio Normalizer is the
  3695. @code{window size} of the Gaussian smoothing filter. The filter's window size
  3696. is specified in frames, centered around the current frame. For the sake of
  3697. simplicity, this must be an odd number. Consequently, the default value of 31
  3698. takes into account the current frame, as well as the 15 preceding frames and
  3699. the 15 subsequent frames. Using a larger window results in a stronger
  3700. smoothing effect and thus in less gain variation, i.e. slower gain
  3701. adaptation. Conversely, using a smaller window results in a weaker smoothing
  3702. effect and thus in more gain variation, i.e. faster gain adaptation.
  3703. In other words, the more you increase this value, the more the Dynamic Audio
  3704. Normalizer will behave like a "traditional" normalization filter. On the
  3705. contrary, the more you decrease this value, the more the Dynamic Audio
  3706. Normalizer will behave like a dynamic range compressor.
  3707. @item peak, p
  3708. Set the target peak value. This specifies the highest permissible magnitude
  3709. level for the normalized audio input. This filter will try to approach the
  3710. target peak magnitude as closely as possible, but at the same time it also
  3711. makes sure that the normalized signal will never exceed the peak magnitude.
  3712. A frame's maximum local gain factor is imposed directly by the target peak
  3713. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  3714. It is not recommended to go above this value.
  3715. @item maxgain, m
  3716. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  3717. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  3718. factor for each input frame, i.e. the maximum gain factor that does not
  3719. result in clipping or distortion. The maximum gain factor is determined by
  3720. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  3721. additionally bounds the frame's maximum gain factor by a predetermined
  3722. (global) maximum gain factor. This is done in order to avoid excessive gain
  3723. factors in "silent" or almost silent frames. By default, the maximum gain
  3724. factor is 10.0, For most inputs the default value should be sufficient and
  3725. it usually is not recommended to increase this value. Though, for input
  3726. with an extremely low overall volume level, it may be necessary to allow even
  3727. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  3728. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  3729. Instead, a "sigmoid" threshold function will be applied. This way, the
  3730. gain factors will smoothly approach the threshold value, but never exceed that
  3731. value.
  3732. @item targetrms, r
  3733. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  3734. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  3735. This means that the maximum local gain factor for each frame is defined
  3736. (only) by the frame's highest magnitude sample. This way, the samples can
  3737. be amplified as much as possible without exceeding the maximum signal
  3738. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  3739. Normalizer can also take into account the frame's root mean square,
  3740. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  3741. determine the power of a time-varying signal. It is therefore considered
  3742. that the RMS is a better approximation of the "perceived loudness" than
  3743. just looking at the signal's peak magnitude. Consequently, by adjusting all
  3744. frames to a constant RMS value, a uniform "perceived loudness" can be
  3745. established. If a target RMS value has been specified, a frame's local gain
  3746. factor is defined as the factor that would result in exactly that RMS value.
  3747. Note, however, that the maximum local gain factor is still restricted by the
  3748. frame's highest magnitude sample, in order to prevent clipping.
  3749. @item coupling, n
  3750. Enable channels coupling. By default is enabled.
  3751. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  3752. amount. This means the same gain factor will be applied to all channels, i.e.
  3753. the maximum possible gain factor is determined by the "loudest" channel.
  3754. However, in some recordings, it may happen that the volume of the different
  3755. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  3756. In this case, this option can be used to disable the channel coupling. This way,
  3757. the gain factor will be determined independently for each channel, depending
  3758. only on the individual channel's highest magnitude sample. This allows for
  3759. harmonizing the volume of the different channels.
  3760. @item correctdc, c
  3761. Enable DC bias correction. By default is disabled.
  3762. An audio signal (in the time domain) is a sequence of sample values.
  3763. In the Dynamic Audio Normalizer these sample values are represented in the
  3764. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  3765. audio signal, or "waveform", should be centered around the zero point.
  3766. That means if we calculate the mean value of all samples in a file, or in a
  3767. single frame, then the result should be 0.0 or at least very close to that
  3768. value. If, however, there is a significant deviation of the mean value from
  3769. 0.0, in either positive or negative direction, this is referred to as a
  3770. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  3771. Audio Normalizer provides optional DC bias correction.
  3772. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  3773. the mean value, or "DC correction" offset, of each input frame and subtract
  3774. that value from all of the frame's sample values which ensures those samples
  3775. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  3776. boundaries, the DC correction offset values will be interpolated smoothly
  3777. between neighbouring frames.
  3778. @item altboundary, b
  3779. Enable alternative boundary mode. By default is disabled.
  3780. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  3781. around each frame. This includes the preceding frames as well as the
  3782. subsequent frames. However, for the "boundary" frames, located at the very
  3783. beginning and at the very end of the audio file, not all neighbouring
  3784. frames are available. In particular, for the first few frames in the audio
  3785. file, the preceding frames are not known. And, similarly, for the last few
  3786. frames in the audio file, the subsequent frames are not known. Thus, the
  3787. question arises which gain factors should be assumed for the missing frames
  3788. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  3789. to deal with this situation. The default boundary mode assumes a gain factor
  3790. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  3791. "fade out" at the beginning and at the end of the input, respectively.
  3792. @item compress, s
  3793. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  3794. By default, the Dynamic Audio Normalizer does not apply "traditional"
  3795. compression. This means that signal peaks will not be pruned and thus the
  3796. full dynamic range will be retained within each local neighbourhood. However,
  3797. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  3798. normalization algorithm with a more "traditional" compression.
  3799. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  3800. (thresholding) function. If (and only if) the compression feature is enabled,
  3801. all input frames will be processed by a soft knee thresholding function prior
  3802. to the actual normalization process. Put simply, the thresholding function is
  3803. going to prune all samples whose magnitude exceeds a certain threshold value.
  3804. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  3805. value. Instead, the threshold value will be adjusted for each individual
  3806. frame.
  3807. In general, smaller parameters result in stronger compression, and vice versa.
  3808. Values below 3.0 are not recommended, because audible distortion may appear.
  3809. @item threshold, t
  3810. Set the target threshold value. This specifies the lowest permissible
  3811. magnitude level for the audio input which will be normalized.
  3812. If input frame volume is above this value frame will be normalized.
  3813. Otherwise frame may not be normalized at all. The default value is set
  3814. to 0, which means all input frames will be normalized.
  3815. This option is mostly useful if digital noise is not wanted to be amplified.
  3816. @item channels, h
  3817. Specify which channels to filter, by default all available channels are filtered.
  3818. @item overlap, o
  3819. Specify overlap for frames. If set to 0 (default) no frame overlapping is done.
  3820. Using >0 and <1 values will make less conservative gain adjustments, like
  3821. when framelen option is set to smaller value, if framelen option value is
  3822. compensated for non-zero overlap then gain adjustments will be smoother across time
  3823. compared to zero overlap case.
  3824. @item curve, v
  3825. Specify the peak mapping curve expression which is going to be used when calculating
  3826. gain applied to frames. The max output frame gain will still be limited by other
  3827. options mentioned previously for this filter.
  3828. The expression can contain the following constants:
  3829. @table @option
  3830. @item ch
  3831. current channel number
  3832. @item sn
  3833. current sample number
  3834. @item nb_channels
  3835. number of channels
  3836. @item t
  3837. timestamp expressed in seconds
  3838. @item sr
  3839. sample rate
  3840. @item p
  3841. current frame peak value
  3842. @end table
  3843. @end table
  3844. @subsection Commands
  3845. This filter supports the all above options as @ref{commands}.
  3846. @section earwax
  3847. Make audio easier to listen to on headphones.
  3848. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  3849. so that when listened to on headphones the stereo image is moved from
  3850. inside your head (standard for headphones) to outside and in front of
  3851. the listener (standard for speakers).
  3852. Ported from SoX.
  3853. @section equalizer
  3854. Apply a two-pole peaking equalisation (EQ) filter. With this
  3855. filter, the signal-level at and around a selected frequency can
  3856. be increased or decreased, whilst (unlike bandpass and bandreject
  3857. filters) that at all other frequencies is unchanged.
  3858. In order to produce complex equalisation curves, this filter can
  3859. be given several times, each with a different central frequency.
  3860. The filter accepts the following options:
  3861. @table @option
  3862. @item frequency, f
  3863. Set the filter's central frequency in Hz.
  3864. @item width_type, t
  3865. Set method to specify band-width of filter.
  3866. @table @option
  3867. @item h
  3868. Hz
  3869. @item q
  3870. Q-Factor
  3871. @item o
  3872. octave
  3873. @item s
  3874. slope
  3875. @item k
  3876. kHz
  3877. @end table
  3878. @item width, w
  3879. Specify the band-width of a filter in width_type units.
  3880. @item gain, g
  3881. Set the required gain or attenuation in dB.
  3882. Beware of clipping when using a positive gain.
  3883. @item mix, m
  3884. How much to use filtered signal in output. Default is 1.
  3885. Range is between 0 and 1.
  3886. @item channels, c
  3887. Specify which channels to filter, by default all available are filtered.
  3888. @item normalize, n
  3889. Normalize biquad coefficients, by default is disabled.
  3890. Enabling it will normalize magnitude response at DC to 0dB.
  3891. @item transform, a
  3892. Set transform type of IIR filter.
  3893. @table @option
  3894. @item di
  3895. @item dii
  3896. @item tdi
  3897. @item tdii
  3898. @item latt
  3899. @item svf
  3900. @item zdf
  3901. @end table
  3902. @item precision, r
  3903. Set precision of filtering.
  3904. @table @option
  3905. @item auto
  3906. Pick automatic sample format depending on surround filters.
  3907. @item s16
  3908. Always use signed 16-bit.
  3909. @item s32
  3910. Always use signed 32-bit.
  3911. @item f32
  3912. Always use float 32-bit.
  3913. @item f64
  3914. Always use float 64-bit.
  3915. @end table
  3916. @item block_size, b
  3917. Set block size used for reverse IIR processing. If this value is set to high enough
  3918. value (higher than impulse response length truncated when reaches near zero values) filtering
  3919. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  3920. Note that filter delay will be exactly this many samples when set to non-zero value.
  3921. @end table
  3922. @subsection Examples
  3923. @itemize
  3924. @item
  3925. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  3926. @example
  3927. equalizer=f=1000:t=h:width=200:g=-10
  3928. @end example
  3929. @item
  3930. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  3931. @example
  3932. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  3933. @end example
  3934. @end itemize
  3935. @subsection Commands
  3936. This filter supports the following commands:
  3937. @table @option
  3938. @item frequency, f
  3939. Change equalizer frequency.
  3940. Syntax for the command is : "@var{frequency}"
  3941. @item width_type, t
  3942. Change equalizer width_type.
  3943. Syntax for the command is : "@var{width_type}"
  3944. @item width, w
  3945. Change equalizer width.
  3946. Syntax for the command is : "@var{width}"
  3947. @item gain, g
  3948. Change equalizer gain.
  3949. Syntax for the command is : "@var{gain}"
  3950. @item mix, m
  3951. Change equalizer mix.
  3952. Syntax for the command is : "@var{mix}"
  3953. @end table
  3954. @section extrastereo
  3955. Linearly increases the difference between left and right channels which
  3956. adds some sort of "live" effect to playback.
  3957. The filter accepts the following options:
  3958. @table @option
  3959. @item m
  3960. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  3961. (average of both channels), with 1.0 sound will be unchanged, with
  3962. -1.0 left and right channels will be swapped.
  3963. @item c
  3964. Enable clipping. By default is enabled.
  3965. @end table
  3966. @subsection Commands
  3967. This filter supports the all above options as @ref{commands}.
  3968. @section firequalizer
  3969. Apply FIR Equalization using arbitrary frequency response.
  3970. The filter accepts the following option:
  3971. @table @option
  3972. @item gain
  3973. Set gain curve equation (in dB). The expression can contain variables:
  3974. @table @option
  3975. @item f
  3976. the evaluated frequency
  3977. @item sr
  3978. sample rate
  3979. @item ch
  3980. channel number, set to 0 when multichannels evaluation is disabled
  3981. @item chid
  3982. channel id, see libavutil/channel_layout.h, set to the first channel id when
  3983. multichannels evaluation is disabled
  3984. @item chs
  3985. number of channels
  3986. @item chlayout
  3987. channel_layout, see libavutil/channel_layout.h
  3988. @end table
  3989. and functions:
  3990. @table @option
  3991. @item gain_interpolate(f)
  3992. interpolate gain on frequency f based on gain_entry
  3993. @item cubic_interpolate(f)
  3994. same as gain_interpolate, but smoother
  3995. @end table
  3996. This option is also available as command. Default is @code{gain_interpolate(f)}.
  3997. @item gain_entry
  3998. Set gain entry for gain_interpolate function. The expression can
  3999. contain functions:
  4000. @table @option
  4001. @item entry(f, g)
  4002. store gain entry at frequency f with value g
  4003. @end table
  4004. This option is also available as command.
  4005. @item delay
  4006. Set filter delay in seconds. Higher value means more accurate.
  4007. Default is @code{0.01}.
  4008. @item accuracy
  4009. Set filter accuracy in Hz. Lower value means more accurate.
  4010. Default is @code{5}.
  4011. @item wfunc
  4012. Set window function. Acceptable values are:
  4013. @table @option
  4014. @item rectangular
  4015. rectangular window, useful when gain curve is already smooth
  4016. @item hann
  4017. hann window (default)
  4018. @item hamming
  4019. hamming window
  4020. @item blackman
  4021. blackman window
  4022. @item nuttall3
  4023. 3-terms continuous 1st derivative nuttall window
  4024. @item mnuttall3
  4025. minimum 3-terms discontinuous nuttall window
  4026. @item nuttall
  4027. 4-terms continuous 1st derivative nuttall window
  4028. @item bnuttall
  4029. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  4030. @item bharris
  4031. blackman-harris window
  4032. @item tukey
  4033. tukey window
  4034. @end table
  4035. @item fixed
  4036. If enabled, use fixed number of audio samples. This improves speed when
  4037. filtering with large delay. Default is disabled.
  4038. @item multi
  4039. Enable multichannels evaluation on gain. Default is disabled.
  4040. @item zero_phase
  4041. Enable zero phase mode by subtracting timestamp to compensate delay.
  4042. Default is disabled.
  4043. @item scale
  4044. Set scale used by gain. Acceptable values are:
  4045. @table @option
  4046. @item linlin
  4047. linear frequency, linear gain
  4048. @item linlog
  4049. linear frequency, logarithmic (in dB) gain (default)
  4050. @item loglin
  4051. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  4052. @item loglog
  4053. logarithmic frequency, logarithmic gain
  4054. @end table
  4055. @item dumpfile
  4056. Set file for dumping, suitable for gnuplot.
  4057. @item dumpscale
  4058. Set scale for dumpfile. Acceptable values are same with scale option.
  4059. Default is linlog.
  4060. @item fft2
  4061. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  4062. Default is disabled.
  4063. @item min_phase
  4064. Enable minimum phase impulse response. Default is disabled.
  4065. @end table
  4066. @subsection Examples
  4067. @itemize
  4068. @item
  4069. lowpass at 1000 Hz:
  4070. @example
  4071. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  4072. @end example
  4073. @item
  4074. lowpass at 1000 Hz with gain_entry:
  4075. @example
  4076. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  4077. @end example
  4078. @item
  4079. custom equalization:
  4080. @example
  4081. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  4082. @end example
  4083. @item
  4084. higher delay with zero phase to compensate delay:
  4085. @example
  4086. firequalizer=delay=0.1:fixed=on:zero_phase=on
  4087. @end example
  4088. @item
  4089. lowpass on left channel, highpass on right channel:
  4090. @example
  4091. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  4092. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  4093. @end example
  4094. @end itemize
  4095. @section flanger
  4096. Apply a flanging effect to the audio.
  4097. The filter accepts the following options:
  4098. @table @option
  4099. @item delay
  4100. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  4101. @item depth
  4102. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  4103. @item regen
  4104. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  4105. Default value is 0.
  4106. @item width
  4107. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  4108. Default value is 71.
  4109. @item speed
  4110. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  4111. @item shape
  4112. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  4113. Default value is @var{sinusoidal}.
  4114. @item phase
  4115. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  4116. Default value is 25.
  4117. @item interp
  4118. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  4119. Default is @var{linear}.
  4120. @end table
  4121. @section haas
  4122. Apply Haas effect to audio.
  4123. Note that this makes most sense to apply on mono signals.
  4124. With this filter applied to mono signals it give some directionality and
  4125. stretches its stereo image.
  4126. The filter accepts the following options:
  4127. @table @option
  4128. @item level_in
  4129. Set input level. By default is @var{1}, or 0dB
  4130. @item level_out
  4131. Set output level. By default is @var{1}, or 0dB.
  4132. @item side_gain
  4133. Set gain applied to side part of signal. By default is @var{1}.
  4134. @item middle_source
  4135. Set kind of middle source. Can be one of the following:
  4136. @table @samp
  4137. @item left
  4138. Pick left channel.
  4139. @item right
  4140. Pick right channel.
  4141. @item mid
  4142. Pick middle part signal of stereo image.
  4143. @item side
  4144. Pick side part signal of stereo image.
  4145. @end table
  4146. @item middle_phase
  4147. Change middle phase. By default is disabled.
  4148. @item left_delay
  4149. Set left channel delay. By default is @var{2.05} milliseconds.
  4150. @item left_balance
  4151. Set left channel balance. By default is @var{-1}.
  4152. @item left_gain
  4153. Set left channel gain. By default is @var{1}.
  4154. @item left_phase
  4155. Change left phase. By default is disabled.
  4156. @item right_delay
  4157. Set right channel delay. By defaults is @var{2.12} milliseconds.
  4158. @item right_balance
  4159. Set right channel balance. By default is @var{1}.
  4160. @item right_gain
  4161. Set right channel gain. By default is @var{1}.
  4162. @item right_phase
  4163. Change right phase. By default is enabled.
  4164. @end table
  4165. @section hdcd
  4166. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  4167. embedded HDCD codes is expanded into a 20-bit PCM stream.
  4168. The filter supports the Peak Extend and Low-level Gain Adjustment features
  4169. of HDCD, and detects the Transient Filter flag.
  4170. @example
  4171. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  4172. @end example
  4173. When using the filter with wav, note the default encoding for wav is 16-bit,
  4174. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  4175. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  4176. @example
  4177. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  4178. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  4179. @end example
  4180. The filter accepts the following options:
  4181. @table @option
  4182. @item disable_autoconvert
  4183. Disable any automatic format conversion or resampling in the filter graph.
  4184. @item process_stereo
  4185. Process the stereo channels together. If target_gain does not match between
  4186. channels, consider it invalid and use the last valid target_gain.
  4187. @item cdt_ms
  4188. Set the code detect timer period in ms.
  4189. @item force_pe
  4190. Always extend peaks above -3dBFS even if PE isn't signaled.
  4191. @item analyze_mode
  4192. Replace audio with a solid tone and adjust the amplitude to signal some
  4193. specific aspect of the decoding process. The output file can be loaded in
  4194. an audio editor alongside the original to aid analysis.
  4195. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  4196. Modes are:
  4197. @table @samp
  4198. @item 0, off
  4199. Disabled
  4200. @item 1, lle
  4201. Gain adjustment level at each sample
  4202. @item 2, pe
  4203. Samples where peak extend occurs
  4204. @item 3, cdt
  4205. Samples where the code detect timer is active
  4206. @item 4, tgm
  4207. Samples where the target gain does not match between channels
  4208. @end table
  4209. @end table
  4210. @section headphone
  4211. Apply head-related transfer functions (HRTFs) to create virtual
  4212. loudspeakers around the user for binaural listening via headphones.
  4213. The HRIRs are provided via additional streams, for each channel
  4214. one stereo input stream is needed.
  4215. The filter accepts the following options:
  4216. @table @option
  4217. @item map
  4218. Set mapping of input streams for convolution.
  4219. The argument is a '|'-separated list of channel names in order as they
  4220. are given as additional stream inputs for filter.
  4221. This also specify number of input streams. Number of input streams
  4222. must be not less than number of channels in first stream plus one.
  4223. @item gain
  4224. Set gain applied to audio. Value is in dB. Default is 0.
  4225. @item type
  4226. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  4227. processing audio in time domain which is slow.
  4228. @var{freq} is processing audio in frequency domain which is fast.
  4229. Default is @var{freq}.
  4230. @item lfe
  4231. Set custom gain for LFE channels. Value is in dB. Default is 0.
  4232. @item size
  4233. Set size of frame in number of samples which will be processed at once.
  4234. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  4235. @item hrir
  4236. Set format of hrir stream.
  4237. Default value is @var{stereo}. Alternative value is @var{multich}.
  4238. If value is set to @var{stereo}, number of additional streams should
  4239. be greater or equal to number of input channels in first input stream.
  4240. Also each additional stream should have stereo number of channels.
  4241. If value is set to @var{multich}, number of additional streams should
  4242. be exactly one. Also number of input channels of additional stream
  4243. should be equal or greater than twice number of channels of first input
  4244. stream.
  4245. @end table
  4246. @subsection Examples
  4247. @itemize
  4248. @item
  4249. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4250. each amovie filter use stereo file with IR coefficients as input.
  4251. The files give coefficients for each position of virtual loudspeaker:
  4252. @example
  4253. ffmpeg -i input.wav
  4254. -filter_complex "amovie=azi_270_ele_0_DFC.wav[sr];amovie=azi_90_ele_0_DFC.wav[sl];amovie=azi_225_ele_0_DFC.wav[br];amovie=azi_135_ele_0_DFC.wav[bl];amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe];amovie=azi_35_ele_0_DFC.wav[fl];amovie=azi_325_ele_0_DFC.wav[fr];[0:a][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  4255. output.wav
  4256. @end example
  4257. @item
  4258. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  4259. but now in @var{multich} @var{hrir} format.
  4260. @example
  4261. ffmpeg -i input.wav -filter_complex "amovie=minp.wav[hrirs];[0:a][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  4262. output.wav
  4263. @end example
  4264. @end itemize
  4265. @section highpass
  4266. Apply a high-pass filter with 3dB point frequency.
  4267. The filter can be either single-pole, or double-pole (the default).
  4268. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4269. The filter accepts the following options:
  4270. @table @option
  4271. @item frequency, f
  4272. Set frequency in Hz. Default is 3000.
  4273. @item poles, p
  4274. Set number of poles. Default is 2.
  4275. @item width_type, t
  4276. Set method to specify band-width of filter.
  4277. @table @option
  4278. @item h
  4279. Hz
  4280. @item q
  4281. Q-Factor
  4282. @item o
  4283. octave
  4284. @item s
  4285. slope
  4286. @item k
  4287. kHz
  4288. @end table
  4289. @item width, w
  4290. Specify the band-width of a filter in width_type units.
  4291. Applies only to double-pole filter.
  4292. The default is 0.707q and gives a Butterworth response.
  4293. @item mix, m
  4294. How much to use filtered signal in output. Default is 1.
  4295. Range is between 0 and 1.
  4296. @item channels, c
  4297. Specify which channels to filter, by default all available are filtered.
  4298. @item normalize, n
  4299. Normalize biquad coefficients, by default is disabled.
  4300. Enabling it will normalize magnitude response at DC to 0dB.
  4301. @item transform, a
  4302. Set transform type of IIR filter.
  4303. @table @option
  4304. @item di
  4305. @item dii
  4306. @item tdi
  4307. @item tdii
  4308. @item latt
  4309. @item svf
  4310. @item zdf
  4311. @end table
  4312. @item precision, r
  4313. Set precision of filtering.
  4314. @table @option
  4315. @item auto
  4316. Pick automatic sample format depending on surround filters.
  4317. @item s16
  4318. Always use signed 16-bit.
  4319. @item s32
  4320. Always use signed 32-bit.
  4321. @item f32
  4322. Always use float 32-bit.
  4323. @item f64
  4324. Always use float 64-bit.
  4325. @end table
  4326. @item block_size, b
  4327. Set block size used for reverse IIR processing. If this value is set to high enough
  4328. value (higher than impulse response length truncated when reaches near zero values) filtering
  4329. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4330. Note that filter delay will be exactly this many samples when set to non-zero value.
  4331. @end table
  4332. @subsection Commands
  4333. This filter supports the following commands:
  4334. @table @option
  4335. @item frequency, f
  4336. Change highpass frequency.
  4337. Syntax for the command is : "@var{frequency}"
  4338. @item width_type, t
  4339. Change highpass width_type.
  4340. Syntax for the command is : "@var{width_type}"
  4341. @item width, w
  4342. Change highpass width.
  4343. Syntax for the command is : "@var{width}"
  4344. @item mix, m
  4345. Change highpass mix.
  4346. Syntax for the command is : "@var{mix}"
  4347. @end table
  4348. @section join
  4349. Join multiple input streams into one multi-channel stream.
  4350. It accepts the following parameters:
  4351. @table @option
  4352. @item inputs
  4353. The number of input streams. It defaults to 2.
  4354. @item channel_layout
  4355. The desired output channel layout. It defaults to stereo.
  4356. @item map
  4357. Map channels from inputs to output. The argument is a '|'-separated list of
  4358. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  4359. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  4360. can be either the name of the input channel (e.g. FL for front left) or its
  4361. index in the specified input stream. @var{out_channel} is the name of the output
  4362. channel.
  4363. @end table
  4364. The filter will attempt to guess the mappings when they are not specified
  4365. explicitly. It does so by first trying to find an unused matching input channel
  4366. and if that fails it picks the first unused input channel.
  4367. Join 3 inputs (with properly set channel layouts):
  4368. @example
  4369. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  4370. @end example
  4371. Build a 5.1 output from 6 single-channel streams:
  4372. @example
  4373. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  4374. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  4375. out
  4376. @end example
  4377. @section ladspa
  4378. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  4379. To enable compilation of this filter you need to configure FFmpeg with
  4380. @code{--enable-ladspa}.
  4381. @table @option
  4382. @item file, f
  4383. Specifies the name of LADSPA plugin library to load. If the environment
  4384. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  4385. each one of the directories specified by the colon separated list in
  4386. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  4387. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  4388. @file{/usr/lib/ladspa/}.
  4389. @item plugin, p
  4390. Specifies the plugin within the library. Some libraries contain only
  4391. one plugin, but others contain many of them. If this is not set filter
  4392. will list all available plugins within the specified library.
  4393. @item controls, c
  4394. Set the '|' separated list of controls which are zero or more floating point
  4395. values that determine the behavior of the loaded plugin (for example delay,
  4396. threshold or gain).
  4397. Controls need to be defined using the following syntax:
  4398. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  4399. @var{valuei} is the value set on the @var{i}-th control.
  4400. Alternatively they can be also defined using the following syntax:
  4401. @var{value0}|@var{value1}|@var{value2}|..., where
  4402. @var{valuei} is the value set on the @var{i}-th control.
  4403. If @option{controls} is set to @code{help}, all available controls and
  4404. their valid ranges are printed.
  4405. @item sample_rate, s
  4406. Specify the sample rate, default to 44100. Only used if plugin have
  4407. zero inputs.
  4408. @item nb_samples, n
  4409. Set the number of samples per channel per each output frame, default
  4410. is 1024. Only used if plugin have zero inputs.
  4411. @item duration, d
  4412. Set the minimum duration of the sourced audio. See
  4413. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4414. for the accepted syntax.
  4415. Note that the resulting duration may be greater than the specified duration,
  4416. as the generated audio is always cut at the end of a complete frame.
  4417. If not specified, or the expressed duration is negative, the audio is
  4418. supposed to be generated forever.
  4419. Only used if plugin have zero inputs.
  4420. @item latency, l
  4421. Enable latency compensation, by default is disabled.
  4422. Only used if plugin have inputs.
  4423. @end table
  4424. @subsection Examples
  4425. @itemize
  4426. @item
  4427. List all available plugins within amp (LADSPA example plugin) library:
  4428. @example
  4429. ladspa=file=amp
  4430. @end example
  4431. @item
  4432. List all available controls and their valid ranges for @code{vcf_notch}
  4433. plugin from @code{VCF} library:
  4434. @example
  4435. ladspa=f=vcf:p=vcf_notch:c=help
  4436. @end example
  4437. @item
  4438. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  4439. plugin library:
  4440. @example
  4441. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  4442. @end example
  4443. @item
  4444. Add reverberation to the audio using TAP-plugins
  4445. (Tom's Audio Processing plugins):
  4446. @example
  4447. ladspa=file=tap_reverb:tap_reverb
  4448. @end example
  4449. @item
  4450. Generate white noise, with 0.2 amplitude:
  4451. @example
  4452. ladspa=file=cmt:noise_source_white:c=c0=.2
  4453. @end example
  4454. @item
  4455. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  4456. @code{C* Audio Plugin Suite} (CAPS) library:
  4457. @example
  4458. ladspa=file=caps:Click:c=c1=20'
  4459. @end example
  4460. @item
  4461. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  4462. @example
  4463. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  4464. @end example
  4465. @item
  4466. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  4467. @code{SWH Plugins} collection:
  4468. @example
  4469. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  4470. @end example
  4471. @item
  4472. Attenuate low frequencies using Multiband EQ from Steve Harris
  4473. @code{SWH Plugins} collection:
  4474. @example
  4475. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  4476. @end example
  4477. @item
  4478. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  4479. (CAPS) library:
  4480. @example
  4481. ladspa=caps:Narrower
  4482. @end example
  4483. @item
  4484. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  4485. @example
  4486. ladspa=caps:White:.2
  4487. @end example
  4488. @item
  4489. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  4490. @example
  4491. ladspa=caps:Fractal:c=c1=1
  4492. @end example
  4493. @item
  4494. Dynamic volume normalization using @code{VLevel} plugin:
  4495. @example
  4496. ladspa=vlevel-ladspa:vlevel_mono
  4497. @end example
  4498. @end itemize
  4499. @subsection Commands
  4500. This filter supports the following commands:
  4501. @table @option
  4502. @item cN
  4503. Modify the @var{N}-th control value.
  4504. If the specified value is not valid, it is ignored and prior one is kept.
  4505. @end table
  4506. @section loudnorm
  4507. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  4508. Support for both single pass (livestreams, files) and double pass (files) modes.
  4509. This algorithm can target IL, LRA, and maximum true peak. In dynamic mode, to accurately
  4510. detect true peaks, the audio stream will be upsampled to 192 kHz.
  4511. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  4512. The filter accepts the following options:
  4513. @table @option
  4514. @item I, i
  4515. Set integrated loudness target.
  4516. Range is -70.0 - -5.0. Default value is -24.0.
  4517. @item LRA, lra
  4518. Set loudness range target.
  4519. Range is 1.0 - 50.0. Default value is 7.0.
  4520. @item TP, tp
  4521. Set maximum true peak.
  4522. Range is -9.0 - +0.0. Default value is -2.0.
  4523. @item measured_I, measured_i
  4524. Measured IL of input file.
  4525. Range is -99.0 - +0.0.
  4526. @item measured_LRA, measured_lra
  4527. Measured LRA of input file.
  4528. Range is 0.0 - 99.0.
  4529. @item measured_TP, measured_tp
  4530. Measured true peak of input file.
  4531. Range is -99.0 - +99.0.
  4532. @item measured_thresh
  4533. Measured threshold of input file.
  4534. Range is -99.0 - +0.0.
  4535. @item offset
  4536. Set offset gain. Gain is applied before the true-peak limiter.
  4537. Range is -99.0 - +99.0. Default is +0.0.
  4538. @item linear
  4539. Normalize by linearly scaling the source audio.
  4540. @code{measured_I}, @code{measured_LRA}, @code{measured_TP},
  4541. and @code{measured_thresh} must all be specified. Target LRA shouldn't
  4542. be lower than source LRA and the change in integrated loudness shouldn't
  4543. result in a true peak which exceeds the target TP. If any of these
  4544. conditions aren't met, normalization mode will revert to @var{dynamic}.
  4545. Options are @code{true} or @code{false}. Default is @code{true}.
  4546. @item dual_mono
  4547. Treat mono input files as "dual-mono". If a mono file is intended for playback
  4548. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  4549. If set to @code{true}, this option will compensate for this effect.
  4550. Multi-channel input files are not affected by this option.
  4551. Options are true or false. Default is false.
  4552. @item print_format
  4553. Set print format for stats. Options are summary, json, or none.
  4554. Default value is none.
  4555. @end table
  4556. @section lowpass
  4557. Apply a low-pass filter with 3dB point frequency.
  4558. The filter can be either single-pole or double-pole (the default).
  4559. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  4560. The filter accepts the following options:
  4561. @table @option
  4562. @item frequency, f
  4563. Set frequency in Hz. Default is 500.
  4564. @item poles, p
  4565. Set number of poles. Default is 2.
  4566. @item width_type, t
  4567. Set method to specify band-width of filter.
  4568. @table @option
  4569. @item h
  4570. Hz
  4571. @item q
  4572. Q-Factor
  4573. @item o
  4574. octave
  4575. @item s
  4576. slope
  4577. @item k
  4578. kHz
  4579. @end table
  4580. @item width, w
  4581. Specify the band-width of a filter in width_type units.
  4582. Applies only to double-pole filter.
  4583. The default is 0.707q and gives a Butterworth response.
  4584. @item mix, m
  4585. How much to use filtered signal in output. Default is 1.
  4586. Range is between 0 and 1.
  4587. @item channels, c
  4588. Specify which channels to filter, by default all available are filtered.
  4589. @item normalize, n
  4590. Normalize biquad coefficients, by default is disabled.
  4591. Enabling it will normalize magnitude response at DC to 0dB.
  4592. @item transform, a
  4593. Set transform type of IIR filter.
  4594. @table @option
  4595. @item di
  4596. @item dii
  4597. @item tdi
  4598. @item tdii
  4599. @item latt
  4600. @item svf
  4601. @item zdf
  4602. @end table
  4603. @item precision, r
  4604. Set precision of filtering.
  4605. @table @option
  4606. @item auto
  4607. Pick automatic sample format depending on surround filters.
  4608. @item s16
  4609. Always use signed 16-bit.
  4610. @item s32
  4611. Always use signed 32-bit.
  4612. @item f32
  4613. Always use float 32-bit.
  4614. @item f64
  4615. Always use float 64-bit.
  4616. @end table
  4617. @item block_size, b
  4618. Set block size used for reverse IIR processing. If this value is set to high enough
  4619. value (higher than impulse response length truncated when reaches near zero values) filtering
  4620. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  4621. Note that filter delay will be exactly this many samples when set to non-zero value.
  4622. @end table
  4623. @subsection Examples
  4624. @itemize
  4625. @item
  4626. Lowpass only LFE channel, it LFE is not present it does nothing:
  4627. @example
  4628. lowpass=c=LFE
  4629. @end example
  4630. @end itemize
  4631. @subsection Commands
  4632. This filter supports the following commands:
  4633. @table @option
  4634. @item frequency, f
  4635. Change lowpass frequency.
  4636. Syntax for the command is : "@var{frequency}"
  4637. @item width_type, t
  4638. Change lowpass width_type.
  4639. Syntax for the command is : "@var{width_type}"
  4640. @item width, w
  4641. Change lowpass width.
  4642. Syntax for the command is : "@var{width}"
  4643. @item mix, m
  4644. Change lowpass mix.
  4645. Syntax for the command is : "@var{mix}"
  4646. @end table
  4647. @section lv2
  4648. Load a LV2 (LADSPA Version 2) plugin.
  4649. To enable compilation of this filter you need to configure FFmpeg with
  4650. @code{--enable-lv2}.
  4651. @table @option
  4652. @item plugin, p
  4653. Specifies the plugin URI. You may need to escape ':'.
  4654. @item controls, c
  4655. Set the '|' separated list of controls which are zero or more floating point
  4656. values that determine the behavior of the loaded plugin (for example delay,
  4657. threshold or gain).
  4658. If @option{controls} is set to @code{help}, all available controls and
  4659. their valid ranges are printed.
  4660. @item sample_rate, s
  4661. Specify the sample rate, default to 44100. Only used if plugin have
  4662. zero inputs.
  4663. @item nb_samples, n
  4664. Set the number of samples per channel per each output frame, default
  4665. is 1024. Only used if plugin have zero inputs.
  4666. @item duration, d
  4667. Set the minimum duration of the sourced audio. See
  4668. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  4669. for the accepted syntax.
  4670. Note that the resulting duration may be greater than the specified duration,
  4671. as the generated audio is always cut at the end of a complete frame.
  4672. If not specified, or the expressed duration is negative, the audio is
  4673. supposed to be generated forever.
  4674. Only used if plugin have zero inputs.
  4675. @end table
  4676. @subsection Examples
  4677. @itemize
  4678. @item
  4679. Apply bass enhancer plugin from Calf:
  4680. @example
  4681. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  4682. @end example
  4683. @item
  4684. Apply vinyl plugin from Calf:
  4685. @example
  4686. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  4687. @end example
  4688. @item
  4689. Apply bit crusher plugin from ArtyFX:
  4690. @example
  4691. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  4692. @end example
  4693. @end itemize
  4694. @subsection Commands
  4695. This filter supports all options that are exported by plugin as commands.
  4696. @section mcompand
  4697. Multiband Compress or expand the audio's dynamic range.
  4698. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  4699. This is akin to the crossover of a loudspeaker, and results in flat frequency
  4700. response when absent compander action.
  4701. It accepts the following parameters:
  4702. @table @option
  4703. @item args
  4704. This option syntax is:
  4705. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  4706. For explanation of each item refer to compand filter documentation.
  4707. @end table
  4708. @anchor{pan}
  4709. @section pan
  4710. Mix channels with specific gain levels. The filter accepts the output
  4711. channel layout followed by a set of channels definitions.
  4712. This filter is also designed to efficiently remap the channels of an audio
  4713. stream.
  4714. The filter accepts parameters of the form:
  4715. "@var{l}|@var{outdef}|@var{outdef}|..."
  4716. @table @option
  4717. @item l
  4718. output channel layout or number of channels
  4719. @item outdef
  4720. output channel specification, of the form:
  4721. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  4722. @item out_name
  4723. output channel to define, either a channel name (FL, FR, etc.) or a channel
  4724. number (c0, c1, etc.)
  4725. @item gain
  4726. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  4727. @item in_name
  4728. input channel to use, see out_name for details; it is not possible to mix
  4729. named and numbered input channels
  4730. @end table
  4731. If the `=' in a channel specification is replaced by `<', then the gains for
  4732. that specification will be renormalized so that the total is 1, thus
  4733. avoiding clipping noise.
  4734. @subsection Mixing examples
  4735. For example, if you want to down-mix from stereo to mono, but with a bigger
  4736. factor for the left channel:
  4737. @example
  4738. pan=1c|c0=0.9*c0+0.1*c1
  4739. @end example
  4740. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  4741. 7-channels surround:
  4742. @example
  4743. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  4744. @end example
  4745. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  4746. that should be preferred (see "-ac" option) unless you have very specific
  4747. needs.
  4748. @subsection Remapping examples
  4749. The channel remapping will be effective if, and only if:
  4750. @itemize
  4751. @item gain coefficients are zeroes or ones,
  4752. @item only one input per channel output,
  4753. @end itemize
  4754. If all these conditions are satisfied, the filter will notify the user ("Pure
  4755. channel mapping detected"), and use an optimized and lossless method to do the
  4756. remapping.
  4757. For example, if you have a 5.1 source and want a stereo audio stream by
  4758. dropping the extra channels:
  4759. @example
  4760. pan="stereo| c0=FL | c1=FR"
  4761. @end example
  4762. Given the same source, you can also switch front left and front right channels
  4763. and keep the input channel layout:
  4764. @example
  4765. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  4766. @end example
  4767. If the input is a stereo audio stream, you can mute the front left channel (and
  4768. still keep the stereo channel layout) with:
  4769. @example
  4770. pan="stereo|c1=c1"
  4771. @end example
  4772. Still with a stereo audio stream input, you can copy the right channel in both
  4773. front left and right:
  4774. @example
  4775. pan="stereo| c0=FR | c1=FR"
  4776. @end example
  4777. @section replaygain
  4778. ReplayGain scanner filter. This filter takes an audio stream as an input and
  4779. outputs it unchanged.
  4780. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  4781. The filter accepts the following exported read-only options:
  4782. @table @option
  4783. @item track_gain
  4784. Exported track gain in dB at end of stream.
  4785. @item track_peak
  4786. Exported track peak at end of stream.
  4787. @end table
  4788. @section resample
  4789. Convert the audio sample format, sample rate and channel layout. It is
  4790. not meant to be used directly.
  4791. @section rubberband
  4792. Apply time-stretching and pitch-shifting with librubberband.
  4793. To enable compilation of this filter, you need to configure FFmpeg with
  4794. @code{--enable-librubberband}.
  4795. The filter accepts the following options:
  4796. @table @option
  4797. @item tempo
  4798. Set tempo scale factor.
  4799. @item pitch
  4800. Set pitch scale factor.
  4801. @item transients
  4802. Set transients detector.
  4803. Possible values are:
  4804. @table @var
  4805. @item crisp
  4806. @item mixed
  4807. @item smooth
  4808. @end table
  4809. @item detector
  4810. Set detector.
  4811. Possible values are:
  4812. @table @var
  4813. @item compound
  4814. @item percussive
  4815. @item soft
  4816. @end table
  4817. @item phase
  4818. Set phase.
  4819. Possible values are:
  4820. @table @var
  4821. @item laminar
  4822. @item independent
  4823. @end table
  4824. @item window
  4825. Set processing window size.
  4826. Possible values are:
  4827. @table @var
  4828. @item standard
  4829. @item short
  4830. @item long
  4831. @end table
  4832. @item smoothing
  4833. Set smoothing.
  4834. Possible values are:
  4835. @table @var
  4836. @item off
  4837. @item on
  4838. @end table
  4839. @item formant
  4840. Enable formant preservation when shift pitching.
  4841. Possible values are:
  4842. @table @var
  4843. @item shifted
  4844. @item preserved
  4845. @end table
  4846. @item pitchq
  4847. Set pitch quality.
  4848. Possible values are:
  4849. @table @var
  4850. @item quality
  4851. @item speed
  4852. @item consistency
  4853. @end table
  4854. @item channels
  4855. Set channels.
  4856. Possible values are:
  4857. @table @var
  4858. @item apart
  4859. @item together
  4860. @end table
  4861. @end table
  4862. @subsection Commands
  4863. This filter supports the following commands:
  4864. @table @option
  4865. @item tempo
  4866. Change filter tempo scale factor.
  4867. Syntax for the command is : "@var{tempo}"
  4868. @item pitch
  4869. Change filter pitch scale factor.
  4870. Syntax for the command is : "@var{pitch}"
  4871. @end table
  4872. @section sidechaincompress
  4873. This filter acts like normal compressor but has the ability to compress
  4874. detected signal using second input signal.
  4875. It needs two input streams and returns one output stream.
  4876. First input stream will be processed depending on second stream signal.
  4877. The filtered signal then can be filtered with other filters in later stages of
  4878. processing. See @ref{pan} and @ref{amerge} filter.
  4879. The filter accepts the following options:
  4880. @table @option
  4881. @item level_in
  4882. Set input gain. Default is 1. Range is between 0.015625 and 64.
  4883. @item mode
  4884. Set mode of compressor operation. Can be @code{upward} or @code{downward}.
  4885. Default is @code{downward}.
  4886. @item threshold
  4887. If a signal of second stream raises above this level it will affect the gain
  4888. reduction of first stream.
  4889. By default is 0.125. Range is between 0.00097563 and 1.
  4890. @item ratio
  4891. Set a ratio about which the signal is reduced. 1:2 means that if the level
  4892. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  4893. Default is 2. Range is between 1 and 20.
  4894. @item attack
  4895. Amount of milliseconds the signal has to rise above the threshold before gain
  4896. reduction starts. Default is 20. Range is between 0.01 and 2000.
  4897. @item release
  4898. Amount of milliseconds the signal has to fall below the threshold before
  4899. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  4900. @item makeup
  4901. Set the amount by how much signal will be amplified after processing.
  4902. Default is 1. Range is from 1 to 64.
  4903. @item knee
  4904. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4905. Default is 2.82843. Range is between 1 and 8.
  4906. @item link
  4907. Choose if the @code{average} level between all channels of side-chain stream
  4908. or the louder(@code{maximum}) channel of side-chain stream affects the
  4909. reduction. Default is @code{average}.
  4910. @item detection
  4911. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  4912. of @code{rms}. Default is @code{rms} which is mainly smoother.
  4913. @item level_sc
  4914. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  4915. @item mix
  4916. How much to use compressed signal in output. Default is 1.
  4917. Range is between 0 and 1.
  4918. @end table
  4919. @subsection Commands
  4920. This filter supports the all above options as @ref{commands}.
  4921. @subsection Examples
  4922. @itemize
  4923. @item
  4924. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  4925. depending on the signal of 2nd input and later compressed signal to be
  4926. merged with 2nd input:
  4927. @example
  4928. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  4929. @end example
  4930. @end itemize
  4931. @section sidechaingate
  4932. A sidechain gate acts like a normal (wideband) gate but has the ability to
  4933. filter the detected signal before sending it to the gain reduction stage.
  4934. Normally a gate uses the full range signal to detect a level above the
  4935. threshold.
  4936. For example: If you cut all lower frequencies from your sidechain signal
  4937. the gate will decrease the volume of your track only if not enough highs
  4938. appear. With this technique you are able to reduce the resonation of a
  4939. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  4940. guitar.
  4941. It needs two input streams and returns one output stream.
  4942. First input stream will be processed depending on second stream signal.
  4943. The filter accepts the following options:
  4944. @table @option
  4945. @item level_in
  4946. Set input level before filtering.
  4947. Default is 1. Allowed range is from 0.015625 to 64.
  4948. @item mode
  4949. Set the mode of operation. Can be @code{upward} or @code{downward}.
  4950. Default is @code{downward}. If set to @code{upward} mode, higher parts of signal
  4951. will be amplified, expanding dynamic range in upward direction.
  4952. Otherwise, in case of @code{downward} lower parts of signal will be reduced.
  4953. @item range
  4954. Set the level of gain reduction when the signal is below the threshold.
  4955. Default is 0.06125. Allowed range is from 0 to 1.
  4956. Setting this to 0 disables reduction and then filter behaves like expander.
  4957. @item threshold
  4958. If a signal rises above this level the gain reduction is released.
  4959. Default is 0.125. Allowed range is from 0 to 1.
  4960. @item ratio
  4961. Set a ratio about which the signal is reduced.
  4962. Default is 2. Allowed range is from 1 to 9000.
  4963. @item attack
  4964. Amount of milliseconds the signal has to rise above the threshold before gain
  4965. reduction stops.
  4966. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  4967. @item release
  4968. Amount of milliseconds the signal has to fall below the threshold before the
  4969. reduction is increased again. Default is 250 milliseconds.
  4970. Allowed range is from 0.01 to 9000.
  4971. @item makeup
  4972. Set amount of amplification of signal after processing.
  4973. Default is 1. Allowed range is from 1 to 64.
  4974. @item knee
  4975. Curve the sharp knee around the threshold to enter gain reduction more softly.
  4976. Default is 2.828427125. Allowed range is from 1 to 8.
  4977. @item detection
  4978. Choose if exact signal should be taken for detection or an RMS like one.
  4979. Default is rms. Can be peak or rms.
  4980. @item link
  4981. Choose if the average level between all channels or the louder channel affects
  4982. the reduction.
  4983. Default is average. Can be average or maximum.
  4984. @item level_sc
  4985. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  4986. @end table
  4987. @subsection Commands
  4988. This filter supports the all above options as @ref{commands}.
  4989. @section silencedetect
  4990. Detect silence in an audio stream.
  4991. This filter logs a message when it detects that the input audio volume is less
  4992. or equal to a noise tolerance value for a duration greater or equal to the
  4993. minimum detected noise duration.
  4994. The printed times and duration are expressed in seconds. The
  4995. @code{lavfi.silence_start} or @code{lavfi.silence_start.X} metadata key
  4996. is set on the first frame whose timestamp equals or exceeds the detection
  4997. duration and it contains the timestamp of the first frame of the silence.
  4998. The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X}
  4999. and @code{lavfi.silence_end} or @code{lavfi.silence_end.X} metadata
  5000. keys are set on the first frame after the silence. If @option{mono} is
  5001. enabled, and each channel is evaluated separately, the @code{.X}
  5002. suffixed keys are used, and @code{X} corresponds to the channel number.
  5003. The filter accepts the following options:
  5004. @table @option
  5005. @item noise, n
  5006. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  5007. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  5008. @item duration, d
  5009. Set silence duration until notification (default is 2 seconds). See
  5010. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5011. for the accepted syntax.
  5012. @item mono, m
  5013. Process each channel separately, instead of combined. By default is disabled.
  5014. @end table
  5015. @subsection Examples
  5016. @itemize
  5017. @item
  5018. Detect 5 seconds of silence with -50dB noise tolerance:
  5019. @example
  5020. silencedetect=n=-50dB:d=5
  5021. @end example
  5022. @item
  5023. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  5024. tolerance in @file{silence.mp3}:
  5025. @example
  5026. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  5027. @end example
  5028. @end itemize
  5029. @section silenceremove
  5030. Remove silence from the beginning, middle or end of the audio.
  5031. The filter accepts the following options:
  5032. @table @option
  5033. @item start_periods
  5034. This value is used to indicate if audio should be trimmed at beginning of
  5035. the audio. A value of zero indicates no silence should be trimmed from the
  5036. beginning. When specifying a non-zero value, it trims audio up until it
  5037. finds non-silence. Normally, when trimming silence from beginning of audio
  5038. the @var{start_periods} will be @code{1} but it can be increased to higher
  5039. values to trim all audio up to specific count of non-silence periods.
  5040. Default value is @code{0}.
  5041. @item start_duration
  5042. Specify the amount of time that non-silence must be detected before it stops
  5043. trimming audio. By increasing the duration, bursts of noises can be treated
  5044. as silence and trimmed off. Default value is @code{0}.
  5045. @item start_threshold
  5046. This indicates what sample value should be treated as silence. For digital
  5047. audio, a value of @code{0} may be fine but for audio recorded from analog,
  5048. you may wish to increase the value to account for background noise.
  5049. Can be specified in dB (in case "dB" is appended to the specified value)
  5050. or amplitude ratio. Default value is @code{0}.
  5051. @item start_silence
  5052. Specify max duration of silence at beginning that will be kept after
  5053. trimming. Default is 0, which is equal to trimming all samples detected
  5054. as silence.
  5055. @item start_mode
  5056. Specify mode of detection of silence end at start of multi-channel audio.
  5057. Can be @var{any} or @var{all}. Default is @var{any}.
  5058. With @var{any}, any sample from any channel that is detected as non-silence
  5059. will trigger end of silence trimming at start of audio stream.
  5060. With @var{all}, only if every sample from every channel is detected as non-silence
  5061. will trigger end of silence trimming at start of audio stream, limited usage.
  5062. @item stop_periods
  5063. Set the count for trimming silence from the end of audio. When specifying a
  5064. positive value, it trims audio after it finds specified silence period.
  5065. To remove silence from the middle of a file, specify a @var{stop_periods}
  5066. that is negative. This value is then treated as a positive value and is
  5067. used to indicate the effect should restart processing as specified by
  5068. @var{stop_periods}, making it suitable for removing periods of silence
  5069. in the middle of the audio.
  5070. Default value is @code{0}.
  5071. @item stop_duration
  5072. Specify a duration of silence that must exist before audio is not copied any
  5073. more. By specifying a higher duration, silence that is wanted can be left in
  5074. the audio.
  5075. Default value is @code{0}.
  5076. @item stop_threshold
  5077. This is the same as @option{start_threshold} but for trimming silence from
  5078. the end of audio.
  5079. Can be specified in dB (in case "dB" is appended to the specified value)
  5080. or amplitude ratio. Default value is @code{0}.
  5081. @item stop_silence
  5082. Specify max duration of silence at end that will be kept after
  5083. trimming. Default is 0, which is equal to trimming all samples detected
  5084. as silence.
  5085. @item stop_mode
  5086. Specify mode of detection of silence start after start of multi-channel audio.
  5087. Can be @var{any} or @var{all}. Default is @var{all}.
  5088. With @var{any}, any sample from any channel that is detected as silence
  5089. will trigger start of silence trimming after start of audio stream, limited usage.
  5090. With @var{all}, only if every sample from every channel is detected as silence
  5091. will trigger start of silence trimming after start of audio stream.
  5092. @item detection
  5093. Set how is silence detected.
  5094. @table @option
  5095. @item avg
  5096. Mean of absolute values of samples in moving window.
  5097. @item rms
  5098. Root squared mean of absolute values of samples in moving window.
  5099. @item peak
  5100. Maximum of absolute values of samples in moving window.
  5101. @item median
  5102. Median of absolute values of samples in moving window.
  5103. @item ptp
  5104. Absolute of max peak to min peak difference of samples in moving window.
  5105. @item dev
  5106. Standard deviation of values of samples in moving window.
  5107. @end table
  5108. Default value is @code{rms}.
  5109. @item window
  5110. Set duration in number of seconds used to calculate size of window in number
  5111. of samples for detecting silence. Using @code{0} will effectively disable
  5112. any windowing and use only single sample per channel for silence detection.
  5113. In that case it may be needed to also set @option{start_silence} and/or
  5114. @option{stop_silence} to nonzero values with also @option{start_duration} and/or
  5115. @option{stop_duration} to nonzero values.
  5116. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  5117. @item timestamp
  5118. Set processing mode of every audio frame output timestamp.
  5119. @table @option
  5120. @item write
  5121. Full timestamps rewrite, keep only the start time for the first output frame.
  5122. @item copy
  5123. Non-dropped frames are left with same timestamp as input audio frame.
  5124. @end table
  5125. Defaults value is @code{write}.
  5126. @end table
  5127. @subsection Examples
  5128. @itemize
  5129. @item
  5130. The following example shows how this filter can be used to start a recording
  5131. that does not contain the delay at the start which usually occurs between
  5132. pressing the record button and the start of the performance:
  5133. @example
  5134. silenceremove=start_periods=1:start_duration=5:start_threshold=0.02
  5135. @end example
  5136. @item
  5137. Trim all silence encountered from beginning to end where there is more than 1
  5138. second of silence in audio:
  5139. @example
  5140. silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-90dB
  5141. @end example
  5142. @item
  5143. Trim all digital silence samples, using peak detection, from beginning to end
  5144. where there is more than 0 samples of digital silence in audio and digital
  5145. silence is detected in all channels at same positions in stream:
  5146. @example
  5147. silenceremove=window=0:detection=peak:stop_mode=all:start_mode=all:stop_periods=-1:stop_threshold=0
  5148. @end example
  5149. @item
  5150. Trim every 2nd encountered silence period from beginning to end where there is
  5151. more than 1 second of silence per silence period in audio:
  5152. @example
  5153. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB
  5154. @end example
  5155. @item
  5156. Similar as above, but keep maximum of 0.5 seconds of silence from each trimmed period:
  5157. @example
  5158. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5
  5159. @end example
  5160. @item
  5161. Similar as above, but keep maximum of 1.5 seconds of silence from start of audio:
  5162. @example
  5163. silenceremove=stop_periods=-2:stop_duration=1:stop_threshold=-90dB:stop_silence=0.5:start_periods=1:start_duration=1:start_silence=1.5:stop_threshold=-90dB
  5164. @end example
  5165. @end itemize
  5166. @subsection Commands
  5167. This filter supports some above options as @ref{commands}.
  5168. @section sofalizer
  5169. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  5170. loudspeakers around the user for binaural listening via headphones (audio
  5171. formats up to 9 channels supported).
  5172. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  5173. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  5174. Austrian Academy of Sciences.
  5175. To enable compilation of this filter you need to configure FFmpeg with
  5176. @code{--enable-libmysofa}.
  5177. The filter accepts the following options:
  5178. @table @option
  5179. @item sofa
  5180. Set the SOFA file used for rendering.
  5181. @item gain
  5182. Set gain applied to audio. Value is in dB. Default is 0.
  5183. @item rotation
  5184. Set rotation of virtual loudspeakers in deg. Default is 0.
  5185. @item elevation
  5186. Set elevation of virtual speakers in deg. Default is 0.
  5187. @item radius
  5188. Set distance in meters between loudspeakers and the listener with near-field
  5189. HRTFs. Default is 1.
  5190. @item type
  5191. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  5192. processing audio in time domain which is slow.
  5193. @var{freq} is processing audio in frequency domain which is fast.
  5194. Default is @var{freq}.
  5195. @item speakers
  5196. Set custom positions of virtual loudspeakers. Syntax for this option is:
  5197. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  5198. Each virtual loudspeaker is described with short channel name following with
  5199. azimuth and elevation in degrees.
  5200. Each virtual loudspeaker description is separated by '|'.
  5201. For example to override front left and front right channel positions use:
  5202. 'speakers=FL 45 15|FR 345 15'.
  5203. Descriptions with unrecognised channel names are ignored.
  5204. @item lfegain
  5205. Set custom gain for LFE channels. Value is in dB. Default is 0.
  5206. @item framesize
  5207. Set custom frame size in number of samples. Default is 1024.
  5208. Allowed range is from 1024 to 96000. Only used if option @samp{type}
  5209. is set to @var{freq}.
  5210. @item normalize
  5211. Should all IRs be normalized upon importing SOFA file.
  5212. By default is enabled.
  5213. @item interpolate
  5214. Should nearest IRs be interpolated with neighbor IRs if exact position
  5215. does not match. By default is disabled.
  5216. @item minphase
  5217. Minphase all IRs upon loading of SOFA file. By default is disabled.
  5218. @item anglestep
  5219. Set neighbor search angle step. Only used if option @var{interpolate} is enabled.
  5220. @item radstep
  5221. Set neighbor search radius step. Only used if option @var{interpolate} is enabled.
  5222. @end table
  5223. @subsection Examples
  5224. @itemize
  5225. @item
  5226. Using ClubFritz6 sofa file:
  5227. @example
  5228. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  5229. @end example
  5230. @item
  5231. Using ClubFritz12 sofa file and bigger radius with small rotation:
  5232. @example
  5233. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  5234. @end example
  5235. @item
  5236. Similar as above but with custom speaker positions for front left, front right, back left and back right
  5237. and also with custom gain:
  5238. @example
  5239. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  5240. @end example
  5241. @end itemize
  5242. @section speechnorm
  5243. Speech Normalizer.
  5244. This filter expands or compresses each half-cycle of audio samples
  5245. (local set of samples all above or all below zero and between two nearest zero crossings) depending
  5246. on threshold value, so audio reaches target peak value under conditions controlled by below options.
  5247. The filter accepts the following options:
  5248. @table @option
  5249. @item peak, p
  5250. Set the expansion target peak value. This specifies the highest allowed absolute amplitude
  5251. level for the normalized audio input. Default value is 0.95. Allowed range is from 0.0 to 1.0.
  5252. @item expansion, e
  5253. Set the maximum expansion factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5254. This option controls maximum local half-cycle of samples expansion. The maximum expansion
  5255. would be such that local peak value reaches target peak value but never to surpass it and that
  5256. ratio between new and previous peak value does not surpass this option value.
  5257. @item compression, c
  5258. Set the maximum compression factor. Allowed range is from 1.0 to 50.0. Default value is 2.0.
  5259. This option controls maximum local half-cycle of samples compression. This option is used
  5260. only if @option{threshold} option is set to value greater than 0.0, then in such cases
  5261. when local peak is lower or same as value set by @option{threshold} all samples belonging to
  5262. that peak's half-cycle will be compressed by current compression factor.
  5263. @item threshold, t
  5264. Set the threshold value. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  5265. This option specifies which half-cycles of samples will be compressed and which will be expanded.
  5266. Any half-cycle samples with their local peak value below or same as this option value will be
  5267. compressed by current compression factor, otherwise, if greater than threshold value they will be
  5268. expanded with expansion factor so that it could reach peak target value but never surpass it.
  5269. @item raise, r
  5270. Set the expansion raising amount per each half-cycle of samples. Default value is 0.001.
  5271. Allowed range is from 0.0 to 1.0. This controls how fast expansion factor is raised per
  5272. each new half-cycle until it reaches @option{expansion} value.
  5273. Setting this options too high may lead to distortions.
  5274. @item fall, f
  5275. Set the compression raising amount per each half-cycle of samples. Default value is 0.001.
  5276. Allowed range is from 0.0 to 1.0. This controls how fast compression factor is raised per
  5277. each new half-cycle until it reaches @option{compression} value.
  5278. @item channels, h
  5279. Specify which channels to filter, by default all available channels are filtered.
  5280. @item invert, i
  5281. Enable inverted filtering, by default is disabled. This inverts interpretation of @option{threshold}
  5282. option. When enabled any half-cycle of samples with their local peak value below or same as
  5283. @option{threshold} option will be expanded otherwise it will be compressed.
  5284. @item link, l
  5285. Link channels when calculating gain applied to each filtered channel sample, by default is disabled.
  5286. When disabled each filtered channel gain calculation is independent, otherwise when this option
  5287. is enabled the minimum of all possible gains for each filtered channel is used.
  5288. @item rms, m
  5289. Set the expansion target RMS value. This specifies the highest allowed RMS level for the normalized
  5290. audio input. Default value is 0.0, thus disabled. Allowed range is from 0.0 to 1.0.
  5291. @end table
  5292. @subsection Commands
  5293. This filter supports the all above options as @ref{commands}.
  5294. @subsection Examples
  5295. @itemize
  5296. @item
  5297. Weak and slow amplification:
  5298. @example
  5299. speechnorm=e=3:r=0.00001:l=1
  5300. @end example
  5301. @item
  5302. Moderate and slow amplification:
  5303. @example
  5304. speechnorm=e=6.25:r=0.00001:l=1
  5305. @end example
  5306. @item
  5307. Strong and fast amplification:
  5308. @example
  5309. speechnorm=e=12.5:r=0.0001:l=1
  5310. @end example
  5311. @item
  5312. Very strong and fast amplification:
  5313. @example
  5314. speechnorm=e=25:r=0.0001:l=1
  5315. @end example
  5316. @item
  5317. Extreme and fast amplification:
  5318. @example
  5319. speechnorm=e=50:r=0.0001:l=1
  5320. @end example
  5321. @end itemize
  5322. @section stereotools
  5323. This filter has some handy utilities to manage stereo signals, for converting
  5324. M/S stereo recordings to L/R signal while having control over the parameters
  5325. or spreading the stereo image of master track.
  5326. The filter accepts the following options:
  5327. @table @option
  5328. @item level_in
  5329. Set input level before filtering for both channels. Defaults is 1.
  5330. Allowed range is from 0.015625 to 64.
  5331. @item level_out
  5332. Set output level after filtering for both channels. Defaults is 1.
  5333. Allowed range is from 0.015625 to 64.
  5334. @item balance_in
  5335. Set input balance between both channels. Default is 0.
  5336. Allowed range is from -1 to 1.
  5337. @item balance_out
  5338. Set output balance between both channels. Default is 0.
  5339. Allowed range is from -1 to 1.
  5340. @item softclip
  5341. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  5342. clipping. Disabled by default.
  5343. @item mutel
  5344. Mute the left channel. Disabled by default.
  5345. @item muter
  5346. Mute the right channel. Disabled by default.
  5347. @item phasel
  5348. Change the phase of the left channel. Disabled by default.
  5349. @item phaser
  5350. Change the phase of the right channel. Disabled by default.
  5351. @item mode
  5352. Set stereo mode. Available values are:
  5353. @table @samp
  5354. @item lr>lr
  5355. Left/Right to Left/Right, this is default.
  5356. @item lr>ms
  5357. Left/Right to Mid/Side.
  5358. @item ms>lr
  5359. Mid/Side to Left/Right.
  5360. @item lr>ll
  5361. Left/Right to Left/Left.
  5362. @item lr>rr
  5363. Left/Right to Right/Right.
  5364. @item lr>l+r
  5365. Left/Right to Left + Right.
  5366. @item lr>rl
  5367. Left/Right to Right/Left.
  5368. @item ms>ll
  5369. Mid/Side to Left/Left.
  5370. @item ms>rr
  5371. Mid/Side to Right/Right.
  5372. @item ms>rl
  5373. Mid/Side to Right/Left.
  5374. @item lr>l-r
  5375. Left/Right to Left - Right.
  5376. @end table
  5377. @item slev
  5378. Set level of side signal. Default is 1.
  5379. Allowed range is from 0.015625 to 64.
  5380. @item sbal
  5381. Set balance of side signal. Default is 0.
  5382. Allowed range is from -1 to 1.
  5383. @item mlev
  5384. Set level of the middle signal. Default is 1.
  5385. Allowed range is from 0.015625 to 64.
  5386. @item mpan
  5387. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  5388. @item base
  5389. Set stereo base between mono and inversed channels. Default is 0.
  5390. Allowed range is from -1 to 1.
  5391. @item delay
  5392. Set delay in milliseconds how much to delay left from right channel and
  5393. vice versa. Default is 0. Allowed range is from -20 to 20.
  5394. @item sclevel
  5395. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  5396. @item phase
  5397. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  5398. @item bmode_in, bmode_out
  5399. Set balance mode for balance_in/balance_out option.
  5400. Can be one of the following:
  5401. @table @samp
  5402. @item balance
  5403. Classic balance mode. Attenuate one channel at time.
  5404. Gain is raised up to 1.
  5405. @item amplitude
  5406. Similar as classic mode above but gain is raised up to 2.
  5407. @item power
  5408. Equal power distribution, from -6dB to +6dB range.
  5409. @end table
  5410. @end table
  5411. @subsection Commands
  5412. This filter supports the all above options as @ref{commands}.
  5413. @subsection Examples
  5414. @itemize
  5415. @item
  5416. Apply karaoke like effect:
  5417. @example
  5418. stereotools=mlev=0.015625
  5419. @end example
  5420. @item
  5421. Convert M/S signal to L/R:
  5422. @example
  5423. "stereotools=mode=ms>lr"
  5424. @end example
  5425. @end itemize
  5426. @section stereowiden
  5427. This filter enhance the stereo effect by suppressing signal common to both
  5428. channels and by delaying the signal of left into right and vice versa,
  5429. thereby widening the stereo effect.
  5430. The filter accepts the following options:
  5431. @table @option
  5432. @item delay
  5433. Time in milliseconds of the delay of left signal into right and vice versa.
  5434. Default is 20 milliseconds.
  5435. @item feedback
  5436. Amount of gain in delayed signal into right and vice versa. Gives a delay
  5437. effect of left signal in right output and vice versa which gives widening
  5438. effect. Default is 0.3.
  5439. @item crossfeed
  5440. Cross feed of left into right with inverted phase. This helps in suppressing
  5441. the mono. If the value is 1 it will cancel all the signal common to both
  5442. channels. Default is 0.3.
  5443. @item drymix
  5444. Set level of input signal of original channel. Default is 0.8.
  5445. @end table
  5446. @subsection Commands
  5447. This filter supports the all above options except @code{delay} as @ref{commands}.
  5448. @section superequalizer
  5449. Apply 18 band equalizer.
  5450. The filter accepts the following options:
  5451. @table @option
  5452. @item 1b
  5453. Set 65Hz band gain.
  5454. @item 2b
  5455. Set 92Hz band gain.
  5456. @item 3b
  5457. Set 131Hz band gain.
  5458. @item 4b
  5459. Set 185Hz band gain.
  5460. @item 5b
  5461. Set 262Hz band gain.
  5462. @item 6b
  5463. Set 370Hz band gain.
  5464. @item 7b
  5465. Set 523Hz band gain.
  5466. @item 8b
  5467. Set 740Hz band gain.
  5468. @item 9b
  5469. Set 1047Hz band gain.
  5470. @item 10b
  5471. Set 1480Hz band gain.
  5472. @item 11b
  5473. Set 2093Hz band gain.
  5474. @item 12b
  5475. Set 2960Hz band gain.
  5476. @item 13b
  5477. Set 4186Hz band gain.
  5478. @item 14b
  5479. Set 5920Hz band gain.
  5480. @item 15b
  5481. Set 8372Hz band gain.
  5482. @item 16b
  5483. Set 11840Hz band gain.
  5484. @item 17b
  5485. Set 16744Hz band gain.
  5486. @item 18b
  5487. Set 20000Hz band gain.
  5488. @end table
  5489. @section surround
  5490. Apply audio surround upmix filter.
  5491. This filter allows to produce multichannel output from audio stream.
  5492. The filter accepts the following options:
  5493. @table @option
  5494. @item chl_out
  5495. Set output channel layout. By default, this is @var{5.1}.
  5496. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5497. for the required syntax.
  5498. @item chl_in
  5499. Set input channel layout. By default, this is @var{stereo}.
  5500. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  5501. for the required syntax.
  5502. @item level_in
  5503. Set input volume level. By default, this is @var{1}.
  5504. @item level_out
  5505. Set output volume level. By default, this is @var{1}.
  5506. @item lfe
  5507. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  5508. @item lfe_low
  5509. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  5510. @item lfe_high
  5511. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  5512. @item lfe_mode
  5513. Set LFE mode, can be @var{add} or @var{sub}. Default is @var{add}.
  5514. In @var{add} mode, LFE channel is created from input audio and added to output.
  5515. In @var{sub} mode, LFE channel is created from input audio and added to output but
  5516. also all non-LFE output channels are subtracted with output LFE channel.
  5517. @item smooth
  5518. Set temporal smoothness strength, used to gradually change factors when transforming
  5519. stereo sound in time. Allowed range is from @var{0.0} to @var{1.0}.
  5520. Useful to improve output quality with @var{focus} option values greater than @var{0.0}.
  5521. Default is @var{0.0}. Only values inside this range and without edges are effective.
  5522. @item angle
  5523. Set angle of stereo surround transform, Allowed range is from @var{0} to @var{360}.
  5524. Default is @var{90}.
  5525. @item focus
  5526. Set focus of stereo surround transform, Allowed range is from @var{-1} to @var{1}.
  5527. Default is @var{0}.
  5528. @item fc_in
  5529. Set front center input volume. By default, this is @var{1}.
  5530. @item fc_out
  5531. Set front center output volume. By default, this is @var{1}.
  5532. @item fl_in
  5533. Set front left input volume. By default, this is @var{1}.
  5534. @item fl_out
  5535. Set front left output volume. By default, this is @var{1}.
  5536. @item fr_in
  5537. Set front right input volume. By default, this is @var{1}.
  5538. @item fr_out
  5539. Set front right output volume. By default, this is @var{1}.
  5540. @item sl_in
  5541. Set side left input volume. By default, this is @var{1}.
  5542. @item sl_out
  5543. Set side left output volume. By default, this is @var{1}.
  5544. @item sr_in
  5545. Set side right input volume. By default, this is @var{1}.
  5546. @item sr_out
  5547. Set side right output volume. By default, this is @var{1}.
  5548. @item bl_in
  5549. Set back left input volume. By default, this is @var{1}.
  5550. @item bl_out
  5551. Set back left output volume. By default, this is @var{1}.
  5552. @item br_in
  5553. Set back right input volume. By default, this is @var{1}.
  5554. @item br_out
  5555. Set back right output volume. By default, this is @var{1}.
  5556. @item bc_in
  5557. Set back center input volume. By default, this is @var{1}.
  5558. @item bc_out
  5559. Set back center output volume. By default, this is @var{1}.
  5560. @item lfe_in
  5561. Set LFE input volume. By default, this is @var{1}.
  5562. @item lfe_out
  5563. Set LFE output volume. By default, this is @var{1}.
  5564. @item allx
  5565. Set spread usage of stereo image across X axis for all channels.
  5566. Allowed range is from @var{-1} to @var{15}.
  5567. By default this value is negative @var{-1}, and thus unused.
  5568. @item ally
  5569. Set spread usage of stereo image across Y axis for all channels.
  5570. Allowed range is from @var{-1} to @var{15}.
  5571. By default this value is negative @var{-1}, and thus unused.
  5572. @item fcx, flx, frx, blx, brx, slx, srx, bcx
  5573. Set spread usage of stereo image across X axis for each channel.
  5574. Allowed range is from @var{0.06} to @var{15}.
  5575. By default this value is @var{0.5}.
  5576. @item fcy, fly, fry, bly, bry, sly, sry, bcy
  5577. Set spread usage of stereo image across Y axis for each channel.
  5578. Allowed range is from @var{0.06} to @var{15}.
  5579. By default this value is @var{0.5}.
  5580. @item win_size
  5581. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  5582. @item win_func
  5583. Set window function.
  5584. It accepts the following values:
  5585. @table @samp
  5586. @item rect
  5587. @item bartlett
  5588. @item hann, hanning
  5589. @item hamming
  5590. @item blackman
  5591. @item welch
  5592. @item flattop
  5593. @item bharris
  5594. @item bnuttall
  5595. @item bhann
  5596. @item sine
  5597. @item nuttall
  5598. @item lanczos
  5599. @item gauss
  5600. @item tukey
  5601. @item dolph
  5602. @item cauchy
  5603. @item parzen
  5604. @item poisson
  5605. @item bohman
  5606. @item kaiser
  5607. @end table
  5608. Default is @code{hann}.
  5609. @item overlap
  5610. Set window overlap. If set to 1, the recommended overlap for selected
  5611. window function will be picked. Default is @code{0.5}.
  5612. @end table
  5613. @section tiltshelf
  5614. Boost or cut the lower frequencies and cut or boost higher frequencies
  5615. of the audio using a two-pole shelving filter with a response similar to
  5616. that of a standard hi-fi's tone-controls.
  5617. This is also known as shelving equalisation (EQ).
  5618. The filter accepts the following options:
  5619. @table @option
  5620. @item gain, g
  5621. Give the gain at 0 Hz. Its useful range is about -20
  5622. (for a large cut) to +20 (for a large boost).
  5623. Beware of clipping when using a positive gain.
  5624. @item frequency, f
  5625. Set the filter's central frequency and so can be used
  5626. to extend or reduce the frequency range to be boosted or cut.
  5627. The default value is @code{3000} Hz.
  5628. @item width_type, t
  5629. Set method to specify band-width of filter.
  5630. @table @option
  5631. @item h
  5632. Hz
  5633. @item q
  5634. Q-Factor
  5635. @item o
  5636. octave
  5637. @item s
  5638. slope
  5639. @item k
  5640. kHz
  5641. @end table
  5642. @item width, w
  5643. Determine how steep is the filter's shelf transition.
  5644. @item poles, p
  5645. Set number of poles. Default is 2.
  5646. @item mix, m
  5647. How much to use filtered signal in output. Default is 1.
  5648. Range is between 0 and 1.
  5649. @item channels, c
  5650. Specify which channels to filter, by default all available are filtered.
  5651. @item normalize, n
  5652. Normalize biquad coefficients, by default is disabled.
  5653. Enabling it will normalize magnitude response at DC to 0dB.
  5654. @item transform, a
  5655. Set transform type of IIR filter.
  5656. @table @option
  5657. @item di
  5658. @item dii
  5659. @item tdi
  5660. @item tdii
  5661. @item latt
  5662. @item svf
  5663. @item zdf
  5664. @end table
  5665. @item precision, r
  5666. Set precision of filtering.
  5667. @table @option
  5668. @item auto
  5669. Pick automatic sample format depending on surround filters.
  5670. @item s16
  5671. Always use signed 16-bit.
  5672. @item s32
  5673. Always use signed 32-bit.
  5674. @item f32
  5675. Always use float 32-bit.
  5676. @item f64
  5677. Always use float 64-bit.
  5678. @end table
  5679. @item block_size, b
  5680. Set block size used for reverse IIR processing. If this value is set to high enough
  5681. value (higher than impulse response length truncated when reaches near zero values) filtering
  5682. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5683. Note that filter delay will be exactly this many samples when set to non-zero value.
  5684. @end table
  5685. @subsection Commands
  5686. This filter supports some options as @ref{commands}.
  5687. @section treble, highshelf
  5688. Boost or cut treble (upper) frequencies of the audio using a two-pole
  5689. shelving filter with a response similar to that of a standard
  5690. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  5691. The filter accepts the following options:
  5692. @table @option
  5693. @item gain, g
  5694. Give the gain at whichever is the lower of ~22 kHz and the
  5695. Nyquist frequency. Its useful range is about -20 (for a large cut)
  5696. to +20 (for a large boost). Beware of clipping when using a positive gain.
  5697. @item frequency, f
  5698. Set the filter's central frequency and so can be used
  5699. to extend or reduce the frequency range to be boosted or cut.
  5700. The default value is @code{3000} Hz.
  5701. @item width_type, t
  5702. Set method to specify band-width of filter.
  5703. @table @option
  5704. @item h
  5705. Hz
  5706. @item q
  5707. Q-Factor
  5708. @item o
  5709. octave
  5710. @item s
  5711. slope
  5712. @item k
  5713. kHz
  5714. @end table
  5715. @item width, w
  5716. Determine how steep is the filter's shelf transition.
  5717. @item poles, p
  5718. Set number of poles. Default is 2.
  5719. @item mix, m
  5720. How much to use filtered signal in output. Default is 1.
  5721. Range is between 0 and 1.
  5722. @item channels, c
  5723. Specify which channels to filter, by default all available are filtered.
  5724. @item normalize, n
  5725. Normalize biquad coefficients, by default is disabled.
  5726. Enabling it will normalize magnitude response at DC to 0dB.
  5727. @item transform, a
  5728. Set transform type of IIR filter.
  5729. @table @option
  5730. @item di
  5731. @item dii
  5732. @item tdi
  5733. @item tdii
  5734. @item latt
  5735. @item svf
  5736. @item zdf
  5737. @end table
  5738. @item precision, r
  5739. Set precision of filtering.
  5740. @table @option
  5741. @item auto
  5742. Pick automatic sample format depending on surround filters.
  5743. @item s16
  5744. Always use signed 16-bit.
  5745. @item s32
  5746. Always use signed 32-bit.
  5747. @item f32
  5748. Always use float 32-bit.
  5749. @item f64
  5750. Always use float 64-bit.
  5751. @end table
  5752. @item block_size, b
  5753. Set block size used for reverse IIR processing. If this value is set to high enough
  5754. value (higher than impulse response length truncated when reaches near zero values) filtering
  5755. will become linear phase otherwise if not big enough it will just produce nasty artifacts.
  5756. Note that filter delay will be exactly this many samples when set to non-zero value.
  5757. @end table
  5758. @subsection Commands
  5759. This filter supports the following commands:
  5760. @table @option
  5761. @item frequency, f
  5762. Change treble frequency.
  5763. Syntax for the command is : "@var{frequency}"
  5764. @item width_type, t
  5765. Change treble width_type.
  5766. Syntax for the command is : "@var{width_type}"
  5767. @item width, w
  5768. Change treble width.
  5769. Syntax for the command is : "@var{width}"
  5770. @item gain, g
  5771. Change treble gain.
  5772. Syntax for the command is : "@var{gain}"
  5773. @item mix, m
  5774. Change treble mix.
  5775. Syntax for the command is : "@var{mix}"
  5776. @end table
  5777. @section tremolo
  5778. Sinusoidal amplitude modulation.
  5779. The filter accepts the following options:
  5780. @table @option
  5781. @item f
  5782. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  5783. (20 Hz or lower) will result in a tremolo effect.
  5784. This filter may also be used as a ring modulator by specifying
  5785. a modulation frequency higher than 20 Hz.
  5786. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5787. @item d
  5788. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5789. Default value is 0.5.
  5790. @end table
  5791. @section vibrato
  5792. Sinusoidal phase modulation.
  5793. The filter accepts the following options:
  5794. @table @option
  5795. @item f
  5796. Modulation frequency in Hertz.
  5797. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  5798. @item d
  5799. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  5800. Default value is 0.5.
  5801. @end table
  5802. @section virtualbass
  5803. Apply audio Virtual Bass filter.
  5804. This filter accepts stereo input and produce stereo with LFE (2.1) channels output.
  5805. The newly produced LFE channel have enhanced virtual bass originally obtained from both stereo channels.
  5806. This filter outputs front left and front right channels unchanged as available in stereo input.
  5807. The filter accepts the following options:
  5808. @table @option
  5809. @item cutoff
  5810. Set the virtual bass cutoff frequency. Default value is 250 Hz.
  5811. Allowed range is from 100 to 500 Hz.
  5812. @item strength
  5813. Set the virtual bass strength. Allowed range is from 0.5 to 3.
  5814. Default value is 3.
  5815. @end table
  5816. @section volume
  5817. Adjust the input audio volume.
  5818. It accepts the following parameters:
  5819. @table @option
  5820. @item volume
  5821. Set audio volume expression.
  5822. Output values are clipped to the maximum value.
  5823. The output audio volume is given by the relation:
  5824. @example
  5825. @var{output_volume} = @var{volume} * @var{input_volume}
  5826. @end example
  5827. The default value for @var{volume} is "1.0".
  5828. @item precision
  5829. This parameter represents the mathematical precision.
  5830. It determines which input sample formats will be allowed, which affects the
  5831. precision of the volume scaling.
  5832. @table @option
  5833. @item fixed
  5834. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  5835. @item float
  5836. 32-bit floating-point; this limits input sample format to FLT. (default)
  5837. @item double
  5838. 64-bit floating-point; this limits input sample format to DBL.
  5839. @end table
  5840. @item replaygain
  5841. Choose the behaviour on encountering ReplayGain side data in input frames.
  5842. @table @option
  5843. @item drop
  5844. Remove ReplayGain side data, ignoring its contents (the default).
  5845. @item ignore
  5846. Ignore ReplayGain side data, but leave it in the frame.
  5847. @item track
  5848. Prefer the track gain, if present.
  5849. @item album
  5850. Prefer the album gain, if present.
  5851. @end table
  5852. @item replaygain_preamp
  5853. Pre-amplification gain in dB to apply to the selected replaygain gain.
  5854. Default value for @var{replaygain_preamp} is 0.0.
  5855. @item replaygain_noclip
  5856. Prevent clipping by limiting the gain applied.
  5857. Default value for @var{replaygain_noclip} is 1.
  5858. @item eval
  5859. Set when the volume expression is evaluated.
  5860. It accepts the following values:
  5861. @table @samp
  5862. @item once
  5863. only evaluate expression once during the filter initialization, or
  5864. when the @samp{volume} command is sent
  5865. @item frame
  5866. evaluate expression for each incoming frame
  5867. @end table
  5868. Default value is @samp{once}.
  5869. @end table
  5870. The volume expression can contain the following parameters.
  5871. @table @option
  5872. @item n
  5873. frame number (starting at zero)
  5874. @item nb_channels
  5875. number of channels
  5876. @item nb_consumed_samples
  5877. number of samples consumed by the filter
  5878. @item nb_samples
  5879. number of samples in the current frame
  5880. @item pos
  5881. original frame position in the file; deprecated, do not use
  5882. @item pts
  5883. frame PTS
  5884. @item sample_rate
  5885. sample rate
  5886. @item startpts
  5887. PTS at start of stream
  5888. @item startt
  5889. time at start of stream
  5890. @item t
  5891. frame time
  5892. @item tb
  5893. timestamp timebase
  5894. @item volume
  5895. last set volume value
  5896. @end table
  5897. Note that when @option{eval} is set to @samp{once} only the
  5898. @var{sample_rate} and @var{tb} variables are available, all other
  5899. variables will evaluate to NAN.
  5900. @subsection Commands
  5901. This filter supports the following commands:
  5902. @table @option
  5903. @item volume
  5904. Modify the volume expression.
  5905. The command accepts the same syntax of the corresponding option.
  5906. If the specified expression is not valid, it is kept at its current
  5907. value.
  5908. @end table
  5909. @subsection Examples
  5910. @itemize
  5911. @item
  5912. Halve the input audio volume:
  5913. @example
  5914. volume=volume=0.5
  5915. volume=volume=1/2
  5916. volume=volume=-6.0206dB
  5917. @end example
  5918. In all the above example the named key for @option{volume} can be
  5919. omitted, for example like in:
  5920. @example
  5921. volume=0.5
  5922. @end example
  5923. @item
  5924. Increase input audio power by 6 decibels using fixed-point precision:
  5925. @example
  5926. volume=volume=6dB:precision=fixed
  5927. @end example
  5928. @item
  5929. Fade volume after time 10 with an annihilation period of 5 seconds:
  5930. @example
  5931. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  5932. @end example
  5933. @end itemize
  5934. @section volumedetect
  5935. Detect the volume of the input video.
  5936. The filter has no parameters. It supports only 16-bit signed integer samples,
  5937. so the input will be converted when needed. Statistics about the volume will
  5938. be printed in the log when the input stream end is reached.
  5939. In particular it will show the mean volume (root mean square), maximum
  5940. volume (on a per-sample basis), and the beginning of a histogram of the
  5941. registered volume values (from the maximum value to a cumulated 1/1000 of
  5942. the samples).
  5943. All volumes are in decibels relative to the maximum PCM value.
  5944. @subsection Examples
  5945. Here is an excerpt of the output:
  5946. @example
  5947. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  5948. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  5949. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  5950. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  5951. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  5952. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  5953. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  5954. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  5955. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  5956. @end example
  5957. It means that:
  5958. @itemize
  5959. @item
  5960. The mean square energy is approximately -27 dB, or 10^-2.7.
  5961. @item
  5962. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  5963. @item
  5964. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  5965. @end itemize
  5966. In other words, raising the volume by +4 dB does not cause any clipping,
  5967. raising it by +5 dB causes clipping for 6 samples, etc.
  5968. @c man end AUDIO FILTERS
  5969. @chapter Audio Sources
  5970. @c man begin AUDIO SOURCES
  5971. Below is a description of the currently available audio sources.
  5972. @section abuffer
  5973. Buffer audio frames, and make them available to the filter chain.
  5974. This source is mainly intended for a programmatic use, in particular
  5975. through the interface defined in @file{libavfilter/buffersrc.h}.
  5976. It accepts the following parameters:
  5977. @table @option
  5978. @item time_base
  5979. The timebase which will be used for timestamps of submitted frames. It must be
  5980. either a floating-point number or in @var{numerator}/@var{denominator} form.
  5981. @item sample_rate
  5982. The sample rate of the incoming audio buffers.
  5983. @item sample_fmt
  5984. The sample format of the incoming audio buffers.
  5985. Either a sample format name or its corresponding integer representation from
  5986. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  5987. @item channel_layout
  5988. The channel layout of the incoming audio buffers.
  5989. Either a channel layout name from channel_layout_map in
  5990. @file{libavutil/channel_layout.c} or its corresponding integer representation
  5991. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  5992. @item channels
  5993. The number of channels of the incoming audio buffers.
  5994. If both @var{channels} and @var{channel_layout} are specified, then they
  5995. must be consistent.
  5996. @end table
  5997. @subsection Examples
  5998. @example
  5999. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  6000. @end example
  6001. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  6002. Since the sample format with name "s16p" corresponds to the number
  6003. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  6004. equivalent to:
  6005. @example
  6006. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  6007. @end example
  6008. @section aevalsrc
  6009. Generate an audio signal specified by an expression.
  6010. This source accepts in input one or more expressions (one for each
  6011. channel), which are evaluated and used to generate a corresponding
  6012. audio signal.
  6013. This source accepts the following options:
  6014. @table @option
  6015. @item exprs
  6016. Set the '|'-separated expressions list for each separate channel. In case the
  6017. @option{channel_layout} option is not specified, the selected channel layout
  6018. depends on the number of provided expressions. Otherwise the last
  6019. specified expression is applied to the remaining output channels.
  6020. @item channel_layout, c
  6021. Set the channel layout. The number of channels in the specified layout
  6022. must be equal to the number of specified expressions.
  6023. @item duration, d
  6024. Set the minimum duration of the sourced audio. See
  6025. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6026. for the accepted syntax.
  6027. Note that the resulting duration may be greater than the specified
  6028. duration, as the generated audio is always cut at the end of a
  6029. complete frame.
  6030. If not specified, or the expressed duration is negative, the audio is
  6031. supposed to be generated forever.
  6032. @item nb_samples, n
  6033. Set the number of samples per channel per each output frame,
  6034. default to 1024.
  6035. @item sample_rate, s
  6036. Specify the sample rate, default to 44100.
  6037. @end table
  6038. Each expression in @var{exprs} can contain the following constants:
  6039. @table @option
  6040. @item n
  6041. number of the evaluated sample, starting from 0
  6042. @item t
  6043. time of the evaluated sample expressed in seconds, starting from 0
  6044. @item s
  6045. sample rate
  6046. @end table
  6047. @subsection Examples
  6048. @itemize
  6049. @item
  6050. Generate silence:
  6051. @example
  6052. aevalsrc=0
  6053. @end example
  6054. @item
  6055. Generate a sin signal with frequency of 440 Hz, set sample rate to
  6056. 8000 Hz:
  6057. @example
  6058. aevalsrc="sin(440*2*PI*t):s=8000"
  6059. @end example
  6060. @item
  6061. Generate a two channels signal, specify the channel layout (Front
  6062. Center + Back Center) explicitly:
  6063. @example
  6064. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  6065. @end example
  6066. @item
  6067. Generate white noise:
  6068. @example
  6069. aevalsrc="-2+random(0)"
  6070. @end example
  6071. @item
  6072. Generate an amplitude modulated signal:
  6073. @example
  6074. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  6075. @end example
  6076. @item
  6077. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  6078. @example
  6079. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  6080. @end example
  6081. @end itemize
  6082. @section afdelaysrc
  6083. Generate a fractional delay FIR coefficients.
  6084. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6085. The filter accepts the following options:
  6086. @table @option
  6087. @item delay, d
  6088. Set the fractional delay. Default is 0.
  6089. @item sample_rate, r
  6090. Set the sample rate, default is 44100.
  6091. @item nb_samples, n
  6092. Set the number of samples per each frame. Default is 1024.
  6093. @item taps, t
  6094. Set the number of filter coefficients in output audio stream.
  6095. Default value is 0.
  6096. @item channel_layout, c
  6097. Specifies the channel layout, and can be a string representing a channel layout.
  6098. The default value of @var{channel_layout} is "stereo".
  6099. @end table
  6100. @section afireqsrc
  6101. Generate a FIR equalizer coefficients.
  6102. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6103. The filter accepts the following options:
  6104. @table @option
  6105. @item preset, p
  6106. Set equalizer preset.
  6107. Default preset is @code{flat}.
  6108. Available presets are:
  6109. @table @samp
  6110. @item custom
  6111. @item flat
  6112. @item acoustic
  6113. @item bass
  6114. @item beats
  6115. @item classic
  6116. @item clear
  6117. @item deep bass
  6118. @item dubstep
  6119. @item electronic
  6120. @item hard-style
  6121. @item hip-hop
  6122. @item jazz
  6123. @item metal
  6124. @item movie
  6125. @item pop
  6126. @item r&b
  6127. @item rock
  6128. @item vocal booster
  6129. @end table
  6130. @item gains, g
  6131. Set custom gains for each band. Only used if the preset option is set to @code{custom}.
  6132. Gains are separated by white spaces and each gain is set in dBFS.
  6133. Default is @code{0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}.
  6134. @item bands, b
  6135. Set the custom bands from where custon equalizer gains are set.
  6136. This must be in strictly increasing order. Only used if the preset option is set to @code{custom}.
  6137. Bands are separated by white spaces and each band represent frequency in Hz.
  6138. Default is @code{25 40 63 100 160 250 400 630 1000 1600 2500 4000 6300 10000 16000 24000}.
  6139. @item taps, t
  6140. Set number of filter coefficients in output audio stream.
  6141. Default value is @code{4096}.
  6142. @item sample_rate, r
  6143. Set sample rate of output audio stream, default is @code{44100}.
  6144. @item nb_samples, n
  6145. Set number of samples per each frame in output audio stream. Default is @code{1024}.
  6146. @item interp, i
  6147. Set interpolation method for FIR equalizer coefficients. Can be @code{linear} or @code{cubic}.
  6148. @item phase, h
  6149. Set phase type of FIR filter. Can be @code{linear} or @code{min}: minimum-phase.
  6150. Default is minimum-phase filter.
  6151. @end table
  6152. @section afirsrc
  6153. Generate a FIR coefficients using frequency sampling method.
  6154. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6155. The filter accepts the following options:
  6156. @table @option
  6157. @item taps, t
  6158. Set number of filter coefficients in output audio stream.
  6159. Default value is 1025.
  6160. @item frequency, f
  6161. Set frequency points from where magnitude and phase are set.
  6162. This must be in non decreasing order, and first element must be 0, while last element
  6163. must be 1. Elements are separated by white spaces.
  6164. @item magnitude, m
  6165. Set magnitude value for every frequency point set by @option{frequency}.
  6166. Number of values must be same as number of frequency points.
  6167. Values are separated by white spaces.
  6168. @item phase, p
  6169. Set phase value for every frequency point set by @option{frequency}.
  6170. Number of values must be same as number of frequency points.
  6171. Values are separated by white spaces.
  6172. @item sample_rate, r
  6173. Set sample rate, default is 44100.
  6174. @item nb_samples, n
  6175. Set number of samples per each frame. Default is 1024.
  6176. @item win_func, w
  6177. Set window function. Default is blackman.
  6178. @end table
  6179. @section anullsrc
  6180. The null audio source, return unprocessed audio frames. It is mainly useful
  6181. as a template and to be employed in analysis / debugging tools, or as
  6182. the source for filters which ignore the input data (for example the sox
  6183. synth filter).
  6184. This source accepts the following options:
  6185. @table @option
  6186. @item channel_layout, cl
  6187. Specifies the channel layout, and can be either an integer or a string
  6188. representing a channel layout. The default value of @var{channel_layout}
  6189. is "stereo".
  6190. Check the channel_layout_map definition in
  6191. @file{libavutil/channel_layout.c} for the mapping between strings and
  6192. channel layout values.
  6193. @item sample_rate, r
  6194. Specifies the sample rate, and defaults to 44100.
  6195. @item nb_samples, n
  6196. Set the number of samples per requested frames.
  6197. @item duration, d
  6198. Set the duration of the sourced audio. See
  6199. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  6200. for the accepted syntax.
  6201. If not specified, or the expressed duration is negative, the audio is
  6202. supposed to be generated forever.
  6203. @end table
  6204. @subsection Examples
  6205. @itemize
  6206. @item
  6207. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  6208. @example
  6209. anullsrc=r=48000:cl=4
  6210. @end example
  6211. @item
  6212. Do the same operation with a more obvious syntax:
  6213. @example
  6214. anullsrc=r=48000:cl=mono
  6215. @end example
  6216. @end itemize
  6217. All the parameters need to be explicitly defined.
  6218. @section flite
  6219. Synthesize a voice utterance using the libflite library.
  6220. To enable compilation of this filter you need to configure FFmpeg with
  6221. @code{--enable-libflite}.
  6222. Note that versions of the flite library prior to 2.0 are not thread-safe.
  6223. The filter accepts the following options:
  6224. @table @option
  6225. @item list_voices
  6226. If set to 1, list the names of the available voices and exit
  6227. immediately. Default value is 0.
  6228. @item nb_samples, n
  6229. Set the maximum number of samples per frame. Default value is 512.
  6230. @item textfile
  6231. Set the filename containing the text to speak.
  6232. @item text
  6233. Set the text to speak.
  6234. @item voice, v
  6235. Set the voice to use for the speech synthesis. Default value is
  6236. @code{kal}. See also the @var{list_voices} option.
  6237. @end table
  6238. @subsection Examples
  6239. @itemize
  6240. @item
  6241. Read from file @file{speech.txt}, and synthesize the text using the
  6242. standard flite voice:
  6243. @example
  6244. flite=textfile=speech.txt
  6245. @end example
  6246. @item
  6247. Read the specified text selecting the @code{slt} voice:
  6248. @example
  6249. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6250. @end example
  6251. @item
  6252. Input text to ffmpeg:
  6253. @example
  6254. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  6255. @end example
  6256. @item
  6257. Make @file{ffplay} speak the specified text, using @code{flite} and
  6258. the @code{lavfi} device:
  6259. @example
  6260. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  6261. @end example
  6262. @end itemize
  6263. For more information about libflite, check:
  6264. @url{http://www.festvox.org/flite/}
  6265. @section anoisesrc
  6266. Generate a noise audio signal.
  6267. The filter accepts the following options:
  6268. @table @option
  6269. @item sample_rate, r
  6270. Specify the sample rate. Default value is 48000 Hz.
  6271. @item amplitude, a
  6272. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  6273. is 1.0.
  6274. @item duration, d
  6275. Specify the duration of the generated audio stream. Not specifying this option
  6276. results in noise with an infinite length.
  6277. @item color, colour, c
  6278. Specify the color of noise. Available noise colors are white, pink, brown,
  6279. blue, violet and velvet. Default color is white.
  6280. @item seed, s
  6281. Specify a value used to seed the PRNG.
  6282. @item nb_samples, n
  6283. Set the number of samples per each output frame, default is 1024.
  6284. @item density
  6285. Set the density (0.0 - 1.0) for the velvet noise generator, default is 0.05.
  6286. @end table
  6287. @subsection Examples
  6288. @itemize
  6289. @item
  6290. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  6291. @example
  6292. anoisesrc=d=60:c=pink:r=44100:a=0.5
  6293. @end example
  6294. @end itemize
  6295. @section hilbert
  6296. Generate odd-tap Hilbert transform FIR coefficients.
  6297. The resulting stream can be used with @ref{afir} filter for phase-shifting
  6298. the signal by 90 degrees.
  6299. This is used in many matrix coding schemes and for analytic signal generation.
  6300. The process is often written as a multiplication by i (or j), the imaginary unit.
  6301. The filter accepts the following options:
  6302. @table @option
  6303. @item sample_rate, s
  6304. Set sample rate, default is 44100.
  6305. @item taps, t
  6306. Set length of FIR filter, default is 22051.
  6307. @item nb_samples, n
  6308. Set number of samples per each frame.
  6309. @item win_func, w
  6310. Set window function to be used when generating FIR coefficients.
  6311. @end table
  6312. @section sinc
  6313. Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
  6314. The resulting stream can be used with @ref{afir} filter for filtering the audio signal.
  6315. The filter accepts the following options:
  6316. @table @option
  6317. @item sample_rate, r
  6318. Set sample rate, default is 44100.
  6319. @item nb_samples, n
  6320. Set number of samples per each frame. Default is 1024.
  6321. @item hp
  6322. Set high-pass frequency. Default is 0.
  6323. @item lp
  6324. Set low-pass frequency. Default is 0.
  6325. If high-pass frequency is lower than low-pass frequency and low-pass frequency
  6326. is higher than 0 then filter will create band-pass filter coefficients,
  6327. otherwise band-reject filter coefficients.
  6328. @item phase
  6329. Set filter phase response. Default is 50. Allowed range is from 0 to 100.
  6330. @item beta
  6331. Set Kaiser window beta.
  6332. @item att
  6333. Set stop-band attenuation. Default is 120dB, allowed range is from 40 to 180 dB.
  6334. @item round
  6335. Enable rounding, by default is disabled.
  6336. @item hptaps
  6337. Set number of taps for high-pass filter.
  6338. @item lptaps
  6339. Set number of taps for low-pass filter.
  6340. @end table
  6341. @section sine
  6342. Generate an audio signal made of a sine wave with amplitude 1/8.
  6343. The audio signal is bit-exact.
  6344. The filter accepts the following options:
  6345. @table @option
  6346. @item frequency, f
  6347. Set the carrier frequency. Default is 440 Hz.
  6348. @item beep_factor, b
  6349. Enable a periodic beep every second with frequency @var{beep_factor} times
  6350. the carrier frequency. Default is 0, meaning the beep is disabled.
  6351. @item sample_rate, r
  6352. Specify the sample rate, default is 44100.
  6353. @item duration, d
  6354. Specify the duration of the generated audio stream.
  6355. @item samples_per_frame
  6356. Set the number of samples per output frame.
  6357. The expression can contain the following constants:
  6358. @table @option
  6359. @item n
  6360. The (sequential) number of the output audio frame, starting from 0.
  6361. @item pts
  6362. The PTS (Presentation TimeStamp) of the output audio frame,
  6363. expressed in @var{TB} units.
  6364. @item t
  6365. The PTS of the output audio frame, expressed in seconds.
  6366. @item TB
  6367. The timebase of the output audio frames.
  6368. @end table
  6369. Default is @code{1024}.
  6370. @end table
  6371. @subsection Examples
  6372. @itemize
  6373. @item
  6374. Generate a simple 440 Hz sine wave:
  6375. @example
  6376. sine
  6377. @end example
  6378. @item
  6379. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  6380. @example
  6381. sine=220:4:d=5
  6382. sine=f=220:b=4:d=5
  6383. sine=frequency=220:beep_factor=4:duration=5
  6384. @end example
  6385. @item
  6386. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  6387. pattern:
  6388. @example
  6389. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  6390. @end example
  6391. @end itemize
  6392. @c man end AUDIO SOURCES
  6393. @chapter Audio Sinks
  6394. @c man begin AUDIO SINKS
  6395. Below is a description of the currently available audio sinks.
  6396. @section abuffersink
  6397. Buffer audio frames, and make them available to the end of filter chain.
  6398. This sink is mainly intended for programmatic use, in particular
  6399. through the interface defined in @file{libavfilter/buffersink.h}
  6400. or the options system.
  6401. It accepts a pointer to an AVABufferSinkContext structure, which
  6402. defines the incoming buffers' formats, to be passed as the opaque
  6403. parameter to @code{avfilter_init_filter} for initialization.
  6404. @section anullsink
  6405. Null audio sink; do absolutely nothing with the input audio. It is
  6406. mainly useful as a template and for use in analysis / debugging
  6407. tools.
  6408. @c man end AUDIO SINKS
  6409. @chapter Video Filters
  6410. @c man begin VIDEO FILTERS
  6411. When you configure your FFmpeg build, you can disable any of the
  6412. existing filters using @code{--disable-filters}.
  6413. The configure output will show the video filters included in your
  6414. build.
  6415. Below is a description of the currently available video filters.
  6416. @section addroi
  6417. Mark a region of interest in a video frame.
  6418. The frame data is passed through unchanged, but metadata is attached
  6419. to the frame indicating regions of interest which can affect the
  6420. behaviour of later encoding. Multiple regions can be marked by
  6421. applying the filter multiple times.
  6422. @table @option
  6423. @item x
  6424. Region distance in pixels from the left edge of the frame.
  6425. @item y
  6426. Region distance in pixels from the top edge of the frame.
  6427. @item w
  6428. Region width in pixels.
  6429. @item h
  6430. Region height in pixels.
  6431. The parameters @var{x}, @var{y}, @var{w} and @var{h} are expressions,
  6432. and may contain the following variables:
  6433. @table @option
  6434. @item iw
  6435. Width of the input frame.
  6436. @item ih
  6437. Height of the input frame.
  6438. @end table
  6439. @item qoffset
  6440. Quantisation offset to apply within the region.
  6441. This must be a real value in the range -1 to +1. A value of zero
  6442. indicates no quality change. A negative value asks for better quality
  6443. (less quantisation), while a positive value asks for worse quality
  6444. (greater quantisation).
  6445. The range is calibrated so that the extreme values indicate the
  6446. largest possible offset - if the rest of the frame is encoded with the
  6447. worst possible quality, an offset of -1 indicates that this region
  6448. should be encoded with the best possible quality anyway. Intermediate
  6449. values are then interpolated in some codec-dependent way.
  6450. For example, in 10-bit H.264 the quantisation parameter varies between
  6451. -12 and 51. A typical qoffset value of -1/10 therefore indicates that
  6452. this region should be encoded with a QP around one-tenth of the full
  6453. range better than the rest of the frame. So, if most of the frame
  6454. were to be encoded with a QP of around 30, this region would get a QP
  6455. of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3).
  6456. An extreme value of -1 would indicate that this region should be
  6457. encoded with the best possible quality regardless of the treatment of
  6458. the rest of the frame - that is, should be encoded at a QP of -12.
  6459. @item clear
  6460. If set to true, remove any existing regions of interest marked on the
  6461. frame before adding the new one.
  6462. @end table
  6463. @subsection Examples
  6464. @itemize
  6465. @item
  6466. Mark the centre quarter of the frame as interesting.
  6467. @example
  6468. addroi=iw/4:ih/4:iw/2:ih/2:-1/10
  6469. @end example
  6470. @item
  6471. Mark the 100-pixel-wide region on the left edge of the frame as very
  6472. uninteresting (to be encoded at much lower quality than the rest of
  6473. the frame).
  6474. @example
  6475. addroi=0:0:100:ih:+1/5
  6476. @end example
  6477. @end itemize
  6478. @section alphaextract
  6479. Extract the alpha component from the input as a grayscale video. This
  6480. is especially useful with the @var{alphamerge} filter.
  6481. @section alphamerge
  6482. Add or replace the alpha component of the primary input with the
  6483. grayscale value of a second input. This is intended for use with
  6484. @var{alphaextract} to allow the transmission or storage of frame
  6485. sequences that have alpha in a format that doesn't support an alpha
  6486. channel.
  6487. For example, to reconstruct full frames from a normal YUV-encoded video
  6488. and a separate video created with @var{alphaextract}, you might use:
  6489. @example
  6490. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  6491. @end example
  6492. @section amplify
  6493. Amplify differences between current pixel and pixels of adjacent frames in
  6494. same pixel location.
  6495. This filter accepts the following options:
  6496. @table @option
  6497. @item radius
  6498. Set frame radius. Default is 2. Allowed range is from 1 to 63.
  6499. For example radius of 3 will instruct filter to calculate average of 7 frames.
  6500. @item factor
  6501. Set factor to amplify difference. Default is 2. Allowed range is from 0 to 65535.
  6502. @item threshold
  6503. Set threshold for difference amplification. Any difference greater or equal to
  6504. this value will not alter source pixel. Default is 10.
  6505. Allowed range is from 0 to 65535.
  6506. @item tolerance
  6507. Set tolerance for difference amplification. Any difference lower to
  6508. this value will not alter source pixel. Default is 0.
  6509. Allowed range is from 0 to 65535.
  6510. @item low
  6511. Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6512. This option controls maximum possible value that will decrease source pixel value.
  6513. @item high
  6514. Set high limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
  6515. This option controls maximum possible value that will increase source pixel value.
  6516. @item planes
  6517. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  6518. @end table
  6519. @subsection Commands
  6520. This filter supports the following @ref{commands} that corresponds to option of same name:
  6521. @table @option
  6522. @item factor
  6523. @item threshold
  6524. @item tolerance
  6525. @item low
  6526. @item high
  6527. @item planes
  6528. @end table
  6529. @section ass
  6530. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  6531. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  6532. Substation Alpha) subtitles files.
  6533. This filter accepts the following option in addition to the common options from
  6534. the @ref{subtitles} filter:
  6535. @table @option
  6536. @item shaping
  6537. Set the shaping engine
  6538. Available values are:
  6539. @table @samp
  6540. @item auto
  6541. The default libass shaping engine, which is the best available.
  6542. @item simple
  6543. Fast, font-agnostic shaper that can do only substitutions
  6544. @item complex
  6545. Slower shaper using OpenType for substitutions and positioning
  6546. @end table
  6547. The default is @code{auto}.
  6548. @end table
  6549. @section atadenoise
  6550. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  6551. The filter accepts the following options:
  6552. @table @option
  6553. @item 0a
  6554. Set threshold A for 1st plane. Default is 0.02.
  6555. Valid range is 0 to 0.3.
  6556. @item 0b
  6557. Set threshold B for 1st plane. Default is 0.04.
  6558. Valid range is 0 to 5.
  6559. @item 1a
  6560. Set threshold A for 2nd plane. Default is 0.02.
  6561. Valid range is 0 to 0.3.
  6562. @item 1b
  6563. Set threshold B for 2nd plane. Default is 0.04.
  6564. Valid range is 0 to 5.
  6565. @item 2a
  6566. Set threshold A for 3rd plane. Default is 0.02.
  6567. Valid range is 0 to 0.3.
  6568. @item 2b
  6569. Set threshold B for 3rd plane. Default is 0.04.
  6570. Valid range is 0 to 5.
  6571. Threshold A is designed to react on abrupt changes in the input signal and
  6572. threshold B is designed to react on continuous changes in the input signal.
  6573. @item s
  6574. Set number of frames filter will use for averaging. Default is 9. Must be odd
  6575. number in range [5, 129].
  6576. @item p
  6577. Set what planes of frame filter will use for averaging. Default is all.
  6578. @item a
  6579. Set what variant of algorithm filter will use for averaging. Default is @code{p} parallel.
  6580. Alternatively can be set to @code{s} serial.
  6581. Parallel can be faster then serial, while other way around is never true.
  6582. Parallel will abort early on first change being greater then thresholds, while serial
  6583. will continue processing other side of frames if they are equal or below thresholds.
  6584. @item 0s
  6585. @item 1s
  6586. @item 2s
  6587. Set sigma for 1st plane, 2nd plane or 3rd plane. Default is 32767.
  6588. Valid range is from 0 to 32767.
  6589. This options controls weight for each pixel in radius defined by size.
  6590. Default value means every pixel have same weight.
  6591. Setting this option to 0 effectively disables filtering.
  6592. @end table
  6593. @subsection Commands
  6594. This filter supports same @ref{commands} as options except option @code{s}.
  6595. The command accepts the same syntax of the corresponding option.
  6596. @section avgblur
  6597. Apply average blur filter.
  6598. The filter accepts the following options:
  6599. @table @option
  6600. @item sizeX
  6601. Set horizontal radius size.
  6602. @item planes
  6603. Set which planes to filter. By default all planes are filtered.
  6604. @item sizeY
  6605. Set vertical radius size, if zero it will be same as @code{sizeX}.
  6606. Default is @code{0}.
  6607. @end table
  6608. @subsection Commands
  6609. This filter supports same commands as options.
  6610. The command accepts the same syntax of the corresponding option.
  6611. If the specified expression is not valid, it is kept at its current
  6612. value.
  6613. @section backgroundkey
  6614. Turns a static background into transparency.
  6615. The filter accepts the following option:
  6616. @table @option
  6617. @item threshold
  6618. Threshold for scene change detection.
  6619. @item similarity
  6620. Similarity percentage with the background.
  6621. @item blend
  6622. Set the blend amount for pixels that are not similar.
  6623. @end table
  6624. @subsection Commands
  6625. This filter supports the all above options as @ref{commands}.
  6626. @section bbox
  6627. Compute the bounding box for the non-black pixels in the input frame
  6628. luma plane.
  6629. This filter computes the bounding box containing all the pixels with a
  6630. luma value greater than the minimum allowed value.
  6631. The parameters describing the bounding box are printed on the filter
  6632. log.
  6633. The filter accepts the following option:
  6634. @table @option
  6635. @item min_val
  6636. Set the minimal luma value. Default is @code{16}.
  6637. @end table
  6638. @subsection Commands
  6639. This filter supports the all above options as @ref{commands}.
  6640. @section bilateral
  6641. Apply bilateral filter, spatial smoothing while preserving edges.
  6642. The filter accepts the following options:
  6643. @table @option
  6644. @item sigmaS
  6645. Set sigma of gaussian function to calculate spatial weight.
  6646. Allowed range is 0 to 512. Default is 0.1.
  6647. @item sigmaR
  6648. Set sigma of gaussian function to calculate range weight.
  6649. Allowed range is 0 to 1. Default is 0.1.
  6650. @item planes
  6651. Set planes to filter. Default is first only.
  6652. @end table
  6653. @subsection Commands
  6654. This filter supports the all above options as @ref{commands}.
  6655. @section bilateral_cuda
  6656. CUDA accelerated bilateral filter, an edge preserving filter.
  6657. This filter is mathematically accurate thanks to the use of GPU acceleration.
  6658. For best output quality, use one to one chroma subsampling, i.e. yuv444p format.
  6659. The filter accepts the following options:
  6660. @table @option
  6661. @item sigmaS
  6662. Set sigma of gaussian function to calculate spatial weight, also called sigma space.
  6663. Allowed range is 0.1 to 512. Default is 0.1.
  6664. @item sigmaR
  6665. Set sigma of gaussian function to calculate color range weight, also called sigma color.
  6666. Allowed range is 0.1 to 512. Default is 0.1.
  6667. @item window_size
  6668. Set window size of the bilateral function to determine the number of neighbours to loop on.
  6669. If the number entered is even, one will be added automatically.
  6670. Allowed range is 1 to 255. Default is 1.
  6671. @end table
  6672. @subsection Examples
  6673. @itemize
  6674. @item
  6675. Apply the bilateral filter on a video.
  6676. @example
  6677. ./ffmpeg -v verbose \
  6678. -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 \
  6679. -init_hw_device cuda \
  6680. -filter_complex \
  6681. " \
  6682. [0:v]scale_cuda=format=yuv444p[scaled_video];
  6683. [scaled_video]bilateral_cuda=window_size=9:sigmaS=3.0:sigmaR=50.0" \
  6684. -an -sn -c:v h264_nvenc -cq 20 out.mp4
  6685. @end example
  6686. @end itemize
  6687. @section bitplanenoise
  6688. Show and measure bit plane noise.
  6689. The filter accepts the following options:
  6690. @table @option
  6691. @item bitplane
  6692. Set which plane to analyze. Default is @code{1}.
  6693. @item filter
  6694. Filter out noisy pixels from @code{bitplane} set above.
  6695. Default is disabled.
  6696. @end table
  6697. @section blackdetect
  6698. Detect video intervals that are (almost) completely black. Can be
  6699. useful to detect chapter transitions, commercials, or invalid
  6700. recordings.
  6701. The filter outputs its detection analysis to both the log as well as
  6702. frame metadata. If a black segment of at least the specified minimum
  6703. duration is found, a line with the start and end timestamps as well
  6704. as duration is printed to the log with level @code{info}. In addition,
  6705. a log line with level @code{debug} is printed per frame showing the
  6706. black amount detected for that frame.
  6707. The filter also attaches metadata to the first frame of a black
  6708. segment with key @code{lavfi.black_start} and to the first frame
  6709. after the black segment ends with key @code{lavfi.black_end}. The
  6710. value is the frame's timestamp. This metadata is added regardless
  6711. of the minimum duration specified.
  6712. The filter accepts the following options:
  6713. @table @option
  6714. @item black_min_duration, d
  6715. Set the minimum detected black duration expressed in seconds. It must
  6716. be a non-negative floating point number.
  6717. Default value is 2.0.
  6718. @item picture_black_ratio_th, pic_th
  6719. Set the threshold for considering a picture "black".
  6720. Express the minimum value for the ratio:
  6721. @example
  6722. @var{nb_black_pixels} / @var{nb_pixels}
  6723. @end example
  6724. for which a picture is considered black.
  6725. Default value is 0.98.
  6726. @item pixel_black_th, pix_th
  6727. Set the threshold for considering a pixel "black".
  6728. The threshold expresses the maximum pixel luma value for which a
  6729. pixel is considered "black". The provided value is scaled according to
  6730. the following equation:
  6731. @example
  6732. @var{absolute_threshold} = @var{luma_minimum_value} + @var{pixel_black_th} * @var{luma_range_size}
  6733. @end example
  6734. @var{luma_range_size} and @var{luma_minimum_value} depend on
  6735. the input video format, the range is [0-255] for YUV full-range
  6736. formats and [16-235] for YUV non full-range formats.
  6737. Default value is 0.10.
  6738. @end table
  6739. The following example sets the maximum pixel threshold to the minimum
  6740. value, and detects only black intervals of 2 or more seconds:
  6741. @example
  6742. blackdetect=d=2:pix_th=0.00
  6743. @end example
  6744. @section blackframe
  6745. Detect frames that are (almost) completely black. Can be useful to
  6746. detect chapter transitions or commercials. Output lines consist of
  6747. the frame number of the detected frame, the percentage of blackness,
  6748. the position in the file if known or -1 and the timestamp in seconds.
  6749. In order to display the output lines, you need to set the loglevel at
  6750. least to the AV_LOG_INFO value.
  6751. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  6752. The value represents the percentage of pixels in the picture that
  6753. are below the threshold value.
  6754. It accepts the following parameters:
  6755. @table @option
  6756. @item amount
  6757. The percentage of the pixels that have to be below the threshold; it defaults to
  6758. @code{98}.
  6759. @item threshold, thresh
  6760. The threshold below which a pixel value is considered black; it defaults to
  6761. @code{32}.
  6762. @end table
  6763. @anchor{blend}
  6764. @section blend
  6765. Blend two video frames into each other.
  6766. The @code{blend} filter takes two input streams and outputs one
  6767. stream, the first input is the "top" layer and second input is
  6768. "bottom" layer. By default, the output terminates when the longest input terminates.
  6769. The @code{tblend} (time blend) filter takes two consecutive frames
  6770. from one single stream, and outputs the result obtained by blending
  6771. the new frame on top of the old frame.
  6772. A description of the accepted options follows.
  6773. @table @option
  6774. @item c0_mode
  6775. @item c1_mode
  6776. @item c2_mode
  6777. @item c3_mode
  6778. @item all_mode
  6779. Set blend mode for specific pixel component or all pixel components in case
  6780. of @var{all_mode}. Default value is @code{normal}.
  6781. Available values for component modes are:
  6782. @table @samp
  6783. @item addition
  6784. @item and
  6785. @item average
  6786. @item bleach
  6787. @item burn
  6788. @item darken
  6789. @item difference
  6790. @item divide
  6791. @item dodge
  6792. @item exclusion
  6793. @item extremity
  6794. @item freeze
  6795. @item geometric
  6796. @item glow
  6797. @item grainextract
  6798. @item grainmerge
  6799. @item hardlight
  6800. @item hardmix
  6801. @item hardoverlay
  6802. @item harmonic
  6803. @item heat
  6804. @item interpolate
  6805. @item lighten
  6806. @item linearlight
  6807. @item multiply
  6808. @item multiply128
  6809. @item negation
  6810. @item normal
  6811. @item or
  6812. @item overlay
  6813. @item phoenix
  6814. @item pinlight
  6815. @item reflect
  6816. @item screen
  6817. @item softdifference
  6818. @item softlight
  6819. @item stain
  6820. @item subtract
  6821. @item vividlight
  6822. @item xor
  6823. @end table
  6824. @item c0_opacity
  6825. @item c1_opacity
  6826. @item c2_opacity
  6827. @item c3_opacity
  6828. @item all_opacity
  6829. Set blend opacity for specific pixel component or all pixel components in case
  6830. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  6831. @item c0_expr
  6832. @item c1_expr
  6833. @item c2_expr
  6834. @item c3_expr
  6835. @item all_expr
  6836. Set blend expression for specific pixel component or all pixel components in case
  6837. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  6838. The expressions can use the following variables:
  6839. @table @option
  6840. @item N
  6841. The sequential number of the filtered frame, starting from @code{0}.
  6842. @item X
  6843. @item Y
  6844. the coordinates of the current sample
  6845. @item W
  6846. @item H
  6847. the width and height of currently filtered plane
  6848. @item SW
  6849. @item SH
  6850. Width and height scale for the plane being filtered. It is the
  6851. ratio between the dimensions of the current plane to the luma plane,
  6852. e.g. for a @code{yuv420p} frame, the values are @code{1,1} for
  6853. the luma plane and @code{0.5,0.5} for the chroma planes.
  6854. @item T
  6855. Time of the current frame, expressed in seconds.
  6856. @item TOP, A
  6857. Value of pixel component at current location for first video frame (top layer).
  6858. @item BOTTOM, B
  6859. Value of pixel component at current location for second video frame (bottom layer).
  6860. @end table
  6861. @end table
  6862. The @code{blend} filter also supports the @ref{framesync} options.
  6863. @subsection Examples
  6864. @itemize
  6865. @item
  6866. Apply transition from bottom layer to top layer in first 10 seconds:
  6867. @example
  6868. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  6869. @end example
  6870. @item
  6871. Apply linear horizontal transition from top layer to bottom layer:
  6872. @example
  6873. blend=all_expr='A*(X/W)+B*(1-X/W)'
  6874. @end example
  6875. @item
  6876. Apply 1x1 checkerboard effect:
  6877. @example
  6878. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  6879. @end example
  6880. @item
  6881. Apply uncover left effect:
  6882. @example
  6883. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  6884. @end example
  6885. @item
  6886. Apply uncover down effect:
  6887. @example
  6888. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  6889. @end example
  6890. @item
  6891. Apply uncover up-left effect:
  6892. @example
  6893. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  6894. @end example
  6895. @item
  6896. Split diagonally video and shows top and bottom layer on each side:
  6897. @example
  6898. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  6899. @end example
  6900. @item
  6901. Display differences between the current and the previous frame:
  6902. @example
  6903. tblend=all_mode=grainextract
  6904. @end example
  6905. @end itemize
  6906. @subsection Commands
  6907. This filter supports same @ref{commands} as options.
  6908. @anchor{blockdetect}
  6909. @section blockdetect
  6910. Determines blockiness of frames without altering the input frames.
  6911. Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for adaptive video processing." 2005 13th European signal processing conference.
  6912. The filter accepts the following options:
  6913. @table @option
  6914. @item period_min
  6915. @item period_max
  6916. Set minimum and maximum values for determining pixel grids (periods).
  6917. Default values are [3,24].
  6918. @item planes
  6919. Set planes to filter. Default is first only.
  6920. @end table
  6921. @subsection Examples
  6922. @itemize
  6923. @item
  6924. Determine blockiness for the first plane and search for periods within [8,32]:
  6925. @example
  6926. blockdetect=period_min=8:period_max=32:planes=1
  6927. @end example
  6928. @end itemize
  6929. @anchor{blurdetect}
  6930. @section blurdetect
  6931. Determines blurriness of frames without altering the input frames.
  6932. Based on Marziliano, Pina, et al. "A no-reference perceptual blur metric."
  6933. Allows for a block-based abbreviation.
  6934. The filter accepts the following options:
  6935. @table @option
  6936. @item low
  6937. @item high
  6938. Set low and high threshold values used by the Canny thresholding
  6939. algorithm.
  6940. The high threshold selects the "strong" edge pixels, which are then
  6941. connected through 8-connectivity with the "weak" edge pixels selected
  6942. by the low threshold.
  6943. @var{low} and @var{high} threshold values must be chosen in the range
  6944. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6945. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6946. is @code{50/255}.
  6947. @item radius
  6948. Define the radius to search around an edge pixel for local maxima.
  6949. @item block_pct
  6950. Determine blurriness only for the most significant blocks, given in percentage.
  6951. @item block_width
  6952. Determine blurriness for blocks of width @var{block_width}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_height}.
  6953. @item block_height
  6954. Determine blurriness for blocks of height @var{block_height}. If set to any value smaller 1, no blocks are used and the whole image is processed as one no matter of @var{block_width}.
  6955. @item planes
  6956. Set planes to filter. Default is first only.
  6957. @end table
  6958. @subsection Examples
  6959. @itemize
  6960. @item
  6961. Determine blur for 80% of most significant 32x32 blocks:
  6962. @example
  6963. blurdetect=block_width=32:block_height=32:block_pct=80
  6964. @end example
  6965. @end itemize
  6966. @section bm3d
  6967. Denoise frames using Block-Matching 3D algorithm.
  6968. The filter accepts the following options.
  6969. @table @option
  6970. @item sigma
  6971. Set denoising strength. Default value is 1.
  6972. Allowed range is from 0 to 999.9.
  6973. The denoising algorithm is very sensitive to sigma, so adjust it
  6974. according to the source.
  6975. @item block
  6976. Set local patch size. This sets dimensions in 2D.
  6977. @item bstep
  6978. Set sliding step for processing blocks. Default value is 4.
  6979. Allowed range is from 1 to 64.
  6980. Smaller values allows processing more reference blocks and is slower.
  6981. @item group
  6982. Set maximal number of similar blocks for 3rd dimension. Default value is 1.
  6983. When set to 1, no block matching is done. Larger values allows more blocks
  6984. in single group.
  6985. Allowed range is from 1 to 256.
  6986. @item range
  6987. Set radius for search block matching. Default is 9.
  6988. Allowed range is from 1 to INT32_MAX.
  6989. @item mstep
  6990. Set step between two search locations for block matching. Default is 1.
  6991. Allowed range is from 1 to 64. Smaller is slower.
  6992. @item thmse
  6993. Set threshold of mean square error for block matching. Valid range is 0 to
  6994. INT32_MAX.
  6995. @item hdthr
  6996. Set thresholding parameter for hard thresholding in 3D transformed domain.
  6997. Larger values results in stronger hard-thresholding filtering in frequency
  6998. domain.
  6999. @item estim
  7000. Set filtering estimation mode. Can be @code{basic} or @code{final}.
  7001. Default is @code{basic}.
  7002. @item ref
  7003. If enabled, filter will use 2nd stream for block matching.
  7004. Default is disabled for @code{basic} value of @var{estim} option,
  7005. and always enabled if value of @var{estim} is @code{final}.
  7006. @item planes
  7007. Set planes to filter. Default is all available except alpha.
  7008. @end table
  7009. @subsection Examples
  7010. @itemize
  7011. @item
  7012. Basic filtering with bm3d:
  7013. @example
  7014. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
  7015. @end example
  7016. @item
  7017. Same as above, but filtering only luma:
  7018. @example
  7019. bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
  7020. @end example
  7021. @item
  7022. Same as above, but with both estimation modes:
  7023. @example
  7024. split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  7025. @end example
  7026. @item
  7027. Same as above, but prefilter with @ref{nlmeans} filter instead:
  7028. @example
  7029. split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
  7030. @end example
  7031. @end itemize
  7032. @section boxblur
  7033. Apply a boxblur algorithm to the input video.
  7034. It accepts the following parameters:
  7035. @table @option
  7036. @item luma_radius, lr
  7037. @item luma_power, lp
  7038. @item chroma_radius, cr
  7039. @item chroma_power, cp
  7040. @item alpha_radius, ar
  7041. @item alpha_power, ap
  7042. @end table
  7043. A description of the accepted options follows.
  7044. @table @option
  7045. @item luma_radius, lr
  7046. @item chroma_radius, cr
  7047. @item alpha_radius, ar
  7048. Set an expression for the box radius in pixels used for blurring the
  7049. corresponding input plane.
  7050. The radius value must be a non-negative number, and must not be
  7051. greater than the value of the expression @code{min(w,h)/2} for the
  7052. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  7053. planes.
  7054. Default value for @option{luma_radius} is "2". If not specified,
  7055. @option{chroma_radius} and @option{alpha_radius} default to the
  7056. corresponding value set for @option{luma_radius}.
  7057. The expressions can contain the following constants:
  7058. @table @option
  7059. @item w
  7060. @item h
  7061. The input width and height in pixels.
  7062. @item cw
  7063. @item ch
  7064. The input chroma image width and height in pixels.
  7065. @item hsub
  7066. @item vsub
  7067. The horizontal and vertical chroma subsample values. For example, for the
  7068. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  7069. @end table
  7070. @item luma_power, lp
  7071. @item chroma_power, cp
  7072. @item alpha_power, ap
  7073. Specify how many times the boxblur filter is applied to the
  7074. corresponding plane.
  7075. Default value for @option{luma_power} is 2. If not specified,
  7076. @option{chroma_power} and @option{alpha_power} default to the
  7077. corresponding value set for @option{luma_power}.
  7078. A value of 0 will disable the effect.
  7079. @end table
  7080. @subsection Examples
  7081. @itemize
  7082. @item
  7083. Apply a boxblur filter with the luma, chroma, and alpha radii
  7084. set to 2:
  7085. @example
  7086. boxblur=luma_radius=2:luma_power=1
  7087. boxblur=2:1
  7088. @end example
  7089. @item
  7090. Set the luma radius to 2, and alpha and chroma radius to 0:
  7091. @example
  7092. boxblur=2:1:cr=0:ar=0
  7093. @end example
  7094. @item
  7095. Set the luma and chroma radii to a fraction of the video dimension:
  7096. @example
  7097. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  7098. @end example
  7099. @end itemize
  7100. @anchor{bwdif}
  7101. @section bwdif
  7102. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  7103. Deinterlacing Filter").
  7104. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  7105. interpolation algorithms.
  7106. It accepts the following parameters:
  7107. @table @option
  7108. @item mode
  7109. The interlacing mode to adopt. It accepts one of the following values:
  7110. @table @option
  7111. @item 0, send_frame
  7112. Output one frame for each frame.
  7113. @item 1, send_field
  7114. Output one frame for each field.
  7115. @end table
  7116. The default value is @code{send_field}.
  7117. @item parity
  7118. The picture field parity assumed for the input interlaced video. It accepts one
  7119. of the following values:
  7120. @table @option
  7121. @item 0, tff
  7122. Assume the top field is first.
  7123. @item 1, bff
  7124. Assume the bottom field is first.
  7125. @item -1, auto
  7126. Enable automatic detection of field parity.
  7127. @end table
  7128. The default value is @code{auto}.
  7129. If the interlacing is unknown or the decoder does not export this information,
  7130. top field first will be assumed.
  7131. @item deint
  7132. Specify which frames to deinterlace. Accepts one of the following
  7133. values:
  7134. @table @option
  7135. @item 0, all
  7136. Deinterlace all frames.
  7137. @item 1, interlaced
  7138. Only deinterlace frames marked as interlaced.
  7139. @end table
  7140. The default value is @code{all}.
  7141. @end table
  7142. @section bwdif_cuda
  7143. Deinterlace the input video using the @ref{bwdif} algorithm, but implemented
  7144. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  7145. and/or nvenc.
  7146. It accepts the following parameters:
  7147. @table @option
  7148. @item mode
  7149. The interlacing mode to adopt. It accepts one of the following values:
  7150. @table @option
  7151. @item 0, send_frame
  7152. Output one frame for each frame.
  7153. @item 1, send_field
  7154. Output one frame for each field.
  7155. @end table
  7156. The default value is @code{send_field}.
  7157. @item parity
  7158. The picture field parity assumed for the input interlaced video. It accepts one
  7159. of the following values:
  7160. @table @option
  7161. @item 0, tff
  7162. Assume the top field is first.
  7163. @item 1, bff
  7164. Assume the bottom field is first.
  7165. @item -1, auto
  7166. Enable automatic detection of field parity.
  7167. @end table
  7168. The default value is @code{auto}.
  7169. If the interlacing is unknown or the decoder does not export this information,
  7170. top field first will be assumed.
  7171. @item deint
  7172. Specify which frames to deinterlace. Accepts one of the following
  7173. values:
  7174. @table @option
  7175. @item 0, all
  7176. Deinterlace all frames.
  7177. @item 1, interlaced
  7178. Only deinterlace frames marked as interlaced.
  7179. @end table
  7180. The default value is @code{all}.
  7181. @end table
  7182. @section ccrepack
  7183. Repack CEA-708 closed captioning side data
  7184. This filter fixes various issues seen with commerical encoders
  7185. related to upstream malformed CEA-708 payloads, specifically
  7186. incorrect number of tuples (wrong cc_count for the target FPS),
  7187. and incorrect ordering of tuples (i.e. the CEA-608 tuples are not at
  7188. the first entries in the payload).
  7189. @section cas
  7190. Apply Contrast Adaptive Sharpen filter to video stream.
  7191. The filter accepts the following options:
  7192. @table @option
  7193. @item strength
  7194. Set the sharpening strength. Default value is 0.
  7195. @item planes
  7196. Set planes to filter. Default value is to filter all
  7197. planes except alpha plane.
  7198. @end table
  7199. @subsection Commands
  7200. This filter supports same @ref{commands} as options.
  7201. @section chromahold
  7202. Remove all color information for all colors except for certain one.
  7203. The filter accepts the following options:
  7204. @table @option
  7205. @item color
  7206. The color which will not be replaced with neutral chroma.
  7207. @item similarity
  7208. Similarity percentage with the above color.
  7209. 0.01 matches only the exact key color, while 1.0 matches everything.
  7210. @item blend
  7211. Blend percentage.
  7212. 0.0 makes pixels either fully gray, or not gray at all.
  7213. Higher values result in more preserved color.
  7214. @item yuv
  7215. Signals that the color passed is already in YUV instead of RGB.
  7216. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7217. This can be used to pass exact YUV values as hexadecimal numbers.
  7218. @end table
  7219. @subsection Commands
  7220. This filter supports same @ref{commands} as options.
  7221. The command accepts the same syntax of the corresponding option.
  7222. If the specified expression is not valid, it is kept at its current
  7223. value.
  7224. @anchor{chromakey}
  7225. @section chromakey
  7226. YUV colorspace color/chroma keying.
  7227. The filter accepts the following options:
  7228. @table @option
  7229. @item color
  7230. The color which will be replaced with transparency.
  7231. @item similarity
  7232. Similarity percentage with the key color.
  7233. 0.01 matches only the exact key color, while 1.0 matches everything.
  7234. @item blend
  7235. Blend percentage.
  7236. 0.0 makes pixels either fully transparent, or not transparent at all.
  7237. Higher values result in semi-transparent pixels, with a higher transparency
  7238. the more similar the pixels color is to the key color.
  7239. @item yuv
  7240. Signals that the color passed is already in YUV instead of RGB.
  7241. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  7242. This can be used to pass exact YUV values as hexadecimal numbers.
  7243. @end table
  7244. @subsection Commands
  7245. This filter supports same @ref{commands} as options.
  7246. The command accepts the same syntax of the corresponding option.
  7247. If the specified expression is not valid, it is kept at its current
  7248. value.
  7249. @subsection Examples
  7250. @itemize
  7251. @item
  7252. Make every green pixel in the input image transparent:
  7253. @example
  7254. ffmpeg -i input.png -vf chromakey=green out.png
  7255. @end example
  7256. @item
  7257. Overlay a greenscreen-video on top of a static black background.
  7258. @example
  7259. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  7260. @end example
  7261. @end itemize
  7262. @section chromakey_cuda
  7263. CUDA accelerated YUV colorspace color/chroma keying.
  7264. This filter works like normal chromakey filter but operates on CUDA frames.
  7265. for more details and parameters see @ref{chromakey}.
  7266. @subsection Examples
  7267. @itemize
  7268. @item
  7269. Make all the green pixels in the input video transparent and use it as an overlay for another video:
  7270. @example
  7271. ./ffmpeg \
  7272. -hwaccel cuda -hwaccel_output_format cuda -i input_green.mp4 \
  7273. -hwaccel cuda -hwaccel_output_format cuda -i base_video.mp4 \
  7274. -init_hw_device cuda \
  7275. -filter_complex \
  7276. " \
  7277. [0:v]chromakey_cuda=0x25302D:0.1:0.12:1[overlay_video]; \
  7278. [1:v]scale_cuda=format=yuv420p[base]; \
  7279. [base][overlay_video]overlay_cuda" \
  7280. -an -sn -c:v h264_nvenc -cq 20 output.mp4
  7281. @end example
  7282. @item
  7283. Process two software sources, explicitly uploading the frames:
  7284. @example
  7285. ./ffmpeg -init_hw_device cuda=cuda -filter_hw_device cuda \
  7286. -f lavfi -i color=size=800x600:color=white,format=yuv420p \
  7287. -f lavfi -i yuvtestsrc=size=200x200,format=yuv420p \
  7288. -filter_complex \
  7289. " \
  7290. [0]hwupload[under]; \
  7291. [1]hwupload,chromakey_cuda=green:0.1:0.12[over]; \
  7292. [under][over]overlay_cuda" \
  7293. -c:v hevc_nvenc -cq 18 -preset slow output.mp4
  7294. @end example
  7295. @end itemize
  7296. @section chromanr
  7297. Reduce chrominance noise.
  7298. The filter accepts the following options:
  7299. @table @option
  7300. @item thres
  7301. Set threshold for averaging chrominance values.
  7302. Sum of absolute difference of Y, U and V pixel components of current
  7303. pixel and neighbour pixels lower than this threshold will be used in
  7304. averaging. Luma component is left unchanged and is copied to output.
  7305. Default value is 30. Allowed range is from 1 to 200.
  7306. @item sizew
  7307. Set horizontal radius of rectangle used for averaging.
  7308. Allowed range is from 1 to 100. Default value is 5.
  7309. @item sizeh
  7310. Set vertical radius of rectangle used for averaging.
  7311. Allowed range is from 1 to 100. Default value is 5.
  7312. @item stepw
  7313. Set horizontal step when averaging. Default value is 1.
  7314. Allowed range is from 1 to 50.
  7315. Mostly useful to speed-up filtering.
  7316. @item steph
  7317. Set vertical step when averaging. Default value is 1.
  7318. Allowed range is from 1 to 50.
  7319. Mostly useful to speed-up filtering.
  7320. @item threy
  7321. Set Y threshold for averaging chrominance values.
  7322. Set finer control for max allowed difference between Y components
  7323. of current pixel and neigbour pixels.
  7324. Default value is 200. Allowed range is from 1 to 200.
  7325. @item threu
  7326. Set U threshold for averaging chrominance values.
  7327. Set finer control for max allowed difference between U components
  7328. of current pixel and neigbour pixels.
  7329. Default value is 200. Allowed range is from 1 to 200.
  7330. @item threv
  7331. Set V threshold for averaging chrominance values.
  7332. Set finer control for max allowed difference between V components
  7333. of current pixel and neigbour pixels.
  7334. Default value is 200. Allowed range is from 1 to 200.
  7335. @item distance
  7336. Set distance type used in calculations.
  7337. @table @samp
  7338. @item manhattan
  7339. Absolute difference.
  7340. @item euclidean
  7341. Difference squared.
  7342. @end table
  7343. Default distance type is manhattan.
  7344. @end table
  7345. @subsection Commands
  7346. This filter supports same @ref{commands} as options.
  7347. The command accepts the same syntax of the corresponding option.
  7348. @section chromashift
  7349. Shift chroma pixels horizontally and/or vertically.
  7350. The filter accepts the following options:
  7351. @table @option
  7352. @item cbh
  7353. Set amount to shift chroma-blue horizontally.
  7354. @item cbv
  7355. Set amount to shift chroma-blue vertically.
  7356. @item crh
  7357. Set amount to shift chroma-red horizontally.
  7358. @item crv
  7359. Set amount to shift chroma-red vertically.
  7360. @item edge
  7361. Set edge mode, can be @var{smear}, default, or @var{warp}.
  7362. @end table
  7363. @subsection Commands
  7364. This filter supports the all above options as @ref{commands}.
  7365. @section ciescope
  7366. Display CIE color diagram with pixels overlaid onto it.
  7367. The filter accepts the following options:
  7368. @table @option
  7369. @item system
  7370. Set color system.
  7371. @table @samp
  7372. @item ntsc, 470m
  7373. @item ebu, 470bg
  7374. @item smpte
  7375. @item 240m
  7376. @item apple
  7377. @item widergb
  7378. @item cie1931
  7379. @item rec709, hdtv
  7380. @item uhdtv, rec2020
  7381. @item dcip3
  7382. @end table
  7383. @item cie
  7384. Set CIE system.
  7385. @table @samp
  7386. @item xyy
  7387. @item ucs
  7388. @item luv
  7389. @end table
  7390. @item gamuts
  7391. Set what gamuts to draw.
  7392. See @code{system} option for available values.
  7393. @item size, s
  7394. Set ciescope size, by default set to 512.
  7395. @item intensity, i
  7396. Set intensity used to map input pixel values to CIE diagram.
  7397. @item contrast
  7398. Set contrast used to draw tongue colors that are out of active color system gamut.
  7399. @item corrgamma
  7400. Correct gamma displayed on scope, by default enabled.
  7401. @item showwhite
  7402. Show white point on CIE diagram, by default disabled.
  7403. @item gamma
  7404. Set input gamma. Used only with XYZ input color space.
  7405. @item fill
  7406. Fill with CIE colors. By default is enabled.
  7407. @end table
  7408. @section codecview
  7409. Visualize information exported by some codecs.
  7410. Some codecs can export information through frames using side-data or other
  7411. means. For example, some MPEG based codecs export motion vectors through the
  7412. @var{export_mvs} flag in the codec @option{flags2} option.
  7413. The filter accepts the following option:
  7414. @table @option
  7415. @item block
  7416. Display block partition structure using the luma plane.
  7417. @item mv
  7418. Set motion vectors to visualize.
  7419. Available flags for @var{mv} are:
  7420. @table @samp
  7421. @item pf
  7422. forward predicted MVs of P-frames
  7423. @item bf
  7424. forward predicted MVs of B-frames
  7425. @item bb
  7426. backward predicted MVs of B-frames
  7427. @end table
  7428. @item qp
  7429. Display quantization parameters using the chroma planes.
  7430. @item mv_type, mvt
  7431. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  7432. Available flags for @var{mv_type} are:
  7433. @table @samp
  7434. @item fp
  7435. forward predicted MVs
  7436. @item bp
  7437. backward predicted MVs
  7438. @end table
  7439. @item frame_type, ft
  7440. Set frame type to visualize motion vectors of.
  7441. Available flags for @var{frame_type} are:
  7442. @table @samp
  7443. @item if
  7444. intra-coded frames (I-frames)
  7445. @item pf
  7446. predicted frames (P-frames)
  7447. @item bf
  7448. bi-directionally predicted frames (B-frames)
  7449. @end table
  7450. @end table
  7451. @subsection Examples
  7452. @itemize
  7453. @item
  7454. Visualize forward predicted MVs of all frames using @command{ffplay}:
  7455. @example
  7456. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  7457. @end example
  7458. @item
  7459. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  7460. @example
  7461. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  7462. @end example
  7463. @end itemize
  7464. @section colorbalance
  7465. Modify intensity of primary colors (red, green and blue) of input frames.
  7466. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  7467. regions for the red-cyan, green-magenta or blue-yellow balance.
  7468. A positive adjustment value shifts the balance towards the primary color, a negative
  7469. value towards the complementary color.
  7470. The filter accepts the following options:
  7471. @table @option
  7472. @item rs
  7473. @item gs
  7474. @item bs
  7475. Adjust red, green and blue shadows (darkest pixels).
  7476. @item rm
  7477. @item gm
  7478. @item bm
  7479. Adjust red, green and blue midtones (medium pixels).
  7480. @item rh
  7481. @item gh
  7482. @item bh
  7483. Adjust red, green and blue highlights (brightest pixels).
  7484. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7485. @item pl
  7486. Preserve lightness when changing color balance. Default is disabled.
  7487. @end table
  7488. @subsection Examples
  7489. @itemize
  7490. @item
  7491. Add red color cast to shadows:
  7492. @example
  7493. colorbalance=rs=.3
  7494. @end example
  7495. @end itemize
  7496. @subsection Commands
  7497. This filter supports the all above options as @ref{commands}.
  7498. @section colorcontrast
  7499. Adjust color contrast between RGB components.
  7500. The filter accepts the following options:
  7501. @table @option
  7502. @item rc
  7503. Set the red-cyan contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7504. @item gm
  7505. Set the green-magenta contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7506. @item by
  7507. Set the blue-yellow contrast. Defaults is 0.0. Allowed range is from -1.0 to 1.0.
  7508. @item rcw
  7509. @item gmw
  7510. @item byw
  7511. Set the weight of each @code{rc}, @code{gm}, @code{by} option value. Default value is 0.0.
  7512. Allowed range is from 0.0 to 1.0. If all weights are 0.0 filtering is disabled.
  7513. @item pl
  7514. Set the amount of preserving lightness. Default value is 0.0. Allowed range is from 0.0 to 1.0.
  7515. @end table
  7516. @subsection Commands
  7517. This filter supports the all above options as @ref{commands}.
  7518. @section colorcorrect
  7519. Adjust color white balance selectively for blacks and whites.
  7520. This filter operates in YUV colorspace.
  7521. The filter accepts the following options:
  7522. @table @option
  7523. @item rl
  7524. Set the red shadow spot. Allowed range is from -1.0 to 1.0.
  7525. Default value is 0.
  7526. @item bl
  7527. Set the blue shadow spot. Allowed range is from -1.0 to 1.0.
  7528. Default value is 0.
  7529. @item rh
  7530. Set the red highlight spot. Allowed range is from -1.0 to 1.0.
  7531. Default value is 0.
  7532. @item bh
  7533. Set the blue highlight spot. Allowed range is from -1.0 to 1.0.
  7534. Default value is 0.
  7535. @item saturation
  7536. Set the amount of saturation. Allowed range is from -3.0 to 3.0.
  7537. Default value is 1.
  7538. @item analyze
  7539. If set to anything other than @code{manual} it will analyze every frame and use derived
  7540. parameters for filtering output frame.
  7541. Possible values are:
  7542. @table @samp
  7543. @item manual
  7544. @item average
  7545. @item minmax
  7546. @item median
  7547. @end table
  7548. Default value is @code{manual}.
  7549. @end table
  7550. @subsection Commands
  7551. This filter supports the all above options as @ref{commands}.
  7552. @section colorchannelmixer
  7553. Adjust video input frames by re-mixing color channels.
  7554. This filter modifies a color channel by adding the values associated to
  7555. the other channels of the same pixels. For example if the value to
  7556. modify is red, the output value will be:
  7557. @example
  7558. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  7559. @end example
  7560. The filter accepts the following options:
  7561. @table @option
  7562. @item rr
  7563. @item rg
  7564. @item rb
  7565. @item ra
  7566. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  7567. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  7568. @item gr
  7569. @item gg
  7570. @item gb
  7571. @item ga
  7572. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  7573. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  7574. @item br
  7575. @item bg
  7576. @item bb
  7577. @item ba
  7578. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  7579. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  7580. @item ar
  7581. @item ag
  7582. @item ab
  7583. @item aa
  7584. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  7585. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  7586. Allowed ranges for options are @code{[-2.0, 2.0]}.
  7587. @item pc
  7588. Set preserve color mode. The accepted values are:
  7589. @table @samp
  7590. @item none
  7591. Disable color preserving, this is default.
  7592. @item lum
  7593. Preserve luminance.
  7594. @item max
  7595. Preserve max value of RGB triplet.
  7596. @item avg
  7597. Preserve average value of RGB triplet.
  7598. @item sum
  7599. Preserve sum value of RGB triplet.
  7600. @item nrm
  7601. Preserve normalized value of RGB triplet.
  7602. @item pwr
  7603. Preserve power value of RGB triplet.
  7604. @end table
  7605. @item pa
  7606. Set the preserve color amount when changing colors. Allowed range is from @code{[0.0, 1.0]}.
  7607. Default is @code{0.0}, thus disabled.
  7608. @end table
  7609. @subsection Examples
  7610. @itemize
  7611. @item
  7612. Convert source to grayscale:
  7613. @example
  7614. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  7615. @end example
  7616. @item
  7617. Simulate sepia tones:
  7618. @example
  7619. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  7620. @end example
  7621. @end itemize
  7622. @subsection Commands
  7623. This filter supports the all above options as @ref{commands}.
  7624. @section colorize
  7625. Overlay a solid color on the video stream.
  7626. The filter accepts the following options:
  7627. @table @option
  7628. @item hue
  7629. Set the color hue. Allowed range is from 0 to 360.
  7630. Default value is 0.
  7631. @item saturation
  7632. Set the color saturation. Allowed range is from 0 to 1.
  7633. Default value is 0.5.
  7634. @item lightness
  7635. Set the color lightness. Allowed range is from 0 to 1.
  7636. Default value is 0.5.
  7637. @item mix
  7638. Set the mix of source lightness. By default is set to 1.0.
  7639. Allowed range is from 0.0 to 1.0.
  7640. @end table
  7641. @subsection Commands
  7642. This filter supports the all above options as @ref{commands}.
  7643. @section colorkey
  7644. RGB colorspace color keying.
  7645. This filter operates on 8-bit RGB format frames by setting the alpha component of each pixel
  7646. which falls within the similarity radius of the key color to 0. The alpha value for pixels outside
  7647. the similarity radius depends on the value of the blend option.
  7648. The filter accepts the following options:
  7649. @table @option
  7650. @item color
  7651. Set the color for which alpha will be set to 0 (full transparency).
  7652. See @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7653. Default is @code{black}.
  7654. @item similarity
  7655. Set the radius from the key color within which other colors also have full transparency.
  7656. The computed distance is related to the unit fractional distance in 3D space between the RGB values
  7657. of the key color and the pixel's color. Range is 0.01 to 1.0. 0.01 matches within a very small radius
  7658. around the exact key color, while 1.0 matches everything.
  7659. Default is @code{0.01}.
  7660. @item blend
  7661. Set how the alpha value for pixels that fall outside the similarity radius is computed.
  7662. 0.0 makes pixels either fully transparent or fully opaque.
  7663. Higher values result in semi-transparent pixels, with greater transparency
  7664. the more similar the pixel color is to the key color.
  7665. Range is 0.0 to 1.0. Default is @code{0.0}.
  7666. @end table
  7667. @subsection Examples
  7668. @itemize
  7669. @item
  7670. Make every green pixel in the input image transparent:
  7671. @example
  7672. ffmpeg -i input.png -vf colorkey=green out.png
  7673. @end example
  7674. @item
  7675. Overlay a greenscreen-video on top of a static background image.
  7676. @example
  7677. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  7678. @end example
  7679. @end itemize
  7680. @subsection Commands
  7681. This filter supports same @ref{commands} as options.
  7682. The command accepts the same syntax of the corresponding option.
  7683. If the specified expression is not valid, it is kept at its current
  7684. value.
  7685. @section colorhold
  7686. Remove all color information for all RGB colors except for certain one.
  7687. The filter accepts the following options:
  7688. @table @option
  7689. @item color
  7690. The color which will not be replaced with neutral gray.
  7691. @item similarity
  7692. Similarity percentage with the above color.
  7693. 0.01 matches only the exact key color, while 1.0 matches everything.
  7694. @item blend
  7695. Blend percentage. 0.0 makes pixels fully gray.
  7696. Higher values result in more preserved color.
  7697. @end table
  7698. @subsection Commands
  7699. This filter supports same @ref{commands} as options.
  7700. The command accepts the same syntax of the corresponding option.
  7701. If the specified expression is not valid, it is kept at its current
  7702. value.
  7703. @section colorlevels
  7704. Adjust video input frames using levels.
  7705. The filter accepts the following options:
  7706. @table @option
  7707. @item rimin
  7708. @item gimin
  7709. @item bimin
  7710. @item aimin
  7711. Adjust red, green, blue and alpha input black point.
  7712. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  7713. @item rimax
  7714. @item gimax
  7715. @item bimax
  7716. @item aimax
  7717. Adjust red, green, blue and alpha input white point.
  7718. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  7719. Input levels are used to lighten highlights (bright tones), darken shadows
  7720. (dark tones), change the balance of bright and dark tones.
  7721. @item romin
  7722. @item gomin
  7723. @item bomin
  7724. @item aomin
  7725. Adjust red, green, blue and alpha output black point.
  7726. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  7727. @item romax
  7728. @item gomax
  7729. @item bomax
  7730. @item aomax
  7731. Adjust red, green, blue and alpha output white point.
  7732. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  7733. Output levels allows manual selection of a constrained output level range.
  7734. @item preserve
  7735. Set preserve color mode. The accepted values are:
  7736. @table @samp
  7737. @item none
  7738. Disable color preserving, this is default.
  7739. @item lum
  7740. Preserve luminance.
  7741. @item max
  7742. Preserve max value of RGB triplet.
  7743. @item avg
  7744. Preserve average value of RGB triplet.
  7745. @item sum
  7746. Preserve sum value of RGB triplet.
  7747. @item nrm
  7748. Preserve normalized value of RGB triplet.
  7749. @item pwr
  7750. Preserve power value of RGB triplet.
  7751. @end table
  7752. @end table
  7753. @subsection Examples
  7754. @itemize
  7755. @item
  7756. Make video output darker:
  7757. @example
  7758. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  7759. @end example
  7760. @item
  7761. Increase contrast:
  7762. @example
  7763. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  7764. @end example
  7765. @item
  7766. Make video output lighter:
  7767. @example
  7768. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  7769. @end example
  7770. @item
  7771. Increase brightness:
  7772. @example
  7773. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  7774. @end example
  7775. @end itemize
  7776. @subsection Commands
  7777. This filter supports the all above options as @ref{commands}.
  7778. @section colormap
  7779. Apply custom color maps to video stream.
  7780. This filter needs three input video streams.
  7781. First stream is video stream that is going to be filtered out.
  7782. Second and third video stream specify color patches for source
  7783. color to target color mapping.
  7784. The filter accepts the following options:
  7785. @table @option
  7786. @item patch_size
  7787. Set the source and target video stream patch size in pixels.
  7788. @item nb_patches
  7789. Set the max number of used patches from source and target video stream.
  7790. Default value is number of patches available in additional video streams.
  7791. Max allowed number of patches is @code{64}.
  7792. @item type
  7793. Set the adjustments used for target colors. Can be @code{relative} or @code{absolute}.
  7794. Defaults is @code{absolute}.
  7795. @item kernel
  7796. Set the kernel used to measure color differences between mapped colors.
  7797. The accepted values are:
  7798. @table @samp
  7799. @item euclidean
  7800. @item weuclidean
  7801. @end table
  7802. Default is @code{euclidean}.
  7803. @end table
  7804. @section colormatrix
  7805. Convert color matrix.
  7806. The filter accepts the following options:
  7807. @table @option
  7808. @item src
  7809. @item dst
  7810. Specify the source and destination color matrix. Both values must be
  7811. specified.
  7812. The accepted values are:
  7813. @table @samp
  7814. @item bt709
  7815. BT.709
  7816. @item fcc
  7817. FCC
  7818. @item bt601
  7819. BT.601
  7820. @item bt470
  7821. BT.470
  7822. @item bt470bg
  7823. BT.470BG
  7824. @item smpte170m
  7825. SMPTE-170M
  7826. @item smpte240m
  7827. SMPTE-240M
  7828. @item bt2020
  7829. BT.2020
  7830. @end table
  7831. @end table
  7832. For example to convert from BT.601 to SMPTE-240M, use the command:
  7833. @example
  7834. colormatrix=bt601:smpte240m
  7835. @end example
  7836. @section colorspace
  7837. Convert colorspace, transfer characteristics or color primaries.
  7838. Input video needs to have an even size.
  7839. The filter accepts the following options:
  7840. @table @option
  7841. @anchor{all}
  7842. @item all
  7843. Specify all color properties at once.
  7844. The accepted values are:
  7845. @table @samp
  7846. @item bt470m
  7847. BT.470M
  7848. @item bt470bg
  7849. BT.470BG
  7850. @item bt601-6-525
  7851. BT.601-6 525
  7852. @item bt601-6-625
  7853. BT.601-6 625
  7854. @item bt709
  7855. BT.709
  7856. @item smpte170m
  7857. SMPTE-170M
  7858. @item smpte240m
  7859. SMPTE-240M
  7860. @item bt2020
  7861. BT.2020
  7862. @end table
  7863. @anchor{space}
  7864. @item space
  7865. Specify output colorspace.
  7866. The accepted values are:
  7867. @table @samp
  7868. @item bt709
  7869. BT.709
  7870. @item fcc
  7871. FCC
  7872. @item bt470bg
  7873. BT.470BG or BT.601-6 625
  7874. @item smpte170m
  7875. SMPTE-170M or BT.601-6 525
  7876. @item smpte240m
  7877. SMPTE-240M
  7878. @item ycgco
  7879. YCgCo
  7880. @item bt2020ncl
  7881. BT.2020 with non-constant luminance
  7882. @end table
  7883. @anchor{trc}
  7884. @item trc
  7885. Specify output transfer characteristics.
  7886. The accepted values are:
  7887. @table @samp
  7888. @item bt709
  7889. BT.709
  7890. @item bt470m
  7891. BT.470M
  7892. @item bt470bg
  7893. BT.470BG
  7894. @item gamma22
  7895. Constant gamma of 2.2
  7896. @item gamma28
  7897. Constant gamma of 2.8
  7898. @item smpte170m
  7899. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  7900. @item smpte240m
  7901. SMPTE-240M
  7902. @item srgb
  7903. SRGB
  7904. @item iec61966-2-1
  7905. iec61966-2-1
  7906. @item iec61966-2-4
  7907. iec61966-2-4
  7908. @item xvycc
  7909. xvycc
  7910. @item bt2020-10
  7911. BT.2020 for 10-bits content
  7912. @item bt2020-12
  7913. BT.2020 for 12-bits content
  7914. @end table
  7915. @anchor{primaries}
  7916. @item primaries
  7917. Specify output color primaries.
  7918. The accepted values are:
  7919. @table @samp
  7920. @item bt709
  7921. BT.709
  7922. @item bt470m
  7923. BT.470M
  7924. @item bt470bg
  7925. BT.470BG or BT.601-6 625
  7926. @item smpte170m
  7927. SMPTE-170M or BT.601-6 525
  7928. @item smpte240m
  7929. SMPTE-240M
  7930. @item film
  7931. film
  7932. @item smpte431
  7933. SMPTE-431
  7934. @item smpte432
  7935. SMPTE-432
  7936. @item bt2020
  7937. BT.2020
  7938. @item jedec-p22
  7939. JEDEC P22 phosphors
  7940. @end table
  7941. @anchor{range}
  7942. @item range
  7943. Specify output color range.
  7944. The accepted values are:
  7945. @table @samp
  7946. @item tv
  7947. TV (restricted) range
  7948. @item mpeg
  7949. MPEG (restricted) range
  7950. @item pc
  7951. PC (full) range
  7952. @item jpeg
  7953. JPEG (full) range
  7954. @end table
  7955. @item format
  7956. Specify output color format.
  7957. The accepted values are:
  7958. @table @samp
  7959. @item yuv420p
  7960. YUV 4:2:0 planar 8-bits
  7961. @item yuv420p10
  7962. YUV 4:2:0 planar 10-bits
  7963. @item yuv420p12
  7964. YUV 4:2:0 planar 12-bits
  7965. @item yuv422p
  7966. YUV 4:2:2 planar 8-bits
  7967. @item yuv422p10
  7968. YUV 4:2:2 planar 10-bits
  7969. @item yuv422p12
  7970. YUV 4:2:2 planar 12-bits
  7971. @item yuv444p
  7972. YUV 4:4:4 planar 8-bits
  7973. @item yuv444p10
  7974. YUV 4:4:4 planar 10-bits
  7975. @item yuv444p12
  7976. YUV 4:4:4 planar 12-bits
  7977. @end table
  7978. @item fast
  7979. Do a fast conversion, which skips gamma/primary correction. This will take
  7980. significantly less CPU, but will be mathematically incorrect. To get output
  7981. compatible with that produced by the colormatrix filter, use fast=1.
  7982. @item dither
  7983. Specify dithering mode.
  7984. The accepted values are:
  7985. @table @samp
  7986. @item none
  7987. No dithering
  7988. @item fsb
  7989. Floyd-Steinberg dithering
  7990. @end table
  7991. @item wpadapt
  7992. Whitepoint adaptation mode.
  7993. The accepted values are:
  7994. @table @samp
  7995. @item bradford
  7996. Bradford whitepoint adaptation
  7997. @item vonkries
  7998. von Kries whitepoint adaptation
  7999. @item identity
  8000. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  8001. @end table
  8002. @item iall
  8003. Override all input properties at once. Same accepted values as @ref{all}.
  8004. @item ispace
  8005. Override input colorspace. Same accepted values as @ref{space}.
  8006. @item iprimaries
  8007. Override input color primaries. Same accepted values as @ref{primaries}.
  8008. @item itrc
  8009. Override input transfer characteristics. Same accepted values as @ref{trc}.
  8010. @item irange
  8011. Override input color range. Same accepted values as @ref{range}.
  8012. @end table
  8013. The filter converts the transfer characteristics, color space and color
  8014. primaries to the specified user values. The output value, if not specified,
  8015. is set to a default value based on the "all" property. If that property is
  8016. also not specified, the filter will log an error. The output color range and
  8017. format default to the same value as the input color range and format. The
  8018. input transfer characteristics, color space, color primaries and color range
  8019. should be set on the input data. If any of these are missing, the filter will
  8020. log an error and no conversion will take place.
  8021. For example to convert the input to SMPTE-240M, use the command:
  8022. @example
  8023. colorspace=smpte240m
  8024. @end example
  8025. @section colorspace_cuda
  8026. CUDA accelerated implementation of the colorspace filter.
  8027. It is by no means feature complete compared to the software colorspace filter,
  8028. and at the current time only supports color range conversion between jpeg/full
  8029. and mpeg/limited range.
  8030. The filter accepts the following options:
  8031. @table @option
  8032. @item range
  8033. Specify output color range.
  8034. The accepted values are:
  8035. @table @samp
  8036. @item tv
  8037. TV (restricted) range
  8038. @item mpeg
  8039. MPEG (restricted) range
  8040. @item pc
  8041. PC (full) range
  8042. @item jpeg
  8043. JPEG (full) range
  8044. @end table
  8045. @end table
  8046. @section colortemperature
  8047. Adjust color temperature in video to simulate variations in ambient color temperature.
  8048. The filter accepts the following options:
  8049. @table @option
  8050. @item temperature
  8051. Set the temperature in Kelvin. Allowed range is from 1000 to 40000.
  8052. Default value is 6500 K.
  8053. @item mix
  8054. Set mixing with filtered output. Allowed range is from 0 to 1.
  8055. Default value is 1.
  8056. @item pl
  8057. Set the amount of preserving lightness. Allowed range is from 0 to 1.
  8058. Default value is 0.
  8059. @end table
  8060. @subsection Commands
  8061. This filter supports same @ref{commands} as options.
  8062. @section convolution
  8063. Apply convolution of 3x3, 5x5, 7x7 or horizontal/vertical up to 49 elements.
  8064. The filter accepts the following options:
  8065. @table @option
  8066. @item 0m
  8067. @item 1m
  8068. @item 2m
  8069. @item 3m
  8070. Set matrix for each plane.
  8071. Matrix is sequence of 9, 25 or 49 signed integers in @var{square} mode,
  8072. and from 1 to 49 odd number of signed integers in @var{row} mode.
  8073. @item 0rdiv
  8074. @item 1rdiv
  8075. @item 2rdiv
  8076. @item 3rdiv
  8077. Set multiplier for calculated value for each plane.
  8078. If unset or 0, it will be 1/sum of all matrix elements.
  8079. @item 0bias
  8080. @item 1bias
  8081. @item 2bias
  8082. @item 3bias
  8083. Set bias for each plane. This value is added to the result of the multiplication.
  8084. Useful for making the overall image brighter or darker. Default is 0.0.
  8085. @item 0mode
  8086. @item 1mode
  8087. @item 2mode
  8088. @item 3mode
  8089. Set matrix mode for each plane. Can be @var{square}, @var{row} or @var{column}.
  8090. Default is @var{square}.
  8091. @end table
  8092. @subsection Commands
  8093. This filter supports the all above options as @ref{commands}.
  8094. @subsection Examples
  8095. @itemize
  8096. @item
  8097. Apply sharpen:
  8098. @example
  8099. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  8100. @end example
  8101. @item
  8102. Apply blur:
  8103. @example
  8104. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  8105. @end example
  8106. @item
  8107. Apply edge enhance:
  8108. @example
  8109. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  8110. @end example
  8111. @item
  8112. Apply edge detect:
  8113. @example
  8114. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  8115. @end example
  8116. @item
  8117. Apply laplacian edge detector which includes diagonals:
  8118. @example
  8119. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  8120. @end example
  8121. @item
  8122. Apply emboss:
  8123. @example
  8124. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  8125. @end example
  8126. @end itemize
  8127. @section convolve
  8128. Apply 2D convolution of video stream in frequency domain using second stream
  8129. as impulse.
  8130. The filter accepts the following options:
  8131. @table @option
  8132. @item planes
  8133. Set which planes to process.
  8134. @item impulse
  8135. Set which impulse video frames will be processed, can be @var{first}
  8136. or @var{all}. Default is @var{all}.
  8137. @end table
  8138. The @code{convolve} filter also supports the @ref{framesync} options.
  8139. @section copy
  8140. Copy the input video source unchanged to the output. This is mainly useful for
  8141. testing purposes.
  8142. @anchor{coreimage}
  8143. @section coreimage
  8144. Video filtering on GPU using Apple's CoreImage API on OSX.
  8145. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  8146. processed by video hardware. However, software-based OpenGL implementations
  8147. exist which means there is no guarantee for hardware processing. It depends on
  8148. the respective OSX.
  8149. There are many filters and image generators provided by Apple that come with a
  8150. large variety of options. The filter has to be referenced by its name along
  8151. with its options.
  8152. The coreimage filter accepts the following options:
  8153. @table @option
  8154. @item list_filters
  8155. List all available filters and generators along with all their respective
  8156. options as well as possible minimum and maximum values along with the default
  8157. values.
  8158. @example
  8159. list_filters=true
  8160. @end example
  8161. @item filter
  8162. Specify all filters by their respective name and options.
  8163. Use @var{list_filters} to determine all valid filter names and options.
  8164. Numerical options are specified by a float value and are automatically clamped
  8165. to their respective value range. Vector and color options have to be specified
  8166. by a list of space separated float values. Character escaping has to be done.
  8167. A special option name @code{default} is available to use default options for a
  8168. filter.
  8169. It is required to specify either @code{default} or at least one of the filter options.
  8170. All omitted options are used with their default values.
  8171. The syntax of the filter string is as follows:
  8172. @example
  8173. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  8174. @end example
  8175. @item output_rect
  8176. Specify a rectangle where the output of the filter chain is copied into the
  8177. input image. It is given by a list of space separated float values:
  8178. @example
  8179. output_rect=x\ y\ width\ height
  8180. @end example
  8181. If not given, the output rectangle equals the dimensions of the input image.
  8182. The output rectangle is automatically cropped at the borders of the input
  8183. image. Negative values are valid for each component.
  8184. @example
  8185. output_rect=25\ 25\ 100\ 100
  8186. @end example
  8187. @end table
  8188. Several filters can be chained for successive processing without GPU-HOST
  8189. transfers allowing for fast processing of complex filter chains.
  8190. Currently, only filters with zero (generators) or exactly one (filters) input
  8191. image and one output image are supported. Also, transition filters are not yet
  8192. usable as intended.
  8193. Some filters generate output images with additional padding depending on the
  8194. respective filter kernel. The padding is automatically removed to ensure the
  8195. filter output has the same size as the input image.
  8196. For image generators, the size of the output image is determined by the
  8197. previous output image of the filter chain or the input image of the whole
  8198. filterchain, respectively. The generators do not use the pixel information of
  8199. this image to generate their output. However, the generated output is
  8200. blended onto this image, resulting in partial or complete coverage of the
  8201. output image.
  8202. The @ref{coreimagesrc} video source can be used for generating input images
  8203. which are directly fed into the filter chain. By using it, providing input
  8204. images by another video source or an input video is not required.
  8205. @subsection Examples
  8206. @itemize
  8207. @item
  8208. List all filters available:
  8209. @example
  8210. coreimage=list_filters=true
  8211. @end example
  8212. @item
  8213. Use the CIBoxBlur filter with default options to blur an image:
  8214. @example
  8215. coreimage=filter=CIBoxBlur@@default
  8216. @end example
  8217. @item
  8218. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  8219. its center at 100x100 and a radius of 50 pixels:
  8220. @example
  8221. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  8222. @end example
  8223. @item
  8224. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  8225. given as complete and escaped command-line for Apple's standard bash shell:
  8226. @example
  8227. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  8228. @end example
  8229. @end itemize
  8230. @section corr
  8231. Obtain the correlation between two input videos.
  8232. This filter takes two input videos.
  8233. Both input videos must have the same resolution and pixel format for
  8234. this filter to work correctly. Also it assumes that both inputs
  8235. have the same number of frames, which are compared one by one.
  8236. The obtained per component, average, min and max correlation is printed through
  8237. the logging system.
  8238. The filter stores the calculated correlation of each frame in frame metadata.
  8239. This filter also supports the @ref{framesync} options.
  8240. In the below example the input file @file{main.mpg} being processed is compared
  8241. with the reference file @file{ref.mpg}.
  8242. @example
  8243. ffmpeg -i main.mpg -i ref.mpg -lavfi corr -f null -
  8244. @end example
  8245. @section cover_rect
  8246. Cover a rectangular object
  8247. It accepts the following options:
  8248. @table @option
  8249. @item cover
  8250. Filepath of the optional cover image, needs to be in yuv420.
  8251. @item mode
  8252. Set covering mode.
  8253. It accepts the following values:
  8254. @table @samp
  8255. @item cover
  8256. cover it by the supplied image
  8257. @item blur
  8258. cover it by interpolating the surrounding pixels
  8259. @end table
  8260. Default value is @var{blur}.
  8261. @end table
  8262. @subsection Examples
  8263. @itemize
  8264. @item
  8265. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  8266. @example
  8267. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  8268. @end example
  8269. @end itemize
  8270. @section crop
  8271. Crop the input video to given dimensions.
  8272. It accepts the following parameters:
  8273. @table @option
  8274. @item w, out_w
  8275. The width of the output video. It defaults to @code{iw}.
  8276. This expression is evaluated only once during the filter
  8277. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  8278. @item h, out_h
  8279. The height of the output video. It defaults to @code{ih}.
  8280. This expression is evaluated only once during the filter
  8281. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  8282. @item x
  8283. The horizontal position, in the input video, of the left edge of the output
  8284. video. It defaults to @code{(in_w-out_w)/2}.
  8285. This expression is evaluated per-frame.
  8286. @item y
  8287. The vertical position, in the input video, of the top edge of the output video.
  8288. It defaults to @code{(in_h-out_h)/2}.
  8289. This expression is evaluated per-frame.
  8290. @item keep_aspect
  8291. If set to 1 will force the output display aspect ratio
  8292. to be the same of the input, by changing the output sample aspect
  8293. ratio. It defaults to 0.
  8294. @item exact
  8295. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  8296. width/height/x/y as specified and will not be rounded to nearest smaller value.
  8297. It defaults to 0.
  8298. @end table
  8299. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  8300. expressions containing the following constants:
  8301. @table @option
  8302. @item x
  8303. @item y
  8304. The computed values for @var{x} and @var{y}. They are evaluated for
  8305. each new frame.
  8306. @item in_w
  8307. @item in_h
  8308. The input width and height.
  8309. @item iw
  8310. @item ih
  8311. These are the same as @var{in_w} and @var{in_h}.
  8312. @item out_w
  8313. @item out_h
  8314. The output (cropped) width and height.
  8315. @item ow
  8316. @item oh
  8317. These are the same as @var{out_w} and @var{out_h}.
  8318. @item a
  8319. same as @var{iw} / @var{ih}
  8320. @item sar
  8321. input sample aspect ratio
  8322. @item dar
  8323. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8324. @item hsub
  8325. @item vsub
  8326. horizontal and vertical chroma subsample values. For example for the
  8327. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8328. @item n
  8329. The number of the input frame, starting from 0.
  8330. @item pos
  8331. the position in the file of the input frame, NAN if unknown; deprecated,
  8332. do not use
  8333. @item t
  8334. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  8335. @end table
  8336. The expression for @var{out_w} may depend on the value of @var{out_h},
  8337. and the expression for @var{out_h} may depend on @var{out_w}, but they
  8338. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  8339. evaluated after @var{out_w} and @var{out_h}.
  8340. The @var{x} and @var{y} parameters specify the expressions for the
  8341. position of the top-left corner of the output (non-cropped) area. They
  8342. are evaluated for each frame. If the evaluated value is not valid, it
  8343. is approximated to the nearest valid value.
  8344. The expression for @var{x} may depend on @var{y}, and the expression
  8345. for @var{y} may depend on @var{x}.
  8346. @subsection Examples
  8347. @itemize
  8348. @item
  8349. Crop area with size 100x100 at position (12,34).
  8350. @example
  8351. crop=100:100:12:34
  8352. @end example
  8353. Using named options, the example above becomes:
  8354. @example
  8355. crop=w=100:h=100:x=12:y=34
  8356. @end example
  8357. @item
  8358. Crop the central input area with size 100x100:
  8359. @example
  8360. crop=100:100
  8361. @end example
  8362. @item
  8363. Crop the central input area with size 2/3 of the input video:
  8364. @example
  8365. crop=2/3*in_w:2/3*in_h
  8366. @end example
  8367. @item
  8368. Crop the input video central square:
  8369. @example
  8370. crop=out_w=in_h
  8371. crop=in_h
  8372. @end example
  8373. @item
  8374. Delimit the rectangle with the top-left corner placed at position
  8375. 100:100 and the right-bottom corner corresponding to the right-bottom
  8376. corner of the input image.
  8377. @example
  8378. crop=in_w-100:in_h-100:100:100
  8379. @end example
  8380. @item
  8381. Crop 10 pixels from the left and right borders, and 20 pixels from
  8382. the top and bottom borders
  8383. @example
  8384. crop=in_w-2*10:in_h-2*20
  8385. @end example
  8386. @item
  8387. Keep only the bottom right quarter of the input image:
  8388. @example
  8389. crop=in_w/2:in_h/2:in_w/2:in_h/2
  8390. @end example
  8391. @item
  8392. Crop height for getting Greek harmony:
  8393. @example
  8394. crop=in_w:1/PHI*in_w
  8395. @end example
  8396. @item
  8397. Apply trembling effect:
  8398. @example
  8399. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
  8400. @end example
  8401. @item
  8402. Apply erratic camera effect depending on timestamp:
  8403. @example
  8404. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)
  8405. @end example
  8406. @item
  8407. Set x depending on the value of y:
  8408. @example
  8409. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  8410. @end example
  8411. @end itemize
  8412. @subsection Commands
  8413. This filter supports the following commands:
  8414. @table @option
  8415. @item w, out_w
  8416. @item h, out_h
  8417. @item x
  8418. @item y
  8419. Set width/height of the output video and the horizontal/vertical position
  8420. in the input video.
  8421. The command accepts the same syntax of the corresponding option.
  8422. If the specified expression is not valid, it is kept at its current
  8423. value.
  8424. @end table
  8425. @section cropdetect
  8426. Auto-detect the crop size.
  8427. It calculates the necessary cropping parameters and prints the
  8428. recommended parameters via the logging system. The detected dimensions
  8429. correspond to the non-black or video area of the input video according to @var{mode}.
  8430. It accepts the following parameters:
  8431. @table @option
  8432. @item mode
  8433. Depending on @var{mode} crop detection is based on either the mere black value of surrounding pixels or a combination of motion vectors and edge pixels.
  8434. @table @samp
  8435. @item black
  8436. Detect black pixels surrounding the playing video. For fine control use option @var{limit}.
  8437. @item mvedges
  8438. Detect the playing video by the motion vectors inside the video and scanning for edge pixels typically forming the border of a playing video.
  8439. @end table
  8440. @item limit
  8441. Set higher black value threshold, which can be optionally specified
  8442. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  8443. value greater to the set value is considered non-black. It defaults to 24.
  8444. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  8445. on the bitdepth of the pixel format.
  8446. @item round
  8447. The value which the width/height should be divisible by. It defaults to
  8448. 16. The offset is automatically adjusted to center the video. Use 2 to
  8449. get only even dimensions (needed for 4:2:2 video). 16 is best when
  8450. encoding to most video codecs.
  8451. @item skip
  8452. Set the number of initial frames for which evaluation is skipped.
  8453. Default is 2. Range is 0 to INT_MAX.
  8454. @item reset_count, reset
  8455. Set the counter that determines after how many frames cropdetect will
  8456. reset the previously detected largest video area and start over to
  8457. detect the current optimal crop area. Default value is 0.
  8458. This can be useful when channel logos distort the video area. 0
  8459. indicates 'never reset', and returns the largest area encountered during
  8460. playback.
  8461. @item mv_threshold
  8462. Set motion in pixel units as threshold for motion detection. It defaults to 8.
  8463. @item low
  8464. @item high
  8465. Set low and high threshold values used by the Canny thresholding
  8466. algorithm.
  8467. The high threshold selects the "strong" edge pixels, which are then
  8468. connected through 8-connectivity with the "weak" edge pixels selected
  8469. by the low threshold.
  8470. @var{low} and @var{high} threshold values must be chosen in the range
  8471. [0,1], and @var{low} should be lesser or equal to @var{high}.
  8472. Default value for @var{low} is @code{5/255}, and default value for @var{high}
  8473. is @code{15/255}.
  8474. @end table
  8475. @subsection Examples
  8476. @itemize
  8477. @item
  8478. Find video area surrounded by black borders:
  8479. @example
  8480. ffmpeg -i file.mp4 -vf cropdetect,metadata=mode=print -f null -
  8481. @end example
  8482. @item
  8483. Find an embedded video area, generate motion vectors beforehand:
  8484. @example
  8485. ffmpeg -i file.mp4 -vf mestimate,cropdetect=mode=mvedges,metadata=mode=print -f null -
  8486. @end example
  8487. @item
  8488. Find an embedded video area, use motion vectors from decoder:
  8489. @example
  8490. ffmpeg -flags2 +export_mvs -i file.mp4 -vf cropdetect=mode=mvedges,metadata=mode=print -f null -
  8491. @end example
  8492. @end itemize
  8493. @subsection Commands
  8494. This filter supports the following commands:
  8495. @table @option
  8496. @item limit
  8497. The command accepts the same syntax of the corresponding option.
  8498. If the specified expression is not valid, it is kept at its current value.
  8499. @end table
  8500. @anchor{cue}
  8501. @section cue
  8502. Delay video filtering until a given wallclock timestamp. The filter first
  8503. passes on @option{preroll} amount of frames, then it buffers at most
  8504. @option{buffer} amount of frames and waits for the cue. After reaching the cue
  8505. it forwards the buffered frames and also any subsequent frames coming in its
  8506. input.
  8507. The filter can be used synchronize the output of multiple ffmpeg processes for
  8508. realtime output devices like decklink. By putting the delay in the filtering
  8509. chain and pre-buffering frames the process can pass on data to output almost
  8510. immediately after the target wallclock timestamp is reached.
  8511. Perfect frame accuracy cannot be guaranteed, but the result is good enough for
  8512. some use cases.
  8513. @table @option
  8514. @item cue
  8515. The cue timestamp expressed in a UNIX timestamp in microseconds. Default is 0.
  8516. @item preroll
  8517. The duration of content to pass on as preroll expressed in seconds. Default is 0.
  8518. @item buffer
  8519. The maximum duration of content to buffer before waiting for the cue expressed
  8520. in seconds. Default is 0.
  8521. @end table
  8522. @anchor{curves}
  8523. @section curves
  8524. Apply color adjustments using curves.
  8525. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  8526. component (red, green and blue) has its values defined by @var{N} key points
  8527. tied from each other using a smooth curve. The x-axis represents the pixel
  8528. values from the input frame, and the y-axis the new pixel values to be set for
  8529. the output frame.
  8530. By default, a component curve is defined by the two points @var{(0;0)} and
  8531. @var{(1;1)}. This creates a straight line where each original pixel value is
  8532. "adjusted" to its own value, which means no change to the image.
  8533. The filter allows you to redefine these two points and add some more. A new
  8534. curve will be defined to pass smoothly through all these new coordinates. The
  8535. new defined points need to be strictly increasing over the x-axis, and their
  8536. @var{x} and @var{y} values must be in the @var{[0;1]} interval. The curve is
  8537. formed by using a natural or monotonic cubic spline interpolation, depending
  8538. on the @var{interp} option (default: @code{natural}). The @code{natural}
  8539. spline produces a smoother curve in general while the monotonic (@code{pchip})
  8540. spline guarantees the transitions between the specified points to be
  8541. monotonic. If the computed curves happened to go outside the vector spaces,
  8542. the values will be clipped accordingly.
  8543. The filter accepts the following options:
  8544. @table @option
  8545. @item preset
  8546. Select one of the available color presets. This option can be used in addition
  8547. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  8548. options takes priority on the preset values.
  8549. Available presets are:
  8550. @table @samp
  8551. @item none
  8552. @item color_negative
  8553. @item cross_process
  8554. @item darker
  8555. @item increase_contrast
  8556. @item lighter
  8557. @item linear_contrast
  8558. @item medium_contrast
  8559. @item negative
  8560. @item strong_contrast
  8561. @item vintage
  8562. @end table
  8563. Default is @code{none}.
  8564. @item master, m
  8565. Set the master key points. These points will define a second pass mapping. It
  8566. is sometimes called a "luminance" or "value" mapping. It can be used with
  8567. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  8568. post-processing LUT.
  8569. @item red, r
  8570. Set the key points for the red component.
  8571. @item green, g
  8572. Set the key points for the green component.
  8573. @item blue, b
  8574. Set the key points for the blue component.
  8575. @item all
  8576. Set the key points for all components (not including master).
  8577. Can be used in addition to the other key points component
  8578. options. In this case, the unset component(s) will fallback on this
  8579. @option{all} setting.
  8580. @item psfile
  8581. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  8582. @item plot
  8583. Save Gnuplot script of the curves in specified file.
  8584. @item interp
  8585. Specify the kind of interpolation. Available algorithms are:
  8586. @table @samp
  8587. @item natural
  8588. Natural cubic spline using a piece-wise cubic polynomial that is twice continuously differentiable.
  8589. @item pchip
  8590. Monotonic cubic spline using a piecewise cubic Hermite interpolating polynomial (PCHIP).
  8591. @end table
  8592. @end table
  8593. To avoid some filtergraph syntax conflicts, each key points list need to be
  8594. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  8595. @subsection Commands
  8596. This filter supports same @ref{commands} as options.
  8597. @subsection Examples
  8598. @itemize
  8599. @item
  8600. Increase slightly the middle level of blue:
  8601. @example
  8602. curves=blue='0/0 0.5/0.58 1/1'
  8603. @end example
  8604. @item
  8605. Vintage effect:
  8606. @example
  8607. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  8608. @end example
  8609. Here we obtain the following coordinates for each components:
  8610. @table @var
  8611. @item red
  8612. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  8613. @item green
  8614. @code{(0;0) (0.50;0.48) (1;1)}
  8615. @item blue
  8616. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  8617. @end table
  8618. @item
  8619. The previous example can also be achieved with the associated built-in preset:
  8620. @example
  8621. curves=preset=vintage
  8622. @end example
  8623. @item
  8624. Or simply:
  8625. @example
  8626. curves=vintage
  8627. @end example
  8628. @item
  8629. Use a Photoshop preset and redefine the points of the green component:
  8630. @example
  8631. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  8632. @end example
  8633. @item
  8634. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  8635. and @command{gnuplot}:
  8636. @example
  8637. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  8638. gnuplot -p /tmp/curves.plt
  8639. @end example
  8640. @end itemize
  8641. @section datascope
  8642. Video data analysis filter.
  8643. This filter shows hexadecimal pixel values of part of video.
  8644. The filter accepts the following options:
  8645. @table @option
  8646. @item size, s
  8647. Set output video size.
  8648. @item x
  8649. Set x offset from where to pick pixels.
  8650. @item y
  8651. Set y offset from where to pick pixels.
  8652. @item mode
  8653. Set scope mode, can be one of the following:
  8654. @table @samp
  8655. @item mono
  8656. Draw hexadecimal pixel values with white color on black background.
  8657. @item color
  8658. Draw hexadecimal pixel values with input video pixel color on black
  8659. background.
  8660. @item color2
  8661. Draw hexadecimal pixel values on color background picked from input video,
  8662. the text color is picked in such way so its always visible.
  8663. @end table
  8664. @item axis
  8665. Draw rows and columns numbers on left and top of video.
  8666. @item opacity
  8667. Set background opacity.
  8668. @item format
  8669. Set display number format. Can be @code{hex}, or @code{dec}. Default is @code{hex}.
  8670. @item components
  8671. Set pixel components to display. By default all pixel components are displayed.
  8672. @end table
  8673. @subsection Commands
  8674. This filter supports same @ref{commands} as options excluding @code{size} option.
  8675. @section dblur
  8676. Apply Directional blur filter.
  8677. The filter accepts the following options:
  8678. @table @option
  8679. @item angle
  8680. Set angle of directional blur. Default is @code{45}.
  8681. @item radius
  8682. Set radius of directional blur. Default is @code{5}.
  8683. @item planes
  8684. Set which planes to filter. By default all planes are filtered.
  8685. @end table
  8686. @subsection Commands
  8687. This filter supports same @ref{commands} as options.
  8688. The command accepts the same syntax of the corresponding option.
  8689. If the specified expression is not valid, it is kept at its current
  8690. value.
  8691. @section dctdnoiz
  8692. Denoise frames using 2D DCT (frequency domain filtering).
  8693. This filter is not designed for real time.
  8694. The filter accepts the following options:
  8695. @table @option
  8696. @item sigma, s
  8697. Set the noise sigma constant.
  8698. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  8699. coefficient (absolute value) below this threshold with be dropped.
  8700. If you need a more advanced filtering, see @option{expr}.
  8701. Default is @code{0}.
  8702. @item overlap
  8703. Set number overlapping pixels for each block. Since the filter can be slow, you
  8704. may want to reduce this value, at the cost of a less effective filter and the
  8705. risk of various artefacts.
  8706. If the overlapping value doesn't permit processing the whole input width or
  8707. height, a warning will be displayed and according borders won't be denoised.
  8708. Default value is @var{blocksize}-1, which is the best possible setting.
  8709. @item expr, e
  8710. Set the coefficient factor expression.
  8711. For each coefficient of a DCT block, this expression will be evaluated as a
  8712. multiplier value for the coefficient.
  8713. If this is option is set, the @option{sigma} option will be ignored.
  8714. The absolute value of the coefficient can be accessed through the @var{c}
  8715. variable.
  8716. @item n
  8717. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  8718. @var{blocksize}, which is the width and height of the processed blocks.
  8719. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  8720. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  8721. on the speed processing. Also, a larger block size does not necessarily means a
  8722. better de-noising.
  8723. @end table
  8724. @subsection Examples
  8725. Apply a denoise with a @option{sigma} of @code{4.5}:
  8726. @example
  8727. dctdnoiz=4.5
  8728. @end example
  8729. The same operation can be achieved using the expression system:
  8730. @example
  8731. dctdnoiz=e='gte(c, 4.5*3)'
  8732. @end example
  8733. Violent denoise using a block size of @code{16x16}:
  8734. @example
  8735. dctdnoiz=15:n=4
  8736. @end example
  8737. @section deband
  8738. Remove banding artifacts from input video.
  8739. It works by replacing banded pixels with average value of referenced pixels.
  8740. The filter accepts the following options:
  8741. @table @option
  8742. @item 1thr
  8743. @item 2thr
  8744. @item 3thr
  8745. @item 4thr
  8746. Set banding detection threshold for each plane. Default is 0.02.
  8747. Valid range is 0.00003 to 0.5.
  8748. If difference between current pixel and reference pixel is less than threshold,
  8749. it will be considered as banded.
  8750. @item range, r
  8751. Banding detection range in pixels. Default is 16. If positive, random number
  8752. in range 0 to set value will be used. If negative, exact absolute value
  8753. will be used.
  8754. The range defines square of four pixels around current pixel.
  8755. @item direction, d
  8756. Set direction in radians from which four pixel will be compared. If positive,
  8757. random direction from 0 to set direction will be picked. If negative, exact of
  8758. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  8759. will pick only pixels on same row and -PI/2 will pick only pixels on same
  8760. column.
  8761. @item blur, b
  8762. If enabled, current pixel is compared with average value of all four
  8763. surrounding pixels. The default is enabled. If disabled current pixel is
  8764. compared with all four surrounding pixels. The pixel is considered banded
  8765. if only all four differences with surrounding pixels are less than threshold.
  8766. @item coupling, c
  8767. If enabled, current pixel is changed if and only if all pixel components are banded,
  8768. e.g. banding detection threshold is triggered for all color components.
  8769. The default is disabled.
  8770. @end table
  8771. @subsection Commands
  8772. This filter supports the all above options as @ref{commands}.
  8773. @section deblock
  8774. Remove blocking artifacts from input video.
  8775. The filter accepts the following options:
  8776. @table @option
  8777. @item filter
  8778. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  8779. This controls what kind of deblocking is applied.
  8780. @item block
  8781. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  8782. @item alpha
  8783. @item beta
  8784. @item gamma
  8785. @item delta
  8786. Set blocking detection thresholds. Allowed range is 0 to 1.
  8787. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  8788. Using higher threshold gives more deblocking strength.
  8789. Setting @var{alpha} controls threshold detection at exact edge of block.
  8790. Remaining options controls threshold detection near the edge. Each one for
  8791. below/above or left/right. Setting any of those to @var{0} disables
  8792. deblocking.
  8793. @item planes
  8794. Set planes to filter. Default is to filter all available planes.
  8795. @end table
  8796. @subsection Examples
  8797. @itemize
  8798. @item
  8799. Deblock using weak filter and block size of 4 pixels.
  8800. @example
  8801. deblock=filter=weak:block=4
  8802. @end example
  8803. @item
  8804. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  8805. deblocking more edges.
  8806. @example
  8807. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  8808. @end example
  8809. @item
  8810. Similar as above, but filter only first plane.
  8811. @example
  8812. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  8813. @end example
  8814. @item
  8815. Similar as above, but filter only second and third plane.
  8816. @example
  8817. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  8818. @end example
  8819. @end itemize
  8820. @subsection Commands
  8821. This filter supports the all above options as @ref{commands}.
  8822. @anchor{decimate}
  8823. @section decimate
  8824. Drop duplicated frames at regular intervals.
  8825. The filter accepts the following options:
  8826. @table @option
  8827. @item cycle
  8828. Set the number of frames from which one will be dropped. Setting this to
  8829. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  8830. Default is @code{5}.
  8831. @item dupthresh
  8832. Set the threshold for duplicate detection. If the difference metric for a frame
  8833. is less than or equal to this value, then it is declared as duplicate. Default
  8834. is @code{1.1}
  8835. @item scthresh
  8836. Set scene change threshold. Default is @code{15}.
  8837. @item blockx
  8838. @item blocky
  8839. Set the size of the x and y-axis blocks used during metric calculations.
  8840. Larger blocks give better noise suppression, but also give worse detection of
  8841. small movements. Must be a power of two. Default is @code{32}.
  8842. @item ppsrc
  8843. Mark main input as a pre-processed input and activate clean source input
  8844. stream. This allows the input to be pre-processed with various filters to help
  8845. the metrics calculation while keeping the frame selection lossless. When set to
  8846. @code{1}, the first stream is for the pre-processed input, and the second
  8847. stream is the clean source from where the kept frames are chosen. Default is
  8848. @code{0}.
  8849. @item chroma
  8850. Set whether or not chroma is considered in the metric calculations. Default is
  8851. @code{1}.
  8852. @item mixed
  8853. Set whether or not the input only partially contains content to be decimated.
  8854. Default is @code{false}.
  8855. If enabled video output stream will be in variable frame rate.
  8856. @end table
  8857. @section deconvolve
  8858. Apply 2D deconvolution of video stream in frequency domain using second stream
  8859. as impulse.
  8860. The filter accepts the following options:
  8861. @table @option
  8862. @item planes
  8863. Set which planes to process.
  8864. @item impulse
  8865. Set which impulse video frames will be processed, can be @var{first}
  8866. or @var{all}. Default is @var{all}.
  8867. @item noise
  8868. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  8869. and height are not same and not power of 2 or if stream prior to convolving
  8870. had noise.
  8871. @end table
  8872. The @code{deconvolve} filter also supports the @ref{framesync} options.
  8873. @section dedot
  8874. Reduce cross-luminance (dot-crawl) and cross-color (rainbows) from video.
  8875. It accepts the following options:
  8876. @table @option
  8877. @item m
  8878. Set mode of operation. Can be combination of @var{dotcrawl} for cross-luminance reduction and/or
  8879. @var{rainbows} for cross-color reduction.
  8880. @item lt
  8881. Set spatial luma threshold. Lower values increases reduction of cross-luminance.
  8882. @item tl
  8883. Set tolerance for temporal luma. Higher values increases reduction of cross-luminance.
  8884. @item tc
  8885. Set tolerance for chroma temporal variation. Higher values increases reduction of cross-color.
  8886. @item ct
  8887. Set temporal chroma threshold. Lower values increases reduction of cross-color.
  8888. @end table
  8889. @section deflate
  8890. Apply deflate effect to the video.
  8891. This filter replaces the pixel by the local(3x3) average by taking into account
  8892. only values lower than the pixel.
  8893. It accepts the following options:
  8894. @table @option
  8895. @item threshold0
  8896. @item threshold1
  8897. @item threshold2
  8898. @item threshold3
  8899. Limit the maximum change for each plane, default is 65535.
  8900. If 0, plane will remain unchanged.
  8901. @end table
  8902. @subsection Commands
  8903. This filter supports the all above options as @ref{commands}.
  8904. @section deflicker
  8905. Remove temporal frame luminance variations.
  8906. It accepts the following options:
  8907. @table @option
  8908. @item size, s
  8909. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  8910. @item mode, m
  8911. Set averaging mode to smooth temporal luminance variations.
  8912. Available values are:
  8913. @table @samp
  8914. @item am
  8915. Arithmetic mean
  8916. @item gm
  8917. Geometric mean
  8918. @item hm
  8919. Harmonic mean
  8920. @item qm
  8921. Quadratic mean
  8922. @item cm
  8923. Cubic mean
  8924. @item pm
  8925. Power mean
  8926. @item median
  8927. Median
  8928. @end table
  8929. @item bypass
  8930. Do not actually modify frame. Useful when one only wants metadata.
  8931. @end table
  8932. @section dejudder
  8933. Remove judder produced by partially interlaced telecined content.
  8934. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  8935. source was partially telecined content then the output of @code{pullup,dejudder}
  8936. will have a variable frame rate. May change the recorded frame rate of the
  8937. container. Aside from that change, this filter will not affect constant frame
  8938. rate video.
  8939. The option available in this filter is:
  8940. @table @option
  8941. @item cycle
  8942. Specify the length of the window over which the judder repeats.
  8943. Accepts any integer greater than 1. Useful values are:
  8944. @table @samp
  8945. @item 4
  8946. If the original was telecined from 24 to 30 fps (Film to NTSC).
  8947. @item 5
  8948. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  8949. @item 20
  8950. If a mixture of the two.
  8951. @end table
  8952. The default is @samp{4}.
  8953. @end table
  8954. @section delogo
  8955. Suppress a TV station logo by a simple interpolation of the surrounding
  8956. pixels. Just set a rectangle covering the logo and watch it disappear
  8957. (and sometimes something even uglier appear - your mileage may vary).
  8958. It accepts the following parameters:
  8959. @table @option
  8960. @item x
  8961. @item y
  8962. Specify the top left corner coordinates of the logo. They must be
  8963. specified.
  8964. @item w
  8965. @item h
  8966. Specify the width and height of the logo to clear. They must be
  8967. specified.
  8968. @item show
  8969. When set to 1, a green rectangle is drawn on the screen to simplify
  8970. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  8971. The default value is 0.
  8972. The rectangle is drawn on the outermost pixels which will be (partly)
  8973. replaced with interpolated values. The values of the next pixels
  8974. immediately outside this rectangle in each direction will be used to
  8975. compute the interpolated pixel values inside the rectangle.
  8976. @end table
  8977. @subsection Examples
  8978. @itemize
  8979. @item
  8980. Set a rectangle covering the area with top left corner coordinates 0,0
  8981. and size 100x77:
  8982. @example
  8983. delogo=x=0:y=0:w=100:h=77
  8984. @end example
  8985. @end itemize
  8986. @anchor{derain}
  8987. @section derain
  8988. Remove the rain in the input image/video by applying the derain methods based on
  8989. convolutional neural networks. Supported models:
  8990. @itemize
  8991. @item
  8992. Recurrent Squeeze-and-Excitation Context Aggregation Net (RESCAN).
  8993. See @url{http://openaccess.thecvf.com/content_ECCV_2018/papers/Xia_Li_Recurrent_Squeeze-and-Excitation_Context_ECCV_2018_paper.pdf}.
  8994. @end itemize
  8995. Training as well as model generation scripts are provided in
  8996. the repository at @url{https://github.com/XueweiMeng/derain_filter.git}.
  8997. The filter accepts the following options:
  8998. @table @option
  8999. @item filter_type
  9000. Specify which filter to use. This option accepts the following values:
  9001. @table @samp
  9002. @item derain
  9003. Derain filter. To conduct derain filter, you need to use a derain model.
  9004. @item dehaze
  9005. Dehaze filter. To conduct dehaze filter, you need to use a dehaze model.
  9006. @end table
  9007. Default value is @samp{derain}.
  9008. @item dnn_backend
  9009. Specify which DNN backend to use for model loading and execution. This option accepts
  9010. the following values:
  9011. @table @samp
  9012. @item tensorflow
  9013. TensorFlow backend. To enable this backend you
  9014. need to install the TensorFlow for C library (see
  9015. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  9016. @code{--enable-libtensorflow}
  9017. @end table
  9018. @item model
  9019. Set path to model file specifying network architecture and its parameters.
  9020. Note that different backends use different file formats. TensorFlow can load files for only its format.
  9021. @end table
  9022. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  9023. @section deshake
  9024. Attempt to fix small changes in horizontal and/or vertical shift. This
  9025. filter helps remove camera shake from hand-holding a camera, bumping a
  9026. tripod, moving on a vehicle, etc.
  9027. The filter accepts the following options:
  9028. @table @option
  9029. @item x
  9030. @item y
  9031. @item w
  9032. @item h
  9033. Specify a rectangular area where to limit the search for motion
  9034. vectors.
  9035. If desired the search for motion vectors can be limited to a
  9036. rectangular area of the frame defined by its top left corner, width
  9037. and height. These parameters have the same meaning as the drawbox
  9038. filter which can be used to visualise the position of the bounding
  9039. box.
  9040. This is useful when simultaneous movement of subjects within the frame
  9041. might be confused for camera motion by the motion vector search.
  9042. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  9043. then the full frame is used. This allows later options to be set
  9044. without specifying the bounding box for the motion vector search.
  9045. Default - search the whole frame.
  9046. @item rx
  9047. @item ry
  9048. Specify the maximum extent of movement in x and y directions in the
  9049. range 0-64 pixels. Default 16.
  9050. @item edge
  9051. Specify how to generate pixels to fill blanks at the edge of the
  9052. frame. Available values are:
  9053. @table @samp
  9054. @item blank, 0
  9055. Fill zeroes at blank locations
  9056. @item original, 1
  9057. Original image at blank locations
  9058. @item clamp, 2
  9059. Extruded edge value at blank locations
  9060. @item mirror, 3
  9061. Mirrored edge at blank locations
  9062. @end table
  9063. Default value is @samp{mirror}.
  9064. @item blocksize
  9065. Specify the blocksize to use for motion search. Range 4-128 pixels,
  9066. default 8.
  9067. @item contrast
  9068. Specify the contrast threshold for blocks. Only blocks with more than
  9069. the specified contrast (difference between darkest and lightest
  9070. pixels) will be considered. Range 1-255, default 125.
  9071. @item search
  9072. Specify the search strategy. Available values are:
  9073. @table @samp
  9074. @item exhaustive, 0
  9075. Set exhaustive search
  9076. @item less, 1
  9077. Set less exhaustive search.
  9078. @end table
  9079. Default value is @samp{exhaustive}.
  9080. @item filename
  9081. If set then a detailed log of the motion search is written to the
  9082. specified file.
  9083. @end table
  9084. @section despill
  9085. Remove unwanted contamination of foreground colors, caused by reflected color of
  9086. greenscreen or bluescreen.
  9087. This filter accepts the following options:
  9088. @table @option
  9089. @item type
  9090. Set what type of despill to use.
  9091. @item mix
  9092. Set how spillmap will be generated.
  9093. @item expand
  9094. Set how much to get rid of still remaining spill.
  9095. @item red
  9096. Controls amount of red in spill area.
  9097. @item green
  9098. Controls amount of green in spill area.
  9099. Should be -1 for greenscreen.
  9100. @item blue
  9101. Controls amount of blue in spill area.
  9102. Should be -1 for bluescreen.
  9103. @item brightness
  9104. Controls brightness of spill area, preserving colors.
  9105. @item alpha
  9106. Modify alpha from generated spillmap.
  9107. @end table
  9108. @subsection Commands
  9109. This filter supports the all above options as @ref{commands}.
  9110. @section detelecine
  9111. Apply an exact inverse of the telecine operation. It requires a predefined
  9112. pattern specified using the pattern option which must be the same as that passed
  9113. to the telecine filter.
  9114. This filter accepts the following options:
  9115. @table @option
  9116. @item first_field
  9117. @table @samp
  9118. @item top, t
  9119. top field first
  9120. @item bottom, b
  9121. bottom field first
  9122. The default value is @code{top}.
  9123. @end table
  9124. @item pattern
  9125. A string of numbers representing the pulldown pattern you wish to apply.
  9126. The default value is @code{23}.
  9127. @item start_frame
  9128. A number representing position of the first frame with respect to the telecine
  9129. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  9130. @end table
  9131. @anchor{dilation}
  9132. @section dilation
  9133. Apply dilation effect to the video.
  9134. This filter replaces the pixel by the local(3x3) maximum.
  9135. It accepts the following options:
  9136. @table @option
  9137. @item threshold0
  9138. @item threshold1
  9139. @item threshold2
  9140. @item threshold3
  9141. Limit the maximum change for each plane, default is 65535.
  9142. If 0, plane will remain unchanged.
  9143. @item coordinates
  9144. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  9145. pixels are used.
  9146. Flags to local 3x3 coordinates maps like this:
  9147. 1 2 3
  9148. 4 5
  9149. 6 7 8
  9150. @end table
  9151. @subsection Commands
  9152. This filter supports the all above options as @ref{commands}.
  9153. @section displace
  9154. Displace pixels as indicated by second and third input stream.
  9155. It takes three input streams and outputs one stream, the first input is the
  9156. source, and second and third input are displacement maps.
  9157. The second input specifies how much to displace pixels along the
  9158. x-axis, while the third input specifies how much to displace pixels
  9159. along the y-axis.
  9160. If one of displacement map streams terminates, last frame from that
  9161. displacement map will be used.
  9162. Note that once generated, displacements maps can be reused over and over again.
  9163. A description of the accepted options follows.
  9164. @table @option
  9165. @item edge
  9166. Set displace behavior for pixels that are out of range.
  9167. Available values are:
  9168. @table @samp
  9169. @item blank
  9170. Missing pixels are replaced by black pixels.
  9171. @item smear
  9172. Adjacent pixels will spread out to replace missing pixels.
  9173. @item wrap
  9174. Out of range pixels are wrapped so they point to pixels of other side.
  9175. @item mirror
  9176. Out of range pixels will be replaced with mirrored pixels.
  9177. @end table
  9178. Default is @samp{smear}.
  9179. @end table
  9180. @subsection Examples
  9181. @itemize
  9182. @item
  9183. Add ripple effect to rgb input of video size hd720:
  9184. @example
  9185. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  9186. @end example
  9187. @item
  9188. Add wave effect to rgb input of video size hd720:
  9189. @example
  9190. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  9191. @end example
  9192. @end itemize
  9193. @section dnn_classify
  9194. Do classification with deep neural networks based on bounding boxes.
  9195. The filter accepts the following options:
  9196. @table @option
  9197. @item dnn_backend
  9198. Specify which DNN backend to use for model loading and execution. This option accepts
  9199. only openvino now, tensorflow backends will be added.
  9200. @item model
  9201. Set path to model file specifying network architecture and its parameters.
  9202. Note that different backends use different file formats.
  9203. @item input
  9204. Set the input name of the dnn network.
  9205. @item output
  9206. Set the output name of the dnn network.
  9207. @item confidence
  9208. Set the confidence threshold (default: 0.5).
  9209. @item labels
  9210. Set path to label file specifying the mapping between label id and name.
  9211. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9212. The first line is the name of label id 0,
  9213. and the second line is the name of label id 1, etc.
  9214. The label id is considered as name if the label file is not provided.
  9215. @item backend_configs
  9216. Set the configs to be passed into backend
  9217. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9218. please use tools/python/tf_sess_config.py to get the configs for your system.
  9219. @end table
  9220. @section dnn_detect
  9221. Do object detection with deep neural networks.
  9222. The filter accepts the following options:
  9223. @table @option
  9224. @item dnn_backend
  9225. Specify which DNN backend to use for model loading and execution. This option accepts
  9226. only openvino now, tensorflow backends will be added.
  9227. @item model
  9228. Set path to model file specifying network architecture and its parameters.
  9229. Note that different backends use different file formats.
  9230. @item input
  9231. Set the input name of the dnn network.
  9232. @item output
  9233. Set the output name of the dnn network.
  9234. @item confidence
  9235. Set the confidence threshold (default: 0.5).
  9236. @item labels
  9237. Set path to label file specifying the mapping between label id and name.
  9238. Each label name is written in one line, tailing spaces and empty lines are skipped.
  9239. The first line is the name of label id 0 (usually it is 'background'),
  9240. and the second line is the name of label id 1, etc.
  9241. The label id is considered as name if the label file is not provided.
  9242. @item backend_configs
  9243. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9244. Roll back to sync execution if the backend does not support async.
  9245. @end table
  9246. @anchor{dnn_processing}
  9247. @section dnn_processing
  9248. Do image processing with deep neural networks. It works together with another filter
  9249. which converts the pixel format of the Frame to what the dnn network requires.
  9250. The filter accepts the following options:
  9251. @table @option
  9252. @item dnn_backend
  9253. Specify which DNN backend to use for model loading and execution. This option accepts
  9254. the following values:
  9255. @table @samp
  9256. @item tensorflow
  9257. TensorFlow backend. To enable this backend you
  9258. need to install the TensorFlow for C library (see
  9259. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  9260. @code{--enable-libtensorflow}
  9261. @item openvino
  9262. OpenVINO backend. To enable this backend you
  9263. need to build and install the OpenVINO for C library (see
  9264. @url{https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md}) and configure FFmpeg with
  9265. @code{--enable-libopenvino} (--extra-cflags=-I... --extra-ldflags=-L... might
  9266. be needed if the header files and libraries are not installed into system path)
  9267. @item torch
  9268. Libtorch backend. To enable this backend you need to build and install Libtroch
  9269. for C++ library. Please download cxx11 ABI version (see
  9270. @url{https://pytorch.org/get-started/locally})
  9271. and configure FFmpeg with @code{--enable-libtorch
  9272. --extra-cflags=-I/libtorch_root/libtorch/include
  9273. --extra-cflags=-I/libtorch_root/libtorch/include/torch/csrc/api/include
  9274. --extra-ldflags=-L/libtorch_root/libtorch/lib/}
  9275. @end table
  9276. @item model
  9277. Set path to model file specifying network architecture and its parameters.
  9278. Note that different backends use different file formats. TensorFlow, OpenVINO
  9279. and Libtorch backend can load files for only its format.
  9280. @item input
  9281. Set the input name of the dnn network.
  9282. @item output
  9283. Set the output name of the dnn network.
  9284. @item backend_configs
  9285. Set the configs to be passed into backend. To use async execution, set async (default: set).
  9286. Roll back to sync execution if the backend does not support async.
  9287. For tensorflow backend, you can set its configs with @option{sess_config} options,
  9288. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9289. @end table
  9290. @subsection Examples
  9291. @itemize
  9292. @item
  9293. Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
  9294. @example
  9295. ./ffmpeg -i rain.jpg -vf format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y derain.jpg
  9296. @end example
  9297. @item
  9298. Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p (planar YUV formats supported):
  9299. @example
  9300. ./ffmpeg -i 480p.jpg -vf format=yuv420p,scale=w=iw*2:h=ih*2,dnn_processing=dnn_backend=tensorflow:model=srcnn.pb:input=x:output=y -y srcnn.jpg
  9301. @end example
  9302. @item
  9303. Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported),
  9304. please use tools/python/tf_sess_config.py to get the configs of TensorFlow backend for your system.
  9305. @example
  9306. ./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y:backend_configs=sess_config=0x10022805320e09cdccccccccccec3f20012a01303801 -y tmp.espcn.jpg
  9307. @end example
  9308. @end itemize
  9309. @section drawbox
  9310. Draw a colored box on the input image.
  9311. It accepts the following parameters:
  9312. @table @option
  9313. @item x
  9314. @item y
  9315. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  9316. @item width, w
  9317. @item height, h
  9318. The expressions which specify the width and height of the box; if 0 they are interpreted as
  9319. the input width and height. It defaults to 0.
  9320. @item color, c
  9321. Specify the color of the box to write. For the general syntax of this option,
  9322. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9323. value @code{invert} is used, the box edge color is the same as the
  9324. video with inverted luma.
  9325. @item thickness, t
  9326. The expression which sets the thickness of the box edge.
  9327. A value of @code{fill} will create a filled box. Default value is @code{3}.
  9328. See below for the list of accepted constants.
  9329. @item replace
  9330. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  9331. will overwrite the video's color and alpha pixels.
  9332. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  9333. @end table
  9334. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9335. following constants:
  9336. @table @option
  9337. @item dar
  9338. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9339. @item hsub
  9340. @item vsub
  9341. horizontal and vertical chroma subsample values. For example for the
  9342. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9343. @item in_h, ih
  9344. @item in_w, iw
  9345. The input width and height.
  9346. @item sar
  9347. The input sample aspect ratio.
  9348. @item x
  9349. @item y
  9350. The x and y offset coordinates where the box is drawn.
  9351. @item w
  9352. @item h
  9353. The width and height of the drawn box.
  9354. @item box_source
  9355. Box source can be set as side_data_detection_bboxes if you want to use box data in
  9356. detection bboxes of side data.
  9357. If @var{box_source} is set, the @var{x}, @var{y}, @var{width} and @var{height} will be ignored and
  9358. still use box data in detection bboxes of side data. So please do not use this parameter if you were
  9359. not sure about the box source.
  9360. @item t
  9361. The thickness of the drawn box.
  9362. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9363. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9364. @end table
  9365. @subsection Examples
  9366. @itemize
  9367. @item
  9368. Draw a black box around the edge of the input image:
  9369. @example
  9370. drawbox
  9371. @end example
  9372. @item
  9373. Draw a box with color red and an opacity of 50%:
  9374. @example
  9375. drawbox=10:20:200:60:red@@0.5
  9376. @end example
  9377. The previous example can be specified as:
  9378. @example
  9379. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  9380. @end example
  9381. @item
  9382. Fill the box with pink color:
  9383. @example
  9384. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  9385. @end example
  9386. @item
  9387. Draw a 2-pixel red 2.40:1 mask:
  9388. @example
  9389. drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
  9390. @end example
  9391. @end itemize
  9392. @subsection Commands
  9393. This filter supports same commands as options.
  9394. The command accepts the same syntax of the corresponding option.
  9395. If the specified expression is not valid, it is kept at its current
  9396. value.
  9397. @anchor{drawgraph}
  9398. @section drawgraph
  9399. Draw a graph using input video metadata.
  9400. It accepts the following parameters:
  9401. @table @option
  9402. @item m1
  9403. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  9404. @item fg1
  9405. Set 1st foreground color expression.
  9406. @item m2
  9407. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  9408. @item fg2
  9409. Set 2nd foreground color expression.
  9410. @item m3
  9411. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  9412. @item fg3
  9413. Set 3rd foreground color expression.
  9414. @item m4
  9415. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  9416. @item fg4
  9417. Set 4th foreground color expression.
  9418. @item min
  9419. Set minimal value of metadata value.
  9420. @item max
  9421. Set maximal value of metadata value.
  9422. @item bg
  9423. Set graph background color. Default is white.
  9424. @item mode
  9425. Set graph mode.
  9426. Available values for mode is:
  9427. @table @samp
  9428. @item bar
  9429. @item dot
  9430. @item line
  9431. @end table
  9432. Default is @code{line}.
  9433. @item slide
  9434. Set slide mode.
  9435. Available values for slide is:
  9436. @table @samp
  9437. @item frame
  9438. Draw new frame when right border is reached.
  9439. @item replace
  9440. Replace old columns with new ones.
  9441. @item scroll
  9442. Scroll from right to left.
  9443. @item rscroll
  9444. Scroll from left to right.
  9445. @item picture
  9446. Draw single picture.
  9447. @end table
  9448. Default is @code{frame}.
  9449. @item size
  9450. Set size of graph video. For the syntax of this option, check the
  9451. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9452. The default value is @code{900x256}.
  9453. @item rate, r
  9454. Set the output frame rate. Default value is @code{25}.
  9455. The foreground color expressions can use the following variables:
  9456. @table @option
  9457. @item MIN
  9458. Minimal value of metadata value.
  9459. @item MAX
  9460. Maximal value of metadata value.
  9461. @item VAL
  9462. Current metadata key value.
  9463. @end table
  9464. The color is defined as 0xAABBGGRR.
  9465. @end table
  9466. Example using metadata from @ref{signalstats} filter:
  9467. @example
  9468. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  9469. @end example
  9470. Example using metadata from @ref{ebur128} filter:
  9471. @example
  9472. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  9473. @end example
  9474. @section drawgrid
  9475. Draw a grid on the input image.
  9476. It accepts the following parameters:
  9477. @table @option
  9478. @item x
  9479. @item y
  9480. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  9481. @item width, w
  9482. @item height, h
  9483. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  9484. input width and height, respectively, minus @code{thickness}, so image gets
  9485. framed. Default to 0.
  9486. @item color, c
  9487. Specify the color of the grid. For the general syntax of this option,
  9488. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  9489. value @code{invert} is used, the grid color is the same as the
  9490. video with inverted luma.
  9491. @item thickness, t
  9492. The expression which sets the thickness of the grid line. Default value is @code{1}.
  9493. See below for the list of accepted constants.
  9494. @item replace
  9495. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  9496. will overwrite the video's color and alpha pixels.
  9497. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  9498. @end table
  9499. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  9500. following constants:
  9501. @table @option
  9502. @item dar
  9503. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  9504. @item hsub
  9505. @item vsub
  9506. horizontal and vertical chroma subsample values. For example for the
  9507. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9508. @item in_h, ih
  9509. @item in_w, iw
  9510. The input grid cell width and height.
  9511. @item sar
  9512. The input sample aspect ratio.
  9513. @item x
  9514. @item y
  9515. The x and y coordinates of some point of grid intersection (meant to configure offset).
  9516. @item w
  9517. @item h
  9518. The width and height of the drawn cell.
  9519. @item t
  9520. The thickness of the drawn cell.
  9521. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  9522. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  9523. @end table
  9524. @subsection Examples
  9525. @itemize
  9526. @item
  9527. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  9528. @example
  9529. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  9530. @end example
  9531. @item
  9532. Draw a white 3x3 grid with an opacity of 50%:
  9533. @example
  9534. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  9535. @end example
  9536. @end itemize
  9537. @subsection Commands
  9538. This filter supports same commands as options.
  9539. The command accepts the same syntax of the corresponding option.
  9540. If the specified expression is not valid, it is kept at its current
  9541. value.
  9542. @anchor{drawtext}
  9543. @section drawtext
  9544. Draw a text string or text from a specified file on top of a video, using the
  9545. libfreetype library.
  9546. To enable compilation of this filter, you need to configure FFmpeg with
  9547. @code{--enable-libfreetype} and @code{--enable-libharfbuzz}.
  9548. To enable default font fallback and the @var{font} option you need to
  9549. configure FFmpeg with @code{--enable-libfontconfig}.
  9550. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  9551. @code{--enable-libfribidi}.
  9552. @subsection Syntax
  9553. It accepts the following parameters:
  9554. @table @option
  9555. @item box
  9556. Used to draw a box around text using the background color.
  9557. The value must be either 1 (enable) or 0 (disable).
  9558. The default value of @var{box} is 0.
  9559. @item boxborderw
  9560. Set the width of the border to be drawn around the box using @var{boxcolor}.
  9561. The value must be specified using one of the following formats:
  9562. @itemize @bullet
  9563. @item @code{boxborderw=10} set the width of all the borders to 10
  9564. @item @code{boxborderw=10|20} set the width of the top and bottom borders to 10
  9565. and the width of the left and right borders to 20
  9566. @item @code{boxborderw=10|20|30} set the width of the top border to 10, the width
  9567. of the bottom border to 30 and the width of the left and right borders to 20
  9568. @item @code{boxborderw=10|20|30|40} set the borders width to 10 (top), 20 (right),
  9569. 30 (bottom), 40 (left)
  9570. @end itemize
  9571. The default value of @var{boxborderw} is "0".
  9572. @item boxcolor
  9573. The color to be used for drawing box around text. For the syntax of this
  9574. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9575. The default value of @var{boxcolor} is "white".
  9576. @item line_spacing
  9577. Set the line spacing in pixels. The default value of @var{line_spacing} is 0.
  9578. @item text_align
  9579. Set the vertical and horizontal alignment of the text with respect to the box boundaries.
  9580. The value is combination of flags, one for the vertical alignment (T=top,
  9581. M=middle, B=bottom) and one for the horizontal alignment (L=left, C=center, R=right).
  9582. Please note that tab characters are only supported with the left horizontal alignment.
  9583. @item y_align
  9584. Specify what the @var{y} value is referred to. Possible values are:
  9585. @itemize @bullet
  9586. @item @code{text} the top of the highest glyph of the first text line is placed at @var{y}
  9587. @item @code{baseline} the baseline of the first text line is placed at @var{y}
  9588. @item @code{font} the baseline of the first text line is placed at @var{y} plus the
  9589. ascent (in pixels) defined in the font metrics
  9590. @end itemize
  9591. The default value of @var{y_align} is "text" for backward compatibility.
  9592. @item borderw
  9593. Set the width of the border to be drawn around the text using @var{bordercolor}.
  9594. The default value of @var{borderw} is 0.
  9595. @item bordercolor
  9596. Set the color to be used for drawing border around text. For the syntax of this
  9597. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9598. The default value of @var{bordercolor} is "black".
  9599. @item expansion
  9600. Select how the @var{text} is expanded. Can be either @code{none},
  9601. @code{strftime} (deprecated) or @code{normal} (default). See the
  9602. @ref{drawtext_expansion, Text expansion} section below for details.
  9603. @item basetime
  9604. Set a start time for the count. Value is in microseconds. Only applied
  9605. in the deprecated @code{strftime} expansion mode. To emulate in normal expansion
  9606. mode use the @code{pts} function, supplying the start time (in seconds)
  9607. as the second argument.
  9608. @item fix_bounds
  9609. If true, check and fix text coords to avoid clipping.
  9610. @item fontcolor
  9611. The color to be used for drawing fonts. For the syntax of this option, check
  9612. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9613. The default value of @var{fontcolor} is "black".
  9614. @item fontcolor_expr
  9615. String which is expanded the same way as @var{text} to obtain dynamic
  9616. @var{fontcolor} value. By default this option has empty value and is not
  9617. processed. When this option is set, it overrides @var{fontcolor} option.
  9618. @item font
  9619. The font family to be used for drawing text. By default Sans.
  9620. @item fontfile
  9621. The font file to be used for drawing text. The path must be included.
  9622. This parameter is mandatory if the fontconfig support is disabled.
  9623. @item alpha
  9624. Draw the text applying alpha blending. The value can
  9625. be a number between 0.0 and 1.0.
  9626. The expression accepts the same variables @var{x, y} as well.
  9627. The default value is 1.
  9628. Please see @var{fontcolor_expr}.
  9629. @item fontsize
  9630. The font size to be used for drawing text.
  9631. The default value of @var{fontsize} is 16.
  9632. @item text_shaping
  9633. If set to 1, attempt to shape the text (for example, reverse the order of
  9634. right-to-left text and join Arabic characters) before drawing it.
  9635. Otherwise, just draw the text exactly as given.
  9636. By default 1 (if supported).
  9637. @item ft_load_flags
  9638. The flags to be used for loading the fonts.
  9639. The flags map the corresponding flags supported by libfreetype, and are
  9640. a combination of the following values:
  9641. @table @var
  9642. @item default
  9643. @item no_scale
  9644. @item no_hinting
  9645. @item render
  9646. @item no_bitmap
  9647. @item vertical_layout
  9648. @item force_autohint
  9649. @item crop_bitmap
  9650. @item pedantic
  9651. @item ignore_global_advance_width
  9652. @item no_recurse
  9653. @item ignore_transform
  9654. @item monochrome
  9655. @item linear_design
  9656. @item no_autohint
  9657. @end table
  9658. Default value is "default".
  9659. For more information consult the documentation for the FT_LOAD_*
  9660. libfreetype flags.
  9661. @item shadowcolor
  9662. The color to be used for drawing a shadow behind the drawn text. For the
  9663. syntax of this option, check the @ref{color syntax,,"Color" section in the
  9664. ffmpeg-utils manual,ffmpeg-utils}.
  9665. The default value of @var{shadowcolor} is "black".
  9666. @item boxw
  9667. Set the width of the box to be drawn around text.
  9668. The default value of @var{boxw} is computed automatically to match the text width
  9669. @item boxh
  9670. Set the height of the box to be drawn around text.
  9671. The default value of @var{boxh} is computed automatically to match the text height
  9672. @item shadowx
  9673. @item shadowy
  9674. The x and y offsets for the text shadow position with respect to the
  9675. position of the text. They can be either positive or negative
  9676. values. The default value for both is "0".
  9677. @item start_number
  9678. The starting frame number for the n/frame_num variable. The default value
  9679. is "0".
  9680. @item tabsize
  9681. The size in number of spaces to use for rendering the tab.
  9682. Default value is 4.
  9683. @item timecode
  9684. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  9685. format. It can be used with or without text parameter. @var{timecode_rate}
  9686. option must be specified.
  9687. @item timecode_rate, rate, r
  9688. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  9689. integer. Minimum value is "1".
  9690. Drop-frame timecode is supported for frame rates 30 & 60.
  9691. @item tc24hmax
  9692. If set to 1, the output of the timecode option will wrap around at 24 hours.
  9693. Default is 0 (disabled).
  9694. @item text
  9695. The text string to be drawn. The text must be a sequence of UTF-8
  9696. encoded characters.
  9697. This parameter is mandatory if no file is specified with the parameter
  9698. @var{textfile}.
  9699. @item textfile
  9700. A text file containing text to be drawn. The text must be a sequence
  9701. of UTF-8 encoded characters.
  9702. This parameter is mandatory if no text string is specified with the
  9703. parameter @var{text}.
  9704. If both @var{text} and @var{textfile} are specified, an error is thrown.
  9705. @item text_source
  9706. Text source should be set as side_data_detection_bboxes if you want to use text data in
  9707. detection bboxes of side data.
  9708. If text source is set, @var{text} and @var{textfile} will be ignored and still use
  9709. text data in detection bboxes of side data. So please do not use this parameter
  9710. if you are not sure about the text source.
  9711. @item reload
  9712. The @var{textfile} will be reloaded at specified frame interval.
  9713. Be sure to update @var{textfile} atomically, or it may be read partially,
  9714. or even fail.
  9715. Range is 0 to INT_MAX. Default is 0.
  9716. @item x
  9717. @item y
  9718. The expressions which specify the offsets where text will be drawn
  9719. within the video frame. They are relative to the top/left border of the
  9720. output image.
  9721. The default value of @var{x} and @var{y} is "0".
  9722. See below for the list of accepted constants and functions.
  9723. @end table
  9724. The parameters for @var{x} and @var{y} are expressions containing the
  9725. following constants and functions:
  9726. @table @option
  9727. @item dar
  9728. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9729. @item hsub
  9730. @item vsub
  9731. horizontal and vertical chroma subsample values. For example for the
  9732. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9733. @item line_h, lh
  9734. the height of each text line
  9735. @item main_h, h, H
  9736. the input height
  9737. @item main_w, w, W
  9738. the input width
  9739. @item max_glyph_a, ascent
  9740. the maximum distance from the baseline to the highest/upper grid
  9741. coordinate used to place a glyph outline point, for all the rendered
  9742. glyphs.
  9743. It is a positive value, due to the grid's orientation with the Y axis
  9744. upwards.
  9745. @item max_glyph_d, descent
  9746. the maximum distance from the baseline to the lowest grid coordinate
  9747. used to place a glyph outline point, for all the rendered glyphs.
  9748. This is a negative value, due to the grid's orientation, with the Y axis
  9749. upwards.
  9750. @item max_glyph_h
  9751. maximum glyph height, that is the maximum height for all the glyphs
  9752. contained in the rendered text, it is equivalent to @var{ascent} -
  9753. @var{descent}.
  9754. @item max_glyph_w
  9755. maximum glyph width, that is the maximum width for all the glyphs
  9756. contained in the rendered text
  9757. @item font_a
  9758. the ascent size defined in the font metrics
  9759. @item font_d
  9760. the descent size defined in the font metrics
  9761. @item top_a
  9762. the maximum ascender of the glyphs of the first text line
  9763. @item bottom_d
  9764. the maximum descender of the glyphs of the last text line
  9765. @item n
  9766. the number of input frame, starting from 0
  9767. @item rand(min, max)
  9768. return a random number included between @var{min} and @var{max}
  9769. @item sar
  9770. The input sample aspect ratio.
  9771. @item t
  9772. timestamp expressed in seconds, NAN if the input timestamp is unknown
  9773. @item text_h, th
  9774. the height of the rendered text
  9775. @item text_w, tw
  9776. the width of the rendered text
  9777. @item x
  9778. @item y
  9779. the x and y offset coordinates where the text is drawn.
  9780. These parameters allow the @var{x} and @var{y} expressions to refer
  9781. to each other, so you can for example specify @code{y=x/dar}.
  9782. @item pict_type
  9783. A one character description of the current frame's picture type.
  9784. @item pkt_pos
  9785. The current packet's position in the input file or stream
  9786. (in bytes, from the start of the input). A value of -1 indicates
  9787. this info is not available.
  9788. @item duration
  9789. The current packet's duration, in seconds.
  9790. @item pkt_size
  9791. The current packet's size (in bytes).
  9792. @end table
  9793. @anchor{drawtext_expansion}
  9794. @subsection Text expansion
  9795. If @option{expansion} is set to @code{strftime}, the filter recognizes
  9796. sequences accepted by the @code{strftime} C function in the provided
  9797. text and expands them accordingly. Check the documentation of
  9798. @code{strftime}. This feature is deprecated in favor of @code{normal}
  9799. expansion with the @code{gmtime} or @code{localtime} expansion
  9800. functions.
  9801. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  9802. If @option{expansion} is set to @code{normal} (which is the default),
  9803. the following expansion mechanism is used.
  9804. The backslash character @samp{\}, followed by any character, always expands to
  9805. the second character.
  9806. Sequences of the form @code{%@{...@}} are expanded. The text between the
  9807. braces is a function name, possibly followed by arguments separated by ':'.
  9808. If the arguments contain special characters or delimiters (':' or '@}'),
  9809. they should be escaped.
  9810. Note that they probably must also be escaped as the value for the @option{text}
  9811. option in the filter argument string and as the filter argument in the
  9812. filtergraph description, and possibly also for the shell, that makes up to four
  9813. levels of escaping; using a text file with the @option{textfile} option avoids
  9814. these problems.
  9815. The following functions are available:
  9816. @table @command
  9817. @item expr, e
  9818. The expression evaluation result.
  9819. It must take one argument specifying the expression to be evaluated,
  9820. which accepts the same constants and functions as the @var{x} and
  9821. @var{y} values. Note that not all constants should be used, for
  9822. example the text size is not known when evaluating the expression, so
  9823. the constants @var{text_w} and @var{text_h} will have an undefined
  9824. value.
  9825. @item expr_int_format, eif
  9826. Evaluate the expression's value and output as formatted integer.
  9827. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  9828. The second argument specifies the output format. Allowed values are @samp{x},
  9829. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  9830. @code{printf} function.
  9831. The third parameter is optional and sets the number of positions taken by the output.
  9832. It can be used to add padding with zeros from the left.
  9833. @item gmtime
  9834. The time at which the filter is running, expressed in UTC.
  9835. It can accept an argument: a @code{strftime} C function format string.
  9836. The format string is extended to support the variable @var{%[1-6]N}
  9837. which prints fractions of the second with optionally specified number of digits.
  9838. @item localtime
  9839. The time at which the filter is running, expressed in the local time zone.
  9840. It can accept an argument: a @code{strftime} C function format string.
  9841. The format string is extended to support the variable @var{%[1-6]N}
  9842. which prints fractions of the second with optionally specified number of digits.
  9843. @item metadata
  9844. Frame metadata. Takes one or two arguments.
  9845. The first argument is mandatory and specifies the metadata key.
  9846. The second argument is optional and specifies a default value, used when the
  9847. metadata key is not found or empty.
  9848. Available metadata can be identified by inspecting entries
  9849. starting with TAG included within each frame section
  9850. printed by running @code{ffprobe -show_frames}.
  9851. String metadata generated in filters leading to
  9852. the drawtext filter are also available.
  9853. @item n, frame_num
  9854. The frame number, starting from 0.
  9855. @item pict_type
  9856. A one character description of the current picture type.
  9857. @item pts
  9858. The timestamp of the current frame.
  9859. It can take up to three arguments.
  9860. The first argument is the format of the timestamp; it defaults to @code{flt}
  9861. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  9862. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  9863. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  9864. @code{localtime} stands for the timestamp of the frame formatted as
  9865. local time zone time.
  9866. The second argument is an offset added to the timestamp.
  9867. If the format is set to @code{hms}, a third argument @code{24HH} may be
  9868. supplied to present the hour part of the formatted timestamp in 24h format
  9869. (00-23).
  9870. If the format is set to @code{localtime} or @code{gmtime}, a third
  9871. argument may be supplied: a @code{strftime} C function format string.
  9872. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  9873. @end table
  9874. @subsection Commands
  9875. This filter supports altering parameters via commands:
  9876. @table @option
  9877. @item reinit
  9878. Alter existing filter parameters.
  9879. Syntax for the argument is the same as for filter invocation, e.g.
  9880. @example
  9881. fontsize=56:fontcolor=green:text='Hello World'
  9882. @end example
  9883. Full filter invocation with sendcmd would look like this:
  9884. @example
  9885. sendcmd=c='56.0 drawtext reinit fontsize=56\:fontcolor=green\:text=Hello\\ World'
  9886. @end example
  9887. If the entire argument can't be parsed or applied as valid values then the filter will
  9888. continue with its existing parameters.
  9889. @end table
  9890. The following options are also supported as @ref{commands}:
  9891. @itemize @bullet
  9892. @item x
  9893. @item y
  9894. @item alpha
  9895. @item fontsize
  9896. @item fontcolor
  9897. @item boxcolor
  9898. @item bordercolor
  9899. @item shadowcolor
  9900. @item box
  9901. @item boxw
  9902. @item boxh
  9903. @item boxborderw
  9904. @item line_spacing
  9905. @item text_align
  9906. @item shadowx
  9907. @item shadowy
  9908. @item borderw
  9909. @end itemize
  9910. @subsection Examples
  9911. @itemize
  9912. @item
  9913. Draw "Test Text" with font FreeSerif, using the default values for the
  9914. optional parameters.
  9915. @example
  9916. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  9917. @end example
  9918. @item
  9919. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  9920. and y=50 (counting from the top-left corner of the screen), text is
  9921. yellow with a red box around it. Both the text and the box have an
  9922. opacity of 20%.
  9923. @example
  9924. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  9925. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  9926. @end example
  9927. Note that the double quotes are not necessary if spaces are not used
  9928. within the parameter list.
  9929. @item
  9930. Show the text at the center of the video frame:
  9931. @example
  9932. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  9933. @end example
  9934. @item
  9935. Show the text at a random position, switching to a new position every 30 seconds:
  9936. @example
  9937. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  9938. @end example
  9939. @item
  9940. Show a text line sliding from right to left in the last row of the video
  9941. frame. The file @file{LONG_LINE} is assumed to contain a single line
  9942. with no newlines.
  9943. @example
  9944. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  9945. @end example
  9946. @item
  9947. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  9948. @example
  9949. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  9950. @end example
  9951. @item
  9952. Draw a single green letter "g", at the center of the input video.
  9953. The glyph baseline is placed at half screen height.
  9954. @example
  9955. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  9956. @end example
  9957. @item
  9958. Show text for 1 second every 3 seconds:
  9959. @example
  9960. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  9961. @end example
  9962. @item
  9963. Use fontconfig to set the font. Note that the colons need to be escaped.
  9964. @example
  9965. drawtext='fontfile=Linux Libertine O-40\\:style=Semibold:text=FFmpeg'
  9966. @end example
  9967. @item
  9968. Draw "Test Text" with font size dependent on height of the video.
  9969. @example
  9970. drawtext="text='Test Text': fontsize=h/30: x=(w-text_w)/2: y=(h-text_h*2)"
  9971. @end example
  9972. @item
  9973. Print the date of a real-time encoding (see documentation for the
  9974. @code{strftime} C function):
  9975. @example
  9976. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  9977. @end example
  9978. @item
  9979. Show text fading in and out (appearing/disappearing):
  9980. @example
  9981. #!/bin/sh
  9982. DS=1.0 # display start
  9983. DE=10.0 # display end
  9984. FID=1.5 # fade in duration
  9985. FOD=5 # fade out duration
  9986. ffplay -f lavfi "color,drawtext=text=TEST:fontsize=50:fontfile=FreeSerif.ttf:fontcolor_expr=ff0000%@{eif\\\\: clip(255*(1*between(t\\, $DS + $FID\\, $DE - $FOD) + ((t - $DS)/$FID)*between(t\\, $DS\\, $DS + $FID) + (-(t - $DE)/$FOD)*between(t\\, $DE - $FOD\\, $DE) )\\, 0\\, 255) \\\\: x\\\\: 2 @}"
  9987. @end example
  9988. @item
  9989. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  9990. and the @option{fontsize} value are included in the @option{y} offset.
  9991. @example
  9992. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  9993. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  9994. @end example
  9995. @item
  9996. Plot special @var{lavf.image2dec.source_basename} metadata onto each frame if
  9997. such metadata exists. Otherwise, plot the string "NA". Note that image2 demuxer
  9998. must have option @option{-export_path_metadata 1} for the special metadata fields
  9999. to be available for filters.
  10000. @example
  10001. drawtext="fontsize=20:fontcolor=white:fontfile=FreeSans.ttf:text='%@{metadata\:lavf.image2dec.source_basename\:NA@}':x=10:y=10"
  10002. @end example
  10003. @end itemize
  10004. For more information about libfreetype, check:
  10005. @url{http://www.freetype.org/}.
  10006. For more information about fontconfig, check:
  10007. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  10008. For more information about libfribidi, check:
  10009. @url{http://fribidi.org/}.
  10010. For more information about libharfbuzz, check:
  10011. @url{https://github.com/harfbuzz/harfbuzz}.
  10012. @section edgedetect
  10013. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  10014. The filter accepts the following options:
  10015. @table @option
  10016. @item low
  10017. @item high
  10018. Set low and high threshold values used by the Canny thresholding
  10019. algorithm.
  10020. The high threshold selects the "strong" edge pixels, which are then
  10021. connected through 8-connectivity with the "weak" edge pixels selected
  10022. by the low threshold.
  10023. @var{low} and @var{high} threshold values must be chosen in the range
  10024. [0,1], and @var{low} should be lesser or equal to @var{high}.
  10025. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  10026. is @code{50/255}.
  10027. @item mode
  10028. Define the drawing mode.
  10029. @table @samp
  10030. @item wires
  10031. Draw white/gray wires on black background.
  10032. @item colormix
  10033. Mix the colors to create a paint/cartoon effect.
  10034. @item canny
  10035. Apply Canny edge detector on all selected planes.
  10036. @end table
  10037. Default value is @var{wires}.
  10038. @item planes
  10039. Select planes for filtering. By default all available planes are filtered.
  10040. @end table
  10041. @subsection Examples
  10042. @itemize
  10043. @item
  10044. Standard edge detection with custom values for the hysteresis thresholding:
  10045. @example
  10046. edgedetect=low=0.1:high=0.4
  10047. @end example
  10048. @item
  10049. Painting effect without thresholding:
  10050. @example
  10051. edgedetect=mode=colormix:high=0
  10052. @end example
  10053. @end itemize
  10054. @section elbg
  10055. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  10056. For each input image, the filter will compute the optimal mapping from
  10057. the input to the output given the codebook length, that is the number
  10058. of distinct output colors.
  10059. This filter accepts the following options.
  10060. @table @option
  10061. @item codebook_length, l
  10062. Set codebook length. The value must be a positive integer, and
  10063. represents the number of distinct output colors. Default value is 256.
  10064. @item nb_steps, n
  10065. Set the maximum number of iterations to apply for computing the optimal
  10066. mapping. The higher the value the better the result and the higher the
  10067. computation time. Default value is 1.
  10068. @item seed, s
  10069. Set a random seed, must be an integer included between 0 and
  10070. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  10071. will try to use a good random seed on a best effort basis.
  10072. @item pal8
  10073. Set pal8 output pixel format. This option does not work with codebook
  10074. length greater than 256. Default is disabled.
  10075. @item use_alpha
  10076. Include alpha values in the quantization calculation. Allows creating
  10077. palettized output images (e.g. PNG8) with multiple alpha smooth blending.
  10078. @end table
  10079. @section entropy
  10080. Measure graylevel entropy in histogram of color channels of video frames.
  10081. It accepts the following parameters:
  10082. @table @option
  10083. @item mode
  10084. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  10085. @var{diff} mode measures entropy of histogram delta values, absolute differences
  10086. between neighbour histogram values.
  10087. @end table
  10088. @section epx
  10089. Apply the EPX magnification filter which is designed for pixel art.
  10090. It accepts the following option:
  10091. @table @option
  10092. @item n
  10093. Set the scaling dimension: @code{2} for @code{2xEPX}, @code{3} for
  10094. @code{3xEPX}.
  10095. Default is @code{3}.
  10096. @end table
  10097. @section eq
  10098. Set brightness, contrast, saturation and approximate gamma adjustment.
  10099. The filter accepts the following options:
  10100. @table @option
  10101. @item contrast
  10102. Set the contrast expression. The value must be a float value in range
  10103. @code{-1000.0} to @code{1000.0}. The default value is "1".
  10104. @item brightness
  10105. Set the brightness expression. The value must be a float value in
  10106. range @code{-1.0} to @code{1.0}. The default value is "0".
  10107. @item saturation
  10108. Set the saturation expression. The value must be a float in
  10109. range @code{0.0} to @code{3.0}. The default value is "1".
  10110. @item gamma
  10111. Set the gamma expression. The value must be a float in range
  10112. @code{0.1} to @code{10.0}. The default value is "1".
  10113. @item gamma_r
  10114. Set the gamma expression for red. The value must be a float in
  10115. range @code{0.1} to @code{10.0}. The default value is "1".
  10116. @item gamma_g
  10117. Set the gamma expression for green. The value must be a float in range
  10118. @code{0.1} to @code{10.0}. The default value is "1".
  10119. @item gamma_b
  10120. Set the gamma expression for blue. The value must be a float in range
  10121. @code{0.1} to @code{10.0}. The default value is "1".
  10122. @item gamma_weight
  10123. Set the gamma weight expression. It can be used to reduce the effect
  10124. of a high gamma value on bright image areas, e.g. keep them from
  10125. getting overamplified and just plain white. The value must be a float
  10126. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  10127. gamma correction all the way down while @code{1.0} leaves it at its
  10128. full strength. Default is "1".
  10129. @item eval
  10130. Set when the expressions for brightness, contrast, saturation and
  10131. gamma expressions are evaluated.
  10132. It accepts the following values:
  10133. @table @samp
  10134. @item init
  10135. only evaluate expressions once during the filter initialization or
  10136. when a command is processed
  10137. @item frame
  10138. evaluate expressions for each incoming frame
  10139. @end table
  10140. Default value is @samp{init}.
  10141. @end table
  10142. The expressions accept the following parameters:
  10143. @table @option
  10144. @item n
  10145. frame count of the input frame starting from 0
  10146. @item pos
  10147. byte position of the corresponding packet in the input file, NAN if
  10148. unspecified; deprecated, do not use
  10149. @item r
  10150. frame rate of the input video, NAN if the input frame rate is unknown
  10151. @item t
  10152. timestamp expressed in seconds, NAN if the input timestamp is unknown
  10153. @end table
  10154. @subsection Commands
  10155. The filter supports the following commands:
  10156. @table @option
  10157. @item contrast
  10158. Set the contrast expression.
  10159. @item brightness
  10160. Set the brightness expression.
  10161. @item saturation
  10162. Set the saturation expression.
  10163. @item gamma
  10164. Set the gamma expression.
  10165. @item gamma_r
  10166. Set the gamma_r expression.
  10167. @item gamma_g
  10168. Set gamma_g expression.
  10169. @item gamma_b
  10170. Set gamma_b expression.
  10171. @item gamma_weight
  10172. Set gamma_weight expression.
  10173. The command accepts the same syntax of the corresponding option.
  10174. If the specified expression is not valid, it is kept at its current
  10175. value.
  10176. @end table
  10177. @anchor{erosion}
  10178. @section erosion
  10179. Apply erosion effect to the video.
  10180. This filter replaces the pixel by the local(3x3) minimum.
  10181. It accepts the following options:
  10182. @table @option
  10183. @item threshold0
  10184. @item threshold1
  10185. @item threshold2
  10186. @item threshold3
  10187. Limit the maximum change for each plane, default is 65535.
  10188. If 0, plane will remain unchanged.
  10189. @item coordinates
  10190. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  10191. pixels are used.
  10192. Flags to local 3x3 coordinates maps like this:
  10193. 1 2 3
  10194. 4 5
  10195. 6 7 8
  10196. @end table
  10197. @subsection Commands
  10198. This filter supports the all above options as @ref{commands}.
  10199. @section estdif
  10200. Deinterlace the input video ("estdif" stands for "Edge Slope
  10201. Tracing Deinterlacing Filter").
  10202. Spatial only filter that uses edge slope tracing algorithm
  10203. to interpolate missing lines.
  10204. It accepts the following parameters:
  10205. @table @option
  10206. @item mode
  10207. The interlacing mode to adopt. It accepts one of the following values:
  10208. @table @option
  10209. @item frame
  10210. Output one frame for each frame.
  10211. @item field
  10212. Output one frame for each field.
  10213. @end table
  10214. The default value is @code{field}.
  10215. @item parity
  10216. The picture field parity assumed for the input interlaced video. It accepts one
  10217. of the following values:
  10218. @table @option
  10219. @item tff
  10220. Assume the top field is first.
  10221. @item bff
  10222. Assume the bottom field is first.
  10223. @item auto
  10224. Enable automatic detection of field parity.
  10225. @end table
  10226. The default value is @code{auto}.
  10227. If the interlacing is unknown or the decoder does not export this information,
  10228. top field first will be assumed.
  10229. @item deint
  10230. Specify which frames to deinterlace. Accepts one of the following
  10231. values:
  10232. @table @option
  10233. @item all
  10234. Deinterlace all frames.
  10235. @item interlaced
  10236. Only deinterlace frames marked as interlaced.
  10237. @end table
  10238. The default value is @code{all}.
  10239. @item rslope
  10240. Specify the search radius for edge slope tracing. Default value is 1.
  10241. Allowed range is from 1 to 15.
  10242. @item redge
  10243. Specify the search radius for best edge matching. Default value is 2.
  10244. Allowed range is from 0 to 15.
  10245. @item ecost
  10246. Specify the edge cost for edge matching. Default value is 2.
  10247. Allowed range is from 0 to 50.
  10248. @item mcost
  10249. Specify the middle cost for edge matching. Default value is 1.
  10250. Allowed range is from 0 to 50.
  10251. @item dcost
  10252. Specify the distance cost for edge matching. Default value is 1.
  10253. Allowed range is from 0 to 50.
  10254. @item interp
  10255. Specify the interpolation used. Default is 4-point interpolation. It accepts one
  10256. of the following values:
  10257. @table @option
  10258. @item 2p
  10259. Two-point interpolation.
  10260. @item 4p
  10261. Four-point interpolation.
  10262. @item 6p
  10263. Six-point interpolation.
  10264. @end table
  10265. @end table
  10266. @subsection Commands
  10267. This filter supports same @ref{commands} as options.
  10268. @section exposure
  10269. Adjust exposure of the video stream.
  10270. The filter accepts the following options:
  10271. @table @option
  10272. @item exposure
  10273. Set the exposure correction in EV. Allowed range is from -3.0 to 3.0 EV
  10274. Default value is 0 EV.
  10275. @item black
  10276. Set the black level correction. Allowed range is from -1.0 to 1.0.
  10277. Default value is 0.
  10278. @end table
  10279. @subsection Commands
  10280. This filter supports same @ref{commands} as options.
  10281. @section extractplanes
  10282. Extract color channel components from input video stream into
  10283. separate grayscale video streams.
  10284. The filter accepts the following option:
  10285. @table @option
  10286. @item planes
  10287. Set plane(s) to extract.
  10288. Available values for planes are:
  10289. @table @samp
  10290. @item y
  10291. @item u
  10292. @item v
  10293. @item a
  10294. @item r
  10295. @item g
  10296. @item b
  10297. @end table
  10298. Choosing planes not available in the input will result in an error.
  10299. That means you cannot select @code{r}, @code{g}, @code{b} planes
  10300. with @code{y}, @code{u}, @code{v} planes at same time.
  10301. @end table
  10302. @subsection Examples
  10303. @itemize
  10304. @item
  10305. Extract luma, u and v color channel component from input video frame
  10306. into 3 grayscale outputs:
  10307. @example
  10308. ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
  10309. @end example
  10310. @end itemize
  10311. @section fade
  10312. Apply a fade-in/out effect to the input video.
  10313. It accepts the following parameters:
  10314. @table @option
  10315. @item type, t
  10316. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  10317. effect.
  10318. Default is @code{in}.
  10319. @item start_frame, s
  10320. Specify the number of the frame to start applying the fade
  10321. effect at. Default is 0.
  10322. @item nb_frames, n
  10323. The number of frames that the fade effect lasts. At the end of the
  10324. fade-in effect, the output video will have the same intensity as the input video.
  10325. At the end of the fade-out transition, the output video will be filled with the
  10326. selected @option{color}.
  10327. Default is 25.
  10328. @item alpha
  10329. If set to 1, fade only alpha channel, if one exists on the input.
  10330. Default value is 0.
  10331. @item start_time, st
  10332. Specify the timestamp (in seconds) of the frame to start to apply the fade
  10333. effect. If both start_frame and start_time are specified, the fade will start at
  10334. whichever comes last. Default is 0.
  10335. @item duration, d
  10336. The number of seconds for which the fade effect has to last. At the end of the
  10337. fade-in effect the output video will have the same intensity as the input video,
  10338. at the end of the fade-out transition the output video will be filled with the
  10339. selected @option{color}.
  10340. If both duration and nb_frames are specified, duration is used. Default is 0
  10341. (nb_frames is used by default).
  10342. @item color, c
  10343. Specify the color of the fade. Default is "black".
  10344. @end table
  10345. @subsection Examples
  10346. @itemize
  10347. @item
  10348. Fade in the first 30 frames of video:
  10349. @example
  10350. fade=in:0:30
  10351. @end example
  10352. The command above is equivalent to:
  10353. @example
  10354. fade=t=in:s=0:n=30
  10355. @end example
  10356. @item
  10357. Fade out the last 45 frames of a 200-frame video:
  10358. @example
  10359. fade=out:155:45
  10360. fade=type=out:start_frame=155:nb_frames=45
  10361. @end example
  10362. @item
  10363. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  10364. @example
  10365. fade=in:0:25, fade=out:975:25
  10366. @end example
  10367. @item
  10368. Make the first 5 frames yellow, then fade in from frame 5-24:
  10369. @example
  10370. fade=in:5:20:color=yellow
  10371. @end example
  10372. @item
  10373. Fade in alpha over first 25 frames of video:
  10374. @example
  10375. fade=in:0:25:alpha=1
  10376. @end example
  10377. @item
  10378. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  10379. @example
  10380. fade=t=in:st=5.5:d=0.5
  10381. @end example
  10382. @end itemize
  10383. @section feedback
  10384. Apply feedback video filter.
  10385. This filter pass cropped input frames to 2nd output.
  10386. From there it can be filtered with other video filters.
  10387. After filter receives frame from 2nd input, that frame
  10388. is combined on top of original frame from 1st input and passed
  10389. to 1st output.
  10390. The typical usage is filter only part of frame.
  10391. The filter accepts the following options:
  10392. @table @option
  10393. @item x
  10394. @item y
  10395. Set the top left crop position.
  10396. @item w
  10397. @item h
  10398. Set the crop size.
  10399. @end table
  10400. @subsection Examples
  10401. @itemize
  10402. @item
  10403. Blur only top left rectangular part of video frame size 100x100 with gblur filter.
  10404. @example
  10405. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]gblur=8[blurin]
  10406. @end example
  10407. @item
  10408. Draw black box on top left part of video frame of size 100x100 with drawbox filter.
  10409. @example
  10410. [in][blurin]feedback=x=0:y=0:w=100:h=100[out][blurout];[blurout]drawbox=x=0:y=0:w=100:h=100:t=100[blurin]
  10411. @end example
  10412. @item
  10413. Pixelize rectangular part of video frame of size 100x100 with pixelize filter.
  10414. @example
  10415. [in][blurin]feedback=x=320:y=240:w=100:h=100[out][blurout];[blurout]pixelize[blurin]
  10416. @end example
  10417. @end itemize
  10418. @section fftdnoiz
  10419. Denoise frames using 3D FFT (frequency domain filtering).
  10420. The filter accepts the following options:
  10421. @table @option
  10422. @item sigma
  10423. Set the noise sigma constant. This sets denoising strength.
  10424. Default value is 1. Allowed range is from 0 to 30.
  10425. Using very high sigma with low overlap may give blocking artifacts.
  10426. @item amount
  10427. Set amount of denoising. By default all detected noise is reduced.
  10428. Default value is 1. Allowed range is from 0 to 1.
  10429. @item block
  10430. Set size of block in pixels, Default is 32, can be 8 to 256.
  10431. @item overlap
  10432. Set block overlap. Default is 0.5. Allowed range is from 0.2 to 0.8.
  10433. @item method
  10434. Set denoising method. Default is @code{wiener}, can also be @code{hard}.
  10435. @item prev
  10436. Set number of previous frames to use for denoising. By default is set to 0.
  10437. @item next
  10438. Set number of next frames to to use for denoising. By default is set to 0.
  10439. @item planes
  10440. Set planes which will be filtered, by default are all available filtered
  10441. except alpha.
  10442. @end table
  10443. @section fftfilt
  10444. Apply arbitrary expressions to samples in frequency domain
  10445. @table @option
  10446. @item dc_Y
  10447. Adjust the dc value (gain) of the luma plane of the image. The filter
  10448. accepts an integer value in range @code{0} to @code{1000}. The default
  10449. value is set to @code{0}.
  10450. @item dc_U
  10451. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  10452. filter accepts an integer value in range @code{0} to @code{1000}. The
  10453. default value is set to @code{0}.
  10454. @item dc_V
  10455. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  10456. filter accepts an integer value in range @code{0} to @code{1000}. The
  10457. default value is set to @code{0}.
  10458. @item weight_Y
  10459. Set the frequency domain weight expression for the luma plane.
  10460. @item weight_U
  10461. Set the frequency domain weight expression for the 1st chroma plane.
  10462. @item weight_V
  10463. Set the frequency domain weight expression for the 2nd chroma plane.
  10464. @item eval
  10465. Set when the expressions are evaluated.
  10466. It accepts the following values:
  10467. @table @samp
  10468. @item init
  10469. Only evaluate expressions once during the filter initialization.
  10470. @item frame
  10471. Evaluate expressions for each incoming frame.
  10472. @end table
  10473. Default value is @samp{init}.
  10474. The filter accepts the following variables:
  10475. @item X
  10476. @item Y
  10477. The coordinates of the current sample.
  10478. @item W
  10479. @item H
  10480. The width and height of the image.
  10481. @item N
  10482. The number of input frame, starting from 0.
  10483. @item WS
  10484. @item HS
  10485. The size of FFT array for horizontal and vertical processing.
  10486. @end table
  10487. @subsection Examples
  10488. @itemize
  10489. @item
  10490. High-pass:
  10491. @example
  10492. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  10493. @end example
  10494. @item
  10495. Low-pass:
  10496. @example
  10497. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  10498. @end example
  10499. @item
  10500. Sharpen:
  10501. @example
  10502. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  10503. @end example
  10504. @item
  10505. Blur:
  10506. @example
  10507. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  10508. @end example
  10509. @end itemize
  10510. @section field
  10511. Extract a single field from an interlaced image using stride
  10512. arithmetic to avoid wasting CPU time. The output frames are marked as
  10513. non-interlaced.
  10514. The filter accepts the following options:
  10515. @table @option
  10516. @item type
  10517. Specify whether to extract the top (if the value is @code{0} or
  10518. @code{top}) or the bottom field (if the value is @code{1} or
  10519. @code{bottom}).
  10520. @end table
  10521. @section fieldhint
  10522. Create new frames by copying the top and bottom fields from surrounding frames
  10523. supplied as numbers by the hint file.
  10524. @table @option
  10525. @item hint
  10526. Set file containing hints: absolute/relative frame numbers.
  10527. There must be one line for each frame in a clip. Each line must contain two
  10528. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  10529. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  10530. is current frame number for @code{absolute} mode or out of [-1, 1] range
  10531. for @code{relative} mode. First number tells from which frame to pick up top
  10532. field and second number tells from which frame to pick up bottom field.
  10533. If optionally followed by @code{+} output frame will be marked as interlaced,
  10534. else if followed by @code{-} output frame will be marked as progressive, else
  10535. it will be marked same as input frame.
  10536. If optionally followed by @code{t} output frame will use only top field, or in
  10537. case of @code{b} it will use only bottom field.
  10538. If line starts with @code{#} or @code{;} that line is skipped.
  10539. @item mode
  10540. Can be item @code{absolute} or @code{relative} or @code{pattern}. Default is @code{absolute}.
  10541. The @code{pattern} mode is same as @code{relative} mode, except at last entry of file if there
  10542. are more frames to process than @code{hint} file is seek back to start.
  10543. @end table
  10544. Example of first several lines of @code{hint} file for @code{relative} mode:
  10545. @example
  10546. 0,0 - # first frame
  10547. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  10548. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  10549. 1,0 -
  10550. 0,0 -
  10551. 0,0 -
  10552. 1,0 -
  10553. 1,0 -
  10554. 1,0 -
  10555. 0,0 -
  10556. 0,0 -
  10557. 1,0 -
  10558. 1,0 -
  10559. 1,0 -
  10560. 0,0 -
  10561. @end example
  10562. @section fieldmatch
  10563. Field matching filter for inverse telecine. It is meant to reconstruct the
  10564. progressive frames from a telecined stream. The filter does not drop duplicated
  10565. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  10566. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  10567. The separation of the field matching and the decimation is notably motivated by
  10568. the possibility of inserting a de-interlacing filter fallback between the two.
  10569. If the source has mixed telecined and real interlaced content,
  10570. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  10571. But these remaining combed frames will be marked as interlaced, and thus can be
  10572. de-interlaced by a later filter such as @ref{yadif} before decimation.
  10573. In addition to the various configuration options, @code{fieldmatch} can take an
  10574. optional second stream, activated through the @option{ppsrc} option. If
  10575. enabled, the frames reconstruction will be based on the fields and frames from
  10576. this second stream. This allows the first input to be pre-processed in order to
  10577. help the various algorithms of the filter, while keeping the output lossless
  10578. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  10579. or brightness/contrast adjustments can help.
  10580. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  10581. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  10582. which @code{fieldmatch} is based on. While the semantic and usage are very
  10583. close, some behaviour and options names can differ.
  10584. The @ref{decimate} filter currently only works for constant frame rate input.
  10585. If your input has mixed telecined (30fps) and progressive content with a lower
  10586. framerate like 24fps use the following filterchain to produce the necessary cfr
  10587. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  10588. The filter accepts the following options:
  10589. @table @option
  10590. @item order
  10591. Specify the assumed field order of the input stream. Available values are:
  10592. @table @samp
  10593. @item auto
  10594. Auto detect parity (use FFmpeg's internal parity value).
  10595. @item bff
  10596. Assume bottom field first.
  10597. @item tff
  10598. Assume top field first.
  10599. @end table
  10600. Note that it is sometimes recommended not to trust the parity announced by the
  10601. stream.
  10602. Default value is @var{auto}.
  10603. @item mode
  10604. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  10605. sense that it won't risk creating jerkiness due to duplicate frames when
  10606. possible, but if there are bad edits or blended fields it will end up
  10607. outputting combed frames when a good match might actually exist. On the other
  10608. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  10609. but will almost always find a good frame if there is one. The other values are
  10610. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  10611. jerkiness and creating duplicate frames versus finding good matches in sections
  10612. with bad edits, orphaned fields, blended fields, etc.
  10613. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  10614. Available values are:
  10615. @table @samp
  10616. @item pc
  10617. 2-way matching (p/c)
  10618. @item pc_n
  10619. 2-way matching, and trying 3rd match if still combed (p/c + n)
  10620. @item pc_u
  10621. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  10622. @item pc_n_ub
  10623. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  10624. still combed (p/c + n + u/b)
  10625. @item pcn
  10626. 3-way matching (p/c/n)
  10627. @item pcn_ub
  10628. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  10629. detected as combed (p/c/n + u/b)
  10630. @end table
  10631. The parenthesis at the end indicate the matches that would be used for that
  10632. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  10633. @var{top}).
  10634. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  10635. the slowest.
  10636. Default value is @var{pc_n}.
  10637. @item ppsrc
  10638. Mark the main input stream as a pre-processed input, and enable the secondary
  10639. input stream as the clean source to pick the fields from. See the filter
  10640. introduction for more details. It is similar to the @option{clip2} feature from
  10641. VFM/TFM.
  10642. Default value is @code{0} (disabled).
  10643. @item field
  10644. Set the field to match from. It is recommended to set this to the same value as
  10645. @option{order} unless you experience matching failures with that setting. In
  10646. certain circumstances changing the field that is used to match from can have a
  10647. large impact on matching performance. Available values are:
  10648. @table @samp
  10649. @item auto
  10650. Automatic (same value as @option{order}).
  10651. @item bottom
  10652. Match from the bottom field.
  10653. @item top
  10654. Match from the top field.
  10655. @end table
  10656. Default value is @var{auto}.
  10657. @item mchroma
  10658. Set whether or not chroma is included during the match comparisons. In most
  10659. cases it is recommended to leave this enabled. You should set this to @code{0}
  10660. only if your clip has bad chroma problems such as heavy rainbowing or other
  10661. artifacts. Setting this to @code{0} could also be used to speed things up at
  10662. the cost of some accuracy.
  10663. Default value is @code{1}.
  10664. @item y0
  10665. @item y1
  10666. These define an exclusion band which excludes the lines between @option{y0} and
  10667. @option{y1} from being included in the field matching decision. An exclusion
  10668. band can be used to ignore subtitles, a logo, or other things that may
  10669. interfere with the matching. @option{y0} sets the starting scan line and
  10670. @option{y1} sets the ending line; all lines in between @option{y0} and
  10671. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  10672. @option{y0} and @option{y1} to the same value will disable the feature.
  10673. @option{y0} and @option{y1} defaults to @code{0}.
  10674. @item scthresh
  10675. Set the scene change detection threshold as a percentage of maximum change on
  10676. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  10677. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  10678. @option{scthresh} is @code{[0.0, 100.0]}.
  10679. Default value is @code{12.0}.
  10680. @item combmatch
  10681. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  10682. account the combed scores of matches when deciding what match to use as the
  10683. final match. Available values are:
  10684. @table @samp
  10685. @item none
  10686. No final matching based on combed scores.
  10687. @item sc
  10688. Combed scores are only used when a scene change is detected.
  10689. @item full
  10690. Use combed scores all the time.
  10691. @end table
  10692. Default is @var{sc}.
  10693. @item combdbg
  10694. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  10695. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  10696. Available values are:
  10697. @table @samp
  10698. @item none
  10699. No forced calculation.
  10700. @item pcn
  10701. Force p/c/n calculations.
  10702. @item pcnub
  10703. Force p/c/n/u/b calculations.
  10704. @end table
  10705. Default value is @var{none}.
  10706. @item cthresh
  10707. This is the area combing threshold used for combed frame detection. This
  10708. essentially controls how "strong" or "visible" combing must be to be detected.
  10709. Larger values mean combing must be more visible and smaller values mean combing
  10710. can be less visible or strong and still be detected. Valid settings are from
  10711. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  10712. be detected as combed). This is basically a pixel difference value. A good
  10713. range is @code{[8, 12]}.
  10714. Default value is @code{9}.
  10715. @item chroma
  10716. Sets whether or not chroma is considered in the combed frame decision. Only
  10717. disable this if your source has chroma problems (rainbowing, etc.) that are
  10718. causing problems for the combed frame detection with chroma enabled. Actually,
  10719. using @option{chroma}=@var{0} is usually more reliable, except for the case
  10720. where there is chroma only combing in the source.
  10721. Default value is @code{0}.
  10722. @item blockx
  10723. @item blocky
  10724. Respectively set the x-axis and y-axis size of the window used during combed
  10725. frame detection. This has to do with the size of the area in which
  10726. @option{combpel} pixels are required to be detected as combed for a frame to be
  10727. declared combed. See the @option{combpel} parameter description for more info.
  10728. Possible values are any number that is a power of 2 starting at 4 and going up
  10729. to 512.
  10730. Default value is @code{16}.
  10731. @item combpel
  10732. The number of combed pixels inside any of the @option{blocky} by
  10733. @option{blockx} size blocks on the frame for the frame to be detected as
  10734. combed. While @option{cthresh} controls how "visible" the combing must be, this
  10735. setting controls "how much" combing there must be in any localized area (a
  10736. window defined by the @option{blockx} and @option{blocky} settings) on the
  10737. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  10738. which point no frames will ever be detected as combed). This setting is known
  10739. as @option{MI} in TFM/VFM vocabulary.
  10740. Default value is @code{80}.
  10741. @end table
  10742. @anchor{p/c/n/u/b meaning}
  10743. @subsection p/c/n/u/b meaning
  10744. @subsubsection p/c/n
  10745. We assume the following telecined stream:
  10746. @example
  10747. Top fields: 1 2 2 3 4
  10748. Bottom fields: 1 2 3 4 4
  10749. @end example
  10750. The numbers correspond to the progressive frame the fields relate to. Here, the
  10751. first two frames are progressive, the 3rd and 4th are combed, and so on.
  10752. When @code{fieldmatch} is configured to run a matching from bottom
  10753. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  10754. @example
  10755. Input stream:
  10756. T 1 2 2 3 4
  10757. B 1 2 3 4 4 <-- matching reference
  10758. Matches: c c n n c
  10759. Output stream:
  10760. T 1 2 3 4 4
  10761. B 1 2 3 4 4
  10762. @end example
  10763. As a result of the field matching, we can see that some frames get duplicated.
  10764. To perform a complete inverse telecine, you need to rely on a decimation filter
  10765. after this operation. See for instance the @ref{decimate} filter.
  10766. The same operation now matching from top fields (@option{field}=@var{top})
  10767. looks like this:
  10768. @example
  10769. Input stream:
  10770. T 1 2 2 3 4 <-- matching reference
  10771. B 1 2 3 4 4
  10772. Matches: c c p p c
  10773. Output stream:
  10774. T 1 2 2 3 4
  10775. B 1 2 2 3 4
  10776. @end example
  10777. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  10778. basically, they refer to the frame and field of the opposite parity:
  10779. @itemize
  10780. @item @var{p} matches the field of the opposite parity in the previous frame
  10781. @item @var{c} matches the field of the opposite parity in the current frame
  10782. @item @var{n} matches the field of the opposite parity in the next frame
  10783. @end itemize
  10784. @subsubsection u/b
  10785. The @var{u} and @var{b} matching are a bit special in the sense that they match
  10786. from the opposite parity flag. In the following examples, we assume that we are
  10787. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  10788. 'x' is placed above and below each matched fields.
  10789. With bottom matching (@option{field}=@var{bottom}):
  10790. @example
  10791. Match: c p n b u
  10792. x x x x x
  10793. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10794. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10795. x x x x x
  10796. Output frames:
  10797. 2 1 2 2 2
  10798. 2 2 2 1 3
  10799. @end example
  10800. With top matching (@option{field}=@var{top}):
  10801. @example
  10802. Match: c p n b u
  10803. x x x x x
  10804. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  10805. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  10806. x x x x x
  10807. Output frames:
  10808. 2 2 2 1 2
  10809. 2 1 3 2 2
  10810. @end example
  10811. @subsection Examples
  10812. Simple IVTC of a top field first telecined stream:
  10813. @example
  10814. fieldmatch=order=tff:combmatch=none, decimate
  10815. @end example
  10816. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  10817. @example
  10818. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  10819. @end example
  10820. @section fieldorder
  10821. Transform the field order of the input video.
  10822. It accepts the following parameters:
  10823. @table @option
  10824. @item order
  10825. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  10826. for bottom field first.
  10827. @end table
  10828. The default value is @samp{tff}.
  10829. The transformation is done by shifting the picture content up or down
  10830. by one line, and filling the remaining line with appropriate picture content.
  10831. This method is consistent with most broadcast field order converters.
  10832. If the input video is not flagged as being interlaced, or it is already
  10833. flagged as being of the required output field order, then this filter does
  10834. not alter the incoming video.
  10835. It is very useful when converting to or from PAL DV material,
  10836. which is bottom field first.
  10837. For example:
  10838. @example
  10839. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  10840. @end example
  10841. @section fillborders
  10842. Fill borders of the input video, without changing video stream dimensions.
  10843. Sometimes video can have garbage at the four edges and you may not want to
  10844. crop video input to keep size multiple of some number.
  10845. This filter accepts the following options:
  10846. @table @option
  10847. @item left
  10848. Number of pixels to fill from left border.
  10849. @item right
  10850. Number of pixels to fill from right border.
  10851. @item top
  10852. Number of pixels to fill from top border.
  10853. @item bottom
  10854. Number of pixels to fill from bottom border.
  10855. @item mode
  10856. Set fill mode.
  10857. It accepts the following values:
  10858. @table @samp
  10859. @item smear
  10860. fill pixels using outermost pixels
  10861. @item mirror
  10862. fill pixels using mirroring (half sample symmetric)
  10863. @item fixed
  10864. fill pixels with constant value
  10865. @item reflect
  10866. fill pixels using reflecting (whole sample symmetric)
  10867. @item wrap
  10868. fill pixels using wrapping
  10869. @item fade
  10870. fade pixels to constant value
  10871. @item margins
  10872. fill pixels at top and bottom with weighted averages pixels near borders
  10873. @end table
  10874. Default is @var{smear}.
  10875. @item color
  10876. Set color for pixels in fixed or fade mode. Default is @var{black}.
  10877. @end table
  10878. @subsection Commands
  10879. This filter supports same @ref{commands} as options.
  10880. The command accepts the same syntax of the corresponding option.
  10881. If the specified expression is not valid, it is kept at its current
  10882. value.
  10883. @section find_rect
  10884. Find a rectangular object in the input video.
  10885. The object to search for must be specified as a gray8 image specified with the
  10886. @option{object} option.
  10887. For each possible match, a score is computed. If the score reaches the specified
  10888. threshold, the object is considered found.
  10889. If the input video contains multiple instances of the object, the filter will
  10890. find only one of them.
  10891. When an object is found, the following metadata entries are set in the matching
  10892. frame:
  10893. @table @option
  10894. @item lavfi.rect.w
  10895. width of object
  10896. @item lavfi.rect.h
  10897. height of object
  10898. @item lavfi.rect.x
  10899. x position of object
  10900. @item lavfi.rect.y
  10901. y position of object
  10902. @item lavfi.rect.score
  10903. match score of the found object
  10904. @end table
  10905. It accepts the following options:
  10906. @table @option
  10907. @item object
  10908. Filepath of the object image, needs to be in gray8.
  10909. @item threshold
  10910. Detection threshold, expressed as a decimal number in the range 0-1.
  10911. A threshold value of 0.01 means only exact matches, a threshold of 0.99 means
  10912. almost everything matches.
  10913. Default value is 0.5.
  10914. @item mipmaps
  10915. Number of mipmaps, default is 3.
  10916. @item xmin, ymin, xmax, ymax
  10917. Specifies the rectangle in which to search.
  10918. @item discard
  10919. Discard frames where object is not detected. Default is disabled.
  10920. @end table
  10921. @subsection Examples
  10922. @itemize
  10923. @item
  10924. Cover a rectangular object by the supplied image of a given video using @command{ffmpeg}:
  10925. @example
  10926. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  10927. @end example
  10928. @item
  10929. Find the position of an object in each frame using @command{ffprobe} and write
  10930. it to a log file:
  10931. @example
  10932. ffprobe -f lavfi movie=test.mp4,find_rect=object=object.pgm:threshold=0.3 \
  10933. -show_entries frame=pkt_pts_time:frame_tags=lavfi.rect.x,lavfi.rect.y \
  10934. -of csv -o find_rect.csv
  10935. @end example
  10936. @end itemize
  10937. @section floodfill
  10938. Flood area with values of same pixel components with another values.
  10939. It accepts the following options:
  10940. @table @option
  10941. @item x
  10942. Set pixel x coordinate.
  10943. @item y
  10944. Set pixel y coordinate.
  10945. @item s0
  10946. Set source #0 component value.
  10947. @item s1
  10948. Set source #1 component value.
  10949. @item s2
  10950. Set source #2 component value.
  10951. @item s3
  10952. Set source #3 component value.
  10953. @item d0
  10954. Set destination #0 component value.
  10955. @item d1
  10956. Set destination #1 component value.
  10957. @item d2
  10958. Set destination #2 component value.
  10959. @item d3
  10960. Set destination #3 component value.
  10961. @end table
  10962. @anchor{format}
  10963. @section format
  10964. Convert the input video to one of the specified pixel formats.
  10965. Libavfilter will try to pick one that is suitable as input to
  10966. the next filter.
  10967. It accepts the following parameters:
  10968. @table @option
  10969. @item pix_fmts
  10970. A '|'-separated list of pixel format names, such as
  10971. "pix_fmts=yuv420p|monow|rgb24".
  10972. @item color_spaces
  10973. A '|'-separated list of color space names, such as
  10974. "color_spaces=bt709|bt470bg|bt2020nc".
  10975. @item color_ranges
  10976. A '|'-separated list of color range names, such as
  10977. "color_spaces=tv|pc".
  10978. @end table
  10979. @subsection Examples
  10980. @itemize
  10981. @item
  10982. Convert the input video to the @var{yuv420p} format
  10983. @example
  10984. format=pix_fmts=yuv420p
  10985. @end example
  10986. Convert the input video to any of the formats in the list
  10987. @example
  10988. format=pix_fmts=yuv420p|yuv444p|yuv410p
  10989. @end example
  10990. @end itemize
  10991. @anchor{fps}
  10992. @section fps
  10993. Convert the video to specified constant frame rate by duplicating or dropping
  10994. frames as necessary.
  10995. It accepts the following parameters:
  10996. @table @option
  10997. @item fps
  10998. The desired output frame rate. It accepts expressions containing the following
  10999. constants:
  11000. @table @samp
  11001. @item source_fps
  11002. The input's frame rate
  11003. @item ntsc
  11004. NTSC frame rate of @code{30000/1001}
  11005. @item pal
  11006. PAL frame rate of @code{25.0}
  11007. @item film
  11008. Film frame rate of @code{24.0}
  11009. @item ntsc_film
  11010. NTSC-film frame rate of @code{24000/1001}
  11011. @end table
  11012. The default is @code{25}.
  11013. @item start_time
  11014. Assume the first PTS should be the given value, in seconds. This allows for
  11015. padding/trimming at the start of stream. By default, no assumption is made
  11016. about the first frame's expected PTS, so no padding or trimming is done.
  11017. For example, this could be set to 0 to pad the beginning with duplicates of
  11018. the first frame if a video stream starts after the audio stream or to trim any
  11019. frames with a negative PTS.
  11020. @item round
  11021. Timestamp (PTS) rounding method.
  11022. Possible values are:
  11023. @table @option
  11024. @item zero
  11025. round towards 0
  11026. @item inf
  11027. round away from 0
  11028. @item down
  11029. round towards -infinity
  11030. @item up
  11031. round towards +infinity
  11032. @item near
  11033. round to nearest
  11034. @end table
  11035. The default is @code{near}.
  11036. @item eof_action
  11037. Action performed when reading the last frame.
  11038. Possible values are:
  11039. @table @option
  11040. @item round
  11041. Use same timestamp rounding method as used for other frames.
  11042. @item pass
  11043. Pass through last frame if input duration has not been reached yet.
  11044. @end table
  11045. The default is @code{round}.
  11046. @end table
  11047. Alternatively, the options can be specified as a flat string:
  11048. @var{fps}[:@var{start_time}[:@var{round}]].
  11049. See also the @ref{setpts} filter.
  11050. @subsection Examples
  11051. @itemize
  11052. @item
  11053. A typical usage in order to set the fps to 25:
  11054. @example
  11055. fps=fps=25
  11056. @end example
  11057. @item
  11058. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  11059. @example
  11060. fps=fps=film:round=near
  11061. @end example
  11062. @end itemize
  11063. @section framepack
  11064. Pack two different video streams into a stereoscopic video, setting proper
  11065. metadata on supported codecs. The two views should have the same size and
  11066. framerate and processing will stop when the shorter video ends. Please note
  11067. that you may conveniently adjust view properties with the @ref{scale} and
  11068. @ref{fps} filters.
  11069. It accepts the following parameters:
  11070. @table @option
  11071. @item format
  11072. The desired packing format. Supported values are:
  11073. @table @option
  11074. @item sbs
  11075. The views are next to each other (default).
  11076. @item tab
  11077. The views are on top of each other.
  11078. @item lines
  11079. The views are packed by line.
  11080. @item columns
  11081. The views are packed by column.
  11082. @item frameseq
  11083. The views are temporally interleaved.
  11084. @end table
  11085. @end table
  11086. Some examples:
  11087. @example
  11088. # Convert left and right views into a frame-sequential video
  11089. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  11090. # Convert views into a side-by-side video with the same output resolution as the input
  11091. ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
  11092. @end example
  11093. @section framerate
  11094. Change the frame rate by interpolating new video output frames from the source
  11095. frames.
  11096. This filter is not designed to function correctly with interlaced media. If
  11097. you wish to change the frame rate of interlaced media then you are required
  11098. to deinterlace before this filter and re-interlace after this filter.
  11099. A description of the accepted options follows.
  11100. @table @option
  11101. @item fps
  11102. Specify the output frames per second. This option can also be specified
  11103. as a value alone. The default is @code{50}.
  11104. @item interp_start
  11105. Specify the start of a range where the output frame will be created as a
  11106. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11107. the default is @code{15}.
  11108. @item interp_end
  11109. Specify the end of a range where the output frame will be created as a
  11110. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  11111. the default is @code{240}.
  11112. @item scene
  11113. Specify the level at which a scene change is detected as a value between
  11114. 0 and 100 to indicate a new scene; a low value reflects a low
  11115. probability for the current frame to introduce a new scene, while a higher
  11116. value means the current frame is more likely to be one.
  11117. The default is @code{8.2}.
  11118. @item flags
  11119. Specify flags influencing the filter process.
  11120. Available value for @var{flags} is:
  11121. @table @option
  11122. @item scene_change_detect, scd
  11123. Enable scene change detection using the value of the option @var{scene}.
  11124. This flag is enabled by default.
  11125. @end table
  11126. @end table
  11127. @section framestep
  11128. Select one frame every N-th frame.
  11129. This filter accepts the following option:
  11130. @table @option
  11131. @item step
  11132. Select frame after every @code{step} frames.
  11133. Allowed values are positive integers higher than 0. Default value is @code{1}.
  11134. @end table
  11135. @section freezedetect
  11136. Detect frozen video.
  11137. This filter logs a message and sets frame metadata when it detects that the
  11138. input video has no significant change in content during a specified duration.
  11139. Video freeze detection calculates the mean average absolute difference of all
  11140. the components of video frames and compares it to a noise floor.
  11141. The printed times and duration are expressed in seconds. The
  11142. @code{lavfi.freezedetect.freeze_start} metadata key is set on the first frame
  11143. whose timestamp equals or exceeds the detection duration and it contains the
  11144. timestamp of the first frame of the freeze. The
  11145. @code{lavfi.freezedetect.freeze_duration} and
  11146. @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame
  11147. after the freeze.
  11148. The filter accepts the following options:
  11149. @table @option
  11150. @item noise, n
  11151. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  11152. specified value) or as a difference ratio between 0 and 1. Default is -60dB, or
  11153. 0.001.
  11154. @item duration, d
  11155. Set freeze duration until notification (default is 2 seconds).
  11156. @end table
  11157. @section freezeframes
  11158. Freeze video frames.
  11159. This filter freezes video frames using frame from 2nd input.
  11160. The filter accepts the following options:
  11161. @table @option
  11162. @item first
  11163. Set number of first frame from which to start freeze.
  11164. @item last
  11165. Set number of last frame from which to end freeze.
  11166. @item replace
  11167. Set number of frame from 2nd input which will be used instead of replaced frames.
  11168. @end table
  11169. @anchor{frei0r}
  11170. @section frei0r
  11171. Apply a frei0r effect to the input video.
  11172. To enable the compilation of this filter, you need to install the frei0r
  11173. header and configure FFmpeg with @code{--enable-frei0r}.
  11174. It accepts the following parameters:
  11175. @table @option
  11176. @item filter_name
  11177. The name of the frei0r effect to load. If the environment variable
  11178. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  11179. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  11180. Otherwise, the standard frei0r paths are searched, in this order:
  11181. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  11182. @file{/usr/lib/frei0r-1/}.
  11183. @item filter_params
  11184. A '|'-separated list of parameters to pass to the frei0r effect.
  11185. @end table
  11186. A frei0r effect parameter can be a boolean (its value is either
  11187. "y" or "n"), a double, a color (specified as
  11188. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  11189. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  11190. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  11191. a position (specified as @var{X}/@var{Y}, where
  11192. @var{X} and @var{Y} are floating point numbers) and/or a string.
  11193. The number and types of parameters depend on the loaded effect. If an
  11194. effect parameter is not specified, the default value is set.
  11195. @subsection Examples
  11196. @itemize
  11197. @item
  11198. Apply the distort0r effect, setting the first two double parameters:
  11199. @example
  11200. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  11201. @end example
  11202. @item
  11203. Apply the colordistance effect, taking a color as the first parameter:
  11204. @example
  11205. frei0r=colordistance:0.2/0.3/0.4
  11206. frei0r=colordistance:violet
  11207. frei0r=colordistance:0x112233
  11208. @end example
  11209. @item
  11210. Apply the perspective effect, specifying the top left and top right image
  11211. positions:
  11212. @example
  11213. frei0r=perspective:0.2/0.2|0.8/0.2
  11214. @end example
  11215. @end itemize
  11216. For more information, see
  11217. @url{http://frei0r.dyne.org}
  11218. @subsection Commands
  11219. This filter supports the @option{filter_params} option as @ref{commands}.
  11220. @section fspp
  11221. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  11222. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  11223. processing filter, one of them is performed once per block, not per pixel.
  11224. This allows for much higher speed.
  11225. The filter accepts the following options:
  11226. @table @option
  11227. @item quality
  11228. Set quality. This option defines the number of levels for averaging. It accepts
  11229. an integer in the range 4-5. Default value is @code{4}.
  11230. @item qp
  11231. Force a constant quantization parameter. It accepts an integer in range 0-63.
  11232. If not set, the filter will use the QP from the video stream (if available).
  11233. @item strength
  11234. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  11235. more details but also more artifacts, while higher values make the image smoother
  11236. but also blurrier. Default value is @code{0} − PSNR optimal.
  11237. @item use_bframe_qp
  11238. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11239. option may cause flicker since the B-Frames have often larger QP. Default is
  11240. @code{0} (not enabled).
  11241. @end table
  11242. @anchor{fsync}
  11243. @section fsync
  11244. Synchronize video frames with an external mapping from a file.
  11245. For each input PTS given in the map file it either drops or creates as many
  11246. frames as necessary to recreate the sequence of output frames given in the
  11247. map file.
  11248. This filter is useful to recreate the output frames of a framerate conversion
  11249. by the @ref{fps} filter, recorded into a map file using the ffmpeg option
  11250. @code{-stats_mux_pre}, and do further processing to the corresponding frames
  11251. e.g. quality comparison.
  11252. Each line of the map file must contain three items per input frame, the input
  11253. PTS (decimal), the output PTS (decimal) and the
  11254. output TIMEBASE (decimal/decimal), seperated by a space.
  11255. This file format corresponds to the output
  11256. of @code{-stats_mux_pre_fmt="@{ptsi@} @{pts@} @{tb@}"}.
  11257. The filter assumes the map file is sorted by increasing input PTS.
  11258. The filter accepts the following options:
  11259. @table @option
  11260. @item file, f
  11261. The filename of the map file to be used.
  11262. @end table
  11263. Example:
  11264. @example
  11265. # Convert a video to 25 fps and record a MAP_FILE file with the default format of this filter
  11266. ffmpeg -i INPUT -vf fps=fps=25 -stats_mux_pre MAP_FILE -stats_mux_pre_fmt "@{ptsi@} @{pts@} @{tb@}" OUTPUT
  11267. # Sort MAP_FILE by increasing input PTS
  11268. sort -n MAP_FILE
  11269. # Use INPUT, OUTPUT and the MAP_FILE from above to compare the corresponding frames in INPUT and OUTPUT via SSIM
  11270. ffmpeg -i INPUT -i OUTPUT -filter_complex '[0:v]fsync=file=MAP_FILE[ref];[1:v][ref]ssim' -f null -
  11271. @end example
  11272. @section gblur
  11273. Apply Gaussian blur filter.
  11274. The filter accepts the following options:
  11275. @table @option
  11276. @item sigma
  11277. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  11278. @item steps
  11279. Set number of steps for Gaussian approximation. Default is @code{1}.
  11280. @item planes
  11281. Set which planes to filter. By default all planes are filtered.
  11282. @item sigmaV
  11283. Set vertical sigma, if negative it will be same as @code{sigma}.
  11284. Default is @code{-1}.
  11285. @end table
  11286. @subsection Commands
  11287. This filter supports same commands as options.
  11288. The command accepts the same syntax of the corresponding option.
  11289. If the specified expression is not valid, it is kept at its current
  11290. value.
  11291. @section geq
  11292. Apply generic equation to each pixel.
  11293. The filter accepts the following options:
  11294. @table @option
  11295. @item lum_expr, lum
  11296. Set the luma expression.
  11297. @item cb_expr, cb
  11298. Set the chrominance blue expression.
  11299. @item cr_expr, cr
  11300. Set the chrominance red expression.
  11301. @item alpha_expr, a
  11302. Set the alpha expression.
  11303. @item red_expr, r
  11304. Set the red expression.
  11305. @item green_expr, g
  11306. Set the green expression.
  11307. @item blue_expr, b
  11308. Set the blue expression.
  11309. @end table
  11310. The colorspace is selected according to the specified options. If one
  11311. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  11312. options is specified, the filter will automatically select a YCbCr
  11313. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  11314. @option{blue_expr} options is specified, it will select an RGB
  11315. colorspace.
  11316. If one of the chrominance expression is not defined, it falls back on the other
  11317. one. If no alpha expression is specified it will evaluate to opaque value.
  11318. If none of chrominance expressions are specified, they will evaluate
  11319. to the luma expression.
  11320. The expressions can use the following variables and functions:
  11321. @table @option
  11322. @item N
  11323. The sequential number of the filtered frame, starting from @code{0}.
  11324. @item X
  11325. @item Y
  11326. The coordinates of the current sample.
  11327. @item W
  11328. @item H
  11329. The width and height of the image.
  11330. @item SW
  11331. @item SH
  11332. Width and height scale depending on the currently filtered plane. It is the
  11333. ratio between the corresponding luma plane number of pixels and the current
  11334. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  11335. @code{0.5,0.5} for chroma planes.
  11336. @item T
  11337. Time of the current frame, expressed in seconds.
  11338. @item p(x, y)
  11339. Return the value of the pixel at location (@var{x},@var{y}) of the current
  11340. plane.
  11341. @item lum(x, y)
  11342. Return the value of the pixel at location (@var{x},@var{y}) of the luma
  11343. plane.
  11344. @item cb(x, y)
  11345. Return the value of the pixel at location (@var{x},@var{y}) of the
  11346. blue-difference chroma plane. Return 0 if there is no such plane.
  11347. @item cr(x, y)
  11348. Return the value of the pixel at location (@var{x},@var{y}) of the
  11349. red-difference chroma plane. Return 0 if there is no such plane.
  11350. @item r(x, y)
  11351. @item g(x, y)
  11352. @item b(x, y)
  11353. Return the value of the pixel at location (@var{x},@var{y}) of the
  11354. red/green/blue component. Return 0 if there is no such component.
  11355. @item alpha(x, y)
  11356. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  11357. plane. Return 0 if there is no such plane.
  11358. @item psum(x,y), lumsum(x, y), cbsum(x,y), crsum(x,y), rsum(x,y), gsum(x,y), bsum(x,y), alphasum(x,y)
  11359. Sum of sample values in the rectangle from (0,0) to (x,y), this allows obtaining
  11360. sums of samples within a rectangle. See the functions without the sum postfix.
  11361. @item interpolation
  11362. Set one of interpolation methods:
  11363. @table @option
  11364. @item nearest, n
  11365. @item bilinear, b
  11366. @end table
  11367. Default is bilinear.
  11368. @end table
  11369. For functions, if @var{x} and @var{y} are outside the area, the value will be
  11370. automatically clipped to the closer edge.
  11371. Please note that this filter can use multiple threads in which case each slice
  11372. will have its own expression state. If you want to use only a single expression
  11373. state because your expressions depend on previous state then you should limit
  11374. the number of filter threads to 1.
  11375. @subsection Examples
  11376. @itemize
  11377. @item
  11378. Flip the image horizontally:
  11379. @example
  11380. geq=p(W-X\,Y)
  11381. @end example
  11382. @item
  11383. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  11384. wavelength of 100 pixels:
  11385. @example
  11386. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  11387. @end example
  11388. @item
  11389. Generate a fancy enigmatic moving light:
  11390. @example
  11391. nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
  11392. @end example
  11393. @item
  11394. Generate a quick emboss effect:
  11395. @example
  11396. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  11397. @end example
  11398. @item
  11399. Modify RGB components depending on pixel position:
  11400. @example
  11401. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  11402. @end example
  11403. @item
  11404. Create a radial gradient that is the same size as the input (also see
  11405. the @ref{vignette} filter):
  11406. @example
  11407. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  11408. @end example
  11409. @end itemize
  11410. @section gradfun
  11411. Fix the banding artifacts that are sometimes introduced into nearly flat
  11412. regions by truncation to 8-bit color depth.
  11413. Interpolate the gradients that should go where the bands are, and
  11414. dither them.
  11415. It is designed for playback only. Do not use it prior to
  11416. lossy compression, because compression tends to lose the dither and
  11417. bring back the bands.
  11418. It accepts the following parameters:
  11419. @table @option
  11420. @item strength
  11421. The maximum amount by which the filter will change any one pixel. This is also
  11422. the threshold for detecting nearly flat regions. Acceptable values range from
  11423. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  11424. valid range.
  11425. @item radius
  11426. The neighborhood to fit the gradient to. A larger radius makes for smoother
  11427. gradients, but also prevents the filter from modifying the pixels near detailed
  11428. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  11429. values will be clipped to the valid range.
  11430. @end table
  11431. Alternatively, the options can be specified as a flat string:
  11432. @var{strength}[:@var{radius}]
  11433. @subsection Examples
  11434. @itemize
  11435. @item
  11436. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  11437. @example
  11438. gradfun=3.5:8
  11439. @end example
  11440. @item
  11441. Specify radius, omitting the strength (which will fall-back to the default
  11442. value):
  11443. @example
  11444. gradfun=radius=8
  11445. @end example
  11446. @end itemize
  11447. @anchor{graphmonitor}
  11448. @section graphmonitor
  11449. Show various filtergraph stats.
  11450. With this filter one can debug complete filtergraph.
  11451. Especially issues with links filling with queued frames.
  11452. The filter accepts the following options:
  11453. @table @option
  11454. @item size, s
  11455. Set video output size. Default is @var{hd720}.
  11456. @item opacity, o
  11457. Set video opacity. Default is @var{0.9}. Allowed range is from @var{0} to @var{1}.
  11458. @item mode, m
  11459. Set output mode flags.
  11460. Available values for flags are:
  11461. @table @samp
  11462. @item full
  11463. No any filtering. Default.
  11464. @item compact
  11465. Show only filters with queued frames.
  11466. @item nozero
  11467. Show only filters with non-zero stats.
  11468. @item noeof
  11469. Show only filters with non-eof stat.
  11470. @item nodisabled
  11471. Show only filters that are enabled in timeline.
  11472. @end table
  11473. @item flags, f
  11474. Set flags which enable which stats are shown in video.
  11475. Available values for flags are:
  11476. @table @samp
  11477. @item none
  11478. All flags turned off.
  11479. @item all
  11480. All flags turned on.
  11481. @item queue
  11482. Display number of queued frames in each link.
  11483. @item frame_count_in
  11484. Display number of frames taken from filter.
  11485. @item frame_count_out
  11486. Display number of frames given out from filter.
  11487. @item frame_count_delta
  11488. Display delta number of frames between above two values.
  11489. @item pts
  11490. Display current filtered frame pts.
  11491. @item pts_delta
  11492. Display pts delta between current and previous frame.
  11493. @item time
  11494. Display current filtered frame time.
  11495. @item time_delta
  11496. Display time delta between current and previous frame.
  11497. @item timebase
  11498. Display time base for filter link.
  11499. @item format
  11500. Display used format for filter link.
  11501. @item size
  11502. Display video size or number of audio channels in case of audio used by filter link.
  11503. @item rate
  11504. Display video frame rate or sample rate in case of audio used by filter link.
  11505. @item eof
  11506. Display link output status.
  11507. @item sample_count_in
  11508. Display number of samples taken from filter.
  11509. @item sample_count_out
  11510. Display number of samples given out from filter.
  11511. @item sample_count_delta
  11512. Display delta number of samples between above two values.
  11513. @item disabled
  11514. Show the timeline filter status.
  11515. @end table
  11516. @item rate, r
  11517. Set upper limit for video rate of output stream, Default value is @var{25}.
  11518. This guarantee that output video frame rate will not be higher than this value.
  11519. @end table
  11520. @section grayworld
  11521. A color constancy filter that applies color correction based on the grayworld assumption
  11522. See: @url{https://www.researchgate.net/publication/275213614_A_New_Color_Correction_Method_for_Underwater_Imaging}
  11523. The algorithm uses linear light, so input
  11524. data should be linearized beforehand (and possibly correctly tagged).
  11525. @example
  11526. ffmpeg -i INPUT -vf zscale=transfer=linear,grayworld,zscale=transfer=bt709,format=yuv420p OUTPUT
  11527. @end example
  11528. @section greyedge
  11529. A color constancy variation filter which estimates scene illumination via grey edge algorithm
  11530. and corrects the scene colors accordingly.
  11531. See: @url{https://staff.science.uva.nl/th.gevers/pub/GeversTIP07.pdf}
  11532. The filter accepts the following options:
  11533. @table @option
  11534. @item difford
  11535. The order of differentiation to be applied on the scene. Must be chosen in the range
  11536. [0,2] and default value is 1.
  11537. @item minknorm
  11538. The Minkowski parameter to be used for calculating the Minkowski distance. Must
  11539. be chosen in the range [0,20] and default value is 1. Set to 0 for getting
  11540. max value instead of calculating Minkowski distance.
  11541. @item sigma
  11542. The standard deviation of Gaussian blur to be applied on the scene. Must be
  11543. chosen in the range [0,1024.0] and default value = 1. floor( @var{sigma} * break_off_sigma(3) )
  11544. can't be equal to 0 if @var{difford} is greater than 0.
  11545. @end table
  11546. @subsection Examples
  11547. @itemize
  11548. @item
  11549. Grey Edge:
  11550. @example
  11551. greyedge=difford=1:minknorm=5:sigma=2
  11552. @end example
  11553. @item
  11554. Max Edge:
  11555. @example
  11556. greyedge=difford=1:minknorm=0:sigma=2
  11557. @end example
  11558. @end itemize
  11559. @section guided
  11560. Apply guided filter for edge-preserving smoothing, dehazing and so on.
  11561. The filter accepts the following options:
  11562. @table @option
  11563. @item radius
  11564. Set the box radius in pixels.
  11565. Allowed range is 1 to 20. Default is 3.
  11566. @item eps
  11567. Set regularization parameter (with square).
  11568. Allowed range is 0 to 1. Default is 0.01.
  11569. @item mode
  11570. Set filter mode. Can be @code{basic} or @code{fast}.
  11571. Default is @code{basic}.
  11572. @item sub
  11573. Set subsampling ratio for @code{fast} mode.
  11574. Range is 2 to 64. Default is 4.
  11575. No subsampling occurs in @code{basic} mode.
  11576. @item guidance
  11577. Set guidance mode. Can be @code{off} or @code{on}. Default is @code{off}.
  11578. If @code{off}, single input is required.
  11579. If @code{on}, two inputs of the same resolution and pixel format are required.
  11580. The second input serves as the guidance.
  11581. @item planes
  11582. Set planes to filter. Default is first only.
  11583. @end table
  11584. @subsection Commands
  11585. This filter supports the all above options as @ref{commands}.
  11586. @subsection Examples
  11587. @itemize
  11588. @item
  11589. Edge-preserving smoothing with guided filter:
  11590. @example
  11591. ffmpeg -i in.png -vf guided out.png
  11592. @end example
  11593. @item
  11594. Dehazing, structure-transferring filtering, detail enhancement with guided filter.
  11595. For the generation of guidance image, refer to paper "Guided Image Filtering".
  11596. See: @url{http://kaiminghe.com/publications/pami12guidedfilter.pdf}.
  11597. @example
  11598. ffmpeg -i in.png -i guidance.png -filter_complex guided=guidance=on out.png
  11599. @end example
  11600. @end itemize
  11601. @anchor{haldclut}
  11602. @section haldclut
  11603. Apply a Hald CLUT to a video stream.
  11604. First input is the video stream to process, and second one is the Hald CLUT.
  11605. The Hald CLUT input can be a simple picture or a complete video stream.
  11606. The filter accepts the following options:
  11607. @table @option
  11608. @item clut
  11609. Set which CLUT video frames will be processed from second input stream,
  11610. can be @var{first} or @var{all}. Default is @var{all}.
  11611. @item shortest
  11612. Force termination when the shortest input terminates. Default is @code{0}.
  11613. @item repeatlast
  11614. Continue applying the last CLUT after the end of the stream. A value of
  11615. @code{0} disable the filter after the last frame of the CLUT is reached.
  11616. Default is @code{1}.
  11617. @end table
  11618. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  11619. filters share the same internals).
  11620. This filter also supports the @ref{framesync} options.
  11621. More information about the Hald CLUT can be found on Eskil Steenberg's website
  11622. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  11623. @subsection Commands
  11624. This filter supports the @code{interp} option as @ref{commands}.
  11625. @subsection Workflow examples
  11626. @subsubsection Hald CLUT video stream
  11627. Generate an identity Hald CLUT stream altered with various effects:
  11628. @example
  11629. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
  11630. @end example
  11631. Note: make sure you use a lossless codec.
  11632. Then use it with @code{haldclut} to apply it on some random stream:
  11633. @example
  11634. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  11635. @end example
  11636. The Hald CLUT will be applied to the 10 first seconds (duration of
  11637. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  11638. to the remaining frames of the @code{mandelbrot} stream.
  11639. @subsubsection Hald CLUT with preview
  11640. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  11641. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  11642. biggest possible square starting at the top left of the picture. The remaining
  11643. padding pixels (bottom or right) will be ignored. This area can be used to add
  11644. a preview of the Hald CLUT.
  11645. Typically, the following generated Hald CLUT will be supported by the
  11646. @code{haldclut} filter:
  11647. @example
  11648. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  11649. pad=iw+320 [padded_clut];
  11650. smptebars=s=320x256, split [a][b];
  11651. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  11652. [main][b] overlay=W-320" -frames:v 1 clut.png
  11653. @end example
  11654. It contains the original and a preview of the effect of the CLUT: SMPTE color
  11655. bars are displayed on the right-top, and below the same color bars processed by
  11656. the color changes.
  11657. Then, the effect of this Hald CLUT can be visualized with:
  11658. @example
  11659. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  11660. @end example
  11661. @section hflip
  11662. Flip the input video horizontally.
  11663. For example, to horizontally flip the input video with @command{ffmpeg}:
  11664. @example
  11665. ffmpeg -i in.avi -vf "hflip" out.avi
  11666. @end example
  11667. @section histeq
  11668. This filter applies a global color histogram equalization on a
  11669. per-frame basis.
  11670. It can be used to correct video that has a compressed range of pixel
  11671. intensities. The filter redistributes the pixel intensities to
  11672. equalize their distribution across the intensity range. It may be
  11673. viewed as an "automatically adjusting contrast filter". This filter is
  11674. useful only for correcting degraded or poorly captured source
  11675. video.
  11676. The filter accepts the following options:
  11677. @table @option
  11678. @item strength
  11679. Determine the amount of equalization to be applied. As the strength
  11680. is reduced, the distribution of pixel intensities more-and-more
  11681. approaches that of the input frame. The value must be a float number
  11682. in the range [0,1] and defaults to 0.200.
  11683. @item intensity
  11684. Set the maximum intensity that can generated and scale the output
  11685. values appropriately. The strength should be set as desired and then
  11686. the intensity can be limited if needed to avoid washing-out. The value
  11687. must be a float number in the range [0,1] and defaults to 0.210.
  11688. @item antibanding
  11689. Set the antibanding level. If enabled the filter will randomly vary
  11690. the luminance of output pixels by a small amount to avoid banding of
  11691. the histogram. Possible values are @code{none}, @code{weak} or
  11692. @code{strong}. It defaults to @code{none}.
  11693. @end table
  11694. @anchor{histogram}
  11695. @section histogram
  11696. Compute and draw a color distribution histogram for the input video.
  11697. The computed histogram is a representation of the color component
  11698. distribution in an image.
  11699. Standard histogram displays the color components distribution in an image.
  11700. Displays color graph for each color component. Shows distribution of
  11701. the Y, U, V, A or R, G, B components, depending on input format, in the
  11702. current frame. Below each graph a color component scale meter is shown.
  11703. The filter accepts the following options:
  11704. @table @option
  11705. @item level_height
  11706. Set height of level. Default value is @code{200}.
  11707. Allowed range is [50, 2048].
  11708. @item scale_height
  11709. Set height of color scale. Default value is @code{12}.
  11710. Allowed range is [0, 40].
  11711. @item display_mode
  11712. Set display mode.
  11713. It accepts the following values:
  11714. @table @samp
  11715. @item stack
  11716. Per color component graphs are placed below each other.
  11717. @item parade
  11718. Per color component graphs are placed side by side.
  11719. @item overlay
  11720. Presents information identical to that in the @code{parade}, except
  11721. that the graphs representing color components are superimposed directly
  11722. over one another.
  11723. @end table
  11724. Default is @code{stack}.
  11725. @item levels_mode
  11726. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  11727. Default is @code{linear}.
  11728. @item components
  11729. Set what color components to display.
  11730. Default is @code{7}.
  11731. @item fgopacity
  11732. Set foreground opacity. Default is @code{0.7}.
  11733. @item bgopacity
  11734. Set background opacity. Default is @code{0.5}.
  11735. @item colors_mode
  11736. Set colors mode.
  11737. It accepts the following values:
  11738. @table @samp
  11739. @item whiteonblack
  11740. @item blackonwhite
  11741. @item whiteongray
  11742. @item blackongray
  11743. @item coloronblack
  11744. @item coloronwhite
  11745. @item colorongray
  11746. @item blackoncolor
  11747. @item whiteoncolor
  11748. @item grayoncolor
  11749. @end table
  11750. Default is @code{whiteonblack}.
  11751. @end table
  11752. @subsection Examples
  11753. @itemize
  11754. @item
  11755. Calculate and draw histogram:
  11756. @example
  11757. ffplay -i input -vf histogram
  11758. @end example
  11759. @end itemize
  11760. @anchor{hqdn3d}
  11761. @section hqdn3d
  11762. This is a high precision/quality 3d denoise filter. It aims to reduce
  11763. image noise, producing smooth images and making still images really
  11764. still. It should enhance compressibility.
  11765. It accepts the following optional parameters:
  11766. @table @option
  11767. @item luma_spatial
  11768. A non-negative floating point number which specifies spatial luma strength.
  11769. It defaults to 4.0.
  11770. @item chroma_spatial
  11771. A non-negative floating point number which specifies spatial chroma strength.
  11772. It defaults to 3.0*@var{luma_spatial}/4.0.
  11773. @item luma_tmp
  11774. A floating point number which specifies luma temporal strength. It defaults to
  11775. 6.0*@var{luma_spatial}/4.0.
  11776. @item chroma_tmp
  11777. A floating point number which specifies chroma temporal strength. It defaults to
  11778. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  11779. @end table
  11780. @subsection Commands
  11781. This filter supports same @ref{commands} as options.
  11782. The command accepts the same syntax of the corresponding option.
  11783. If the specified expression is not valid, it is kept at its current
  11784. value.
  11785. @anchor{hwdownload}
  11786. @section hwdownload
  11787. Download hardware frames to system memory.
  11788. The input must be in hardware frames, and the output a non-hardware format.
  11789. Not all formats will be supported on the output - it may be necessary to insert
  11790. an additional @option{format} filter immediately following in the graph to get
  11791. the output in a supported format.
  11792. @section hwmap
  11793. Map hardware frames to system memory or to another device.
  11794. This filter has several different modes of operation; which one is used depends
  11795. on the input and output formats:
  11796. @itemize
  11797. @item
  11798. Hardware frame input, normal frame output
  11799. Map the input frames to system memory and pass them to the output. If the
  11800. original hardware frame is later required (for example, after overlaying
  11801. something else on part of it), the @option{hwmap} filter can be used again
  11802. in the next mode to retrieve it.
  11803. @item
  11804. Normal frame input, hardware frame output
  11805. If the input is actually a software-mapped hardware frame, then unmap it -
  11806. that is, return the original hardware frame.
  11807. Otherwise, a device must be provided. Create new hardware surfaces on that
  11808. device for the output, then map them back to the software format at the input
  11809. and give those frames to the preceding filter. This will then act like the
  11810. @option{hwupload} filter, but may be able to avoid an additional copy when
  11811. the input is already in a compatible format.
  11812. @item
  11813. Hardware frame input and output
  11814. A device must be supplied for the output, either directly or with the
  11815. @option{derive_device} option. The input and output devices must be of
  11816. different types and compatible - the exact meaning of this is
  11817. system-dependent, but typically it means that they must refer to the same
  11818. underlying hardware context (for example, refer to the same graphics card).
  11819. If the input frames were originally created on the output device, then unmap
  11820. to retrieve the original frames.
  11821. Otherwise, map the frames to the output device - create new hardware frames
  11822. on the output corresponding to the frames on the input.
  11823. @end itemize
  11824. The following additional parameters are accepted:
  11825. @table @option
  11826. @item mode
  11827. Set the frame mapping mode. Some combination of:
  11828. @table @var
  11829. @item read
  11830. The mapped frame should be readable.
  11831. @item write
  11832. The mapped frame should be writeable.
  11833. @item overwrite
  11834. The mapping will always overwrite the entire frame.
  11835. This may improve performance in some cases, as the original contents of the
  11836. frame need not be loaded.
  11837. @item direct
  11838. The mapping must not involve any copying.
  11839. Indirect mappings to copies of frames are created in some cases where either
  11840. direct mapping is not possible or it would have unexpected properties.
  11841. Setting this flag ensures that the mapping is direct and will fail if that is
  11842. not possible.
  11843. @end table
  11844. Defaults to @var{read+write} if not specified.
  11845. @item derive_device @var{type}
  11846. Rather than using the device supplied at initialisation, instead derive a new
  11847. device of type @var{type} from the device the input frames exist on.
  11848. @item reverse
  11849. In a hardware to hardware mapping, map in reverse - create frames in the sink
  11850. and map them back to the source. This may be necessary in some cases where
  11851. a mapping in one direction is required but only the opposite direction is
  11852. supported by the devices being used.
  11853. This option is dangerous - it may break the preceding filter in undefined
  11854. ways if there are any additional constraints on that filter's output.
  11855. Do not use it without fully understanding the implications of its use.
  11856. @end table
  11857. @anchor{hwupload}
  11858. @section hwupload
  11859. Upload system memory frames to hardware surfaces.
  11860. The device to upload to must be supplied when the filter is initialised. If
  11861. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  11862. option or with the @option{derive_device} option. The input and output devices
  11863. must be of different types and compatible - the exact meaning of this is
  11864. system-dependent, but typically it means that they must refer to the same
  11865. underlying hardware context (for example, refer to the same graphics card).
  11866. The following additional parameters are accepted:
  11867. @table @option
  11868. @item derive_device @var{type}
  11869. Rather than using the device supplied at initialisation, instead derive a new
  11870. device of type @var{type} from the device the input frames exist on.
  11871. @end table
  11872. @anchor{hwupload_cuda}
  11873. @section hwupload_cuda
  11874. Upload system memory frames to a CUDA device.
  11875. It accepts the following optional parameters:
  11876. @table @option
  11877. @item device
  11878. The number of the CUDA device to use
  11879. @end table
  11880. @section hqx
  11881. Apply a high-quality magnification filter designed for pixel art. This filter
  11882. was originally created by Maxim Stepin.
  11883. It accepts the following option:
  11884. @table @option
  11885. @item n
  11886. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  11887. @code{hq3x} and @code{4} for @code{hq4x}.
  11888. Default is @code{3}.
  11889. @end table
  11890. @anchor{hstack}
  11891. @section hstack
  11892. Stack input videos horizontally.
  11893. All streams must be of same pixel format and of same height.
  11894. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11895. to create same output.
  11896. The filter accepts the following option:
  11897. @table @option
  11898. @item inputs
  11899. Set number of input streams. Default is 2.
  11900. @item shortest
  11901. If set to 1, force the output to terminate when the shortest input
  11902. terminates. Default value is 0.
  11903. @end table
  11904. @section hsvhold
  11905. Turns a certain HSV range into gray values.
  11906. This filter measures color difference between set HSV color in options
  11907. and ones measured in video stream. Depending on options, output
  11908. colors can be changed to be gray or not.
  11909. The filter accepts the following options:
  11910. @table @option
  11911. @item hue
  11912. Set the hue value which will be used in color difference calculation.
  11913. Allowed range is from -360 to 360. Default value is 0.
  11914. @item sat
  11915. Set the saturation value which will be used in color difference calculation.
  11916. Allowed range is from -1 to 1. Default value is 0.
  11917. @item val
  11918. Set the value which will be used in color difference calculation.
  11919. Allowed range is from -1 to 1. Default value is 0.
  11920. @item similarity
  11921. Set similarity percentage with the key color.
  11922. Allowed range is from 0 to 1. Default value is 0.01.
  11923. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11924. @item blend
  11925. Blend percentage.
  11926. Allowed range is from 0 to 1. Default value is 0.
  11927. 0.0 makes pixels either fully gray, or not gray at all.
  11928. Higher values result in more gray pixels, with a higher gray pixel
  11929. the more similar the pixels color is to the key color.
  11930. @end table
  11931. @section hsvkey
  11932. Turns a certain HSV range into transparency.
  11933. This filter measures color difference between set HSV color in options
  11934. and ones measured in video stream. Depending on options, output
  11935. colors can be changed to transparent by adding alpha channel.
  11936. The filter accepts the following options:
  11937. @table @option
  11938. @item hue
  11939. Set the hue value which will be used in color difference calculation.
  11940. Allowed range is from -360 to 360. Default value is 0.
  11941. @item sat
  11942. Set the saturation value which will be used in color difference calculation.
  11943. Allowed range is from -1 to 1. Default value is 0.
  11944. @item val
  11945. Set the value which will be used in color difference calculation.
  11946. Allowed range is from -1 to 1. Default value is 0.
  11947. @item similarity
  11948. Set similarity percentage with the key color.
  11949. Allowed range is from 0 to 1. Default value is 0.01.
  11950. 0.00001 matches only the exact key color, while 1.0 matches everything.
  11951. @item blend
  11952. Blend percentage.
  11953. Allowed range is from 0 to 1. Default value is 0.
  11954. 0.0 makes pixels either fully transparent, or not transparent at all.
  11955. Higher values result in semi-transparent pixels, with a higher transparency
  11956. the more similar the pixels color is to the key color.
  11957. @end table
  11958. @section hue
  11959. Modify the hue and/or the saturation of the input.
  11960. It accepts the following parameters:
  11961. @table @option
  11962. @item h
  11963. Specify the hue angle as a number of degrees. It accepts an expression,
  11964. and defaults to "0".
  11965. @item s
  11966. Specify the saturation in the [-10,10] range. It accepts an expression and
  11967. defaults to "1".
  11968. @item H
  11969. Specify the hue angle as a number of radians. It accepts an
  11970. expression, and defaults to "0".
  11971. @item b
  11972. Specify the brightness in the [-10,10] range. It accepts an expression and
  11973. defaults to "0".
  11974. @end table
  11975. @option{h} and @option{H} are mutually exclusive, and can't be
  11976. specified at the same time.
  11977. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  11978. expressions containing the following constants:
  11979. @table @option
  11980. @item n
  11981. frame count of the input frame starting from 0
  11982. @item pts
  11983. presentation timestamp of the input frame expressed in time base units
  11984. @item r
  11985. frame rate of the input video, NAN if the input frame rate is unknown
  11986. @item t
  11987. timestamp expressed in seconds, NAN if the input timestamp is unknown
  11988. @item tb
  11989. time base of the input video
  11990. @end table
  11991. @subsection Examples
  11992. @itemize
  11993. @item
  11994. Set the hue to 90 degrees and the saturation to 1.0:
  11995. @example
  11996. hue=h=90:s=1
  11997. @end example
  11998. @item
  11999. Same command but expressing the hue in radians:
  12000. @example
  12001. hue=H=PI/2:s=1
  12002. @end example
  12003. @item
  12004. Rotate hue and make the saturation swing between 0
  12005. and 2 over a period of 1 second:
  12006. @example
  12007. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  12008. @end example
  12009. @item
  12010. Apply a 3 seconds saturation fade-in effect starting at 0:
  12011. @example
  12012. hue="s=min(t/3\,1)"
  12013. @end example
  12014. The general fade-in expression can be written as:
  12015. @example
  12016. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  12017. @end example
  12018. @item
  12019. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  12020. @example
  12021. hue="s=max(0\, min(1\, (8-t)/3))"
  12022. @end example
  12023. The general fade-out expression can be written as:
  12024. @example
  12025. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  12026. @end example
  12027. @end itemize
  12028. @subsection Commands
  12029. This filter supports the following commands:
  12030. @table @option
  12031. @item b
  12032. @item s
  12033. @item h
  12034. @item H
  12035. Modify the hue and/or the saturation and/or brightness of the input video.
  12036. The command accepts the same syntax of the corresponding option.
  12037. If the specified expression is not valid, it is kept at its current
  12038. value.
  12039. @end table
  12040. @section huesaturation
  12041. Apply hue-saturation-intensity adjustments to input video stream.
  12042. This filter operates in RGB colorspace.
  12043. This filter accepts the following options:
  12044. @table @option
  12045. @item hue
  12046. Set the hue shift in degrees to apply. Default is 0.
  12047. Allowed range is from -180 to 180.
  12048. @item saturation
  12049. Set the saturation shift. Default is 0.
  12050. Allowed range is from -1 to 1.
  12051. @item intensity
  12052. Set the intensity shift. Default is 0.
  12053. Allowed range is from -1 to 1.
  12054. @item colors
  12055. Set which primary and complementary colors are going to be adjusted.
  12056. This options is set by providing one or multiple values.
  12057. This can select multiple colors at once. By default all colors are selected.
  12058. @table @samp
  12059. @item r
  12060. Adjust reds.
  12061. @item y
  12062. Adjust yellows.
  12063. @item g
  12064. Adjust greens.
  12065. @item c
  12066. Adjust cyans.
  12067. @item b
  12068. Adjust blues.
  12069. @item m
  12070. Adjust magentas.
  12071. @item a
  12072. Adjust all colors.
  12073. @end table
  12074. @item strength
  12075. Set strength of filtering. Allowed range is from 0 to 100.
  12076. Default value is 1.
  12077. @item rw, gw, bw
  12078. Set weight for each RGB component. Allowed range is from 0 to 1.
  12079. By default is set to 0.333, 0.334, 0.333.
  12080. Those options are used in saturation and lightess processing.
  12081. @item lightness
  12082. Set preserving lightness, by default is disabled.
  12083. Adjusting hues can change lightness from original RGB triplet,
  12084. with this option enabled lightness is kept at same value.
  12085. @end table
  12086. @section hysteresis
  12087. Grow first stream into second stream by connecting components.
  12088. This makes it possible to build more robust edge masks.
  12089. This filter accepts the following options:
  12090. @table @option
  12091. @item planes
  12092. Set which planes will be processed as bitmap, unprocessed planes will be
  12093. copied from first stream.
  12094. By default value 0xf, all planes will be processed.
  12095. @item threshold
  12096. Set threshold which is used in filtering. If pixel component value is higher than
  12097. this value filter algorithm for connecting components is activated.
  12098. By default value is 0.
  12099. @end table
  12100. The @code{hysteresis} filter also supports the @ref{framesync} options.
  12101. @section iccdetect
  12102. Detect the colorspace from an embedded ICC profile (if present), and update
  12103. the frame's tags accordingly.
  12104. This filter accepts the following options:
  12105. @table @option
  12106. @item force
  12107. If true, the frame's existing colorspace tags will always be overridden by
  12108. values detected from an ICC profile. Otherwise, they will only be assigned if
  12109. they contain @code{unknown}. Enabled by default.
  12110. @end table
  12111. @section iccgen
  12112. Generate ICC profiles and attach them to frames.
  12113. This filter accepts the following options:
  12114. @table @option
  12115. @item color_primaries
  12116. @item color_trc
  12117. Configure the colorspace that the ICC profile will be generated for. The
  12118. default value of @code{auto} infers the value from the input frame's metadata,
  12119. defaulting to BT.709/sRGB as appropriate.
  12120. See the @ref{setparams} filter for a list of possible values, but note that
  12121. @code{unknown} are not valid values for this filter.
  12122. @item force
  12123. If true, an ICC profile will be generated even if it would overwrite an
  12124. already existing ICC profile. Disabled by default.
  12125. @end table
  12126. @section identity
  12127. Obtain the identity score between two input videos.
  12128. This filter takes two input videos.
  12129. Both input videos must have the same resolution and pixel format for
  12130. this filter to work correctly. Also it assumes that both inputs
  12131. have the same number of frames, which are compared one by one.
  12132. The obtained per component, average, min and max identity score is printed through
  12133. the logging system.
  12134. The filter stores the calculated identity scores of each frame in frame metadata.
  12135. This filter also supports the @ref{framesync} options.
  12136. In the below example the input file @file{main.mpg} being processed is compared
  12137. with the reference file @file{ref.mpg}.
  12138. @example
  12139. ffmpeg -i main.mpg -i ref.mpg -lavfi identity -f null -
  12140. @end example
  12141. @section idet
  12142. Detect video interlacing type.
  12143. This filter tries to detect if the input frames are interlaced, progressive,
  12144. top or bottom field first. It will also try to detect fields that are
  12145. repeated between adjacent frames (a sign of telecine).
  12146. Single frame detection considers only immediately adjacent frames when classifying each frame.
  12147. Multiple frame detection incorporates the classification history of previous frames.
  12148. The filter will log these metadata values:
  12149. @table @option
  12150. @item single.current_frame
  12151. Detected type of current frame using single-frame detection. One of:
  12152. ``tff'' (top field first), ``bff'' (bottom field first),
  12153. ``progressive'', or ``undetermined''
  12154. @item single.tff
  12155. Cumulative number of frames detected as top field first using single-frame detection.
  12156. @item multiple.tff
  12157. Cumulative number of frames detected as top field first using multiple-frame detection.
  12158. @item single.bff
  12159. Cumulative number of frames detected as bottom field first using single-frame detection.
  12160. @item multiple.current_frame
  12161. Detected type of current frame using multiple-frame detection. One of:
  12162. ``tff'' (top field first), ``bff'' (bottom field first),
  12163. ``progressive'', or ``undetermined''
  12164. @item multiple.bff
  12165. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  12166. @item single.progressive
  12167. Cumulative number of frames detected as progressive using single-frame detection.
  12168. @item multiple.progressive
  12169. Cumulative number of frames detected as progressive using multiple-frame detection.
  12170. @item single.undetermined
  12171. Cumulative number of frames that could not be classified using single-frame detection.
  12172. @item multiple.undetermined
  12173. Cumulative number of frames that could not be classified using multiple-frame detection.
  12174. @item repeated.current_frame
  12175. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  12176. @item repeated.neither
  12177. Cumulative number of frames with no repeated field.
  12178. @item repeated.top
  12179. Cumulative number of frames with the top field repeated from the previous frame's top field.
  12180. @item repeated.bottom
  12181. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  12182. @end table
  12183. The filter accepts the following options:
  12184. @table @option
  12185. @item intl_thres
  12186. Set interlacing threshold.
  12187. @item prog_thres
  12188. Set progressive threshold.
  12189. @item rep_thres
  12190. Threshold for repeated field detection.
  12191. @item half_life
  12192. Number of frames after which a given frame's contribution to the
  12193. statistics is halved (i.e., it contributes only 0.5 to its
  12194. classification). The default of 0 means that all frames seen are given
  12195. full weight of 1.0 forever.
  12196. @item analyze_interlaced_flag
  12197. When this is not 0 then idet will use the specified number of frames to determine
  12198. if the interlaced flag is accurate, it will not count undetermined frames.
  12199. If the flag is found to be accurate it will be used without any further
  12200. computations, if it is found to be inaccurate it will be cleared without any
  12201. further computations. This allows inserting the idet filter as a low computational
  12202. method to clean up the interlaced flag
  12203. @end table
  12204. @subsection Examples
  12205. Inspect the field order of the first 360 frames in a video, in verbose detail:
  12206. @example
  12207. ffmpeg -i INPUT -filter:v idet,metadata=mode=print -frames:v 360 -an -f null -
  12208. @end example
  12209. The idet filter will add analysis metadata to each frame, which will then be
  12210. discarded. At the end, the filter will also print a final report with statistics.
  12211. @section il
  12212. Deinterleave or interleave fields.
  12213. This filter allows one to process interlaced images fields without
  12214. deinterlacing them. Deinterleaving splits the input frame into 2
  12215. fields (so called half pictures). Odd lines are moved to the top
  12216. half of the output image, even lines to the bottom half.
  12217. You can process (filter) them independently and then re-interleave them.
  12218. The filter accepts the following options:
  12219. @table @option
  12220. @item luma_mode, l
  12221. @item chroma_mode, c
  12222. @item alpha_mode, a
  12223. Available values for @var{luma_mode}, @var{chroma_mode} and
  12224. @var{alpha_mode} are:
  12225. @table @samp
  12226. @item none
  12227. Do nothing.
  12228. @item deinterleave, d
  12229. Deinterleave fields, placing one above the other.
  12230. @item interleave, i
  12231. Interleave fields. Reverse the effect of deinterleaving.
  12232. @end table
  12233. Default value is @code{none}.
  12234. @item luma_swap, ls
  12235. @item chroma_swap, cs
  12236. @item alpha_swap, as
  12237. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  12238. @end table
  12239. @subsection Commands
  12240. This filter supports the all above options as @ref{commands}.
  12241. @section inflate
  12242. Apply inflate effect to the video.
  12243. This filter replaces the pixel by the local(3x3) average by taking into account
  12244. only values higher than the pixel.
  12245. It accepts the following options:
  12246. @table @option
  12247. @item threshold0
  12248. @item threshold1
  12249. @item threshold2
  12250. @item threshold3
  12251. Limit the maximum change for each plane, default is 65535.
  12252. If 0, plane will remain unchanged.
  12253. @end table
  12254. @subsection Commands
  12255. This filter supports the all above options as @ref{commands}.
  12256. @section interlace
  12257. Simple interlacing filter from progressive contents. This interleaves upper (or
  12258. lower) lines from odd frames with lower (or upper) lines from even frames,
  12259. halving the frame rate and preserving image height.
  12260. @example
  12261. Original Original New Frame
  12262. Frame 'j' Frame 'j+1' (tff)
  12263. ========== =========== ==================
  12264. Line 0 --------------------> Frame 'j' Line 0
  12265. Line 1 Line 1 ----> Frame 'j+1' Line 1
  12266. Line 2 ---------------------> Frame 'j' Line 2
  12267. Line 3 Line 3 ----> Frame 'j+1' Line 3
  12268. ... ... ...
  12269. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  12270. @end example
  12271. It accepts the following optional parameters:
  12272. @table @option
  12273. @item scan
  12274. This determines whether the interlaced frame is taken from the even
  12275. (tff - default) or odd (bff) lines of the progressive frame.
  12276. @item lowpass
  12277. Vertical lowpass filter to avoid twitter interlacing and
  12278. reduce moire patterns.
  12279. @table @samp
  12280. @item 0, off
  12281. Disable vertical lowpass filter
  12282. @item 1, linear
  12283. Enable linear filter (default)
  12284. @item 2, complex
  12285. Enable complex filter. This will slightly less reduce twitter and moire
  12286. but better retain detail and subjective sharpness impression.
  12287. @end table
  12288. @end table
  12289. @section kerndeint
  12290. Deinterlace input video by applying Donald Graft's adaptive kernel
  12291. deinterling. Work on interlaced parts of a video to produce
  12292. progressive frames.
  12293. The description of the accepted parameters follows.
  12294. @table @option
  12295. @item thresh
  12296. Set the threshold which affects the filter's tolerance when
  12297. determining if a pixel line must be processed. It must be an integer
  12298. in the range [0,255] and defaults to 10. A value of 0 will result in
  12299. applying the process on every pixels.
  12300. @item map
  12301. Paint pixels exceeding the threshold value to white if set to 1.
  12302. Default is 0.
  12303. @item order
  12304. Set the fields order. Swap fields if set to 1, leave fields alone if
  12305. 0. Default is 0.
  12306. @item sharp
  12307. Enable additional sharpening if set to 1. Default is 0.
  12308. @item twoway
  12309. Enable twoway sharpening if set to 1. Default is 0.
  12310. @end table
  12311. @subsection Examples
  12312. @itemize
  12313. @item
  12314. Apply default values:
  12315. @example
  12316. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  12317. @end example
  12318. @item
  12319. Enable additional sharpening:
  12320. @example
  12321. kerndeint=sharp=1
  12322. @end example
  12323. @item
  12324. Paint processed pixels in white:
  12325. @example
  12326. kerndeint=map=1
  12327. @end example
  12328. @end itemize
  12329. @section kirsch
  12330. Apply kirsch operator to input video stream.
  12331. The filter accepts the following option:
  12332. @table @option
  12333. @item planes
  12334. Set which planes will be processed, unprocessed planes will be copied.
  12335. By default value 0xf, all planes will be processed.
  12336. @item scale
  12337. Set value which will be multiplied with filtered result.
  12338. @item delta
  12339. Set value which will be added to filtered result.
  12340. @end table
  12341. @subsection Commands
  12342. This filter supports the all above options as @ref{commands}.
  12343. @section lagfun
  12344. Slowly update darker pixels.
  12345. This filter makes short flashes of light appear longer.
  12346. This filter accepts the following options:
  12347. @table @option
  12348. @item decay
  12349. Set factor for decaying. Default is .95. Allowed range is from 0 to 1.
  12350. @item planes
  12351. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  12352. @end table
  12353. @subsection Commands
  12354. This filter supports the all above options as @ref{commands}.
  12355. @section lenscorrection
  12356. Correct radial lens distortion
  12357. This filter can be used to correct for radial distortion as can result from the use
  12358. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  12359. one can use tools available for example as part of opencv or simply trial-and-error.
  12360. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  12361. and extract the k1 and k2 coefficients from the resulting matrix.
  12362. Note that effectively the same filter is available in the open-source tools Krita and
  12363. Digikam from the KDE project.
  12364. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  12365. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  12366. brightness distribution, so you may want to use both filters together in certain
  12367. cases, though you will have to take care of ordering, i.e. whether vignetting should
  12368. be applied before or after lens correction.
  12369. @subsection Options
  12370. The filter accepts the following options:
  12371. @table @option
  12372. @item cx
  12373. Relative x-coordinate of the focal point of the image, and thereby the center of the
  12374. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12375. width. Default is 0.5.
  12376. @item cy
  12377. Relative y-coordinate of the focal point of the image, and thereby the center of the
  12378. distortion. This value has a range [0,1] and is expressed as fractions of the image
  12379. height. Default is 0.5.
  12380. @item k1
  12381. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  12382. no correction. Default is 0.
  12383. @item k2
  12384. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  12385. 0 means no correction. Default is 0.
  12386. @item i
  12387. Set interpolation type. Can be @code{nearest} or @code{bilinear}.
  12388. Default is @code{nearest}.
  12389. @item fc
  12390. Specify the color of the unmapped pixels. For the syntax of this option,
  12391. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12392. manual,ffmpeg-utils}. Default color is @code{black@@0}.
  12393. @end table
  12394. The formula that generates the correction is:
  12395. @var{r_src} = @var{r_tgt} * (1 + @var{k1} * (@var{r_tgt} / @var{r_0})^2 + @var{k2} * (@var{r_tgt} / @var{r_0})^4)
  12396. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  12397. distances from the focal point in the source and target images, respectively.
  12398. @subsection Commands
  12399. This filter supports the all above options as @ref{commands}.
  12400. @section lensfun
  12401. Apply lens correction via the lensfun library (@url{http://lensfun.sourceforge.net/}).
  12402. The @code{lensfun} filter requires the camera make, camera model, and lens model
  12403. to apply the lens correction. The filter will load the lensfun database and
  12404. query it to find the corresponding camera and lens entries in the database. As
  12405. long as these entries can be found with the given options, the filter can
  12406. perform corrections on frames. Note that incomplete strings will result in the
  12407. filter choosing the best match with the given options, and the filter will
  12408. output the chosen camera and lens models (logged with level "info"). You must
  12409. provide the make, camera model, and lens model as they are required.
  12410. To obtain a list of available makes and models, leave out one or both of @code{make} and
  12411. @code{model} options. The filter will send the full list to the log with level @code{INFO}.
  12412. The first column is the make and the second column is the model.
  12413. To obtain a list of available lenses, set any values for make and model and leave out the
  12414. @code{lens_model} option. The filter will send the full list of lenses in the log with level
  12415. @code{INFO}. The ffmpeg tool will exit after the list is printed.
  12416. The filter accepts the following options:
  12417. @table @option
  12418. @item make
  12419. The make of the camera (for example, "Canon"). This option is required.
  12420. @item model
  12421. The model of the camera (for example, "Canon EOS 100D"). This option is
  12422. required.
  12423. @item lens_model
  12424. The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
  12425. option is required.
  12426. @item db_path
  12427. The full path to the lens database folder. If not set, the filter will attempt to
  12428. load the database from the install path when the library was built. Default is unset.
  12429. @item mode
  12430. The type of correction to apply. The following values are valid options:
  12431. @table @samp
  12432. @item vignetting
  12433. Enables fixing lens vignetting.
  12434. @item geometry
  12435. Enables fixing lens geometry. This is the default.
  12436. @item subpixel
  12437. Enables fixing chromatic aberrations.
  12438. @item vig_geo
  12439. Enables fixing lens vignetting and lens geometry.
  12440. @item vig_subpixel
  12441. Enables fixing lens vignetting and chromatic aberrations.
  12442. @item distortion
  12443. Enables fixing both lens geometry and chromatic aberrations.
  12444. @item all
  12445. Enables all possible corrections.
  12446. @end table
  12447. @item focal_length
  12448. The focal length of the image/video (zoom; expected constant for video). For
  12449. example, a 18--55mm lens has focal length range of [18--55], so a value in that
  12450. range should be chosen when using that lens. Default 18.
  12451. @item aperture
  12452. The aperture of the image/video (expected constant for video). Note that
  12453. aperture is only used for vignetting correction. Default 3.5.
  12454. @item focus_distance
  12455. The focus distance of the image/video (expected constant for video). Note that
  12456. focus distance is only used for vignetting and only slightly affects the
  12457. vignetting correction process. If unknown, leave it at the default value (which
  12458. is 1000).
  12459. @item scale
  12460. The scale factor which is applied after transformation. After correction the
  12461. video is no longer necessarily rectangular. This parameter controls how much of
  12462. the resulting image is visible. The value 0 means that a value will be chosen
  12463. automatically such that there is little or no unmapped area in the output
  12464. image. 1.0 means that no additional scaling is done. Lower values may result
  12465. in more of the corrected image being visible, while higher values may avoid
  12466. unmapped areas in the output.
  12467. @item target_geometry
  12468. The target geometry of the output image/video. The following values are valid
  12469. options:
  12470. @table @samp
  12471. @item rectilinear (default)
  12472. @item fisheye
  12473. @item panoramic
  12474. @item equirectangular
  12475. @item fisheye_orthographic
  12476. @item fisheye_stereographic
  12477. @item fisheye_equisolid
  12478. @item fisheye_thoby
  12479. @end table
  12480. @item reverse
  12481. Apply the reverse of image correction (instead of correcting distortion, apply
  12482. it).
  12483. @item interpolation
  12484. The type of interpolation used when correcting distortion. The following values
  12485. are valid options:
  12486. @table @samp
  12487. @item nearest
  12488. @item linear (default)
  12489. @item lanczos
  12490. @end table
  12491. @end table
  12492. @subsection Examples
  12493. @itemize
  12494. @item
  12495. Apply lens correction with make "Canon", camera model "Canon EOS 100D", and lens
  12496. model "Canon EF-S 18-55mm f/3.5-5.6 IS STM" with focal length of "18" and
  12497. aperture of "8.0".
  12498. @example
  12499. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov
  12500. @end example
  12501. @item
  12502. Apply the same as before, but only for the first 5 seconds of video.
  12503. @example
  12504. ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:enable='lte(t\,5)' -c:v h264 -b:v 8000k output.mov
  12505. @end example
  12506. @end itemize
  12507. @section libplacebo
  12508. Flexible GPU-accelerated processing filter based on libplacebo
  12509. (@url{https://code.videolan.org/videolan/libplacebo}).
  12510. @subsection Options
  12511. The options for this filter are divided into the following sections:
  12512. @subsubsection Output mode
  12513. These options control the overall output mode. By default, libplacebo will try
  12514. to preserve the source colorimetry and size as best as it can, but it will
  12515. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12516. in source frames.
  12517. @table @option
  12518. @item inputs
  12519. Set the number of inputs. This can be used, alongside the @code{idx} variable,
  12520. to allow placing/blending multiple inputs inside the output frame. This
  12521. effectively enables functionality similar to @ref{hstack}, @ref{overlay}, etc.
  12522. @item w
  12523. @item h
  12524. Set the output video dimension expression. Default values are @code{iw} and
  12525. @code{ih}.
  12526. Allows for the same expressions as the @ref{scale} filter.
  12527. @item crop_x
  12528. @item crop_y
  12529. Set the input crop x/y expressions, default values are @code{(iw-cw)/2} and
  12530. @code{(ih-ch)/2}.
  12531. @item crop_w
  12532. @item crop_h
  12533. Set the input crop width/height expressions, default values are @code{iw} and
  12534. @code{ih}.
  12535. @item pos_x
  12536. @item pos_y
  12537. Set the output placement x/y expressions, default values are @code{(ow-pw)/2}
  12538. and @code{(oh-ph)/2}.
  12539. @item pos_w
  12540. @item pos_h
  12541. Set the output placement width/height expressions, default values are @code{ow}
  12542. and @code{oh}.
  12543. @item fps
  12544. Set the output frame rate. This can be rational, e.g. @code{60000/1001}. If
  12545. set to the special string @code{none} (the default), input timestamps will
  12546. instead be passed through to the output unmodified. Otherwise, the input video
  12547. frames will be interpolated as necessary to rescale the video to the specified
  12548. target framerate, in a manner as determined by the @option{frame_mixer} option.
  12549. @item format
  12550. Set the output format override. If unset (the default), frames will be output
  12551. in the same format as the respective input frames. Otherwise, format conversion
  12552. will be performed.
  12553. @item force_original_aspect_ratio
  12554. @item force_divisible_by
  12555. Work the same as the identical @ref{scale} filter options.
  12556. @item normalize_sar
  12557. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12558. will introduce additional padding/cropping as necessary. If disabled (the
  12559. default), any aspect ratio mismatches, including those from e.g. anamorphic
  12560. video sources, are forwarded to the output pixel aspect ratio.
  12561. @item pad_crop_ratio
  12562. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12563. cropping when the input aspect ratio does not match the output aspect ratio and
  12564. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12565. content with black borders, while a value of @code{1.0} always crops off parts
  12566. of the content. Intermediate values are possible, leading to a mix of the two
  12567. approaches.
  12568. @item fillcolor
  12569. Set the color used to fill the output area not covered by the output image, for
  12570. example as a result of @option{normalize_sar}. For the general syntax of this
  12571. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12572. manual,ffmpeg-utils}. Defaults to @code{black}.
  12573. @item corner_rounding
  12574. Render frames with rounded corners. The value, given as a float ranging from
  12575. @code{0.0} to @code{1.0}, indicates the relative degree of rounding, from fully
  12576. square to fully circular. In other words, it gives the radius divided by half
  12577. the smaller side length. Defaults to @code{0.0}.
  12578. @item extra_opts
  12579. Pass extra libplacebo internal configuration options. These can be specified
  12580. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  12581. shows how to configure a custom filter kernel ("EWA LanczosSharp") and use it
  12582. to double the input image resolution:
  12583. @example
  12584. -vf "libplacebo=w=iw*2:h=ih*2:extra_opts='upscaler=custom\:upscaler_preset=ewa_lanczos\:upscaler_blur=0.9812505644269356'"
  12585. @end example
  12586. @item colorspace
  12587. @item color_primaries
  12588. @item color_trc
  12589. @item range
  12590. Configure the colorspace that output frames will be delivered in. The default
  12591. value of @code{auto} outputs frames in the same format as the input frames,
  12592. leading to no change. For any other value, conversion will be performed.
  12593. See the @ref{setparams} filter for a list of possible values.
  12594. @item apply_filmgrain
  12595. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12596. it from the output. Enabled by default.
  12597. @item apply_dolbyvision
  12598. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12599. the output. Enabled by default. Note that Dolby Vision will always output
  12600. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12601. picked as the values of @code{auto} for the respective frame output options.
  12602. @end table
  12603. In addition to the expression constants documented for the @ref{scale} filter,
  12604. the @option{crop_w}, @option{crop_h}, @option{crop_x}, @option{crop_y},
  12605. @option{pos_w}, @option{pos_h}, @option{pos_x} and @option{pos_y} options can
  12606. also contain the following constants:
  12607. @table @option
  12608. @item in_idx, idx
  12609. The (0-based) numeric index of the currently active input stream.
  12610. @item crop_w, cw
  12611. @item crop_h, ch
  12612. The computed values of @option{crop_w} and @option{crop_h}.
  12613. @item pos_w, pw
  12614. @item pos_h, ph
  12615. The computed values of @option{pos_w} and @option{pos_h}.
  12616. @item in_t, t
  12617. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12618. @item out_t, ot
  12619. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12620. @item n
  12621. The input frame number, starting with 0.
  12622. @end table
  12623. @subsubsection Scaling
  12624. The options in this section control how libplacebo performs upscaling and (if
  12625. necessary) downscaling. Note that libplacebo will always internally operate on
  12626. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12627. necessarily be upsampled and downsampled as part of the rendering process. That
  12628. means scaling might be in effect even if the source and destination resolution
  12629. are the same.
  12630. @table @option
  12631. @item upscaler
  12632. @item downscaler
  12633. Configure the filter kernel used for upscaling and downscaling. The respective
  12634. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12635. values, pass @code{help} to these options. The most important values are:
  12636. @table @samp
  12637. @item none
  12638. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12639. fast but poor quality, especially when downscaling.
  12640. @item bilinear
  12641. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12642. doing so would lead to aliasing. Fast and low quality.
  12643. @item nearest
  12644. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12645. @item oversample
  12646. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12647. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12648. minimal distortion of the artistic appearance.
  12649. @item lanczos
  12650. Standard sinc-sinc interpolation kernel.
  12651. @item spline36
  12652. Cubic spline approximation of lanczos. No difference in performance, but has
  12653. very slightly less ringing.
  12654. @item ewa_lanczos
  12655. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  12656. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12657. quality.
  12658. @item gaussian
  12659. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12660. very blurry.
  12661. @item mitchell
  12662. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12663. little ringing.
  12664. @end table
  12665. @item frame_mixer
  12666. Controls the kernel used for mixing frames temporally. The default value is
  12667. @code{none}, which disables frame mixing. For a full list of possible values,
  12668. pass @code{help} to this option. The most important values are:
  12669. @table @samp
  12670. @item none
  12671. Disables frame mixing, giving a result equivalent to "nearest neighbour"
  12672. semantics.
  12673. @item oversample
  12674. Oversamples the input video to create a "Smooth Motion"-type effect: if an
  12675. output frame would exactly fall on the transition between two video frames, it
  12676. is blended according to the relative overlap. This is the recommended option
  12677. whenever preserving the original subjective appearance is desired.
  12678. @item mitchell_clamp
  12679. Larger filter kernel that smoothly interpolates multiple frames in a manner
  12680. designed to eliminate ringing and other artefacts as much as possible. This is
  12681. the recommended option wherever maximum visual smoothness is desired.
  12682. @item linear
  12683. Linear blend/fade between frames. Especially useful for constructing e.g.
  12684. slideshows.
  12685. @end table
  12686. @item lut_entries
  12687. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  12688. default of @code{0} will pick libplacebo's internal default, typically
  12689. @code{64}.
  12690. @item antiringing
  12691. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12692. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12693. aliasing if set too high. Disabled by default.
  12694. @item sigmoid
  12695. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12696. Enabled by default.
  12697. @end table
  12698. @subsubsection Debanding
  12699. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12700. many common sources of banding and blocking. Turning this on is highly
  12701. recommended whenever quality is desired.
  12702. @table @option
  12703. @item deband
  12704. Enable (fast) debanding algorithm. Disabled by default.
  12705. @item deband_iterations
  12706. Number of deband iterations of the debanding algorithm. Each iteration is
  12707. performed with progressively increased radius (and diminished threshold).
  12708. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12709. @item deband_threshold
  12710. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12711. Defaults to @code{4.0}.
  12712. @item deband_radius
  12713. Debanding filter radius. A higher radius is better for slow gradients, while
  12714. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12715. @item deband_grain
  12716. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12717. @code{6.0}.
  12718. @end table
  12719. @subsubsection Color adjustment
  12720. A collection of subjective color controls. Not very rigorous, so the exact
  12721. effect will vary somewhat depending on the input primaries and colorspace.
  12722. @table @option
  12723. @item brightness
  12724. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12725. @item contrast
  12726. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12727. @item saturation
  12728. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12729. @item hue
  12730. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12731. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12732. coefficients for RGB inputs.
  12733. @item gamma
  12734. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12735. @item cones
  12736. Cone model to use for color blindness simulation. Accepts any combination of
  12737. @code{l}, @code{m} and @code{s}. Here are some examples:
  12738. @table @samp
  12739. @item m
  12740. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12741. @item l
  12742. Protanomaly / protanopia (affecting 1%-2% of the population)
  12743. @item l+m
  12744. Monochromacy (very rare)
  12745. @item l+m+s
  12746. Achromatopsy (complete loss of daytime vision, extremely rare)
  12747. @end table
  12748. @item cone-strength
  12749. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12750. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12751. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12752. above @code{1.0} result in exaggerating the differences between cones, which
  12753. may help compensate for reduced color vision.
  12754. @end table
  12755. @subsubsection Peak detection
  12756. To help deal with sources that only have static HDR10 metadata (or no tagging
  12757. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12758. analyze source frames and adapt the tone mapping function in realtime. If this
  12759. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12760. recommended to turn this feature off.
  12761. @table @option
  12762. @item peak_detect
  12763. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12764. dynamic detection from the input. Note that the detected values do not get
  12765. written back to the output frames, they merely guide the internal tone mapping
  12766. process. Enabled by default.
  12767. @item smoothing_period
  12768. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12769. values result in peak detection becoming less responsive to changes in the
  12770. input. Defaults to @code{100.0}.
  12771. @item minimum_peak
  12772. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12773. and @code{100.0}. Defaults to @code{1.0}.
  12774. @item scene_threshold_low
  12775. @item scene_threshold_high
  12776. Lower and upper thresholds for scene change detection. Expressed in a
  12777. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12778. and @code{10.0}, respectively. Setting either to a negative value disables
  12779. this functionality.
  12780. @item percentile
  12781. Which percentile of the frame brightness histogram to use as the source peak
  12782. for tone-mapping. Defaults to @code{99.995}, a fairly conservative value.
  12783. Setting this to @code{100.0} disables frame histogram measurement and instead
  12784. uses the true peak brightness for tone-mapping.
  12785. @end table
  12786. @subsubsection Tone mapping
  12787. The options in this section control how libplacebo performs tone-mapping and
  12788. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12789. In general, libplacebo relies on accurate source tagging and mastering display
  12790. gamut information to produce the best results.
  12791. @table @option
  12792. @item gamut_mode
  12793. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12794. gamut mapping.
  12795. @table @samp
  12796. @item clip
  12797. Do nothing, simply clip out-of-range colors to the RGB volume. Low quality but
  12798. extremely fast.
  12799. @item perceptual
  12800. Perceptually soft-clip colors to the gamut volume. This is the default.
  12801. @item relative
  12802. Relative colorimetric hard-clip. Similar to @code{perceptual} but without
  12803. the soft knee.
  12804. @item saturation
  12805. Saturation mapping, maps primaries directly to primaries in RGB space.
  12806. Not recommended except for artificial computer graphics for which a bright,
  12807. saturated display is desired.
  12808. @item absolute
  12809. Absolute colorimetric hard-clip. Performs no adjustment of the white point.
  12810. @item desaturate
  12811. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12812. luminance. Has a tendency to distort the visual appearance of bright objects.
  12813. @item darken
  12814. Linearly reduces content brightness to preserves saturated details, followed by
  12815. clipping the remaining out-of-gamut colors.
  12816. @item warn
  12817. Highlight out-of-gamut pixels (by inverting/marking them).
  12818. @item linear
  12819. Linearly reduces chromaticity of the entire image to make it fit within the
  12820. target color volume. Be careful when using this on BT.2020 sources without
  12821. proper mastering metadata, as doing so will lead to excessive desaturation.
  12822. @end table
  12823. @item tonemapping
  12824. Tone-mapping algorithm to use. Available values are:
  12825. @table @samp
  12826. @item auto
  12827. Automatic selection based on internal heuristics. This is the default.
  12828. @item clip
  12829. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12830. accuracy for in-range colors but completely destroys out-of-range information.
  12831. Does not perform any black point adaptation. Not configurable.
  12832. @item st2094-40
  12833. EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
  12834. dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
  12835. is adjusted based on the ratio between the targeted and actual display peak
  12836. luminances.
  12837. @item st2094-10
  12838. EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
  12839. average luminance in addition to the maximum/minimum. The configurable contrast
  12840. parameter influences the slope of the linear output segment, defaulting to
  12841. @code{1.0} for no increase/decrease in contrast. Note that this does not
  12842. currently include the subjective gain/offset/gamma controls defined in Annex
  12843. B.3.
  12844. @item bt.2390
  12845. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12846. segment. The knee point offset is configurable. Note that this parameter
  12847. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12848. spec.
  12849. @item bt.2446a
  12850. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12851. sources. Can be used for both forward and inverse tone mapping. Not
  12852. configurable.
  12853. @item spline
  12854. Simple spline consisting of two polynomials, joined by a single pivot point.
  12855. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12856. Can be used for both forward and inverse tone mapping.
  12857. @item reinhard
  12858. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12859. local contrast coefficient at the display peak. Essentially, a parameter of
  12860. @code{0.5} implies that the reference white will be about half as bright as
  12861. when clipping. Defaults to @code{0.5}, which results in the simplest
  12862. formulation of this function.
  12863. @item mobius
  12864. Generalization of the reinhard tone mapping algorithm to support an additional
  12865. linear slope near black. The tone mapping parameter indicates the trade-off
  12866. between the linear section and the non-linear section. Essentially, for a given
  12867. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12868. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12869. this curve behave like @code{clip}, while values near @code{0.0} make this
  12870. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12871. provides a good balance between colorimetric accuracy and preserving
  12872. out-of-gamut details.
  12873. @item hable
  12874. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12875. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12876. Popularized by its use in video games with HDR rendering. Preserves both dark
  12877. and bright details very well, but comes with the drawback of changing the
  12878. average brightness quite significantly. This is sort of similar to
  12879. @code{reinhard} with parameter @code{0.24}.
  12880. @item gamma
  12881. Fits a gamma (power) function to transfer between the source and target color
  12882. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12883. linear sections. This preserves details at all scales fairly accurately, but
  12884. can result in an image with a muted or dull appearance. The parameter is used
  12885. as the cutoff point, defaulting to @code{0.5}.
  12886. @item linear
  12887. Linearly stretches the input range to the output range, in PQ space. This will
  12888. preserve all details accurately, but results in a significantly different
  12889. average brightness. Can be used for inverse tone-mapping in addition to regular
  12890. tone-mapping. The parameter can be used as an additional linear gain
  12891. coefficient (defaulting to @code{1.0}).
  12892. @end table
  12893. @item tonemapping_param
  12894. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12895. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12896. value of @code{0.0} is replaced by the curve's preferred default setting.
  12897. @item inverse_tonemapping
  12898. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12899. output color volumes. Disabled by default.
  12900. @item tonemapping_lut_size
  12901. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12902. @code{256}. Note that this figure is squared when combined with
  12903. @code{peak_detect}.
  12904. @item contrast_recovery
  12905. Contrast recovery strength. If set to a value above @code{0.0}, the source
  12906. image will be divided into high-frequency and low-frequency components, and a
  12907. portion of the high-frequency image is added back onto the tone-mapped output.
  12908. May cause excessive ringing artifacts for some HDR sources, but can improve the
  12909. subjective sharpness and detail left over in the image after tone-mapping.
  12910. Defaults to @code{0.30}.
  12911. @item contrast_smoothness
  12912. Contrast recovery lowpass kernel size. Defaults to @code{3.5}. Increasing or
  12913. decreasing this will affect the visual appearance substantially. Has no effect
  12914. when @code{contrast_recovery} is disabled.
  12915. @end table
  12916. @subsubsection Dithering
  12917. By default, libplacebo will dither whenever necessary, which includes rendering
  12918. to any integer format below 16-bit precision. It's recommended to always leave
  12919. this on, since not doing so may result in visible banding in the output, even
  12920. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12921. use @code{ordered_fixed} instead of disabling dithering.
  12922. @table @option
  12923. @item dithering
  12924. Dithering method to use. Accepts the following values:
  12925. @table @samp
  12926. @item none
  12927. Disables dithering completely. May result in visible banding.
  12928. @item blue
  12929. Dither with pseudo-blue noise. This is the default.
  12930. @item ordered
  12931. Tunable ordered dither pattern.
  12932. @item ordered_fixed
  12933. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12934. @item white
  12935. Dither with white noise. Texture-less.
  12936. @end table
  12937. @item dither_lut_size
  12938. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12939. @code{6}, corresponding to a LUT size of @code{64x64}.
  12940. @item dither_temporal
  12941. Enables temporal dithering. Disabled by default.
  12942. @end table
  12943. @subsubsection Custom shaders
  12944. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12945. syntax. A collection of such shaders can be found here:
  12946. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12947. A full description of the mpv shader format is beyond the scope of this
  12948. section, but a summary can be found here:
  12949. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12950. @table @option
  12951. @item custom_shader_path
  12952. Specifies a path to a custom shader file to load at runtime.
  12953. @item custom_shader_bin
  12954. Specifies a complete custom shader as a raw string.
  12955. @end table
  12956. @subsubsection Debugging / performance
  12957. All of the options in this section default off. They may be of assistance when
  12958. attempting to squeeze the maximum performance at the cost of quality.
  12959. @table @option
  12960. @item skip_aa
  12961. Disable anti-aliasing when downscaling.
  12962. @item polar_cutoff
  12963. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12964. @code{0.0} and @code{1.0}.
  12965. @item disable_linear
  12966. Disable linear light scaling.
  12967. @item disable_builtin
  12968. Disable built-in GPU sampling (forces LUT).
  12969. @item disable_fbos
  12970. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12971. offering the maximum possible speed.
  12972. @end table
  12973. @subsection Commands
  12974. This filter supports almost all of the above options as @ref{commands}.
  12975. @subsection Examples
  12976. @itemize
  12977. @item
  12978. Tone-map input to standard gamut BT.709 output:
  12979. @example
  12980. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12981. @end example
  12982. @item
  12983. Rescale input to fit into standard 1080p, with high quality scaling:
  12984. @example
  12985. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12986. @end example
  12987. @item
  12988. Interpolate low FPS / VFR input to smoothed constant 60 fps output:
  12989. @example
  12990. libplacebo=fps=60:frame_mixer=mitchell_clamp
  12991. @end example
  12992. @item
  12993. Convert input to standard sRGB JPEG:
  12994. @example
  12995. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12996. @end example
  12997. @item
  12998. Use higher quality debanding settings:
  12999. @example
  13000. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  13001. @end example
  13002. @item
  13003. Run this filter on the CPU, on systems with Mesa installed (and with the most
  13004. expensive options disabled):
  13005. @example
  13006. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  13007. @end example
  13008. @item
  13009. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  13010. doing it with this filter. Note that this is only a gain if the frames are
  13011. either already on the GPU, or if you're using libplacebo for other purposes,
  13012. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  13013. @example
  13014. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  13015. @end example
  13016. @item
  13017. Interop with VAAPI hwdec to avoid round-tripping through RAM:
  13018. @example
  13019. ffmpeg -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi ... -vf libplacebo
  13020. @end example
  13021. @end itemize
  13022. @anchor{libvmaf}
  13023. @section libvmaf
  13024. Calculate the VMAF (Video Multi-Method Assessment Fusion) score for a
  13025. reference/distorted pair of input videos.
  13026. The first input is the distorted video, and the second input is the reference video.
  13027. The obtained VMAF score is printed through the logging system.
  13028. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  13029. After installing the library it can be enabled using:
  13030. @code{./configure --enable-libvmaf}.
  13031. The filter has following options:
  13032. @table @option
  13033. @item model
  13034. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  13035. Default value: @code{"version=vmaf_v0.6.1"}
  13036. @item feature
  13037. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  13038. @item log_path
  13039. Set the file path to be used to store log files.
  13040. @item log_fmt
  13041. Set the format of the log file (xml, json, csv, or sub).
  13042. @item pool
  13043. Set the pool method to be used for computing vmaf.
  13044. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  13045. @item n_threads
  13046. Set number of threads to be used when initializing libvmaf.
  13047. Default value: @code{0}, no threads.
  13048. @item n_subsample
  13049. Set frame subsampling interval to be used.
  13050. @end table
  13051. This filter also supports the @ref{framesync} options.
  13052. @subsection Examples
  13053. @itemize
  13054. @item
  13055. In the examples below, a distorted video @file{distorted.mpg} is
  13056. compared with a reference file @file{reference.mpg}.
  13057. @item
  13058. Basic usage:
  13059. @example
  13060. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  13061. @end example
  13062. @item
  13063. Example with multiple models:
  13064. @example
  13065. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='model=version=vmaf_v0.6.1\\:name=vmaf|version=vmaf_v0.6.1neg\\:name=vmaf_neg' -f null -
  13066. @end example
  13067. @item
  13068. Example with multiple additional features:
  13069. @example
  13070. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  13071. @end example
  13072. @item
  13073. Example with options and different containers:
  13074. @example
  13075. ffmpeg -i distorted.mpg -i reference.mkv -lavfi "[0:v]settb=AVTB,setpts=PTS-STARTPTS[main];[1:v]settb=AVTB,setpts=PTS-STARTPTS[ref];[main][ref]libvmaf=log_fmt=json:log_path=output.json" -f null -
  13076. @end example
  13077. @end itemize
  13078. @section libvmaf_cuda
  13079. This is the CUDA variant of the @ref{libvmaf} filter. It only accepts CUDA frames.
  13080. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  13081. After installing the library it can be enabled using:
  13082. @code{./configure --enable-nonfree --enable-ffnvcodec --enable-libvmaf}.
  13083. @subsection Examples
  13084. @itemize
  13085. @item
  13086. Basic usage showing CUVID hardware decoding and CUDA scaling with @ref{scale_cuda}:
  13087. @example
  13088. ffmpeg \
  13089. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i dis.obu \
  13090. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i ref.obu \
  13091. -filter_complex "
  13092. [0:v]scale_cuda=format=yuv420p[ref]; \
  13093. [1:v]scale_cuda=format=yuv420p[dis]; \
  13094. [dis][ref]libvmaf_cuda=log_fmt=json:log_path=output.json
  13095. " \
  13096. -f null -
  13097. @end example
  13098. @end itemize
  13099. @section limitdiff
  13100. Apply limited difference filter using second and optionally third video stream.
  13101. The filter accepts the following options:
  13102. @table @option
  13103. @item threshold
  13104. Set the threshold to use when allowing certain differences between video streams.
  13105. Any absolute difference value lower or exact than this threshold will pick pixel components from
  13106. first video stream.
  13107. @item elasticity
  13108. Set the elasticity of soft thresholding when processing video streams.
  13109. This value multiplied with first one sets second threshold.
  13110. Any absolute difference value greater or exact than second threshold will pick pixel components
  13111. from second video stream. For values between those two threshold
  13112. linear interpolation between first and second video stream will be used.
  13113. @item reference
  13114. Enable the reference (third) video stream processing. By default is disabled.
  13115. If set, this video stream will be used for calculating absolute difference with first video
  13116. stream.
  13117. @item planes
  13118. Specify which planes will be processed. Defaults to all available.
  13119. @end table
  13120. @subsection Commands
  13121. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  13122. @section limiter
  13123. Limits the pixel components values to the specified range [min, max].
  13124. The filter accepts the following options:
  13125. @table @option
  13126. @item min
  13127. Lower bound. Defaults to the lowest allowed value for the input.
  13128. @item max
  13129. Upper bound. Defaults to the highest allowed value for the input.
  13130. @item planes
  13131. Specify which planes will be processed. Defaults to all available.
  13132. @end table
  13133. @subsection Commands
  13134. This filter supports the all above options as @ref{commands}.
  13135. @section loop
  13136. Loop video frames.
  13137. The filter accepts the following options:
  13138. @table @option
  13139. @item loop
  13140. Set the number of loops. Setting this value to -1 will result in infinite loops.
  13141. Default is 0.
  13142. @item size
  13143. Set maximal size in number of frames. Default is 0.
  13144. @item start
  13145. Set first frame of loop. Default is 0.
  13146. @item time
  13147. Set the time of loop start in seconds.
  13148. Only used if option named @var{start} is set to @code{-1}.
  13149. @end table
  13150. @subsection Examples
  13151. @itemize
  13152. @item
  13153. Loop single first frame infinitely:
  13154. @example
  13155. loop=loop=-1:size=1:start=0
  13156. @end example
  13157. @item
  13158. Loop single first frame 10 times:
  13159. @example
  13160. loop=loop=10:size=1:start=0
  13161. @end example
  13162. @item
  13163. Loop 10 first frames 5 times:
  13164. @example
  13165. loop=loop=5:size=10:start=0
  13166. @end example
  13167. @end itemize
  13168. @section lut1d
  13169. Apply a 1D LUT to an input video.
  13170. The filter accepts the following options:
  13171. @table @option
  13172. @item file
  13173. Set the 1D LUT file name.
  13174. Currently supported formats:
  13175. @table @samp
  13176. @item cube
  13177. Iridas
  13178. @item csp
  13179. cineSpace
  13180. @end table
  13181. @item interp
  13182. Select interpolation mode.
  13183. Available values are:
  13184. @table @samp
  13185. @item nearest
  13186. Use values from the nearest defined point.
  13187. @item linear
  13188. Interpolate values using the linear interpolation.
  13189. @item cosine
  13190. Interpolate values using the cosine interpolation.
  13191. @item cubic
  13192. Interpolate values using the cubic interpolation.
  13193. @item spline
  13194. Interpolate values using the spline interpolation.
  13195. @end table
  13196. @end table
  13197. @subsection Commands
  13198. This filter supports the all above options as @ref{commands}.
  13199. @anchor{lut3d}
  13200. @section lut3d
  13201. Apply a 3D LUT to an input video.
  13202. The filter accepts the following options:
  13203. @table @option
  13204. @item file
  13205. Set the 3D LUT file name.
  13206. Currently supported formats:
  13207. @table @samp
  13208. @item 3dl
  13209. AfterEffects
  13210. @item cube
  13211. Iridas
  13212. @item dat
  13213. DaVinci
  13214. @item m3d
  13215. Pandora
  13216. @item csp
  13217. cineSpace
  13218. @end table
  13219. @item interp
  13220. Select interpolation mode.
  13221. Available values are:
  13222. @table @samp
  13223. @item nearest
  13224. Use values from the nearest defined point.
  13225. @item trilinear
  13226. Interpolate values using the 8 points defining a cube.
  13227. @item tetrahedral
  13228. Interpolate values using a tetrahedron.
  13229. @item pyramid
  13230. Interpolate values using a pyramid.
  13231. @item prism
  13232. Interpolate values using a prism.
  13233. @end table
  13234. @end table
  13235. @subsection Commands
  13236. This filter supports the @code{interp} option as @ref{commands}.
  13237. @section lumakey
  13238. Turn certain luma values into transparency.
  13239. The filter accepts the following options:
  13240. @table @option
  13241. @item threshold
  13242. Set the luma which will be used as base for transparency.
  13243. Default value is @code{0}.
  13244. @item tolerance
  13245. Set the range of luma values to be keyed out.
  13246. Default value is @code{0.01}.
  13247. @item softness
  13248. Set the range of softness. Default value is @code{0}.
  13249. Use this to control gradual transition from zero to full transparency.
  13250. @end table
  13251. @subsection Commands
  13252. This filter supports same @ref{commands} as options.
  13253. The command accepts the same syntax of the corresponding option.
  13254. If the specified expression is not valid, it is kept at its current
  13255. value.
  13256. @anchor{lutrgb}
  13257. @anchor{lutyuv}
  13258. @anchor{lut}
  13259. @section lut, lutrgb, lutyuv
  13260. Compute a look-up table for binding each pixel component input value
  13261. to an output value, and apply it to the input video.
  13262. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  13263. to an RGB input video.
  13264. These filters accept the following parameters:
  13265. @table @option
  13266. @item c0
  13267. set first pixel component expression
  13268. @item c1
  13269. set second pixel component expression
  13270. @item c2
  13271. set third pixel component expression
  13272. @item c3
  13273. set fourth pixel component expression, corresponds to the alpha component
  13274. @item r
  13275. set red component expression
  13276. @item g
  13277. set green component expression
  13278. @item b
  13279. set blue component expression
  13280. @item a
  13281. alpha component expression
  13282. @item y
  13283. set Y/luma component expression
  13284. @item u
  13285. set U/Cb component expression
  13286. @item v
  13287. set V/Cr component expression
  13288. @end table
  13289. Each of them specifies the expression to use for computing the lookup table for
  13290. the corresponding pixel component values.
  13291. The exact component associated to each of the @var{c*} options depends on the
  13292. format in input.
  13293. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  13294. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  13295. The expressions can contain the following constants and functions:
  13296. @table @option
  13297. @item w
  13298. @item h
  13299. The input width and height.
  13300. @item val
  13301. The input value for the pixel component.
  13302. @item clipval
  13303. The input value, clipped to the @var{minval}-@var{maxval} range.
  13304. @item maxval
  13305. The maximum value for the pixel component.
  13306. @item minval
  13307. The minimum value for the pixel component.
  13308. @item negval
  13309. The negated value for the pixel component value, clipped to the
  13310. @var{minval}-@var{maxval} range; it corresponds to the expression
  13311. "maxval-clipval+minval".
  13312. @item clip(val)
  13313. The computed value in @var{val}, clipped to the
  13314. @var{minval}-@var{maxval} range.
  13315. @item gammaval(gamma)
  13316. The computed gamma correction value of the pixel component value,
  13317. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  13318. expression
  13319. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  13320. @end table
  13321. All expressions default to "clipval".
  13322. @subsection Commands
  13323. This filter supports same @ref{commands} as options.
  13324. @subsection Examples
  13325. @itemize
  13326. @item
  13327. Negate input video:
  13328. @example
  13329. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  13330. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  13331. @end example
  13332. The above is the same as:
  13333. @example
  13334. lutrgb="r=negval:g=negval:b=negval"
  13335. lutyuv="y=negval:u=negval:v=negval"
  13336. @end example
  13337. @item
  13338. Negate luma:
  13339. @example
  13340. lutyuv=y=negval
  13341. @end example
  13342. @item
  13343. Remove chroma components, turning the video into a graytone image:
  13344. @example
  13345. lutyuv="u=128:v=128"
  13346. @end example
  13347. @item
  13348. Apply a luma burning effect:
  13349. @example
  13350. lutyuv="y=2*val"
  13351. @end example
  13352. @item
  13353. Remove green and blue components:
  13354. @example
  13355. lutrgb="g=0:b=0"
  13356. @end example
  13357. @item
  13358. Set a constant alpha channel value on input:
  13359. @example
  13360. format=rgba,lutrgb=a="maxval-minval/2"
  13361. @end example
  13362. @item
  13363. Correct luma gamma by a factor of 0.5:
  13364. @example
  13365. lutyuv=y=gammaval(0.5)
  13366. @end example
  13367. @item
  13368. Discard least significant bits of luma:
  13369. @example
  13370. lutyuv=y='bitand(val, 128+64+32)'
  13371. @end example
  13372. @item
  13373. Technicolor like effect:
  13374. @example
  13375. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  13376. @end example
  13377. @end itemize
  13378. @section lut2, tlut2
  13379. The @code{lut2} filter takes two input streams and outputs one
  13380. stream.
  13381. The @code{tlut2} (time lut2) filter takes two consecutive frames
  13382. from one single stream.
  13383. This filter accepts the following parameters:
  13384. @table @option
  13385. @item c0
  13386. set first pixel component expression
  13387. @item c1
  13388. set second pixel component expression
  13389. @item c2
  13390. set third pixel component expression
  13391. @item c3
  13392. set fourth pixel component expression, corresponds to the alpha component
  13393. @item d
  13394. set output bit depth, only available for @code{lut2} filter. By default is 0,
  13395. which means bit depth is automatically picked from first input format.
  13396. @end table
  13397. The @code{lut2} filter also supports the @ref{framesync} options.
  13398. Each of them specifies the expression to use for computing the lookup table for
  13399. the corresponding pixel component values.
  13400. The exact component associated to each of the @var{c*} options depends on the
  13401. format in inputs.
  13402. The expressions can contain the following constants:
  13403. @table @option
  13404. @item w
  13405. @item h
  13406. The input width and height.
  13407. @item x
  13408. The first input value for the pixel component.
  13409. @item y
  13410. The second input value for the pixel component.
  13411. @item bdx
  13412. The first input video bit depth.
  13413. @item bdy
  13414. The second input video bit depth.
  13415. @end table
  13416. All expressions default to "x".
  13417. @subsection Commands
  13418. This filter supports the all above options as @ref{commands} except option @code{d}.
  13419. @subsection Examples
  13420. @itemize
  13421. @item
  13422. Highlight differences between two RGB video streams:
  13423. @example
  13424. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  13425. @end example
  13426. @item
  13427. Highlight differences between two YUV video streams:
  13428. @example
  13429. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  13430. @end example
  13431. @item
  13432. Show max difference between two video streams:
  13433. @example
  13434. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  13435. @end example
  13436. @end itemize
  13437. @section maskedclamp
  13438. Clamp the first input stream with the second input and third input stream.
  13439. Returns the value of first stream to be between second input
  13440. stream - @code{undershoot} and third input stream + @code{overshoot}.
  13441. This filter accepts the following options:
  13442. @table @option
  13443. @item undershoot
  13444. Default value is @code{0}.
  13445. @item overshoot
  13446. Default value is @code{0}.
  13447. @item planes
  13448. Set which planes will be processed as bitmap, unprocessed planes will be
  13449. copied from first stream.
  13450. By default value 0xf, all planes will be processed.
  13451. @end table
  13452. @subsection Commands
  13453. This filter supports the all above options as @ref{commands}.
  13454. @section maskedmax
  13455. Merge the second and third input stream into output stream using absolute differences
  13456. between second input stream and first input stream and absolute difference between
  13457. third input stream and first input stream. The picked value will be from second input
  13458. stream if second absolute difference is greater than first one or from third input stream
  13459. otherwise.
  13460. This filter accepts the following options:
  13461. @table @option
  13462. @item planes
  13463. Set which planes will be processed as bitmap, unprocessed planes will be
  13464. copied from first stream.
  13465. By default value 0xf, all planes will be processed.
  13466. @end table
  13467. @subsection Commands
  13468. This filter supports the all above options as @ref{commands}.
  13469. @section maskedmerge
  13470. Merge the first input stream with the second input stream using per pixel
  13471. weights in the third input stream.
  13472. A value of 0 in the third stream pixel component means that pixel component
  13473. from first stream is returned unchanged, while maximum value (eg. 255 for
  13474. 8-bit videos) means that pixel component from second stream is returned
  13475. unchanged. Intermediate values define the amount of merging between both
  13476. input stream's pixel components.
  13477. This filter accepts the following options:
  13478. @table @option
  13479. @item planes
  13480. Set which planes will be processed as bitmap, unprocessed planes will be
  13481. copied from first stream.
  13482. By default value 0xf, all planes will be processed.
  13483. @end table
  13484. @subsection Commands
  13485. This filter supports the all above options as @ref{commands}.
  13486. @section maskedmin
  13487. Merge the second and third input stream into output stream using absolute differences
  13488. between second input stream and first input stream and absolute difference between
  13489. third input stream and first input stream. The picked value will be from second input
  13490. stream if second absolute difference is less than first one or from third input stream
  13491. otherwise.
  13492. This filter accepts the following options:
  13493. @table @option
  13494. @item planes
  13495. Set which planes will be processed as bitmap, unprocessed planes will be
  13496. copied from first stream.
  13497. By default value 0xf, all planes will be processed.
  13498. @end table
  13499. @subsection Commands
  13500. This filter supports the all above options as @ref{commands}.
  13501. @section maskedthreshold
  13502. Pick pixels comparing absolute difference of two video streams with fixed
  13503. threshold.
  13504. If absolute difference between pixel component of first and second video
  13505. stream is equal or lower than user supplied threshold than pixel component
  13506. from first video stream is picked, otherwise pixel component from second
  13507. video stream is picked.
  13508. This filter accepts the following options:
  13509. @table @option
  13510. @item threshold
  13511. Set threshold used when picking pixels from absolute difference from two input
  13512. video streams.
  13513. @item planes
  13514. Set which planes will be processed as bitmap, unprocessed planes will be
  13515. copied from second stream.
  13516. By default value 0xf, all planes will be processed.
  13517. @item mode
  13518. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  13519. Default is @code{abs}.
  13520. @end table
  13521. @subsection Commands
  13522. This filter supports the all above options as @ref{commands}.
  13523. @section maskfun
  13524. Create mask from input video.
  13525. For example it is useful to create motion masks after @code{tblend} filter.
  13526. This filter accepts the following options:
  13527. @table @option
  13528. @item low
  13529. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  13530. @item high
  13531. Set high threshold. Any pixel component higher than this value will be set to max value
  13532. allowed for current pixel format.
  13533. @item planes
  13534. Set planes to filter, by default all available planes are filtered.
  13535. @item fill
  13536. Fill all frame pixels with this value.
  13537. @item sum
  13538. Set max average pixel value for frame. If sum of all pixel components is higher that this
  13539. average, output frame will be completely filled with value set by @var{fill} option.
  13540. Typically useful for scene changes when used in combination with @code{tblend} filter.
  13541. @end table
  13542. @subsection Commands
  13543. This filter supports the all above options as @ref{commands}.
  13544. @section mcdeint
  13545. Apply motion-compensation deinterlacing.
  13546. It needs one field per frame as input and must thus be used together
  13547. with yadif=1/3 or equivalent.
  13548. This filter accepts the following options:
  13549. @table @option
  13550. @item mode
  13551. Set the deinterlacing mode.
  13552. It accepts one of the following values:
  13553. @table @samp
  13554. @item fast
  13555. @item medium
  13556. @item slow
  13557. use iterative motion estimation
  13558. @item extra_slow
  13559. like @samp{slow}, but use multiple reference frames.
  13560. @end table
  13561. Default value is @samp{fast}.
  13562. @item parity
  13563. Set the picture field parity assumed for the input video. It must be
  13564. one of the following values:
  13565. @table @samp
  13566. @item 0, tff
  13567. assume top field first
  13568. @item 1, bff
  13569. assume bottom field first
  13570. @end table
  13571. Default value is @samp{bff}.
  13572. @item qp
  13573. Set per-block quantization parameter (QP) used by the internal
  13574. encoder.
  13575. Higher values should result in a smoother motion vector field but less
  13576. optimal individual vectors. Default value is 1.
  13577. @end table
  13578. @section median
  13579. Pick median pixel from certain rectangle defined by radius.
  13580. This filter accepts the following options:
  13581. @table @option
  13582. @item radius
  13583. Set horizontal radius size. Default value is @code{1}.
  13584. Allowed range is integer from 1 to 127.
  13585. @item planes
  13586. Set which planes to process. Default is @code{15}, which is all available planes.
  13587. @item radiusV
  13588. Set vertical radius size. Default value is @code{0}.
  13589. Allowed range is integer from 0 to 127.
  13590. If it is 0, value will be picked from horizontal @code{radius} option.
  13591. @item percentile
  13592. Set median percentile. Default value is @code{0.5}.
  13593. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13594. minimum values, and @code{1} maximum values.
  13595. @end table
  13596. @subsection Commands
  13597. This filter supports same @ref{commands} as options.
  13598. The command accepts the same syntax of the corresponding option.
  13599. If the specified expression is not valid, it is kept at its current
  13600. value.
  13601. @section mergeplanes
  13602. Merge color channel components from several video streams.
  13603. The filter accepts up to 4 input streams, and merge selected input
  13604. planes to the output video.
  13605. This filter accepts the following options:
  13606. @table @option
  13607. @item mapping
  13608. Set input to output plane mapping. Default is @code{0}.
  13609. The mappings is specified as a bitmap. It should be specified as a
  13610. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13611. mapping for the first plane of the output stream. 'A' sets the number of
  13612. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13613. corresponding input to use (from 0 to 3). The rest of the mappings is
  13614. similar, 'Bb' describes the mapping for the output stream second
  13615. plane, 'Cc' describes the mapping for the output stream third plane and
  13616. 'Dd' describes the mapping for the output stream fourth plane.
  13617. @item format
  13618. Set output pixel format. Default is @code{yuva444p}.
  13619. @item map0s
  13620. @item map1s
  13621. @item map2s
  13622. @item map3s
  13623. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13624. @item map0p
  13625. @item map1p
  13626. @item map2p
  13627. @item map3p
  13628. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13629. @end table
  13630. @subsection Examples
  13631. @itemize
  13632. @item
  13633. Merge three gray video streams of same width and height into single video stream:
  13634. @example
  13635. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13636. @end example
  13637. @item
  13638. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13639. @example
  13640. [a0][a1]mergeplanes=0x00010210:yuva444p
  13641. @end example
  13642. @item
  13643. Swap Y and A plane in yuva444p stream:
  13644. @example
  13645. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13646. @end example
  13647. @item
  13648. Swap U and V plane in yuv420p stream:
  13649. @example
  13650. format=yuv420p,mergeplanes=0x000201:yuv420p
  13651. @end example
  13652. @item
  13653. Cast a rgb24 clip to yuv444p:
  13654. @example
  13655. format=rgb24,mergeplanes=0x000102:yuv444p
  13656. @end example
  13657. @end itemize
  13658. @section mestimate
  13659. Estimate and export motion vectors using block matching algorithms.
  13660. Motion vectors are stored in frame side data to be used by other filters.
  13661. This filter accepts the following options:
  13662. @table @option
  13663. @item method
  13664. Specify the motion estimation method. Accepts one of the following values:
  13665. @table @samp
  13666. @item esa
  13667. Exhaustive search algorithm.
  13668. @item tss
  13669. Three step search algorithm.
  13670. @item tdls
  13671. Two dimensional logarithmic search algorithm.
  13672. @item ntss
  13673. New three step search algorithm.
  13674. @item fss
  13675. Four step search algorithm.
  13676. @item ds
  13677. Diamond search algorithm.
  13678. @item hexbs
  13679. Hexagon-based search algorithm.
  13680. @item epzs
  13681. Enhanced predictive zonal search algorithm.
  13682. @item umh
  13683. Uneven multi-hexagon search algorithm.
  13684. @end table
  13685. Default value is @samp{esa}.
  13686. @item mb_size
  13687. Macroblock size. Default @code{16}.
  13688. @item search_param
  13689. Search parameter. Default @code{7}.
  13690. @end table
  13691. @section midequalizer
  13692. Apply Midway Image Equalization effect using two video streams.
  13693. Midway Image Equalization adjusts a pair of images to have the same
  13694. histogram, while maintaining their dynamics as much as possible. It's
  13695. useful for e.g. matching exposures from a pair of stereo cameras.
  13696. This filter has two inputs and one output, which must be of same pixel format, but
  13697. may be of different sizes. The output of filter is first input adjusted with
  13698. midway histogram of both inputs.
  13699. This filter accepts the following option:
  13700. @table @option
  13701. @item planes
  13702. Set which planes to process. Default is @code{15}, which is all available planes.
  13703. @end table
  13704. @section minterpolate
  13705. Convert the video to specified frame rate using motion interpolation.
  13706. This filter accepts the following options:
  13707. @table @option
  13708. @item fps
  13709. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  13710. @item mi_mode
  13711. Motion interpolation mode. Following values are accepted:
  13712. @table @samp
  13713. @item dup
  13714. Duplicate previous or next frame for interpolating new ones.
  13715. @item blend
  13716. Blend source frames. Interpolated frame is mean of previous and next frames.
  13717. @item mci
  13718. Motion compensated interpolation. Following options are effective when this mode is selected:
  13719. @table @samp
  13720. @item mc_mode
  13721. Motion compensation mode. Following values are accepted:
  13722. @table @samp
  13723. @item obmc
  13724. Overlapped block motion compensation.
  13725. @item aobmc
  13726. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13727. @end table
  13728. Default mode is @samp{obmc}.
  13729. @item me_mode
  13730. Motion estimation mode. Following values are accepted:
  13731. @table @samp
  13732. @item bidir
  13733. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13734. @item bilat
  13735. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13736. @end table
  13737. Default mode is @samp{bilat}.
  13738. @item me
  13739. The algorithm to be used for motion estimation. Following values are accepted:
  13740. @table @samp
  13741. @item esa
  13742. Exhaustive search algorithm.
  13743. @item tss
  13744. Three step search algorithm.
  13745. @item tdls
  13746. Two dimensional logarithmic search algorithm.
  13747. @item ntss
  13748. New three step search algorithm.
  13749. @item fss
  13750. Four step search algorithm.
  13751. @item ds
  13752. Diamond search algorithm.
  13753. @item hexbs
  13754. Hexagon-based search algorithm.
  13755. @item epzs
  13756. Enhanced predictive zonal search algorithm.
  13757. @item umh
  13758. Uneven multi-hexagon search algorithm.
  13759. @end table
  13760. Default algorithm is @samp{epzs}.
  13761. @item mb_size
  13762. Macroblock size. Default @code{16}.
  13763. @item search_param
  13764. Motion estimation search parameter. Default @code{32}.
  13765. @item vsbmc
  13766. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make them less blurry. Default is @code{0} (disabled).
  13767. @end table
  13768. @end table
  13769. @item scd
  13770. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  13771. @table @samp
  13772. @item none
  13773. Disable scene change detection.
  13774. @item fdiff
  13775. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13776. @end table
  13777. Default method is @samp{fdiff}.
  13778. @item scd_threshold
  13779. Scene change detection threshold. Default is @code{10.}.
  13780. @end table
  13781. @section mix
  13782. Mix several video input streams into one video stream.
  13783. A description of the accepted options follows.
  13784. @table @option
  13785. @item inputs
  13786. The number of inputs. If unspecified, it defaults to 2.
  13787. @item weights
  13788. Specify weight of each input video stream as sequence.
  13789. Each weight is separated by space. If number of weights
  13790. is smaller than number of @var{frames} last specified
  13791. weight will be used for all remaining unset weights.
  13792. @item scale
  13793. Specify scale, if it is set it will be multiplied with sum
  13794. of each weight multiplied with pixel values to give final destination
  13795. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13796. @item planes
  13797. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13798. @item duration
  13799. Specify how end of stream is determined.
  13800. @table @samp
  13801. @item longest
  13802. The duration of the longest input. (default)
  13803. @item shortest
  13804. The duration of the shortest input.
  13805. @item first
  13806. The duration of the first input.
  13807. @end table
  13808. @end table
  13809. @subsection Commands
  13810. This filter supports the following commands:
  13811. @table @option
  13812. @item weights
  13813. @item scale
  13814. @item planes
  13815. Syntax is same as option with same name.
  13816. @end table
  13817. @section monochrome
  13818. Convert video to gray using custom color filter.
  13819. A description of the accepted options follows.
  13820. @table @option
  13821. @item cb
  13822. Set the chroma blue spot. Allowed range is from -1 to 1.
  13823. Default value is 0.
  13824. @item cr
  13825. Set the chroma red spot. Allowed range is from -1 to 1.
  13826. Default value is 0.
  13827. @item size
  13828. Set the color filter size. Allowed range is from .1 to 10.
  13829. Default value is 1.
  13830. @item high
  13831. Set the highlights strength. Allowed range is from 0 to 1.
  13832. Default value is 0.
  13833. @end table
  13834. @subsection Commands
  13835. This filter supports the all above options as @ref{commands}.
  13836. @section morpho
  13837. This filter allows to apply main morphological grayscale transforms,
  13838. erode and dilate with arbitrary structures set in second input stream.
  13839. Unlike naive implementation and much slower performance in @ref{erosion}
  13840. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13841. should be used instead.
  13842. A description of accepted options follows,
  13843. @table @option
  13844. @item mode
  13845. Set morphological transform to apply, can be:
  13846. @table @samp
  13847. @item erode
  13848. @item dilate
  13849. @item open
  13850. @item close
  13851. @item gradient
  13852. @item tophat
  13853. @item blackhat
  13854. @end table
  13855. Default is @code{erode}.
  13856. @item planes
  13857. Set planes to filter, by default all planes except alpha are filtered.
  13858. @item structure
  13859. Set which structure video frames will be processed from second input stream,
  13860. can be @var{first} or @var{all}. Default is @var{all}.
  13861. @end table
  13862. The @code{morpho} filter also supports the @ref{framesync} options.
  13863. @subsection Commands
  13864. This filter supports same @ref{commands} as options.
  13865. @section mpdecimate
  13866. Drop frames that do not differ greatly from the previous frame in
  13867. order to reduce frame rate.
  13868. The main use of this filter is for very-low-bitrate encoding
  13869. (e.g. streaming over dialup modem), but it could in theory be used for
  13870. fixing movies that were inverse-telecined incorrectly.
  13871. A description of the accepted options follows.
  13872. @table @option
  13873. @item max
  13874. Set the maximum number of consecutive frames which can be dropped (if
  13875. positive), or the minimum interval between dropped frames (if
  13876. negative). If the value is 0, the frame is dropped disregarding the
  13877. number of previous sequentially dropped frames.
  13878. Default value is 0.
  13879. @item keep
  13880. Set the maximum number of consecutive similar frames to ignore before to start dropping them.
  13881. If the value is 0, the frame is dropped disregarding the
  13882. number of previous sequentially similar frames.
  13883. Default value is 0.
  13884. @item hi
  13885. @item lo
  13886. @item frac
  13887. Set the dropping threshold values.
  13888. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13889. represent actual pixel value differences, so a threshold of 64
  13890. corresponds to 1 unit of difference for each pixel, or the same spread
  13891. out differently over the block.
  13892. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13893. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13894. meaning the whole image) differ by more than a threshold of @option{lo}.
  13895. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13896. 64*5, and default value for @option{frac} is 0.33.
  13897. @end table
  13898. @section msad
  13899. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13900. This filter takes two input videos.
  13901. Both input videos must have the same resolution and pixel format for
  13902. this filter to work correctly. Also it assumes that both inputs
  13903. have the same number of frames, which are compared one by one.
  13904. The obtained per component, average, min and max MSAD is printed through
  13905. the logging system.
  13906. The filter stores the calculated MSAD of each frame in frame metadata.
  13907. This filter also supports the @ref{framesync} options.
  13908. In the below example the input file @file{main.mpg} being processed is compared
  13909. with the reference file @file{ref.mpg}.
  13910. @example
  13911. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13912. @end example
  13913. @section multiply
  13914. Multiply first video stream pixels values with second video stream pixels values.
  13915. The filter accepts the following options:
  13916. @table @option
  13917. @item scale
  13918. Set the scale applied to second video stream. By default is @code{1}.
  13919. Allowed range is from @code{0} to @code{9}.
  13920. @item offset
  13921. Set the offset applied to second video stream. By default is @code{0.5}.
  13922. Allowed range is from @code{-1} to @code{1}.
  13923. @item planes
  13924. Specify planes from input video stream that will be processed.
  13925. By default all planes are processed.
  13926. @end table
  13927. @subsection Commands
  13928. This filter supports same @ref{commands} as options.
  13929. @section negate
  13930. Negate (invert) the input video.
  13931. It accepts the following option:
  13932. @table @option
  13933. @item components
  13934. Set components to negate.
  13935. Available values for components are:
  13936. @table @samp
  13937. @item y
  13938. @item u
  13939. @item v
  13940. @item a
  13941. @item r
  13942. @item g
  13943. @item b
  13944. @end table
  13945. @item negate_alpha
  13946. With value 1, it negates the alpha component, if present. Default value is 0.
  13947. @end table
  13948. @subsection Commands
  13949. This filter supports same @ref{commands} as options.
  13950. @anchor{nlmeans}
  13951. @section nlmeans
  13952. Denoise frames using Non-Local Means algorithm.
  13953. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13954. context similarity is defined by comparing their surrounding patches of size
  13955. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13956. around the pixel.
  13957. Note that the research area defines centers for patches, which means some
  13958. patches will be made of pixels outside that research area.
  13959. The filter accepts the following options.
  13960. @table @option
  13961. @item s
  13962. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13963. @item p
  13964. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13965. @item pc
  13966. Same as @option{p} but for chroma planes.
  13967. The default value is @var{0} and means automatic.
  13968. @item r
  13969. Set research size. Default is 15. Must be odd number in range [0, 99].
  13970. @item rc
  13971. Same as @option{r} but for chroma planes.
  13972. The default value is @var{0} and means automatic.
  13973. @end table
  13974. @section nnedi
  13975. Deinterlace video using neural network edge directed interpolation.
  13976. This filter accepts the following options:
  13977. @table @option
  13978. @item weights
  13979. Mandatory option, without binary file filter can not work.
  13980. Currently file can be found here:
  13981. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13982. @item deint
  13983. Set which frames to deinterlace, by default it is @code{all}.
  13984. Can be @code{all} or @code{interlaced}.
  13985. @item field
  13986. Set mode of operation.
  13987. Can be one of the following:
  13988. @table @samp
  13989. @item af
  13990. Use frame flags, both fields.
  13991. @item a
  13992. Use frame flags, single field.
  13993. @item t
  13994. Use top field only.
  13995. @item b
  13996. Use bottom field only.
  13997. @item tf
  13998. Use both fields, top first.
  13999. @item bf
  14000. Use both fields, bottom first.
  14001. @end table
  14002. @item planes
  14003. Set which planes to process, by default filter process all frames.
  14004. @item nsize
  14005. Set size of local neighborhood around each pixel, used by the predictor neural
  14006. network.
  14007. Can be one of the following:
  14008. @table @samp
  14009. @item s8x6
  14010. @item s16x6
  14011. @item s32x6
  14012. @item s48x6
  14013. @item s8x4
  14014. @item s16x4
  14015. @item s32x4
  14016. @end table
  14017. @item nns
  14018. Set the number of neurons in predictor neural network.
  14019. Can be one of the following:
  14020. @table @samp
  14021. @item n16
  14022. @item n32
  14023. @item n64
  14024. @item n128
  14025. @item n256
  14026. @end table
  14027. @item qual
  14028. Controls the number of different neural network predictions that are blended
  14029. together to compute the final output value. Can be @code{fast}, default or
  14030. @code{slow}.
  14031. @item etype
  14032. Set which set of weights to use in the predictor.
  14033. Can be one of the following:
  14034. @table @samp
  14035. @item a, abs
  14036. weights trained to minimize absolute error
  14037. @item s, mse
  14038. weights trained to minimize squared error
  14039. @end table
  14040. @item pscrn
  14041. Controls whether or not the prescreener neural network is used to decide
  14042. which pixels should be processed by the predictor neural network and which
  14043. can be handled by simple cubic interpolation.
  14044. The prescreener is trained to know whether cubic interpolation will be
  14045. sufficient for a pixel or whether it should be predicted by the predictor nn.
  14046. The computational complexity of the prescreener nn is much less than that of
  14047. the predictor nn. Since most pixels can be handled by cubic interpolation,
  14048. using the prescreener generally results in much faster processing.
  14049. The prescreener is pretty accurate, so the difference between using it and not
  14050. using it is almost always unnoticeable.
  14051. Can be one of the following:
  14052. @table @samp
  14053. @item none
  14054. @item original
  14055. @item new
  14056. @item new2
  14057. @item new3
  14058. @end table
  14059. Default is @code{new}.
  14060. @end table
  14061. @subsection Commands
  14062. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  14063. @section noformat
  14064. Force libavfilter not to use any of the specified pixel formats for the
  14065. input to the next filter.
  14066. It accepts the following parameters:
  14067. @table @option
  14068. @item pix_fmts
  14069. A '|'-separated list of pixel format names, such as
  14070. pix_fmts=yuv420p|monow|rgb24".
  14071. @end table
  14072. @subsection Examples
  14073. @itemize
  14074. @item
  14075. Force libavfilter to use a format different from @var{yuv420p} for the
  14076. input to the vflip filter:
  14077. @example
  14078. noformat=pix_fmts=yuv420p,vflip
  14079. @end example
  14080. @item
  14081. Convert the input video to any of the formats not contained in the list:
  14082. @example
  14083. noformat=yuv420p|yuv444p|yuv410p
  14084. @end example
  14085. @end itemize
  14086. @section noise
  14087. Add noise on video input frame.
  14088. The filter accepts the following options:
  14089. @table @option
  14090. @item all_seed
  14091. @item c0_seed
  14092. @item c1_seed
  14093. @item c2_seed
  14094. @item c3_seed
  14095. Set noise seed for specific pixel component or all pixel components in case
  14096. of @var{all_seed}. Default value is @code{123457}.
  14097. @item all_strength, alls
  14098. @item c0_strength, c0s
  14099. @item c1_strength, c1s
  14100. @item c2_strength, c2s
  14101. @item c3_strength, c3s
  14102. Set noise strength for specific pixel component or all pixel components in case
  14103. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  14104. @item all_flags, allf
  14105. @item c0_flags, c0f
  14106. @item c1_flags, c1f
  14107. @item c2_flags, c2f
  14108. @item c3_flags, c3f
  14109. Set pixel component flags or set flags for all components if @var{all_flags}.
  14110. Available values for component flags are:
  14111. @table @samp
  14112. @item a
  14113. averaged temporal noise (smoother)
  14114. @item p
  14115. mix random noise with a (semi)regular pattern
  14116. @item t
  14117. temporal noise (noise pattern changes between frames)
  14118. @item u
  14119. uniform noise (gaussian otherwise)
  14120. @end table
  14121. @end table
  14122. @subsection Examples
  14123. Add temporal and uniform noise to input video:
  14124. @example
  14125. noise=alls=20:allf=t+u
  14126. @end example
  14127. @section normalize
  14128. Normalize RGB video (aka histogram stretching, contrast stretching).
  14129. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  14130. For each channel of each frame, the filter computes the input range and maps
  14131. it linearly to the user-specified output range. The output range defaults
  14132. to the full dynamic range from pure black to pure white.
  14133. Temporal smoothing can be used on the input range to reduce flickering (rapid
  14134. changes in brightness) caused when small dark or bright objects enter or leave
  14135. the scene. This is similar to the auto-exposure (automatic gain control) on a
  14136. video camera, and, like a video camera, it may cause a period of over- or
  14137. under-exposure of the video.
  14138. The R,G,B channels can be normalized independently, which may cause some
  14139. color shifting, or linked together as a single channel, which prevents
  14140. color shifting. Linked normalization preserves hue. Independent normalization
  14141. does not, so it can be used to remove some color casts. Independent and linked
  14142. normalization can be combined in any ratio.
  14143. The normalize filter accepts the following options:
  14144. @table @option
  14145. @item blackpt
  14146. @item whitept
  14147. Colors which define the output range. The minimum input value is mapped to
  14148. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  14149. The defaults are black and white respectively. Specifying white for
  14150. @var{blackpt} and black for @var{whitept} will give color-inverted,
  14151. normalized video. Shades of grey can be used to reduce the dynamic range
  14152. (contrast). Specifying saturated colors here can create some interesting
  14153. effects.
  14154. @item smoothing
  14155. The number of previous frames to use for temporal smoothing. The input range
  14156. of each channel is smoothed using a rolling average over the current frame
  14157. and the @var{smoothing} previous frames. The default is 0 (no temporal
  14158. smoothing).
  14159. @item independence
  14160. Controls the ratio of independent (color shifting) channel normalization to
  14161. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  14162. independent. Defaults to 1.0 (fully independent).
  14163. @item strength
  14164. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  14165. expensive no-op. Defaults to 1.0 (full strength).
  14166. @end table
  14167. @subsection Commands
  14168. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  14169. The command accepts the same syntax of the corresponding option.
  14170. If the specified expression is not valid, it is kept at its current
  14171. value.
  14172. @subsection Examples
  14173. Stretch video contrast to use the full dynamic range, with no temporal
  14174. smoothing; may flicker depending on the source content:
  14175. @example
  14176. normalize=blackpt=black:whitept=white:smoothing=0
  14177. @end example
  14178. As above, but with 50 frames of temporal smoothing; flicker should be
  14179. reduced, depending on the source content:
  14180. @example
  14181. normalize=blackpt=black:whitept=white:smoothing=50
  14182. @end example
  14183. As above, but with hue-preserving linked channel normalization:
  14184. @example
  14185. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  14186. @end example
  14187. As above, but with half strength:
  14188. @example
  14189. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  14190. @end example
  14191. Map the darkest input color to red, the brightest input color to cyan:
  14192. @example
  14193. normalize=blackpt=red:whitept=cyan
  14194. @end example
  14195. @section null
  14196. Pass the video source unchanged to the output.
  14197. @section ocr
  14198. Optical Character Recognition
  14199. This filter uses Tesseract for optical character recognition. To enable
  14200. compilation of this filter, you need to configure FFmpeg with
  14201. @code{--enable-libtesseract}.
  14202. It accepts the following options:
  14203. @table @option
  14204. @item datapath
  14205. Set datapath to tesseract data. Default is to use whatever was
  14206. set at installation.
  14207. @item language
  14208. Set language, default is "eng".
  14209. @item whitelist
  14210. Set character whitelist.
  14211. @item blacklist
  14212. Set character blacklist.
  14213. @end table
  14214. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  14215. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  14216. @section ocv
  14217. Apply a video transform using libopencv.
  14218. To enable this filter, install the libopencv library and headers and
  14219. configure FFmpeg with @code{--enable-libopencv}.
  14220. It accepts the following parameters:
  14221. @table @option
  14222. @item filter_name
  14223. The name of the libopencv filter to apply.
  14224. @item filter_params
  14225. The parameters to pass to the libopencv filter. If not specified, the default
  14226. values are assumed.
  14227. @end table
  14228. Refer to the official libopencv documentation for more precise
  14229. information:
  14230. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  14231. Several libopencv filters are supported; see the following subsections.
  14232. @anchor{dilate}
  14233. @subsection dilate
  14234. Dilate an image by using a specific structuring element.
  14235. It corresponds to the libopencv function @code{cvDilate}.
  14236. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  14237. @var{struct_el} represents a structuring element, and has the syntax:
  14238. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  14239. @var{cols} and @var{rows} represent the number of columns and rows of
  14240. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  14241. point, and @var{shape} the shape for the structuring element. @var{shape}
  14242. must be "rect", "cross", "ellipse", or "custom".
  14243. If the value for @var{shape} is "custom", it must be followed by a
  14244. string of the form "=@var{filename}". The file with name
  14245. @var{filename} is assumed to represent a binary image, with each
  14246. printable character corresponding to a bright pixel. When a custom
  14247. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  14248. or columns and rows of the read file are assumed instead.
  14249. The default value for @var{struct_el} is "3x3+0x0/rect".
  14250. @var{nb_iterations} specifies the number of times the transform is
  14251. applied to the image, and defaults to 1.
  14252. Some examples:
  14253. @example
  14254. # Use the default values
  14255. ocv=dilate
  14256. # Dilate using a structuring element with a 5x5 cross, iterating two times
  14257. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  14258. # Read the shape from the file diamond.shape, iterating two times.
  14259. # The file diamond.shape may contain a pattern of characters like this
  14260. # *
  14261. # ***
  14262. # *****
  14263. # ***
  14264. # *
  14265. # The specified columns and rows are ignored
  14266. # but the anchor point coordinates are not
  14267. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  14268. @end example
  14269. @subsection erode
  14270. Erode an image by using a specific structuring element.
  14271. It corresponds to the libopencv function @code{cvErode}.
  14272. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  14273. with the same syntax and semantics as the @ref{dilate} filter.
  14274. @subsection smooth
  14275. Smooth the input video.
  14276. The filter takes the following parameters:
  14277. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  14278. @var{type} is the type of smooth filter to apply, and must be one of
  14279. the following values: "blur", "blur_no_scale", "median", "gaussian",
  14280. or "bilateral". The default value is "gaussian".
  14281. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  14282. depends on the smooth type. @var{param1} and
  14283. @var{param2} accept integer positive values or 0. @var{param3} and
  14284. @var{param4} accept floating point values.
  14285. The default value for @var{param1} is 3. The default value for the
  14286. other parameters is 0.
  14287. These parameters correspond to the parameters assigned to the
  14288. libopencv function @code{cvSmooth}.
  14289. @section oscilloscope
  14290. 2D Video Oscilloscope.
  14291. Useful to measure spatial impulse, step responses, chroma delays, etc.
  14292. It accepts the following parameters:
  14293. @table @option
  14294. @item x
  14295. Set scope center x position.
  14296. @item y
  14297. Set scope center y position.
  14298. @item s
  14299. Set scope size, relative to frame diagonal.
  14300. @item t
  14301. Set scope tilt/rotation.
  14302. @item o
  14303. Set trace opacity.
  14304. @item tx
  14305. Set trace center x position.
  14306. @item ty
  14307. Set trace center y position.
  14308. @item tw
  14309. Set trace width, relative to width of frame.
  14310. @item th
  14311. Set trace height, relative to height of frame.
  14312. @item c
  14313. Set which components to trace. By default it traces first three components.
  14314. @item g
  14315. Draw trace grid. By default is enabled.
  14316. @item st
  14317. Draw some statistics. By default is enabled.
  14318. @item sc
  14319. Draw scope. By default is enabled.
  14320. @end table
  14321. @subsection Commands
  14322. This filter supports same @ref{commands} as options.
  14323. The command accepts the same syntax of the corresponding option.
  14324. If the specified expression is not valid, it is kept at its current
  14325. value.
  14326. @subsection Examples
  14327. @itemize
  14328. @item
  14329. Inspect full first row of video frame.
  14330. @example
  14331. oscilloscope=x=0.5:y=0:s=1
  14332. @end example
  14333. @item
  14334. Inspect full last row of video frame.
  14335. @example
  14336. oscilloscope=x=0.5:y=1:s=1
  14337. @end example
  14338. @item
  14339. Inspect full 5th line of video frame of height 1080.
  14340. @example
  14341. oscilloscope=x=0.5:y=5/1080:s=1
  14342. @end example
  14343. @item
  14344. Inspect full last column of video frame.
  14345. @example
  14346. oscilloscope=x=1:y=0.5:s=1:t=1
  14347. @end example
  14348. @end itemize
  14349. @anchor{overlay}
  14350. @section overlay
  14351. Overlay one video on top of another.
  14352. It takes two inputs and has one output. The first input is the "main"
  14353. video on which the second input is overlaid.
  14354. It accepts the following parameters:
  14355. A description of the accepted options follows.
  14356. @table @option
  14357. @item x
  14358. @item y
  14359. Set the expression for the x and y coordinates of the overlaid video
  14360. on the main video. Default value is "0" for both expressions. In case
  14361. the expression is invalid, it is set to a huge value (meaning that the
  14362. overlay will not be displayed within the output visible area).
  14363. @item eof_action
  14364. See @ref{framesync}.
  14365. @item eval
  14366. Set when the expressions for @option{x}, and @option{y} are evaluated.
  14367. It accepts the following values:
  14368. @table @samp
  14369. @item init
  14370. only evaluate expressions once during the filter initialization or
  14371. when a command is processed
  14372. @item frame
  14373. evaluate expressions for each incoming frame
  14374. @end table
  14375. Default value is @samp{frame}.
  14376. @item shortest
  14377. See @ref{framesync}.
  14378. @item format
  14379. Set the format for the output video.
  14380. It accepts the following values:
  14381. @table @samp
  14382. @item yuv420
  14383. force YUV 4:2:0 8-bit planar output
  14384. @item yuv420p10
  14385. force YUV 4:2:0 10-bit planar output
  14386. @item yuv422
  14387. force YUV 4:2:2 8-bit planar output
  14388. @item yuv422p10
  14389. force YUV 4:2:2 10-bit planar output
  14390. @item yuv444
  14391. force YUV 4:4:4 8-bit planar output
  14392. @item yuv444p10
  14393. force YUV 4:4:4 10-bit planar output
  14394. @item rgb
  14395. force RGB 8-bit packed output
  14396. @item gbrp
  14397. force RGB 8-bit planar output
  14398. @item auto
  14399. automatically pick format
  14400. @end table
  14401. Default value is @samp{yuv420}.
  14402. @item repeatlast
  14403. See @ref{framesync}.
  14404. @item alpha
  14405. Set format of alpha of the overlaid video, it can be @var{straight} or
  14406. @var{premultiplied}. Default is @var{straight}.
  14407. @end table
  14408. The @option{x}, and @option{y} expressions can contain the following
  14409. parameters.
  14410. @table @option
  14411. @item main_w, W
  14412. @item main_h, H
  14413. The main input width and height.
  14414. @item overlay_w, w
  14415. @item overlay_h, h
  14416. The overlay input width and height.
  14417. @item x
  14418. @item y
  14419. The computed values for @var{x} and @var{y}. They are evaluated for
  14420. each new frame.
  14421. @item hsub
  14422. @item vsub
  14423. horizontal and vertical chroma subsample values of the output
  14424. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  14425. @var{vsub} is 1.
  14426. @item n
  14427. the number of input frame, starting from 0
  14428. @item pos
  14429. the position in the file of the input frame, NAN if unknown; deprecated,
  14430. do not use
  14431. @item t
  14432. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  14433. @end table
  14434. This filter also supports the @ref{framesync} options.
  14435. Note that the @var{n}, @var{t} variables are available only
  14436. when evaluation is done @emph{per frame}, and will evaluate to NAN
  14437. when @option{eval} is set to @samp{init}.
  14438. Be aware that frames are taken from each input video in timestamp
  14439. order, hence, if their initial timestamps differ, it is a good idea
  14440. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  14441. have them begin in the same zero timestamp, as the example for
  14442. the @var{movie} filter does.
  14443. You can chain together more overlays but you should test the
  14444. efficiency of such approach.
  14445. @subsection Commands
  14446. This filter supports the following commands:
  14447. @table @option
  14448. @item x
  14449. @item y
  14450. Modify the x and y of the overlay input.
  14451. The command accepts the same syntax of the corresponding option.
  14452. If the specified expression is not valid, it is kept at its current
  14453. value.
  14454. @end table
  14455. @subsection Examples
  14456. @itemize
  14457. @item
  14458. Draw the overlay at 10 pixels from the bottom right corner of the main
  14459. video:
  14460. @example
  14461. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  14462. @end example
  14463. Using named options the example above becomes:
  14464. @example
  14465. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  14466. @end example
  14467. @item
  14468. Insert a transparent PNG logo in the bottom left corner of the input,
  14469. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  14470. @example
  14471. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  14472. @end example
  14473. @item
  14474. Insert 2 different transparent PNG logos (second logo on bottom
  14475. right corner) using the @command{ffmpeg} tool:
  14476. @example
  14477. ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
  14478. @end example
  14479. @item
  14480. Add a transparent color layer on top of the main video; @code{WxH}
  14481. must specify the size of the main input to the overlay filter:
  14482. @example
  14483. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  14484. @end example
  14485. @item
  14486. Play an original video and a filtered version (here with the deshake
  14487. filter) side by side using the @command{ffplay} tool:
  14488. @example
  14489. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  14490. @end example
  14491. The above command is the same as:
  14492. @example
  14493. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  14494. @end example
  14495. @item
  14496. Make a sliding overlay appearing from the left to the right top part of the
  14497. screen starting since time 2:
  14498. @example
  14499. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  14500. @end example
  14501. @item
  14502. Compose output by putting two input videos side to side:
  14503. @example
  14504. ffmpeg -i left.avi -i right.avi -filter_complex "
  14505. nullsrc=size=200x100 [background];
  14506. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  14507. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  14508. [background][left] overlay=shortest=1 [background+left];
  14509. [background+left][right] overlay=shortest=1:x=100 [left+right]
  14510. "
  14511. @end example
  14512. @item
  14513. Mask 10-20 seconds of a video by applying the delogo filter to a section
  14514. @example
  14515. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  14516. -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
  14517. masked.avi
  14518. @end example
  14519. @item
  14520. Chain several overlays in cascade:
  14521. @example
  14522. nullsrc=s=200x200 [bg];
  14523. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  14524. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  14525. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  14526. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  14527. [in3] null, [mid2] overlay=100:100 [out0]
  14528. @end example
  14529. @end itemize
  14530. @anchor{overlay_cuda}
  14531. @section overlay_cuda
  14532. Overlay one video on top of another.
  14533. This is the CUDA variant of the @ref{overlay} filter.
  14534. It only accepts CUDA frames. The underlying input pixel formats have to match.
  14535. It takes two inputs and has one output. The first input is the "main"
  14536. video on which the second input is overlaid.
  14537. It accepts the following parameters:
  14538. @table @option
  14539. @item x
  14540. @item y
  14541. Set expressions for the x and y coordinates of the overlaid video
  14542. on the main video.
  14543. They can contain the following parameters:
  14544. @table @option
  14545. @item main_w, W
  14546. @item main_h, H
  14547. The main input width and height.
  14548. @item overlay_w, w
  14549. @item overlay_h, h
  14550. The overlay input width and height.
  14551. @item x
  14552. @item y
  14553. The computed values for @var{x} and @var{y}. They are evaluated for
  14554. each new frame.
  14555. @item n
  14556. The ordinal index of the main input frame, starting from 0.
  14557. @item pos
  14558. The byte offset position in the file of the main input frame, NAN if unknown.
  14559. Deprecated, do not use.
  14560. @item t
  14561. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  14562. @end table
  14563. Default value is "0" for both expressions.
  14564. @item eval
  14565. Set when the expressions for @option{x} and @option{y} are evaluated.
  14566. It accepts the following values:
  14567. @table @option
  14568. @item init
  14569. Evaluate expressions once during filter initialization or
  14570. when a command is processed.
  14571. @item frame
  14572. Evaluate expressions for each incoming frame
  14573. @end table
  14574. Default value is @option{frame}.
  14575. @item eof_action
  14576. See @ref{framesync}.
  14577. @item shortest
  14578. See @ref{framesync}.
  14579. @item repeatlast
  14580. See @ref{framesync}.
  14581. @end table
  14582. This filter also supports the @ref{framesync} options.
  14583. @section owdenoise
  14584. Apply Overcomplete Wavelet denoiser.
  14585. The filter accepts the following options:
  14586. @table @option
  14587. @item depth
  14588. Set depth.
  14589. Larger depth values will denoise lower frequency components more, but
  14590. slow down filtering.
  14591. Must be an int in the range 8-16, default is @code{8}.
  14592. @item luma_strength, ls
  14593. Set luma strength.
  14594. Must be a double value in the range 0-1000, default is @code{1.0}.
  14595. @item chroma_strength, cs
  14596. Set chroma strength.
  14597. Must be a double value in the range 0-1000, default is @code{1.0}.
  14598. @end table
  14599. @anchor{pad}
  14600. @section pad
  14601. Add paddings to the input image, and place the original input at the
  14602. provided @var{x}, @var{y} coordinates.
  14603. It accepts the following parameters:
  14604. @table @option
  14605. @item width, w
  14606. @item height, h
  14607. Specify an expression for the size of the output image with the
  14608. paddings added. If the value for @var{width} or @var{height} is 0, the
  14609. corresponding input size is used for the output.
  14610. The @var{width} expression can reference the value set by the
  14611. @var{height} expression, and vice versa.
  14612. The default value of @var{width} and @var{height} is 0.
  14613. @item x
  14614. @item y
  14615. Specify the offsets to place the input image at within the padded area,
  14616. with respect to the top/left border of the output image.
  14617. The @var{x} expression can reference the value set by the @var{y}
  14618. expression, and vice versa.
  14619. The default value of @var{x} and @var{y} is 0.
  14620. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14621. so the input image is centered on the padded area.
  14622. @item color
  14623. Specify the color of the padded area. For the syntax of this option,
  14624. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14625. manual,ffmpeg-utils}.
  14626. The default value of @var{color} is "black".
  14627. @item eval
  14628. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14629. It accepts the following values:
  14630. @table @samp
  14631. @item init
  14632. Only evaluate expressions once during the filter initialization or when
  14633. a command is processed.
  14634. @item frame
  14635. Evaluate expressions for each incoming frame.
  14636. @end table
  14637. Default value is @samp{init}.
  14638. @item aspect
  14639. Pad to aspect instead to a resolution.
  14640. @end table
  14641. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14642. options are expressions containing the following constants:
  14643. @table @option
  14644. @item in_w
  14645. @item in_h
  14646. The input video width and height.
  14647. @item iw
  14648. @item ih
  14649. These are the same as @var{in_w} and @var{in_h}.
  14650. @item out_w
  14651. @item out_h
  14652. The output width and height (the size of the padded area), as
  14653. specified by the @var{width} and @var{height} expressions.
  14654. @item ow
  14655. @item oh
  14656. These are the same as @var{out_w} and @var{out_h}.
  14657. @item x
  14658. @item y
  14659. The x and y offsets as specified by the @var{x} and @var{y}
  14660. expressions, or NAN if not yet specified.
  14661. @item a
  14662. same as @var{iw} / @var{ih}
  14663. @item sar
  14664. input sample aspect ratio
  14665. @item dar
  14666. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14667. @item hsub
  14668. @item vsub
  14669. The horizontal and vertical chroma subsample values. For example for the
  14670. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14671. @end table
  14672. @subsection Examples
  14673. @itemize
  14674. @item
  14675. Add paddings with the color "violet" to the input video. The output video
  14676. size is 640x480, and the top-left corner of the input video is placed at
  14677. column 0, row 40
  14678. @example
  14679. pad=640:480:0:40:violet
  14680. @end example
  14681. The example above is equivalent to the following command:
  14682. @example
  14683. pad=width=640:height=480:x=0:y=40:color=violet
  14684. @end example
  14685. @item
  14686. Pad the input to get an output with dimensions increased by 3/2,
  14687. and put the input video at the center of the padded area:
  14688. @example
  14689. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14690. @end example
  14691. @item
  14692. Pad the input to get a squared output with size equal to the maximum
  14693. value between the input width and height, and put the input video at
  14694. the center of the padded area:
  14695. @example
  14696. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14697. @end example
  14698. @item
  14699. Pad the input to get a final w/h ratio of 16:9:
  14700. @example
  14701. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14702. @end example
  14703. @item
  14704. In case of anamorphic video, in order to set the output display aspect
  14705. correctly, it is necessary to use @var{sar} in the expression,
  14706. according to the relation:
  14707. @example
  14708. (ih * X / ih) * sar = output_dar
  14709. X = output_dar / sar
  14710. @end example
  14711. Thus the previous example needs to be modified to:
  14712. @example
  14713. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14714. @end example
  14715. @item
  14716. Double the output size and put the input video in the bottom-right
  14717. corner of the output padded area:
  14718. @example
  14719. pad="2*iw:2*ih:ow-iw:oh-ih"
  14720. @end example
  14721. @end itemize
  14722. @anchor{palettegen}
  14723. @section palettegen
  14724. Generate one palette for a whole video stream.
  14725. It accepts the following options:
  14726. @table @option
  14727. @item max_colors
  14728. Set the maximum number of colors to quantize in the palette.
  14729. Note: the palette will still contain 256 colors; the unused palette entries
  14730. will be black.
  14731. @item reserve_transparent
  14732. Create a palette of 255 colors maximum and reserve the last one for
  14733. transparency. Reserving the transparency color is useful for GIF optimization.
  14734. If not set, the maximum of colors in the palette will be 256. You probably want
  14735. to disable this option for a standalone image.
  14736. Set by default.
  14737. @item transparency_color
  14738. Set the color that will be used as background for transparency.
  14739. @item stats_mode
  14740. Set statistics mode.
  14741. It accepts the following values:
  14742. @table @samp
  14743. @item full
  14744. Compute full frame histograms.
  14745. @item diff
  14746. Compute histograms only for the part that differs from previous frame. This
  14747. might be relevant to give more importance to the moving part of your input if
  14748. the background is static.
  14749. @item single
  14750. Compute new histogram for each frame.
  14751. @end table
  14752. Default value is @var{full}.
  14753. @end table
  14754. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14755. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14756. color quantization of the palette. This information is also visible at
  14757. @var{info} logging level.
  14758. @subsection Examples
  14759. @itemize
  14760. @item
  14761. Generate a representative palette of a given video using @command{ffmpeg}:
  14762. @example
  14763. ffmpeg -i input.mkv -vf palettegen palette.png
  14764. @end example
  14765. @end itemize
  14766. @section paletteuse
  14767. Use a palette to downsample an input video stream.
  14768. The filter takes two inputs: one video stream and a palette. The palette must
  14769. be a 256 pixels image.
  14770. It accepts the following options:
  14771. @table @option
  14772. @item dither
  14773. Select dithering mode. Available algorithms are:
  14774. @table @samp
  14775. @item bayer
  14776. Ordered 8x8 bayer dithering (deterministic)
  14777. @item heckbert
  14778. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14779. Note: this dithering is sometimes considered "wrong" and is included as a
  14780. reference.
  14781. @item floyd_steinberg
  14782. Floyd and Steingberg dithering (error diffusion)
  14783. @item sierra2
  14784. Frankie Sierra dithering v2 (error diffusion)
  14785. @item sierra2_4a
  14786. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14787. @item sierra3
  14788. Frankie Sierra dithering v3 (error diffusion)
  14789. @item burkes
  14790. Burkes dithering (error diffusion)
  14791. @item atkinson
  14792. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14793. @item none
  14794. Disable dithering.
  14795. @end table
  14796. Default is @var{sierra2_4a}.
  14797. @item bayer_scale
  14798. When @var{bayer} dithering is selected, this option defines the scale of the
  14799. pattern (how much the crosshatch pattern is visible). A low value means more
  14800. visible pattern for less banding, and higher value means less visible pattern
  14801. at the cost of more banding.
  14802. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14803. @item diff_mode
  14804. If set, define the zone to process
  14805. @table @samp
  14806. @item rectangle
  14807. Only the changing rectangle will be reprocessed. This is similar to GIF
  14808. cropping/offsetting compression mechanism. This option can be useful for speed
  14809. if only a part of the image is changing, and has use cases such as limiting the
  14810. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14811. moving scene (it leads to more deterministic output if the scene doesn't change
  14812. much, and as a result less moving noise and better GIF compression).
  14813. @end table
  14814. Default is @var{none}.
  14815. @item new
  14816. Take new palette for each output frame.
  14817. @item alpha_threshold
  14818. Sets the alpha threshold for transparency. Alpha values above this threshold
  14819. will be treated as completely opaque, and values below this threshold will be
  14820. treated as completely transparent.
  14821. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14822. @end table
  14823. @subsection Examples
  14824. @itemize
  14825. @item
  14826. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14827. using @command{ffmpeg}:
  14828. @example
  14829. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14830. @end example
  14831. @end itemize
  14832. @section perspective
  14833. Correct perspective of video not recorded perpendicular to the screen.
  14834. A description of the accepted parameters follows.
  14835. @table @option
  14836. @item x0
  14837. @item y0
  14838. @item x1
  14839. @item y1
  14840. @item x2
  14841. @item y2
  14842. @item x3
  14843. @item y3
  14844. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14845. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14846. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14847. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14848. then the corners of the source will be sent to the specified coordinates.
  14849. The expressions can use the following variables:
  14850. @table @option
  14851. @item W
  14852. @item H
  14853. the width and height of video frame.
  14854. @item in
  14855. Input frame count.
  14856. @item on
  14857. Output frame count.
  14858. @end table
  14859. @item interpolation
  14860. Set interpolation for perspective correction.
  14861. It accepts the following values:
  14862. @table @samp
  14863. @item linear
  14864. @item cubic
  14865. @end table
  14866. Default value is @samp{linear}.
  14867. @item sense
  14868. Set interpretation of coordinate options.
  14869. It accepts the following values:
  14870. @table @samp
  14871. @item 0, source
  14872. Send point in the source specified by the given coordinates to
  14873. the corners of the destination.
  14874. @item 1, destination
  14875. Send the corners of the source to the point in the destination specified
  14876. by the given coordinates.
  14877. Default value is @samp{source}.
  14878. @end table
  14879. @item eval
  14880. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14881. It accepts the following values:
  14882. @table @samp
  14883. @item init
  14884. only evaluate expressions once during the filter initialization or
  14885. when a command is processed
  14886. @item frame
  14887. evaluate expressions for each incoming frame
  14888. @end table
  14889. Default value is @samp{init}.
  14890. @end table
  14891. @section phase
  14892. Delay interlaced video by one field time so that the field order changes.
  14893. The intended use is to fix PAL movies that have been captured with the
  14894. opposite field order to the film-to-video transfer.
  14895. A description of the accepted parameters follows.
  14896. @table @option
  14897. @item mode
  14898. Set phase mode.
  14899. It accepts the following values:
  14900. @table @samp
  14901. @item t
  14902. Capture field order top-first, transfer bottom-first.
  14903. Filter will delay the bottom field.
  14904. @item b
  14905. Capture field order bottom-first, transfer top-first.
  14906. Filter will delay the top field.
  14907. @item p
  14908. Capture and transfer with the same field order. This mode only exists
  14909. for the documentation of the other options to refer to, but if you
  14910. actually select it, the filter will faithfully do nothing.
  14911. @item a
  14912. Capture field order determined automatically by field flags, transfer
  14913. opposite.
  14914. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14915. basis using field flags. If no field information is available,
  14916. then this works just like @samp{u}.
  14917. @item u
  14918. Capture unknown or varying, transfer opposite.
  14919. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14920. analyzing the images and selecting the alternative that produces best
  14921. match between the fields.
  14922. @item T
  14923. Capture top-first, transfer unknown or varying.
  14924. Filter selects among @samp{t} and @samp{p} using image analysis.
  14925. @item B
  14926. Capture bottom-first, transfer unknown or varying.
  14927. Filter selects among @samp{b} and @samp{p} using image analysis.
  14928. @item A
  14929. Capture determined by field flags, transfer unknown or varying.
  14930. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14931. image analysis. If no field information is available, then this works just
  14932. like @samp{U}. This is the default mode.
  14933. @item U
  14934. Both capture and transfer unknown or varying.
  14935. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14936. @end table
  14937. @end table
  14938. @subsection Commands
  14939. This filter supports the all above options as @ref{commands}.
  14940. @section photosensitivity
  14941. Reduce various flashes in video, so to help users with epilepsy.
  14942. It accepts the following options:
  14943. @table @option
  14944. @item frames, f
  14945. Set how many frames to use when filtering. Default is 30.
  14946. @item threshold, t
  14947. Set detection threshold factor. Default is 1.
  14948. Lower is stricter.
  14949. @item skip
  14950. Set how many pixels to skip when sampling frames. Default is 1.
  14951. Allowed range is from 1 to 1024.
  14952. @item bypass
  14953. Leave frames unchanged. Default is disabled.
  14954. @end table
  14955. @section pixdesctest
  14956. Pixel format descriptor test filter, mainly useful for internal
  14957. testing. The output video should be equal to the input video.
  14958. For example:
  14959. @example
  14960. format=monow, pixdesctest
  14961. @end example
  14962. can be used to test the monowhite pixel format descriptor definition.
  14963. @section pixelize
  14964. Apply pixelization to video stream.
  14965. The filter accepts the following options:
  14966. @table @option
  14967. @item width, w
  14968. @item height, h
  14969. Set block dimensions that will be used for pixelization.
  14970. Default value is @code{16}.
  14971. @item mode, m
  14972. Set the mode of pixelization used.
  14973. Possible values are:
  14974. @table @samp
  14975. @item avg
  14976. @item min
  14977. @item max
  14978. @end table
  14979. Default value is @code{avg}.
  14980. @item planes, p
  14981. Set what planes to filter. Default is to filter all planes.
  14982. @end table
  14983. @subsection Commands
  14984. This filter supports all options as @ref{commands}.
  14985. @section pixscope
  14986. Display sample values of color channels. Mainly useful for checking color
  14987. and levels. Minimum supported resolution is 640x480.
  14988. The filters accept the following options:
  14989. @table @option
  14990. @item x
  14991. Set scope X position, relative offset on X axis.
  14992. @item y
  14993. Set scope Y position, relative offset on Y axis.
  14994. @item w
  14995. Set scope width.
  14996. @item h
  14997. Set scope height.
  14998. @item o
  14999. Set window opacity. This window also holds statistics about pixel area.
  15000. @item wx
  15001. Set window X position, relative offset on X axis.
  15002. @item wy
  15003. Set window Y position, relative offset on Y axis.
  15004. @end table
  15005. @subsection Commands
  15006. This filter supports same @ref{commands} as options.
  15007. @section pp
  15008. Enable the specified chain of postprocessing subfilters using libpostproc. This
  15009. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  15010. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  15011. Each subfilter and some options have a short and a long name that can be used
  15012. interchangeably, i.e. dr/dering are the same.
  15013. The filters accept the following options:
  15014. @table @option
  15015. @item subfilters
  15016. Set postprocessing subfilters string.
  15017. @end table
  15018. All subfilters share common options to determine their scope:
  15019. @table @option
  15020. @item a/autoq
  15021. Honor the quality commands for this subfilter.
  15022. @item c/chrom
  15023. Do chrominance filtering, too (default).
  15024. @item y/nochrom
  15025. Do luma filtering only (no chrominance).
  15026. @item n/noluma
  15027. Do chrominance filtering only (no luma).
  15028. @end table
  15029. These options can be appended after the subfilter name, separated by a '|'.
  15030. Available subfilters are:
  15031. @table @option
  15032. @item hb/hdeblock[|difference[|flatness]]
  15033. Horizontal deblocking filter
  15034. @table @option
  15035. @item difference
  15036. Difference factor where higher values mean more deblocking (default: @code{32}).
  15037. @item flatness
  15038. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15039. @end table
  15040. @item vb/vdeblock[|difference[|flatness]]
  15041. Vertical deblocking filter
  15042. @table @option
  15043. @item difference
  15044. Difference factor where higher values mean more deblocking (default: @code{32}).
  15045. @item flatness
  15046. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15047. @end table
  15048. @item ha/hadeblock[|difference[|flatness]]
  15049. Accurate horizontal deblocking filter
  15050. @table @option
  15051. @item difference
  15052. Difference factor where higher values mean more deblocking (default: @code{32}).
  15053. @item flatness
  15054. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15055. @end table
  15056. @item va/vadeblock[|difference[|flatness]]
  15057. Accurate vertical deblocking filter
  15058. @table @option
  15059. @item difference
  15060. Difference factor where higher values mean more deblocking (default: @code{32}).
  15061. @item flatness
  15062. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15063. @end table
  15064. @end table
  15065. The horizontal and vertical deblocking filters share the difference and
  15066. flatness values so you cannot set different horizontal and vertical
  15067. thresholds.
  15068. @table @option
  15069. @item h1/x1hdeblock
  15070. Experimental horizontal deblocking filter
  15071. @item v1/x1vdeblock
  15072. Experimental vertical deblocking filter
  15073. @item dr/dering
  15074. Deringing filter
  15075. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  15076. @table @option
  15077. @item threshold1
  15078. larger -> stronger filtering
  15079. @item threshold2
  15080. larger -> stronger filtering
  15081. @item threshold3
  15082. larger -> stronger filtering
  15083. @end table
  15084. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  15085. @table @option
  15086. @item f/fullyrange
  15087. Stretch luma to @code{0-255}.
  15088. @end table
  15089. @item lb/linblenddeint
  15090. Linear blend deinterlacing filter that deinterlaces the given block by
  15091. filtering all lines with a @code{(1 2 1)} filter.
  15092. @item li/linipoldeint
  15093. Linear interpolating deinterlacing filter that deinterlaces the given block by
  15094. linearly interpolating every second line.
  15095. @item ci/cubicipoldeint
  15096. Cubic interpolating deinterlacing filter deinterlaces the given block by
  15097. cubically interpolating every second line.
  15098. @item md/mediandeint
  15099. Median deinterlacing filter that deinterlaces the given block by applying a
  15100. median filter to every second line.
  15101. @item fd/ffmpegdeint
  15102. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  15103. second line with a @code{(-1 4 2 4 -1)} filter.
  15104. @item l5/lowpass5
  15105. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  15106. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  15107. @item fq/forceQuant[|quantizer]
  15108. Overrides the quantizer table from the input with the constant quantizer you
  15109. specify.
  15110. @table @option
  15111. @item quantizer
  15112. Quantizer to use
  15113. @end table
  15114. @item de/default
  15115. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  15116. @item fa/fast
  15117. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  15118. @item ac
  15119. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  15120. @end table
  15121. @subsection Examples
  15122. @itemize
  15123. @item
  15124. Apply horizontal and vertical deblocking, deringing and automatic
  15125. brightness/contrast:
  15126. @example
  15127. pp=hb/vb/dr/al
  15128. @end example
  15129. @item
  15130. Apply default filters without brightness/contrast correction:
  15131. @example
  15132. pp=de/-al
  15133. @end example
  15134. @item
  15135. Apply default filters and temporal denoiser:
  15136. @example
  15137. pp=default/tmpnoise|1|2|3
  15138. @end example
  15139. @item
  15140. Apply deblocking on luma only, and switch vertical deblocking on or off
  15141. automatically depending on available CPU time:
  15142. @example
  15143. pp=hb|y/vb|a
  15144. @end example
  15145. @end itemize
  15146. @section pp7
  15147. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  15148. similar to spp = 6 with 7 point DCT, where only the center sample is
  15149. used after IDCT.
  15150. The filter accepts the following options:
  15151. @table @option
  15152. @item qp
  15153. Force a constant quantization parameter. It accepts an integer in range
  15154. 0 to 63. If not set, the filter will use the QP from the video stream
  15155. (if available).
  15156. @item mode
  15157. Set thresholding mode. Available modes are:
  15158. @table @samp
  15159. @item hard
  15160. Set hard thresholding.
  15161. @item soft
  15162. Set soft thresholding (better de-ringing effect, but likely blurrier).
  15163. @item medium
  15164. Set medium thresholding (good results, default).
  15165. @end table
  15166. @end table
  15167. @section premultiply
  15168. Apply alpha premultiply effect to input video stream using first plane
  15169. of second stream as alpha.
  15170. Both streams must have same dimensions and same pixel format.
  15171. The filter accepts the following option:
  15172. @table @option
  15173. @item planes
  15174. Set which planes will be processed, unprocessed planes will be copied.
  15175. By default value 0xf, all planes will be processed.
  15176. @item inplace
  15177. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15178. @end table
  15179. @section prewitt
  15180. Apply prewitt operator to input video stream.
  15181. The filter accepts the following option:
  15182. @table @option
  15183. @item planes
  15184. Set which planes will be processed, unprocessed planes will be copied.
  15185. By default value 0xf, all planes will be processed.
  15186. @item scale
  15187. Set value which will be multiplied with filtered result.
  15188. @item delta
  15189. Set value which will be added to filtered result.
  15190. @end table
  15191. @subsection Commands
  15192. This filter supports the all above options as @ref{commands}.
  15193. @section pseudocolor
  15194. Alter frame colors in video with pseudocolors.
  15195. This filter accepts the following options:
  15196. @table @option
  15197. @item c0
  15198. set pixel first component expression
  15199. @item c1
  15200. set pixel second component expression
  15201. @item c2
  15202. set pixel third component expression
  15203. @item c3
  15204. set pixel fourth component expression, corresponds to the alpha component
  15205. @item index, i
  15206. set component to use as base for altering colors
  15207. @item preset, p
  15208. Pick one of built-in LUTs. By default is set to none.
  15209. Available LUTs:
  15210. @table @samp
  15211. @item magma
  15212. @item inferno
  15213. @item plasma
  15214. @item viridis
  15215. @item turbo
  15216. @item cividis
  15217. @item range1
  15218. @item range2
  15219. @item shadows
  15220. @item highlights
  15221. @item solar
  15222. @item nominal
  15223. @item preferred
  15224. @item total
  15225. @item spectral
  15226. @item cool
  15227. @item heat
  15228. @item fiery
  15229. @item blues
  15230. @item green
  15231. @item helix
  15232. @end table
  15233. @item opacity
  15234. Set opacity of output colors. Allowed range is from 0 to 1.
  15235. Default value is set to 1.
  15236. @end table
  15237. Each of the expression options specifies the expression to use for computing
  15238. the lookup table for the corresponding pixel component values.
  15239. The expressions can contain the following constants and functions:
  15240. @table @option
  15241. @item w
  15242. @item h
  15243. The input width and height.
  15244. @item val
  15245. The input value for the pixel component.
  15246. @item ymin, umin, vmin, amin
  15247. The minimum allowed component value.
  15248. @item ymax, umax, vmax, amax
  15249. The maximum allowed component value.
  15250. @end table
  15251. All expressions default to "val".
  15252. @subsection Commands
  15253. This filter supports the all above options as @ref{commands}.
  15254. @subsection Examples
  15255. @itemize
  15256. @item
  15257. Change too high luma values to gradient:
  15258. @example
  15259. pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
  15260. @end example
  15261. @end itemize
  15262. @section psnr
  15263. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  15264. Ratio) between two input videos.
  15265. This filter takes in input two input videos, the first input is
  15266. considered the "main" source and is passed unchanged to the
  15267. output. The second input is used as a "reference" video for computing
  15268. the PSNR.
  15269. Both video inputs must have the same resolution and pixel format for
  15270. this filter to work correctly. Also it assumes that both inputs
  15271. have the same number of frames, which are compared one by one.
  15272. The obtained average PSNR is printed through the logging system.
  15273. The filter stores the accumulated MSE (mean squared error) of each
  15274. frame, and at the end of the processing it is averaged across all frames
  15275. equally, and the following formula is applied to obtain the PSNR:
  15276. @example
  15277. PSNR = 10*log10(MAX^2/MSE)
  15278. @end example
  15279. Where MAX is the average of the maximum values of each component of the
  15280. image.
  15281. The description of the accepted parameters follows.
  15282. @table @option
  15283. @item stats_file, f
  15284. If specified the filter will use the named file to save the PSNR of
  15285. each individual frame. When filename equals "-" the data is sent to
  15286. standard output.
  15287. @item stats_version
  15288. Specifies which version of the stats file format to use. Details of
  15289. each format are written below.
  15290. Default value is 1.
  15291. @item stats_add_max
  15292. Determines whether the max value is output to the stats log.
  15293. Default value is 0.
  15294. Requires stats_version >= 2. If this is set and stats_version < 2,
  15295. the filter will return an error.
  15296. @end table
  15297. This filter also supports the @ref{framesync} options.
  15298. The file printed if @var{stats_file} is selected, contains a sequence of
  15299. key/value pairs of the form @var{key}:@var{value} for each compared
  15300. couple of frames.
  15301. If a @var{stats_version} greater than 1 is specified, a header line precedes
  15302. the list of per-frame-pair stats, with key value pairs following the frame
  15303. format with the following parameters:
  15304. @table @option
  15305. @item psnr_log_version
  15306. The version of the log file format. Will match @var{stats_version}.
  15307. @item fields
  15308. A comma separated list of the per-frame-pair parameters included in
  15309. the log.
  15310. @end table
  15311. A description of each shown per-frame-pair parameter follows:
  15312. @table @option
  15313. @item n
  15314. sequential number of the input frame, starting from 1
  15315. @item mse_avg
  15316. Mean Square Error pixel-by-pixel average difference of the compared
  15317. frames, averaged over all the image components.
  15318. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  15319. Mean Square Error pixel-by-pixel average difference of the compared
  15320. frames for the component specified by the suffix.
  15321. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  15322. Peak Signal to Noise ratio of the compared frames for the component
  15323. specified by the suffix.
  15324. @item max_avg, max_y, max_u, max_v
  15325. Maximum allowed value for each channel, and average over all
  15326. channels.
  15327. @end table
  15328. @subsection Examples
  15329. @itemize
  15330. @item
  15331. For example:
  15332. @example
  15333. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15334. [main][ref] psnr="stats_file=stats.log" [out]
  15335. @end example
  15336. On this example the input file being processed is compared with the
  15337. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  15338. is stored in @file{stats.log}.
  15339. @item
  15340. Another example with different containers:
  15341. @example
  15342. 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 -
  15343. @end example
  15344. @end itemize
  15345. @anchor{pullup}
  15346. @section pullup
  15347. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  15348. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  15349. content.
  15350. The pullup filter is designed to take advantage of future context in making
  15351. its decisions. This filter is stateless in the sense that it does not lock
  15352. onto a pattern to follow, but it instead looks forward to the following
  15353. fields in order to identify matches and rebuild progressive frames.
  15354. To produce content with an even framerate, insert the fps filter after
  15355. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  15356. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  15357. The filter accepts the following options:
  15358. @table @option
  15359. @item jl
  15360. @item jr
  15361. @item jt
  15362. @item jb
  15363. These options set the amount of "junk" to ignore at the left, right, top, and
  15364. bottom of the image, respectively. Left and right are in units of 8 pixels,
  15365. while top and bottom are in units of 2 lines.
  15366. The default is 8 pixels on each side.
  15367. @item sb
  15368. Set the strict breaks. Setting this option to 1 will reduce the chances of
  15369. filter generating an occasional mismatched frame, but it may also cause an
  15370. excessive number of frames to be dropped during high motion sequences.
  15371. Conversely, setting it to -1 will make filter match fields more easily.
  15372. This may help processing of video where there is slight blurring between
  15373. the fields, but may also cause there to be interlaced frames in the output.
  15374. Default value is @code{0}.
  15375. @item mp
  15376. Set the metric plane to use. It accepts the following values:
  15377. @table @samp
  15378. @item l
  15379. Use luma plane.
  15380. @item u
  15381. Use chroma blue plane.
  15382. @item v
  15383. Use chroma red plane.
  15384. @end table
  15385. This option may be set to use chroma plane instead of the default luma plane
  15386. for doing filter's computations. This may improve accuracy on very clean
  15387. source material, but more likely will decrease accuracy, especially if there
  15388. is chroma noise (rainbow effect) or any grayscale video.
  15389. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  15390. load and make pullup usable in realtime on slow machines.
  15391. @end table
  15392. For best results (without duplicated frames in the output file) it is
  15393. necessary to change the output frame rate. For example, to inverse
  15394. telecine NTSC input:
  15395. @example
  15396. ffmpeg -i input -vf pullup -r 24000/1001 ...
  15397. @end example
  15398. @section qp
  15399. Change video quantization parameters (QP).
  15400. The filter accepts the following option:
  15401. @table @option
  15402. @item qp
  15403. Set expression for quantization parameter.
  15404. @end table
  15405. The expression is evaluated through the eval API and can contain, among others,
  15406. the following constants:
  15407. @table @var
  15408. @item known
  15409. 1 if index is not 129, 0 otherwise.
  15410. @item qp
  15411. Sequential index starting from -129 to 128.
  15412. @end table
  15413. @subsection Examples
  15414. @itemize
  15415. @item
  15416. Some equation like:
  15417. @example
  15418. qp=2+2*sin(PI*qp)
  15419. @end example
  15420. @end itemize
  15421. @section qrencode
  15422. Generate a QR code using the libqrencode library (see
  15423. @url{https://fukuchi.org/works/qrencode/}), and overlay it on top of the current
  15424. frame.
  15425. To enable the compilation of this filter, you need to configure FFmpeg with
  15426. @code{--enable-libqrencode}.
  15427. The QR code is generated from the provided text or text pattern. The
  15428. corresponding QR code is scaled and overlayed into the video output according to
  15429. the specified options.
  15430. In case no text is specified, no QR code is overlaied.
  15431. This filter accepts the following options:
  15432. @table @option
  15433. @item qrcode_width, q
  15434. @item padded_qrcode_width, Q
  15435. Specify an expression for the width of the rendered QR code, with and without
  15436. padding. The @var{qrcode_width} expression can reference the value set by the
  15437. @var{padded_qrcode_width} expression, and vice versa.
  15438. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  15439. there is no padding.
  15440. These expressions are evaluated for each new frame.
  15441. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15442. @item x
  15443. @item y
  15444. Specify an expression for positioning the padded QR code top-left corner. The
  15445. @var{x} expression can reference the value set by the @var{y} expression, and
  15446. vice.
  15447. By default @var{x} and @var{y} are set set to @var{0}, meaning that the QR code
  15448. is placed in the top left corner of the input.
  15449. These expressions are evaluated for each new frame.
  15450. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15451. @item case_sensitive, cs
  15452. Instruct libqrencode to use case sensitive encoding. This is enabled by
  15453. default. This can be disabled to reduce the QR encoding size.
  15454. @item level, l
  15455. Specify the QR encoding error correction level. With an higher correction level,
  15456. the encoding size will increase but the code will be more robust to corruption.
  15457. Lower level is @var{L}.
  15458. It accepts the following values:
  15459. @table @samp
  15460. @item L
  15461. @item M
  15462. @item Q
  15463. @item H
  15464. @end table
  15465. @item expansion
  15466. Select how the input text is expanded. Can be either @code{none}, or
  15467. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  15468. section below for details.
  15469. @item text
  15470. @item textfile
  15471. Define the text to be rendered. In case neither is specified, no QR is encoded
  15472. (just an empty colored frame).
  15473. In case expansion is enabled, the text is treated as a text template, using the
  15474. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  15475. Text expansion} section below for details.
  15476. @item background_color, bc
  15477. @item foreground_color, fc
  15478. Set the QR code and background color. The default value of
  15479. @var{foreground_color} is "black", the default value of @var{background_color}
  15480. is "white".
  15481. For the syntax of the color options, check the @ref{color syntax,,"Color"
  15482. section in the ffmpeg-utils manual,ffmpeg-utils}.
  15483. @end table
  15484. @anchor{qrencode_expressions}
  15485. @subsection qrencode Expressions
  15486. The expressions set by the options contain the following constants and functions.
  15487. @table @option
  15488. @item dar
  15489. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  15490. @item duration
  15491. the current frame's duration, in seconds
  15492. @item hsub
  15493. @item vsub
  15494. horizontal and vertical chroma subsample values. For example for the
  15495. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15496. @item main_h, H
  15497. the input height
  15498. @item main_w, W
  15499. the input width
  15500. @item n
  15501. the number of input frame, starting from 0
  15502. @item pict_type
  15503. a number representing the picture type
  15504. @item qr_w, w
  15505. the width of the encoded QR code
  15506. @item rendered_qr_w, q
  15507. @item rendered_padded_qr_w, Q
  15508. the width of the rendered QR code, without and without padding.
  15509. These parameters allow the @var{q} and @var{Q} expressions to refer to each
  15510. other, so you can for example specify @code{q=3/4*Q}.
  15511. @item rand(min, max)
  15512. return a random number included between @var{min} and @var{max}
  15513. @item sar
  15514. the input sample aspect ratio
  15515. @item t
  15516. timestamp expressed in seconds, NAN if the input timestamp is unknown
  15517. @item x
  15518. @item y
  15519. the x and y offset coordinates where the text is drawn.
  15520. These parameters allow the @var{x} and @var{y} expressions to refer to each
  15521. other, so you can for example specify @code{y=x/dar}.
  15522. @end table
  15523. @anchor{qrencode_text_expansion}
  15524. @subsection qrencode Text expansion
  15525. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  15526. If @option{expansion} is set to @code{normal} (which is the default),
  15527. the following expansion mechanism is used.
  15528. The backslash character @samp{\}, followed by any character, always expands to
  15529. the second character.
  15530. Sequences of the form @code{%@{...@}} are expanded. The text between the
  15531. braces is a function name, possibly followed by arguments separated by ':'.
  15532. If the arguments contain special characters or delimiters (':' or '@}'),
  15533. they should be escaped.
  15534. Note that they probably must also be escaped as the value for the @option{text}
  15535. option in the filter argument string and as the filter argument in the
  15536. filtergraph description, and possibly also for the shell, that makes up to four
  15537. levels of escaping; using a text file with the @option{textfile} option avoids
  15538. these problems.
  15539. The following functions are available:
  15540. @table @command
  15541. @item n, frame_num
  15542. return the frame number
  15543. @item pts
  15544. Return the presentation timestamp of the current frame.
  15545. It can take up to two arguments.
  15546. The first argument is the format of the timestamp; it defaults to @code{flt} for
  15547. seconds as a decimal number with microsecond accuracy; @code{hms} stands for a
  15548. formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  15549. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  15550. @code{localtime} stands for the timestamp of the frame formatted as local time
  15551. zone time. If the format is set to @code{hms24hh}, the time is formatted in 24h
  15552. format (00-23).
  15553. The second argument is an offset added to the timestamp.
  15554. If the format is set to @code{localtime} or @code{gmtime}, a third argument may
  15555. be supplied: a @code{strftime} C function format string. By default,
  15556. @var{YYYY-MM-DD HH:MM:SS} format will be used.
  15557. @item expr, e
  15558. Evaluate the expression's value and output as a double.
  15559. It must take one argument specifying the expression to be evaluated, accepting
  15560. the constants and functions defined in @ref{qrencode_expressions}.
  15561. @item expr_formatted, ef
  15562. Evaluate the expression's value and output as a formatted string.
  15563. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  15564. The second argument specifies the output format. Allowed values are @samp{x},
  15565. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  15566. @code{printf} function.
  15567. The third parameter is optional and sets the number of positions taken by the output.
  15568. It can be used to add padding with zeros from the left.
  15569. @item gmtime
  15570. The time at which the filter is running, expressed in UTC.
  15571. It can accept an argument: a @code{strftime} C function format string.
  15572. The format string is extended to support the variable @var{%[1-6]N}
  15573. which prints fractions of the second with optionally specified number of digits.
  15574. @item localtime
  15575. The time at which the filter is running, expressed in the local time zone.
  15576. It can accept an argument: a @code{strftime} C function format string.
  15577. The format string is extended to support the variable @var{%[1-6]N}
  15578. which prints fractions of the second with optionally specified number of digits.
  15579. @item metadata
  15580. Frame metadata. Takes one or two arguments.
  15581. The first argument is mandatory and specifies the metadata key.
  15582. The second argument is optional and specifies a default value, used when the
  15583. metadata key is not found or empty.
  15584. Available metadata can be identified by inspecting entries starting with TAG
  15585. included within each frame section printed by running @code{ffprobe
  15586. -show_frames}.
  15587. String metadata generated in filters leading to the qrencode filter are also
  15588. available.
  15589. @item rand(min, max)
  15590. return a random number included between @var{min} and @var{max}
  15591. @end table
  15592. @subsection Examples
  15593. @itemize
  15594. @item
  15595. Generate a QR code encoding the specified text with the default size, overalaid
  15596. in the top left corner of the input video, with the default size:
  15597. @example
  15598. qrencode=text=www.ffmpeg.org
  15599. @end example
  15600. @item
  15601. Same as below, but select blue on pink colors:
  15602. @example
  15603. qrencode=text=www.ffmpeg.org:bc=pink@@0.5:fc=blue
  15604. @end example
  15605. @item
  15606. Place the QR code in the bottom right corner of the input video:
  15607. @example
  15608. qrencode=text=www.ffmpeg.org:x=W-Q:y=H-Q
  15609. @end example
  15610. @item
  15611. Generate a QR code with width of 200 pixels and padding, making the padded width
  15612. 4/3 of the QR code width:
  15613. @example
  15614. qrencode=text=www.ffmpeg.org:q=200:Q=4/3*q
  15615. @end example
  15616. @item
  15617. Generate a QR code with padded width of 200 pixels and padding, making the QR
  15618. code width 3/4 of the padded width:
  15619. @example
  15620. qrencode=text=www.ffmpeg.org:Q=200:q=3/4*Q
  15621. @end example
  15622. @item
  15623. Make the QR code a fraction of the input video width:
  15624. @example
  15625. qrencode=text=www.ffmpeg.org:q=W/5
  15626. @end example
  15627. @item
  15628. Generate a QR code encoding the frame number:
  15629. @example
  15630. qrencode=text=%@{n@}
  15631. @end example
  15632. @item
  15633. Generate a QR code encoding the GMT timestamp:
  15634. @example
  15635. qrencode=text=%@{gmtime@}
  15636. @end example
  15637. @item
  15638. Generate a QR code encoding the timestamp expressed as a float:
  15639. @example
  15640. qrencode=text=%@{pts@}
  15641. @end example
  15642. @end itemize
  15643. @section quirc
  15644. Identify and decode a QR code using the libquirc library (see
  15645. @url{https://github.com/dlbeer/quirc/}), and print the identified QR codes
  15646. positions and payload as metadata.
  15647. To enable the compilation of this filter, you need to configure FFmpeg with
  15648. @code{--enable-libquirc}.
  15649. For each found QR code in the input video, some metadata entries are added with
  15650. the prefix @var{lavfi.quirc.N}, where @var{N} is the index, starting from 0,
  15651. associated to the QR code.
  15652. A description of each metadata value follows:
  15653. @table @option
  15654. @item lavfi.quirc.count
  15655. the number of found QR codes, it is not set in case none was found
  15656. @item lavfi.quirc.N.corner.M.x
  15657. @item lavfi.quirc.N.coreer.M.y
  15658. the x/y positions of the four corners of the square containing the QR code,
  15659. where @var{M} is the index of the corner starting from 0
  15660. @item lavfi.quirc.N.payload
  15661. the payload of the QR code
  15662. @end table
  15663. @section random
  15664. Flush video frames from internal cache of frames into a random order.
  15665. No frame is discarded.
  15666. Inspired by @ref{frei0r} nervous filter.
  15667. @table @option
  15668. @item frames
  15669. Set size in number of frames of internal cache, in range from @code{2} to
  15670. @code{512}. Default is @code{30}.
  15671. @item seed
  15672. Set seed for random number generator, must be an integer included between
  15673. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15674. less than @code{0}, the filter will try to use a good random seed on a
  15675. best effort basis.
  15676. @end table
  15677. @section readeia608
  15678. Read closed captioning (EIA-608) information from the top lines of a video frame.
  15679. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  15680. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  15681. with EIA-608 data (starting from 0). A description of each metadata value follows:
  15682. @table @option
  15683. @item lavfi.readeia608.X.cc
  15684. The two bytes stored as EIA-608 data (printed in hexadecimal).
  15685. @item lavfi.readeia608.X.line
  15686. The number of the line on which the EIA-608 data was identified and read.
  15687. @end table
  15688. This filter accepts the following options:
  15689. @table @option
  15690. @item scan_min
  15691. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  15692. @item scan_max
  15693. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  15694. @item spw
  15695. Set the ratio of width reserved for sync code detection.
  15696. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  15697. @item chp
  15698. Enable checking the parity bit. In the event of a parity error, the filter will output
  15699. @code{0x00} for that character. Default is false.
  15700. @item lp
  15701. Lowpass lines prior to further processing. Default is enabled.
  15702. @end table
  15703. @subsection Commands
  15704. This filter supports the all above options as @ref{commands}.
  15705. @subsection Examples
  15706. @itemize
  15707. @item
  15708. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  15709. @example
  15710. 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
  15711. @end example
  15712. @end itemize
  15713. @section readvitc
  15714. Read vertical interval timecode (VITC) information from the top lines of a
  15715. video frame.
  15716. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  15717. timecode value, if a valid timecode has been detected. Further metadata key
  15718. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  15719. timecode data has been found or not.
  15720. This filter accepts the following options:
  15721. @table @option
  15722. @item scan_max
  15723. Set the maximum number of lines to scan for VITC data. If the value is set to
  15724. @code{-1} the full video frame is scanned. Default is @code{45}.
  15725. @item thr_b
  15726. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  15727. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  15728. @item thr_w
  15729. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  15730. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  15731. @end table
  15732. @subsection Examples
  15733. @itemize
  15734. @item
  15735. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  15736. draw @code{--:--:--:--} as a placeholder:
  15737. @example
  15738. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  15739. @end example
  15740. @end itemize
  15741. @section remap
  15742. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  15743. Destination pixel at position (X, Y) will be picked from source (x, y) position
  15744. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  15745. value for pixel will be used for destination pixel.
  15746. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  15747. will have Xmap/Ymap video stream dimensions.
  15748. Xmap and Ymap input video streams are 16bit depth, single channel.
  15749. @table @option
  15750. @item format
  15751. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  15752. Default is @code{color}.
  15753. @item fill
  15754. Specify the color of the unmapped pixels. For the syntax of this option,
  15755. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15756. manual,ffmpeg-utils}. Default color is @code{black}.
  15757. @end table
  15758. @section removegrain
  15759. The removegrain filter is a spatial denoiser for progressive video.
  15760. @table @option
  15761. @item m0
  15762. Set mode for the first plane.
  15763. @item m1
  15764. Set mode for the second plane.
  15765. @item m2
  15766. Set mode for the third plane.
  15767. @item m3
  15768. Set mode for the fourth plane.
  15769. @end table
  15770. Range of mode is from 0 to 24. Description of each mode follows:
  15771. @table @var
  15772. @item 0
  15773. Leave input plane unchanged. Default.
  15774. @item 1
  15775. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  15776. @item 2
  15777. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  15778. @item 3
  15779. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  15780. @item 4
  15781. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  15782. This is equivalent to a median filter.
  15783. @item 5
  15784. Line-sensitive clipping giving the minimal change.
  15785. @item 6
  15786. Line-sensitive clipping, intermediate.
  15787. @item 7
  15788. Line-sensitive clipping, intermediate.
  15789. @item 8
  15790. Line-sensitive clipping, intermediate.
  15791. @item 9
  15792. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  15793. @item 10
  15794. Replaces the target pixel with the closest neighbour.
  15795. @item 11
  15796. [1 2 1] horizontal and vertical kernel blur.
  15797. @item 12
  15798. Same as mode 11.
  15799. @item 13
  15800. Bob mode, interpolates top field from the line where the neighbours
  15801. pixels are the closest.
  15802. @item 14
  15803. Bob mode, interpolates bottom field from the line where the neighbours
  15804. pixels are the closest.
  15805. @item 15
  15806. Bob mode, interpolates top field. Same as 13 but with a more complicated
  15807. interpolation formula.
  15808. @item 16
  15809. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  15810. interpolation formula.
  15811. @item 17
  15812. Clips the pixel with the minimum and maximum of respectively the maximum and
  15813. minimum of each pair of opposite neighbour pixels.
  15814. @item 18
  15815. Line-sensitive clipping using opposite neighbours whose greatest distance from
  15816. the current pixel is minimal.
  15817. @item 19
  15818. Replaces the pixel with the average of its 8 neighbours.
  15819. @item 20
  15820. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  15821. @item 21
  15822. Clips pixels using the averages of opposite neighbour.
  15823. @item 22
  15824. Same as mode 21 but simpler and faster.
  15825. @item 23
  15826. Small edge and halo removal, but reputed useless.
  15827. @item 24
  15828. Similar as 23.
  15829. @end table
  15830. @section removelogo
  15831. Suppress a TV station logo, using an image file to determine which
  15832. pixels comprise the logo. It works by filling in the pixels that
  15833. comprise the logo with neighboring pixels.
  15834. The filter accepts the following options:
  15835. @table @option
  15836. @item filename, f
  15837. Set the filter bitmap file, which can be any image format supported by
  15838. libavformat. The width and height of the image file must match those of the
  15839. video stream being processed.
  15840. @end table
  15841. Pixels in the provided bitmap image with a value of zero are not
  15842. considered part of the logo, non-zero pixels are considered part of
  15843. the logo. If you use white (255) for the logo and black (0) for the
  15844. rest, you will be safe. For making the filter bitmap, it is
  15845. recommended to take a screen capture of a black frame with the logo
  15846. visible, and then using a threshold filter followed by the erode
  15847. filter once or twice.
  15848. If needed, little splotches can be fixed manually. Remember that if
  15849. logo pixels are not covered, the filter quality will be much
  15850. reduced. Marking too many pixels as part of the logo does not hurt as
  15851. much, but it will increase the amount of blurring needed to cover over
  15852. the image and will destroy more information than necessary, and extra
  15853. pixels will slow things down on a large logo.
  15854. @section repeatfields
  15855. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15856. fields based on its value.
  15857. @section reverse
  15858. Reverse a video clip.
  15859. Warning: This filter requires memory to buffer the entire clip, so trimming
  15860. is suggested.
  15861. @subsection Examples
  15862. @itemize
  15863. @item
  15864. Take the first 5 seconds of a clip, and reverse it.
  15865. @example
  15866. trim=end=5,reverse
  15867. @end example
  15868. @end itemize
  15869. @section rgbashift
  15870. Shift R/G/B/A pixels horizontally and/or vertically.
  15871. The filter accepts the following options:
  15872. @table @option
  15873. @item rh
  15874. Set amount to shift red horizontally.
  15875. @item rv
  15876. Set amount to shift red vertically.
  15877. @item gh
  15878. Set amount to shift green horizontally.
  15879. @item gv
  15880. Set amount to shift green vertically.
  15881. @item bh
  15882. Set amount to shift blue horizontally.
  15883. @item bv
  15884. Set amount to shift blue vertically.
  15885. @item ah
  15886. Set amount to shift alpha horizontally.
  15887. @item av
  15888. Set amount to shift alpha vertically.
  15889. @item edge
  15890. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15891. @end table
  15892. @subsection Commands
  15893. This filter supports the all above options as @ref{commands}.
  15894. @section roberts
  15895. Apply roberts cross operator to input video stream.
  15896. The filter accepts the following option:
  15897. @table @option
  15898. @item planes
  15899. Set which planes will be processed, unprocessed planes will be copied.
  15900. By default value 0xf, all planes will be processed.
  15901. @item scale
  15902. Set value which will be multiplied with filtered result.
  15903. @item delta
  15904. Set value which will be added to filtered result.
  15905. @end table
  15906. @subsection Commands
  15907. This filter supports the all above options as @ref{commands}.
  15908. @section rotate
  15909. Rotate video by an arbitrary angle expressed in radians.
  15910. The filter accepts the following options:
  15911. A description of the optional parameters follows.
  15912. @table @option
  15913. @item angle, a
  15914. Set an expression for the angle by which to rotate the input video
  15915. clockwise, expressed as a number of radians. A negative value will
  15916. result in a counter-clockwise rotation. By default it is set to "0".
  15917. This expression is evaluated for each frame.
  15918. @item out_w, ow
  15919. Set the output width expression, default value is "iw".
  15920. This expression is evaluated just once during configuration.
  15921. @item out_h, oh
  15922. Set the output height expression, default value is "ih".
  15923. This expression is evaluated just once during configuration.
  15924. @item bilinear
  15925. Enable bilinear interpolation if set to 1, a value of 0 disables
  15926. it. Default value is 1.
  15927. @item fillcolor, c
  15928. Set the color used to fill the output area not covered by the rotated
  15929. image. For the general syntax of this option, check the
  15930. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15931. If the special value "none" is selected then no
  15932. background is printed (useful for example if the background is never shown).
  15933. Default value is "black".
  15934. @end table
  15935. The expressions for the angle and the output size can contain the
  15936. following constants and functions:
  15937. @table @option
  15938. @item n
  15939. sequential number of the input frame, starting from 0. It is always NAN
  15940. before the first frame is filtered.
  15941. @item t
  15942. time in seconds of the input frame, it is set to 0 when the filter is
  15943. configured. It is always NAN before the first frame is filtered.
  15944. @item hsub
  15945. @item vsub
  15946. horizontal and vertical chroma subsample values. For example for the
  15947. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15948. @item in_w, iw
  15949. @item in_h, ih
  15950. the input video width and height
  15951. @item out_w, ow
  15952. @item out_h, oh
  15953. the output width and height, that is the size of the padded area as
  15954. specified by the @var{width} and @var{height} expressions
  15955. @item rotw(a)
  15956. @item roth(a)
  15957. the minimal width/height required for completely containing the input
  15958. video rotated by @var{a} radians.
  15959. These are only available when computing the @option{out_w} and
  15960. @option{out_h} expressions.
  15961. @end table
  15962. @subsection Examples
  15963. @itemize
  15964. @item
  15965. Rotate the input by PI/6 radians clockwise:
  15966. @example
  15967. rotate=PI/6
  15968. @end example
  15969. @item
  15970. Rotate the input by PI/6 radians counter-clockwise:
  15971. @example
  15972. rotate=-PI/6
  15973. @end example
  15974. @item
  15975. Rotate the input by 45 degrees clockwise:
  15976. @example
  15977. rotate=45*PI/180
  15978. @end example
  15979. @item
  15980. Apply a constant rotation with period T, starting from an angle of PI/3:
  15981. @example
  15982. rotate=PI/3+2*PI*t/T
  15983. @end example
  15984. @item
  15985. Make the input video rotation oscillating with a period of T
  15986. seconds and an amplitude of A radians:
  15987. @example
  15988. rotate=A*sin(2*PI/T*t)
  15989. @end example
  15990. @item
  15991. Rotate the video, output size is chosen so that the whole rotating
  15992. input video is always completely contained in the output:
  15993. @example
  15994. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15995. @end example
  15996. @item
  15997. Rotate the video, reduce the output size so that no background is ever
  15998. shown:
  15999. @example
  16000. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  16001. @end example
  16002. @end itemize
  16003. @subsection Commands
  16004. The filter supports the following commands:
  16005. @table @option
  16006. @item a, angle
  16007. Set the angle expression.
  16008. The command accepts the same syntax of the corresponding option.
  16009. If the specified expression is not valid, it is kept at its current
  16010. value.
  16011. @end table
  16012. @section sab
  16013. Apply Shape Adaptive Blur.
  16014. The filter accepts the following options:
  16015. @table @option
  16016. @item luma_radius, lr
  16017. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  16018. value is 1.0. A greater value will result in a more blurred image, and
  16019. in slower processing.
  16020. @item luma_pre_filter_radius, lpfr
  16021. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  16022. value is 1.0.
  16023. @item luma_strength, ls
  16024. Set luma maximum difference between pixels to still be considered, must
  16025. be a value in the 0.1-100.0 range, default value is 1.0.
  16026. @item chroma_radius, cr
  16027. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  16028. greater value will result in a more blurred image, and in slower
  16029. processing.
  16030. @item chroma_pre_filter_radius, cpfr
  16031. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  16032. @item chroma_strength, cs
  16033. Set chroma maximum difference between pixels to still be considered,
  16034. must be a value in the -0.9-100.0 range.
  16035. @end table
  16036. Each chroma option value, if not explicitly specified, is set to the
  16037. corresponding luma option value.
  16038. @anchor{scale}
  16039. @section scale
  16040. Scale (resize) the input video, using the libswscale library.
  16041. The scale filter forces the output display aspect ratio to be the same
  16042. of the input, by changing the output sample aspect ratio.
  16043. If the input image format is different from the format requested by
  16044. the next filter, the scale filter will convert the input to the
  16045. requested format.
  16046. @subsection Options
  16047. The filter accepts the following options, any of the options supported
  16048. by the libswscale scaler, as well as any of the @ref{framesync} options.
  16049. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  16050. the complete list of scaler options.
  16051. @table @option
  16052. @item width, w
  16053. @item height, h
  16054. Set the output video dimension expression. Default value is the input
  16055. dimension.
  16056. If the @var{width} or @var{w} value is 0, the input width is used for
  16057. the output. If the @var{height} or @var{h} value is 0, the input height
  16058. is used for the output.
  16059. If one and only one of the values is -n with n >= 1, the scale filter
  16060. will use a value that maintains the aspect ratio of the input image,
  16061. calculated from the other specified dimension. After that it will,
  16062. however, make sure that the calculated dimension is divisible by n and
  16063. adjust the value if necessary.
  16064. If both values are -n with n >= 1, the behavior will be identical to
  16065. both values being set to 0 as previously detailed.
  16066. See below for the list of accepted constants for use in the dimension
  16067. expression.
  16068. @item eval
  16069. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  16070. @table @samp
  16071. @item init
  16072. Only evaluate expressions once during the filter initialization or when a command is processed.
  16073. @item frame
  16074. Evaluate expressions for each incoming frame.
  16075. @end table
  16076. Default value is @samp{init}.
  16077. @item interl
  16078. Set the interlacing mode. It accepts the following values:
  16079. @table @samp
  16080. @item 1
  16081. Force interlaced aware scaling.
  16082. @item 0
  16083. Do not apply interlaced scaling.
  16084. @item -1
  16085. Select interlaced aware scaling depending on whether the source frames
  16086. are flagged as interlaced or not.
  16087. @end table
  16088. Default value is @samp{0}.
  16089. @item flags
  16090. Set libswscale scaling flags. See
  16091. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  16092. complete list of values. If not explicitly specified the filter applies
  16093. the default flags.
  16094. @item param0, param1
  16095. Set libswscale input parameters for scaling algorithms that need them. See
  16096. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  16097. complete documentation. If not explicitly specified the filter applies
  16098. empty parameters.
  16099. @item size, s
  16100. Set the video size. For the syntax of this option, check the
  16101. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16102. @item in_color_matrix
  16103. @item out_color_matrix
  16104. Set in/output YCbCr color space type.
  16105. This allows the autodetected value to be overridden as well as allows forcing
  16106. a specific value used for the output and encoder.
  16107. If not specified, the color space type depends on the pixel format.
  16108. Possible values:
  16109. @table @samp
  16110. @item auto
  16111. Choose automatically.
  16112. @item bt709
  16113. Format conforming to International Telecommunication Union (ITU)
  16114. Recommendation BT.709.
  16115. @item fcc
  16116. Set color space conforming to the United States Federal Communications
  16117. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  16118. @item bt601
  16119. @item bt470
  16120. @item smpte170m
  16121. Set color space conforming to:
  16122. @itemize
  16123. @item
  16124. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  16125. @item
  16126. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  16127. @item
  16128. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  16129. @end itemize
  16130. @item smpte240m
  16131. Set color space conforming to SMPTE ST 240:1999.
  16132. @item bt2020
  16133. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  16134. @end table
  16135. @item in_range
  16136. @item out_range
  16137. Set in/output YCbCr sample range.
  16138. This allows the autodetected value to be overridden as well as allows forcing
  16139. a specific value used for the output and encoder. If not specified, the
  16140. range depends on the pixel format. Possible values:
  16141. @table @samp
  16142. @item auto/unknown
  16143. Choose automatically.
  16144. @item jpeg/full/pc
  16145. Set full range (0-255 in case of 8-bit luma).
  16146. @item mpeg/limited/tv
  16147. Set "MPEG" range (16-235 in case of 8-bit luma).
  16148. @end table
  16149. @item force_original_aspect_ratio
  16150. Enable decreasing or increasing output video width or height if necessary to
  16151. keep the original aspect ratio. Possible values:
  16152. @table @samp
  16153. @item disable
  16154. Scale the video as specified and disable this feature.
  16155. @item decrease
  16156. The output video dimensions will automatically be decreased if needed.
  16157. @item increase
  16158. The output video dimensions will automatically be increased if needed.
  16159. @end table
  16160. One useful instance of this option is that when you know a specific device's
  16161. maximum allowed resolution, you can use this to limit the output video to
  16162. that, while retaining the aspect ratio. For example, device A allows
  16163. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  16164. decrease) and specifying 1280x720 to the command line makes the output
  16165. 1280x533.
  16166. Please note that this is a different thing than specifying -1 for @option{w}
  16167. or @option{h}, you still need to specify the output resolution for this option
  16168. to work.
  16169. @item force_divisible_by
  16170. Ensures that both the output dimensions, width and height, are divisible by the
  16171. given integer when used together with @option{force_original_aspect_ratio}. This
  16172. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16173. This option respects the value set for @option{force_original_aspect_ratio},
  16174. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16175. may be slightly modified.
  16176. This option can be handy if you need to have a video fit within or exceed
  16177. a defined resolution using @option{force_original_aspect_ratio} but also have
  16178. encoder restrictions on width or height divisibility.
  16179. @end table
  16180. The values of the @option{w} and @option{h} options are expressions
  16181. containing the following constants:
  16182. @table @var
  16183. @item in_w
  16184. @item in_h
  16185. The input width and height
  16186. @item iw
  16187. @item ih
  16188. These are the same as @var{in_w} and @var{in_h}.
  16189. @item out_w
  16190. @item out_h
  16191. The output (scaled) width and height
  16192. @item ow
  16193. @item oh
  16194. These are the same as @var{out_w} and @var{out_h}
  16195. @item a
  16196. The same as @var{iw} / @var{ih}
  16197. @item sar
  16198. input sample aspect ratio
  16199. @item dar
  16200. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16201. @item hsub
  16202. @item vsub
  16203. horizontal and vertical input chroma subsample values. For example for the
  16204. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16205. @item ohsub
  16206. @item ovsub
  16207. horizontal and vertical output chroma subsample values. For example for the
  16208. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16209. @item n
  16210. The (sequential) number of the input frame, starting from 0.
  16211. Only available with @code{eval=frame}.
  16212. @item t
  16213. The presentation timestamp of the input frame, expressed as a number of
  16214. seconds. Only available with @code{eval=frame}.
  16215. @item pos
  16216. The position (byte offset) of the frame in the input stream, or NaN if
  16217. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16218. Only available with @code{eval=frame}.
  16219. Deprecated, do not use.
  16220. @item ref_w, rw
  16221. @item ref_h, rh
  16222. @item ref_a
  16223. @item ref_dar, rdar
  16224. @item ref_n
  16225. @item ref_t
  16226. @item ref_pos
  16227. Eqvuialent to the above, but for a second reference input. If any of these
  16228. variables are present, this filter accepts two inputs.
  16229. @end table
  16230. @subsection Examples
  16231. @itemize
  16232. @item
  16233. Scale the input video to a size of 200x100
  16234. @example
  16235. scale=w=200:h=100
  16236. @end example
  16237. This is equivalent to:
  16238. @example
  16239. scale=200:100
  16240. @end example
  16241. or:
  16242. @example
  16243. scale=200x100
  16244. @end example
  16245. @item
  16246. Specify a size abbreviation for the output size:
  16247. @example
  16248. scale=qcif
  16249. @end example
  16250. which can also be written as:
  16251. @example
  16252. scale=size=qcif
  16253. @end example
  16254. @item
  16255. Scale the input to 2x:
  16256. @example
  16257. scale=w=2*iw:h=2*ih
  16258. @end example
  16259. @item
  16260. The above is the same as:
  16261. @example
  16262. scale=2*in_w:2*in_h
  16263. @end example
  16264. @item
  16265. Scale the input to 2x with forced interlaced scaling:
  16266. @example
  16267. scale=2*iw:2*ih:interl=1
  16268. @end example
  16269. @item
  16270. Scale the input to half size:
  16271. @example
  16272. scale=w=iw/2:h=ih/2
  16273. @end example
  16274. @item
  16275. Increase the width, and set the height to the same size:
  16276. @example
  16277. scale=3/2*iw:ow
  16278. @end example
  16279. @item
  16280. Seek Greek harmony:
  16281. @example
  16282. scale=iw:1/PHI*iw
  16283. scale=ih*PHI:ih
  16284. @end example
  16285. @item
  16286. Increase the height, and set the width to 3/2 of the height:
  16287. @example
  16288. scale=w=3/2*oh:h=3/5*ih
  16289. @end example
  16290. @item
  16291. Increase the size, making the size a multiple of the chroma
  16292. subsample values:
  16293. @example
  16294. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  16295. @end example
  16296. @item
  16297. Increase the width to a maximum of 500 pixels,
  16298. keeping the same aspect ratio as the input:
  16299. @example
  16300. scale=w='min(500\, iw*3/2):h=-1'
  16301. @end example
  16302. @item
  16303. Make pixels square by combining scale and setsar:
  16304. @example
  16305. scale='trunc(ih*dar):ih',setsar=1/1
  16306. @end example
  16307. @item
  16308. Make pixels square by combining scale and setsar,
  16309. making sure the resulting resolution is even (required by some codecs):
  16310. @example
  16311. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  16312. @end example
  16313. @item
  16314. Scale a subtitle stream (sub) to match the main video (main) in size before
  16315. overlaying. ("scale2ref")
  16316. @example
  16317. '[main]split[a][b]; [ref][a]scale=rw:rh[c]; [b][c]overlay'
  16318. @end example
  16319. @item
  16320. Scale a logo to 1/10th the height of a video, while preserving its display
  16321. aspect ratio.
  16322. @example
  16323. [logo-in][video-in]scale=w=oh*dar:h=rh/10[logo-out]
  16324. @end example
  16325. @end itemize
  16326. @subsection Commands
  16327. This filter supports the following commands:
  16328. @table @option
  16329. @item width, w
  16330. @item height, h
  16331. Set the output video dimension expression.
  16332. The command accepts the same syntax of the corresponding option.
  16333. If the specified expression is not valid, it is kept at its current
  16334. value.
  16335. @end table
  16336. @anchor{scale_cuda}
  16337. @section scale_cuda
  16338. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  16339. Setting the output width and height works in the same way as for the @ref{scale} filter.
  16340. The filter accepts the following options:
  16341. @table @option
  16342. @item w
  16343. @item h
  16344. Set the output video dimension expression. Default value is the input dimension.
  16345. Allows for the same expressions as the @ref{scale} filter.
  16346. @item interp_algo
  16347. Sets the algorithm used for scaling:
  16348. @table @var
  16349. @item nearest
  16350. Nearest neighbour
  16351. Used by default if input parameters match the desired output.
  16352. @item bilinear
  16353. Bilinear
  16354. @item bicubic
  16355. Bicubic
  16356. This is the default.
  16357. @item lanczos
  16358. Lanczos
  16359. @end table
  16360. @item format
  16361. Controls the output pixel format. By default, or if none is specified, the input
  16362. pixel format is used.
  16363. The filter does not support converting between YUV and RGB pixel formats.
  16364. @item passthrough
  16365. If set to 0, every frame is processed, even if no conversion is necessary.
  16366. This mode can be useful to use the filter as a buffer for a downstream
  16367. frame-consumer that exhausts the limited decoder frame pool.
  16368. If set to 1, frames are passed through as-is if they match the desired output
  16369. parameters. This is the default behaviour.
  16370. @item param
  16371. Algorithm-Specific parameter.
  16372. Affects the curves of the bicubic algorithm.
  16373. @item force_original_aspect_ratio
  16374. @item force_divisible_by
  16375. Work the same as the identical @ref{scale} filter options.
  16376. @end table
  16377. @subsection Examples
  16378. @itemize
  16379. @item
  16380. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  16381. @example
  16382. scale_cuda=-2:720:format=yuv420p
  16383. @end example
  16384. @item
  16385. Upscale to 4K using nearest neighbour algorithm.
  16386. @example
  16387. scale_cuda=4096:2160:interp_algo=nearest
  16388. @end example
  16389. @item
  16390. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  16391. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  16392. decoders frame pool.
  16393. @example
  16394. scale_cuda=passthrough=0
  16395. @end example
  16396. @end itemize
  16397. @anchor{scale_npp}
  16398. @section scale_npp
  16399. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  16400. format conversion on CUDA video frames. Setting the output width and height
  16401. works in the same way as for the @var{scale} filter.
  16402. The following additional options are accepted:
  16403. @table @option
  16404. @item format
  16405. The pixel format of the output CUDA frames. If set to the string "same" (the
  16406. default), the input format will be kept. Note that automatic format negotiation
  16407. and conversion is not yet supported for hardware frames
  16408. @item interp_algo
  16409. The interpolation algorithm used for resizing. One of the following:
  16410. @table @option
  16411. @item nn
  16412. Nearest neighbour.
  16413. @item linear
  16414. @item cubic
  16415. @item cubic2p_bspline
  16416. 2-parameter cubic (B=1, C=0)
  16417. @item cubic2p_catmullrom
  16418. 2-parameter cubic (B=0, C=1/2)
  16419. @item cubic2p_b05c03
  16420. 2-parameter cubic (B=1/2, C=3/10)
  16421. @item super
  16422. Supersampling
  16423. @item lanczos
  16424. @end table
  16425. @item force_original_aspect_ratio
  16426. Enable decreasing or increasing output video width or height if necessary to
  16427. keep the original aspect ratio. Possible values:
  16428. @table @samp
  16429. @item disable
  16430. Scale the video as specified and disable this feature.
  16431. @item decrease
  16432. The output video dimensions will automatically be decreased if needed.
  16433. @item increase
  16434. The output video dimensions will automatically be increased if needed.
  16435. @end table
  16436. One useful instance of this option is that when you know a specific device's
  16437. maximum allowed resolution, you can use this to limit the output video to
  16438. that, while retaining the aspect ratio. For example, device A allows
  16439. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  16440. decrease) and specifying 1280x720 to the command line makes the output
  16441. 1280x533.
  16442. Please note that this is a different thing than specifying -1 for @option{w}
  16443. or @option{h}, you still need to specify the output resolution for this option
  16444. to work.
  16445. @item force_divisible_by
  16446. Ensures that both the output dimensions, width and height, are divisible by the
  16447. given integer when used together with @option{force_original_aspect_ratio}. This
  16448. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16449. This option respects the value set for @option{force_original_aspect_ratio},
  16450. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16451. may be slightly modified.
  16452. This option can be handy if you need to have a video fit within or exceed
  16453. a defined resolution using @option{force_original_aspect_ratio} but also have
  16454. encoder restrictions on width or height divisibility.
  16455. @item eval
  16456. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  16457. @table @samp
  16458. @item init
  16459. Only evaluate expressions once during the filter initialization or when a command is processed.
  16460. @item frame
  16461. Evaluate expressions for each incoming frame.
  16462. @end table
  16463. @end table
  16464. The values of the @option{w} and @option{h} options are expressions
  16465. containing the following constants:
  16466. @table @var
  16467. @item in_w
  16468. @item in_h
  16469. The input width and height
  16470. @item iw
  16471. @item ih
  16472. These are the same as @var{in_w} and @var{in_h}.
  16473. @item out_w
  16474. @item out_h
  16475. The output (scaled) width and height
  16476. @item ow
  16477. @item oh
  16478. These are the same as @var{out_w} and @var{out_h}
  16479. @item a
  16480. The same as @var{iw} / @var{ih}
  16481. @item sar
  16482. input sample aspect ratio
  16483. @item dar
  16484. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16485. @item n
  16486. The (sequential) number of the input frame, starting from 0.
  16487. Only available with @code{eval=frame}.
  16488. @item t
  16489. The presentation timestamp of the input frame, expressed as a number of
  16490. seconds. Only available with @code{eval=frame}.
  16491. @item pos
  16492. The position (byte offset) of the frame in the input stream, or NaN if
  16493. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16494. Only available with @code{eval=frame}.
  16495. Deprecated, do not use.
  16496. @end table
  16497. @section scale2ref_npp
  16498. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  16499. video, based on a reference video.
  16500. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  16501. but uses the reference video instead of the main input as basis. scale2ref_npp
  16502. also supports the following additional constants for the @option{w} and
  16503. @option{h} options:
  16504. @table @var
  16505. @item main_w
  16506. @item main_h
  16507. The main input video's width and height
  16508. @item main_a
  16509. The same as @var{main_w} / @var{main_h}
  16510. @item main_sar
  16511. The main input video's sample aspect ratio
  16512. @item main_dar, mdar
  16513. The main input video's display aspect ratio. Calculated from
  16514. @code{(main_w / main_h) * main_sar}.
  16515. @item main_n
  16516. The (sequential) number of the main input frame, starting from 0.
  16517. Only available with @code{eval=frame}.
  16518. @item main_t
  16519. The presentation timestamp of the main input frame, expressed as a number of
  16520. seconds. Only available with @code{eval=frame}.
  16521. @item main_pos
  16522. The position (byte offset) of the frame in the main input stream, or NaN if
  16523. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16524. Only available with @code{eval=frame}.
  16525. @end table
  16526. @subsection Examples
  16527. @itemize
  16528. @item
  16529. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  16530. @example
  16531. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  16532. @end example
  16533. @item
  16534. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  16535. @example
  16536. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  16537. @end example
  16538. @end itemize
  16539. @section scale_vt
  16540. Scale and convert the color parameters using VTPixelTransferSession.
  16541. The filter accepts the following options:
  16542. @table @option
  16543. @item w
  16544. @item h
  16545. Set the output video dimension expression. Default value is the input dimension.
  16546. @item color_matrix
  16547. Set the output colorspace matrix.
  16548. @item color_primaries
  16549. Set the output color primaries.
  16550. @item color_transfer
  16551. Set the output transfer characteristics.
  16552. @end table
  16553. @section scharr
  16554. Apply scharr operator to input video stream.
  16555. The filter accepts the following option:
  16556. @table @option
  16557. @item planes
  16558. Set which planes will be processed, unprocessed planes will be copied.
  16559. By default value 0xf, all planes will be processed.
  16560. @item scale
  16561. Set value which will be multiplied with filtered result.
  16562. @item delta
  16563. Set value which will be added to filtered result.
  16564. @end table
  16565. @subsection Commands
  16566. This filter supports the all above options as @ref{commands}.
  16567. @section scroll
  16568. Scroll input video horizontally and/or vertically by constant speed.
  16569. The filter accepts the following options:
  16570. @table @option
  16571. @item horizontal, h
  16572. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16573. Negative values changes scrolling direction.
  16574. @item vertical, v
  16575. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16576. Negative values changes scrolling direction.
  16577. @item hpos
  16578. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  16579. @item vpos
  16580. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  16581. @end table
  16582. @subsection Commands
  16583. This filter supports the following @ref{commands}:
  16584. @table @option
  16585. @item horizontal, h
  16586. Set the horizontal scrolling speed.
  16587. @item vertical, v
  16588. Set the vertical scrolling speed.
  16589. @end table
  16590. @anchor{scdet}
  16591. @section scdet
  16592. Detect video scene change.
  16593. This filter sets frame metadata with mafd between frame, the scene score, and
  16594. forward the frame to the next filter, so they can use these metadata to detect
  16595. scene change or others.
  16596. In addition, this filter logs a message and sets frame metadata when it detects
  16597. a scene change by @option{threshold}.
  16598. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  16599. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  16600. to detect scene change.
  16601. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  16602. detect scene change with @option{threshold}.
  16603. The filter accepts the following options:
  16604. @table @option
  16605. @item threshold, t
  16606. Set the scene change detection threshold as a percentage of maximum change. Good
  16607. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  16608. @code{[0., 100.]}.
  16609. Default value is @code{10.}.
  16610. @item sc_pass, s
  16611. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  16612. You can enable it if you want to get snapshot of scene change frames only.
  16613. @end table
  16614. @anchor{selectivecolor}
  16615. @section selectivecolor
  16616. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  16617. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  16618. by the "purity" of the color (that is, how saturated it already is).
  16619. This filter is similar to the Adobe Photoshop Selective Color tool.
  16620. The filter accepts the following options:
  16621. @table @option
  16622. @item correction_method
  16623. Select color correction method.
  16624. Available values are:
  16625. @table @samp
  16626. @item absolute
  16627. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  16628. component value).
  16629. @item relative
  16630. Specified adjustments are relative to the original component value.
  16631. @end table
  16632. Default is @code{absolute}.
  16633. @item reds
  16634. Adjustments for red pixels (pixels where the red component is the maximum)
  16635. @item yellows
  16636. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  16637. @item greens
  16638. Adjustments for green pixels (pixels where the green component is the maximum)
  16639. @item cyans
  16640. Adjustments for cyan pixels (pixels where the red component is the minimum)
  16641. @item blues
  16642. Adjustments for blue pixels (pixels where the blue component is the maximum)
  16643. @item magentas
  16644. Adjustments for magenta pixels (pixels where the green component is the minimum)
  16645. @item whites
  16646. Adjustments for white pixels (pixels where all components are greater than 128)
  16647. @item neutrals
  16648. Adjustments for all pixels except pure black and pure white
  16649. @item blacks
  16650. Adjustments for black pixels (pixels where all components are lesser than 128)
  16651. @item psfile
  16652. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  16653. @end table
  16654. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  16655. 4 space separated floating point adjustment values in the [-1,1] range,
  16656. respectively to adjust the amount of cyan, magenta, yellow and black for the
  16657. pixels of its range.
  16658. @subsection Examples
  16659. @itemize
  16660. @item
  16661. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  16662. increase magenta by 27% in blue areas:
  16663. @example
  16664. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  16665. @end example
  16666. @item
  16667. Use a Photoshop selective color preset:
  16668. @example
  16669. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  16670. @end example
  16671. @end itemize
  16672. @anchor{separatefields}
  16673. @section separatefields
  16674. The @code{separatefields} takes a frame-based video input and splits
  16675. each frame into its components fields, producing a new half height clip
  16676. with twice the frame rate and twice the frame count.
  16677. This filter use field-dominance information in frame to decide which
  16678. of each pair of fields to place first in the output.
  16679. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  16680. @section setdar, setsar
  16681. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  16682. output video.
  16683. This is done by changing the specified Sample (aka Pixel) Aspect
  16684. Ratio, according to the following equation:
  16685. @example
  16686. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  16687. @end example
  16688. Keep in mind that the @code{setdar} filter does not modify the pixel
  16689. dimensions of the video frame. Also, the display aspect ratio set by
  16690. this filter may be changed by later filters in the filterchain,
  16691. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  16692. applied.
  16693. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  16694. the filter output video.
  16695. Note that as a consequence of the application of this filter, the
  16696. output display aspect ratio will change according to the equation
  16697. above.
  16698. Keep in mind that the sample aspect ratio set by the @code{setsar}
  16699. filter may be changed by later filters in the filterchain, e.g. if
  16700. another "setsar" or a "setdar" filter is applied.
  16701. It accepts the following parameters:
  16702. @table @option
  16703. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  16704. Set the aspect ratio used by the filter.
  16705. The parameter can be a floating point number string, or an expression. If the
  16706. parameter is not specified, the value "0" is assumed, meaning that the same
  16707. input value is used.
  16708. @item max
  16709. Set the maximum integer value to use for expressing numerator and
  16710. denominator when reducing the expressed aspect ratio to a rational.
  16711. Default value is @code{100}.
  16712. @end table
  16713. The parameter @var{sar} is an expression containing the following constants:
  16714. @table @option
  16715. @item w, h
  16716. The input width and height.
  16717. @item a
  16718. Same as @var{w} / @var{h}.
  16719. @item sar
  16720. The input sample aspect ratio.
  16721. @item dar
  16722. The input display aspect ratio. It is the same as
  16723. (@var{w} / @var{h}) * @var{sar}.
  16724. @item hsub, vsub
  16725. Horizontal and vertical chroma subsample values. For example, for the
  16726. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16727. @end table
  16728. @subsection Examples
  16729. @itemize
  16730. @item
  16731. To change the display aspect ratio to 16:9, specify one of the following:
  16732. @example
  16733. setdar=dar=1.77777
  16734. setdar=dar=16/9
  16735. @end example
  16736. @item
  16737. To change the sample aspect ratio to 10:11, specify:
  16738. @example
  16739. setsar=sar=10/11
  16740. @end example
  16741. @item
  16742. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  16743. 1000 in the aspect ratio reduction, use the command:
  16744. @example
  16745. setdar=ratio=16/9:max=1000
  16746. @end example
  16747. @end itemize
  16748. @anchor{setfield}
  16749. @section setfield
  16750. Force field for the output video frame.
  16751. The @code{setfield} filter marks the interlace type field for the
  16752. output frames. It does not change the input frame, but only sets the
  16753. corresponding property, which affects how the frame is treated by
  16754. following filters (e.g. @code{fieldorder} or @code{yadif}).
  16755. The filter accepts the following options:
  16756. @table @option
  16757. @item mode
  16758. Available values are:
  16759. @table @samp
  16760. @item auto
  16761. Keep the same field property.
  16762. @item bff
  16763. Mark the frame as bottom-field-first.
  16764. @item tff
  16765. Mark the frame as top-field-first.
  16766. @item prog
  16767. Mark the frame as progressive.
  16768. @end table
  16769. @end table
  16770. @anchor{setparams}
  16771. @section setparams
  16772. Force frame parameter for the output video frame.
  16773. The @code{setparams} filter marks interlace and color range for the
  16774. output frames. It does not change the input frame, but only sets the
  16775. corresponding property, which affects how the frame is treated by
  16776. filters/encoders.
  16777. @table @option
  16778. @item field_mode
  16779. Available values are:
  16780. @table @samp
  16781. @item auto
  16782. Keep the same field property (default).
  16783. @item bff
  16784. Mark the frame as bottom-field-first.
  16785. @item tff
  16786. Mark the frame as top-field-first.
  16787. @item prog
  16788. Mark the frame as progressive.
  16789. @end table
  16790. @item range
  16791. Available values are:
  16792. @table @samp
  16793. @item auto
  16794. Keep the same color range property (default).
  16795. @item unspecified, unknown
  16796. Mark the frame as unspecified color range.
  16797. @item limited, tv, mpeg
  16798. Mark the frame as limited range.
  16799. @item full, pc, jpeg
  16800. Mark the frame as full range.
  16801. @end table
  16802. @item color_primaries
  16803. Set the color primaries.
  16804. Available values are:
  16805. @table @samp
  16806. @item auto
  16807. Keep the same color primaries property (default).
  16808. @item bt709
  16809. @item unknown
  16810. @item bt470m
  16811. @item bt470bg
  16812. @item smpte170m
  16813. @item smpte240m
  16814. @item film
  16815. @item bt2020
  16816. @item smpte428
  16817. @item smpte431
  16818. @item smpte432
  16819. @item jedec-p22
  16820. @end table
  16821. @item color_trc
  16822. Set the color transfer.
  16823. Available values are:
  16824. @table @samp
  16825. @item auto
  16826. Keep the same color trc property (default).
  16827. @item bt709
  16828. @item unknown
  16829. @item bt470m
  16830. @item bt470bg
  16831. @item smpte170m
  16832. @item smpte240m
  16833. @item linear
  16834. @item log100
  16835. @item log316
  16836. @item iec61966-2-4
  16837. @item bt1361e
  16838. @item iec61966-2-1
  16839. @item bt2020-10
  16840. @item bt2020-12
  16841. @item smpte2084
  16842. @item smpte428
  16843. @item arib-std-b67
  16844. @end table
  16845. @item colorspace
  16846. Set the colorspace.
  16847. Available values are:
  16848. @table @samp
  16849. @item auto
  16850. Keep the same colorspace property (default).
  16851. @item gbr
  16852. @item bt709
  16853. @item unknown
  16854. @item fcc
  16855. @item bt470bg
  16856. @item smpte170m
  16857. @item smpte240m
  16858. @item ycgco
  16859. @item bt2020nc
  16860. @item bt2020c
  16861. @item smpte2085
  16862. @item chroma-derived-nc
  16863. @item chroma-derived-c
  16864. @item ictcp
  16865. @end table
  16866. @end table
  16867. @section sharpen_npp
  16868. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  16869. border control.
  16870. The following additional options are accepted:
  16871. @table @option
  16872. @item border_type
  16873. Type of sampling to be used ad frame borders. One of the following:
  16874. @table @option
  16875. @item replicate
  16876. Replicate pixel values.
  16877. @end table
  16878. @end table
  16879. @section shear
  16880. Apply shear transform to input video.
  16881. This filter supports the following options:
  16882. @table @option
  16883. @item shx
  16884. Shear factor in X-direction. Default value is 0.
  16885. Allowed range is from -2 to 2.
  16886. @item shy
  16887. Shear factor in Y-direction. Default value is 0.
  16888. Allowed range is from -2 to 2.
  16889. @item fillcolor, c
  16890. Set the color used to fill the output area not covered by the transformed
  16891. video. For the general syntax of this option, check the
  16892. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16893. If the special value "none" is selected then no
  16894. background is printed (useful for example if the background is never shown).
  16895. Default value is "black".
  16896. @item interp
  16897. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  16898. @end table
  16899. @subsection Commands
  16900. This filter supports the all above options as @ref{commands}.
  16901. @section showinfo
  16902. Show a line containing various information for each input video frame.
  16903. The input video is not modified.
  16904. This filter supports the following options:
  16905. @table @option
  16906. @item checksum
  16907. Calculate checksums of each plane. By default enabled.
  16908. @item udu_sei_as_ascii
  16909. Try to print user data unregistered SEI as ascii character when possible,
  16910. in hex format otherwise.
  16911. @end table
  16912. The shown line contains a sequence of key/value pairs of the form
  16913. @var{key}:@var{value}.
  16914. The following values are shown in the output:
  16915. @table @option
  16916. @item n
  16917. The (sequential) number of the input frame, starting from 0.
  16918. @item pts
  16919. The Presentation TimeStamp of the input frame, expressed as a number of
  16920. time base units. The time base unit depends on the filter input pad.
  16921. @item pts_time
  16922. The Presentation TimeStamp of the input frame, expressed as a number of
  16923. seconds.
  16924. @item fmt
  16925. The pixel format name.
  16926. @item sar
  16927. The sample aspect ratio of the input frame, expressed in the form
  16928. @var{num}/@var{den}.
  16929. @item s
  16930. The size of the input frame. For the syntax of this option, check the
  16931. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16932. @item i
  16933. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  16934. for bottom field first).
  16935. @item iskey
  16936. This is 1 if the frame is a key frame, 0 otherwise.
  16937. @item type
  16938. The picture type of the input frame ("I" for an I-frame, "P" for a
  16939. P-frame, "B" for a B-frame, or "?" for an unknown type).
  16940. Also refer to the documentation of the @code{AVPictureType} enum and of
  16941. the @code{av_get_picture_type_char} function defined in
  16942. @file{libavutil/avutil.h}.
  16943. @item checksum
  16944. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  16945. @item plane_checksum
  16946. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  16947. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  16948. @item mean
  16949. The mean value of pixels in each plane of the input frame, expressed in the form
  16950. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  16951. @item stdev
  16952. The standard deviation of pixel values in each plane of the input frame, expressed
  16953. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  16954. @end table
  16955. @section showpalette
  16956. Displays the 256 colors palette of each frame. This filter is only relevant for
  16957. @var{pal8} pixel format frames.
  16958. It accepts the following option:
  16959. @table @option
  16960. @item s
  16961. Set the size of the box used to represent one palette color entry. Default is
  16962. @code{30} (for a @code{30x30} pixel box).
  16963. @end table
  16964. @section shuffleframes
  16965. Reorder and/or duplicate and/or drop video frames.
  16966. It accepts the following parameters:
  16967. @table @option
  16968. @item mapping
  16969. Set the destination indexes of input frames.
  16970. This is space or '|' separated list of indexes that maps input frames to output
  16971. frames. Number of indexes also sets maximal value that each index may have.
  16972. '-1' index have special meaning and that is to drop frame.
  16973. @end table
  16974. The first frame has the index 0. The default is to keep the input unchanged.
  16975. @subsection Examples
  16976. @itemize
  16977. @item
  16978. Swap second and third frame of every three frames of the input:
  16979. @example
  16980. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  16981. @end example
  16982. @item
  16983. Swap 10th and 1st frame of every ten frames of the input:
  16984. @example
  16985. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  16986. @end example
  16987. @end itemize
  16988. @section shufflepixels
  16989. Reorder pixels in video frames.
  16990. This filter accepts the following options:
  16991. @table @option
  16992. @item direction, d
  16993. Set shuffle direction. Can be forward or inverse direction.
  16994. Default direction is forward.
  16995. @item mode, m
  16996. Set shuffle mode. Can be horizontal, vertical or block mode.
  16997. @item width, w
  16998. @item height, h
  16999. Set shuffle block_size. In case of horizontal shuffle mode only width
  17000. part of size is used, and in case of vertical shuffle mode only height
  17001. part of size is used.
  17002. @item seed, s
  17003. Set random seed used with shuffling pixels. Mainly useful to set to be able
  17004. to reverse filtering process to get original input.
  17005. For example, to reverse forward shuffle you need to use same parameters
  17006. and exact same seed and to set direction to inverse.
  17007. @end table
  17008. @section shuffleplanes
  17009. Reorder and/or duplicate video planes.
  17010. It accepts the following parameters:
  17011. @table @option
  17012. @item map0
  17013. The index of the input plane to be used as the first output plane.
  17014. @item map1
  17015. The index of the input plane to be used as the second output plane.
  17016. @item map2
  17017. The index of the input plane to be used as the third output plane.
  17018. @item map3
  17019. The index of the input plane to be used as the fourth output plane.
  17020. @end table
  17021. The first plane has the index 0. The default is to keep the input unchanged.
  17022. @subsection Examples
  17023. @itemize
  17024. @item
  17025. Swap the second and third planes of the input:
  17026. @example
  17027. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  17028. @end example
  17029. @end itemize
  17030. @anchor{signalstats}
  17031. @section signalstats
  17032. Evaluate various visual metrics that assist in determining issues associated
  17033. with the digitization of analog video media.
  17034. By default the filter will log these metadata values:
  17035. @table @option
  17036. @item YMIN
  17037. Display the minimal Y value contained within the input frame. Expressed in
  17038. range of [0-255].
  17039. @item YLOW
  17040. Display the Y value at the 10% percentile within the input frame. Expressed in
  17041. range of [0-255].
  17042. @item YAVG
  17043. Display the average Y value within the input frame. Expressed in range of
  17044. [0-255].
  17045. @item YHIGH
  17046. Display the Y value at the 90% percentile within the input frame. Expressed in
  17047. range of [0-255].
  17048. @item YMAX
  17049. Display the maximum Y value contained within the input frame. Expressed in
  17050. range of [0-255].
  17051. @item UMIN
  17052. Display the minimal U value contained within the input frame. Expressed in
  17053. range of [0-255].
  17054. @item ULOW
  17055. Display the U value at the 10% percentile within the input frame. Expressed in
  17056. range of [0-255].
  17057. @item UAVG
  17058. Display the average U value within the input frame. Expressed in range of
  17059. [0-255].
  17060. @item UHIGH
  17061. Display the U value at the 90% percentile within the input frame. Expressed in
  17062. range of [0-255].
  17063. @item UMAX
  17064. Display the maximum U value contained within the input frame. Expressed in
  17065. range of [0-255].
  17066. @item VMIN
  17067. Display the minimal V value contained within the input frame. Expressed in
  17068. range of [0-255].
  17069. @item VLOW
  17070. Display the V value at the 10% percentile within the input frame. Expressed in
  17071. range of [0-255].
  17072. @item VAVG
  17073. Display the average V value within the input frame. Expressed in range of
  17074. [0-255].
  17075. @item VHIGH
  17076. Display the V value at the 90% percentile within the input frame. Expressed in
  17077. range of [0-255].
  17078. @item VMAX
  17079. Display the maximum V value contained within the input frame. Expressed in
  17080. range of [0-255].
  17081. @item SATMIN
  17082. Display the minimal saturation value contained within the input frame.
  17083. Expressed in range of [0-~181.02].
  17084. @item SATLOW
  17085. Display the saturation value at the 10% percentile within the input frame.
  17086. Expressed in range of [0-~181.02].
  17087. @item SATAVG
  17088. Display the average saturation value within the input frame. Expressed in range
  17089. of [0-~181.02].
  17090. @item SATHIGH
  17091. Display the saturation value at the 90% percentile within the input frame.
  17092. Expressed in range of [0-~181.02].
  17093. @item SATMAX
  17094. Display the maximum saturation value contained within the input frame.
  17095. Expressed in range of [0-~181.02].
  17096. @item HUEMED
  17097. Display the median value for hue within the input frame. Expressed in range of
  17098. [0-360].
  17099. @item HUEAVG
  17100. Display the average value for hue within the input frame. Expressed in range of
  17101. [0-360].
  17102. @item YDIF
  17103. Display the average of sample value difference between all values of the Y
  17104. plane in the current frame and corresponding values of the previous input frame.
  17105. Expressed in range of [0-255].
  17106. @item UDIF
  17107. Display the average of sample value difference between all values of the U
  17108. plane in the current frame and corresponding values of the previous input frame.
  17109. Expressed in range of [0-255].
  17110. @item VDIF
  17111. Display the average of sample value difference between all values of the V
  17112. plane in the current frame and corresponding values of the previous input frame.
  17113. Expressed in range of [0-255].
  17114. @item YBITDEPTH
  17115. Display bit depth of Y plane in current frame.
  17116. Expressed in range of [0-16].
  17117. @item UBITDEPTH
  17118. Display bit depth of U plane in current frame.
  17119. Expressed in range of [0-16].
  17120. @item VBITDEPTH
  17121. Display bit depth of V plane in current frame.
  17122. Expressed in range of [0-16].
  17123. @end table
  17124. The filter accepts the following options:
  17125. @table @option
  17126. @item stat
  17127. @item out
  17128. @option{stat} specify an additional form of image analysis.
  17129. @option{out} output video with the specified type of pixel highlighted.
  17130. Both options accept the following values:
  17131. @table @samp
  17132. @item tout
  17133. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  17134. unlike the neighboring pixels of the same field. Examples of temporal outliers
  17135. include the results of video dropouts, head clogs, or tape tracking issues.
  17136. @item vrep
  17137. Identify @var{vertical line repetition}. Vertical line repetition includes
  17138. similar rows of pixels within a frame. In born-digital video vertical line
  17139. repetition is common, but this pattern is uncommon in video digitized from an
  17140. analog source. When it occurs in video that results from the digitization of an
  17141. analog source it can indicate concealment from a dropout compensator.
  17142. @item brng
  17143. Identify pixels that fall outside of legal broadcast range.
  17144. @end table
  17145. @item color, c
  17146. Set the highlight color for the @option{out} option. The default color is
  17147. yellow.
  17148. @end table
  17149. @subsection Examples
  17150. @itemize
  17151. @item
  17152. Output data of various video metrics:
  17153. @example
  17154. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  17155. @end example
  17156. @item
  17157. Output specific data about the minimum and maximum values of the Y plane per frame:
  17158. @example
  17159. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  17160. @end example
  17161. @item
  17162. Playback video while highlighting pixels that are outside of broadcast range in red.
  17163. @example
  17164. ffplay example.mov -vf signalstats="out=brng:color=red"
  17165. @end example
  17166. @item
  17167. Playback video with signalstats metadata drawn over the frame.
  17168. @example
  17169. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  17170. @end example
  17171. The contents of signalstat_drawtext.txt used in the command are:
  17172. @example
  17173. time %@{pts:hms@}
  17174. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  17175. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  17176. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  17177. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  17178. @end example
  17179. @end itemize
  17180. @anchor{signature}
  17181. @section signature
  17182. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  17183. input. In this case the matching between the inputs can be calculated additionally.
  17184. The filter always passes through the first input. The signature of each stream can
  17185. be written into a file.
  17186. It accepts the following options:
  17187. @table @option
  17188. @item detectmode
  17189. Enable or disable the matching process.
  17190. Available values are:
  17191. @table @samp
  17192. @item off
  17193. Disable the calculation of a matching (default).
  17194. @item full
  17195. Calculate the matching for the whole video and output whether the whole video
  17196. matches or only parts.
  17197. @item fast
  17198. Calculate only until a matching is found or the video ends. Should be faster in
  17199. some cases.
  17200. @end table
  17201. @item nb_inputs
  17202. Set the number of inputs. The option value must be a non negative integer.
  17203. Default value is 1.
  17204. @item filename
  17205. Set the path to which the output is written. If there is more than one input,
  17206. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  17207. integer), that will be replaced with the input number. If no filename is
  17208. specified, no output will be written. This is the default.
  17209. @item format
  17210. Choose the output format.
  17211. Available values are:
  17212. @table @samp
  17213. @item binary
  17214. Use the specified binary representation (default).
  17215. @item xml
  17216. Use the specified xml representation.
  17217. @end table
  17218. @item th_d
  17219. Set threshold to detect one word as similar. The option value must be an integer
  17220. greater than zero. The default value is 9000.
  17221. @item th_dc
  17222. Set threshold to detect all words as similar. The option value must be an integer
  17223. greater than zero. The default value is 60000.
  17224. @item th_xh
  17225. Set threshold to detect frames as similar. The option value must be an integer
  17226. greater than zero. The default value is 116.
  17227. @item th_di
  17228. Set the minimum length of a sequence in frames to recognize it as matching
  17229. sequence. The option value must be a non negative integer value.
  17230. The default value is 0.
  17231. @item th_it
  17232. Set the minimum relation, that matching frames to all frames must have.
  17233. The option value must be a double value between 0 and 1. The default value is 0.5.
  17234. @end table
  17235. @subsection Examples
  17236. @itemize
  17237. @item
  17238. To calculate the signature of an input video and store it in signature.bin:
  17239. @example
  17240. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  17241. @end example
  17242. @item
  17243. To detect whether two videos match and store the signatures in XML format in
  17244. signature0.xml and signature1.xml:
  17245. @example
  17246. 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 -
  17247. @end example
  17248. @end itemize
  17249. @anchor{siti}
  17250. @section siti
  17251. Calculate Spatial Information (SI) and Temporal Information (TI) scores for a video,
  17252. as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment methods
  17253. for multimedia applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
  17254. Note that this is a legacy implementation that corresponds to a superseded recommendation.
  17255. 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}
  17256. It accepts the following option:
  17257. @table @option
  17258. @item print_summary
  17259. If set to 1, Summary statistics will be printed to the console. Default 0.
  17260. @end table
  17261. @subsection Examples
  17262. @itemize
  17263. @item
  17264. To calculate SI/TI metrics and print summary:
  17265. @example
  17266. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  17267. @end example
  17268. @end itemize
  17269. @anchor{smartblur}
  17270. @section smartblur
  17271. Blur the input video without impacting the outlines.
  17272. It accepts the following options:
  17273. @table @option
  17274. @item luma_radius, lr
  17275. Set the luma radius. The option value must be a float number in
  17276. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17277. used to blur the image (slower if larger). Default value is 1.0.
  17278. @item luma_strength, ls
  17279. Set the luma strength. The option value must be a float number
  17280. in the range [-1.0,1.0] that configures the blurring. A value included
  17281. in [0.0,1.0] will blur the image whereas a value included in
  17282. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  17283. @item luma_threshold, lt
  17284. Set the luma threshold used as a coefficient to determine
  17285. whether a pixel should be blurred or not. The option value must be an
  17286. integer in the range [-30,30]. A value of 0 will filter all the image,
  17287. a value included in [0,30] will filter flat areas and a value included
  17288. in [-30,0] will filter edges. Default value is 0.
  17289. @item chroma_radius, cr
  17290. Set the chroma radius. The option value must be a float number in
  17291. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17292. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  17293. @item chroma_strength, cs
  17294. Set the chroma strength. The option value must be a float number
  17295. in the range [-1.0,1.0] that configures the blurring. A value included
  17296. in [0.0,1.0] will blur the image whereas a value included in
  17297. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  17298. @item chroma_threshold, ct
  17299. Set the chroma threshold used as a coefficient to determine
  17300. whether a pixel should be blurred or not. The option value must be an
  17301. integer in the range [-30,30]. A value of 0 will filter all the image,
  17302. a value included in [0,30] will filter flat areas and a value included
  17303. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  17304. @item alpha_radius, ar
  17305. Set the alpha radius. The option value must be a float number in
  17306. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17307. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  17308. @item alpha_strength, as
  17309. Set the alpha strength. The option value must be a float number
  17310. in the range [-1.0,1.0] that configures the blurring. A value included
  17311. in [0.0,1.0] will blur the image whereas a value included in
  17312. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  17313. @item alpha_threshold, at
  17314. Set the alpha threshold used as a coefficient to determine
  17315. whether a pixel should be blurred or not. The option value must be an
  17316. integer in the range [-30,30]. A value of 0 will filter all the image,
  17317. a value included in [0,30] will filter flat areas and a value included
  17318. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  17319. @end table
  17320. If a chroma or alpha option is not explicitly set, the corresponding luma value
  17321. is set.
  17322. @section sobel
  17323. Apply sobel operator to input video stream.
  17324. The filter accepts the following option:
  17325. @table @option
  17326. @item planes
  17327. Set which planes will be processed, unprocessed planes will be copied.
  17328. By default value 0xf, all planes will be processed.
  17329. @item scale
  17330. Set value which will be multiplied with filtered result.
  17331. @item delta
  17332. Set value which will be added to filtered result.
  17333. @end table
  17334. @subsection Commands
  17335. This filter supports the all above options as @ref{commands}.
  17336. @anchor{spp}
  17337. @section spp
  17338. Apply a simple postprocessing filter that compresses and decompresses the image
  17339. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  17340. and average the results.
  17341. The filter accepts the following options:
  17342. @table @option
  17343. @item quality
  17344. Set quality. This option defines the number of levels for averaging. It accepts
  17345. an integer in the range 0-6. If set to @code{0}, the filter will have no
  17346. effect. A value of @code{6} means the higher quality. For each increment of
  17347. that value the speed drops by a factor of approximately 2. Default value is
  17348. @code{3}.
  17349. @item qp
  17350. Force a constant quantization parameter. If not set, the filter will use the QP
  17351. from the video stream (if available).
  17352. @item mode
  17353. Set thresholding mode. Available modes are:
  17354. @table @samp
  17355. @item hard
  17356. Set hard thresholding (default).
  17357. @item soft
  17358. Set soft thresholding (better de-ringing effect, but likely blurrier).
  17359. @end table
  17360. @item use_bframe_qp
  17361. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  17362. option may cause flicker since the B-Frames have often larger QP. Default is
  17363. @code{0} (not enabled).
  17364. @end table
  17365. @subsection Commands
  17366. This filter supports the following commands:
  17367. @table @option
  17368. @item quality, level
  17369. Set quality level. The value @code{max} can be used to set the maximum level,
  17370. currently @code{6}.
  17371. @end table
  17372. @anchor{sr}
  17373. @section sr
  17374. Scale the input by applying one of the super-resolution methods based on
  17375. convolutional neural networks. Supported models:
  17376. @itemize
  17377. @item
  17378. Super-Resolution Convolutional Neural Network model (SRCNN).
  17379. See @url{https://arxiv.org/abs/1501.00092}.
  17380. @item
  17381. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  17382. See @url{https://arxiv.org/abs/1609.05158}.
  17383. @end itemize
  17384. Training scripts as well as scripts for model file (.pb) saving can be found at
  17385. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  17386. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  17387. The filter accepts the following options:
  17388. @table @option
  17389. @item dnn_backend
  17390. Specify which DNN backend to use for model loading and execution. This option accepts
  17391. the following values:
  17392. @table @samp
  17393. @item tensorflow
  17394. TensorFlow backend. To enable this backend you
  17395. need to install the TensorFlow for C library (see
  17396. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  17397. @code{--enable-libtensorflow}
  17398. @end table
  17399. @item model
  17400. Set path to model file specifying network architecture and its parameters.
  17401. Note that different backends use different file formats. TensorFlow, OpenVINO backend
  17402. can load files for only its format.
  17403. @item scale_factor
  17404. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  17405. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  17406. input upscaled using bicubic upscaling with proper scale factor.
  17407. @end table
  17408. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  17409. @section ssim
  17410. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  17411. This filter takes in input two input videos, the first input is
  17412. considered the "main" source and is passed unchanged to the
  17413. output. The second input is used as a "reference" video for computing
  17414. the SSIM.
  17415. Both video inputs must have the same resolution and pixel format for
  17416. this filter to work correctly. Also it assumes that both inputs
  17417. have the same number of frames, which are compared one by one.
  17418. The filter stores the calculated SSIM of each frame.
  17419. The description of the accepted parameters follows.
  17420. @table @option
  17421. @item stats_file, f
  17422. If specified the filter will use the named file to save the SSIM of
  17423. each individual frame. When filename equals "-" the data is sent to
  17424. standard output.
  17425. @end table
  17426. The file printed if @var{stats_file} is selected, contains a sequence of
  17427. key/value pairs of the form @var{key}:@var{value} for each compared
  17428. couple of frames.
  17429. A description of each shown parameter follows:
  17430. @table @option
  17431. @item n
  17432. sequential number of the input frame, starting from 1
  17433. @item Y, U, V, R, G, B
  17434. SSIM of the compared frames for the component specified by the suffix.
  17435. @item All
  17436. SSIM of the compared frames for the whole frame.
  17437. @item dB
  17438. Same as above but in dB representation.
  17439. @end table
  17440. This filter also supports the @ref{framesync} options.
  17441. @subsection Examples
  17442. @itemize
  17443. @item
  17444. For example:
  17445. @example
  17446. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  17447. [main][ref] ssim="stats_file=stats.log" [out]
  17448. @end example
  17449. On this example the input file being processed is compared with the
  17450. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  17451. is stored in @file{stats.log}.
  17452. @item
  17453. Another example with both psnr and ssim at same time:
  17454. @example
  17455. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  17456. @end example
  17457. @item
  17458. Another example with different containers:
  17459. @example
  17460. 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 -
  17461. @end example
  17462. @end itemize
  17463. @section stereo3d
  17464. Convert between different stereoscopic image formats.
  17465. The filters accept the following options:
  17466. @table @option
  17467. @item in
  17468. Set stereoscopic image format of input.
  17469. Available values for input image formats are:
  17470. @table @samp
  17471. @item sbsl
  17472. side by side parallel (left eye left, right eye right)
  17473. @item sbsr
  17474. side by side crosseye (right eye left, left eye right)
  17475. @item sbs2l
  17476. side by side parallel with half width resolution
  17477. (left eye left, right eye right)
  17478. @item sbs2r
  17479. side by side crosseye with half width resolution
  17480. (right eye left, left eye right)
  17481. @item abl
  17482. @item tbl
  17483. above-below (left eye above, right eye below)
  17484. @item abr
  17485. @item tbr
  17486. above-below (right eye above, left eye below)
  17487. @item ab2l
  17488. @item tb2l
  17489. above-below with half height resolution
  17490. (left eye above, right eye below)
  17491. @item ab2r
  17492. @item tb2r
  17493. above-below with half height resolution
  17494. (right eye above, left eye below)
  17495. @item al
  17496. alternating frames (left eye first, right eye second)
  17497. @item ar
  17498. alternating frames (right eye first, left eye second)
  17499. @item irl
  17500. interleaved rows (left eye has top row, right eye starts on next row)
  17501. @item irr
  17502. interleaved rows (right eye has top row, left eye starts on next row)
  17503. @item icl
  17504. interleaved columns, left eye first
  17505. @item icr
  17506. interleaved columns, right eye first
  17507. Default value is @samp{sbsl}.
  17508. @end table
  17509. @item out
  17510. Set stereoscopic image format of output.
  17511. @table @samp
  17512. @item sbsl
  17513. side by side parallel (left eye left, right eye right)
  17514. @item sbsr
  17515. side by side crosseye (right eye left, left eye right)
  17516. @item sbs2l
  17517. side by side parallel with half width resolution
  17518. (left eye left, right eye right)
  17519. @item sbs2r
  17520. side by side crosseye with half width resolution
  17521. (right eye left, left eye right)
  17522. @item abl
  17523. @item tbl
  17524. above-below (left eye above, right eye below)
  17525. @item abr
  17526. @item tbr
  17527. above-below (right eye above, left eye below)
  17528. @item ab2l
  17529. @item tb2l
  17530. above-below with half height resolution
  17531. (left eye above, right eye below)
  17532. @item ab2r
  17533. @item tb2r
  17534. above-below with half height resolution
  17535. (right eye above, left eye below)
  17536. @item al
  17537. alternating frames (left eye first, right eye second)
  17538. @item ar
  17539. alternating frames (right eye first, left eye second)
  17540. @item irl
  17541. interleaved rows (left eye has top row, right eye starts on next row)
  17542. @item irr
  17543. interleaved rows (right eye has top row, left eye starts on next row)
  17544. @item arbg
  17545. anaglyph red/blue gray
  17546. (red filter on left eye, blue filter on right eye)
  17547. @item argg
  17548. anaglyph red/green gray
  17549. (red filter on left eye, green filter on right eye)
  17550. @item arcg
  17551. anaglyph red/cyan gray
  17552. (red filter on left eye, cyan filter on right eye)
  17553. @item arch
  17554. anaglyph red/cyan half colored
  17555. (red filter on left eye, cyan filter on right eye)
  17556. @item arcc
  17557. anaglyph red/cyan color
  17558. (red filter on left eye, cyan filter on right eye)
  17559. @item arcd
  17560. anaglyph red/cyan color optimized with the least squares projection of dubois
  17561. (red filter on left eye, cyan filter on right eye)
  17562. @item agmg
  17563. anaglyph green/magenta gray
  17564. (green filter on left eye, magenta filter on right eye)
  17565. @item agmh
  17566. anaglyph green/magenta half colored
  17567. (green filter on left eye, magenta filter on right eye)
  17568. @item agmc
  17569. anaglyph green/magenta colored
  17570. (green filter on left eye, magenta filter on right eye)
  17571. @item agmd
  17572. anaglyph green/magenta color optimized with the least squares projection of dubois
  17573. (green filter on left eye, magenta filter on right eye)
  17574. @item aybg
  17575. anaglyph yellow/blue gray
  17576. (yellow filter on left eye, blue filter on right eye)
  17577. @item aybh
  17578. anaglyph yellow/blue half colored
  17579. (yellow filter on left eye, blue filter on right eye)
  17580. @item aybc
  17581. anaglyph yellow/blue colored
  17582. (yellow filter on left eye, blue filter on right eye)
  17583. @item aybd
  17584. anaglyph yellow/blue color optimized with the least squares projection of dubois
  17585. (yellow filter on left eye, blue filter on right eye)
  17586. @item ml
  17587. mono output (left eye only)
  17588. @item mr
  17589. mono output (right eye only)
  17590. @item chl
  17591. checkerboard, left eye first
  17592. @item chr
  17593. checkerboard, right eye first
  17594. @item icl
  17595. interleaved columns, left eye first
  17596. @item icr
  17597. interleaved columns, right eye first
  17598. @item hdmi
  17599. HDMI frame pack
  17600. @end table
  17601. Default value is @samp{arcd}.
  17602. @end table
  17603. @subsection Examples
  17604. @itemize
  17605. @item
  17606. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  17607. @example
  17608. stereo3d=sbsl:aybd
  17609. @end example
  17610. @item
  17611. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  17612. @example
  17613. stereo3d=abl:sbsr
  17614. @end example
  17615. @end itemize
  17616. @section streamselect, astreamselect
  17617. Select video or audio streams.
  17618. The filter accepts the following options:
  17619. @table @option
  17620. @item inputs
  17621. Set number of inputs. Default is 2.
  17622. @item map
  17623. Set input indexes to remap to outputs.
  17624. @end table
  17625. @subsection Commands
  17626. The @code{streamselect} and @code{astreamselect} filter supports the following
  17627. commands:
  17628. @table @option
  17629. @item map
  17630. Set input indexes to remap to outputs.
  17631. @end table
  17632. @subsection Examples
  17633. @itemize
  17634. @item
  17635. Select first 5 seconds 1st stream and rest of time 2nd stream:
  17636. @example
  17637. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  17638. @end example
  17639. @item
  17640. Same as above, but for audio:
  17641. @example
  17642. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  17643. @end example
  17644. @end itemize
  17645. @anchor{subtitles}
  17646. @section subtitles
  17647. Draw subtitles on top of input video using the libass library.
  17648. To enable compilation of this filter you need to configure FFmpeg with
  17649. @code{--enable-libass}. This filter also requires a build with libavcodec and
  17650. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  17651. Alpha) subtitles format.
  17652. The filter accepts the following options:
  17653. @table @option
  17654. @item filename, f
  17655. Set the filename of the subtitle file to read. It must be specified.
  17656. @item original_size
  17657. Specify the size of the original video, the video for which the ASS file
  17658. was composed. For the syntax of this option, check the
  17659. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17660. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  17661. correctly scale the fonts if the aspect ratio has been changed.
  17662. @item fontsdir
  17663. Set a directory path containing fonts that can be used by the filter.
  17664. These fonts will be used in addition to whatever the font provider uses.
  17665. @item alpha
  17666. Process alpha channel, by default alpha channel is untouched.
  17667. @item charenc
  17668. Set subtitles input character encoding. @code{subtitles} filter only. Only
  17669. useful if not UTF-8.
  17670. @item stream_index, si
  17671. Set subtitles stream index. @code{subtitles} filter only.
  17672. @item force_style
  17673. Override default style or script info parameters of the subtitles. It accepts a
  17674. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  17675. @item wrap_unicode
  17676. Break lines according to the Unicode Line Breaking Algorithm. Availability requires
  17677. at least libass release 0.17.0 (or LIBASS_VERSION 0x01600010), @emph{and} libass must
  17678. have been built with libunibreak.
  17679. The option is enabled by default except for native ASS.
  17680. @end table
  17681. If the first key is not specified, it is assumed that the first value
  17682. specifies the @option{filename}.
  17683. For example, to render the file @file{sub.srt} on top of the input
  17684. video, use the command:
  17685. @example
  17686. subtitles=sub.srt
  17687. @end example
  17688. which is equivalent to:
  17689. @example
  17690. subtitles=filename=sub.srt
  17691. @end example
  17692. To render the default subtitles stream from file @file{video.mkv}, use:
  17693. @example
  17694. subtitles=video.mkv
  17695. @end example
  17696. To render the second subtitles stream from that file, use:
  17697. @example
  17698. subtitles=video.mkv:si=1
  17699. @end example
  17700. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  17701. @code{DejaVu Serif}, use:
  17702. @example
  17703. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  17704. @end example
  17705. @section super2xsai
  17706. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  17707. Interpolate) pixel art scaling algorithm.
  17708. Useful for enlarging pixel art images without reducing sharpness.
  17709. @section swaprect
  17710. Swap two rectangular objects in video.
  17711. This filter accepts the following options:
  17712. @table @option
  17713. @item w
  17714. Set object width.
  17715. @item h
  17716. Set object height.
  17717. @item x1
  17718. Set 1st rect x coordinate.
  17719. @item y1
  17720. Set 1st rect y coordinate.
  17721. @item x2
  17722. Set 2nd rect x coordinate.
  17723. @item y2
  17724. Set 2nd rect y coordinate.
  17725. All expressions are evaluated once for each frame.
  17726. @end table
  17727. The all options are expressions containing the following constants:
  17728. @table @option
  17729. @item w
  17730. @item h
  17731. The input width and height.
  17732. @item a
  17733. same as @var{w} / @var{h}
  17734. @item sar
  17735. input sample aspect ratio
  17736. @item dar
  17737. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  17738. @item n
  17739. The number of the input frame, starting from 0.
  17740. @item t
  17741. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  17742. @item pos
  17743. the position in the file of the input frame, NAN if unknown; deprecated,
  17744. do not use
  17745. @end table
  17746. @subsection Commands
  17747. This filter supports the all above options as @ref{commands}.
  17748. @section swapuv
  17749. Swap U & V plane.
  17750. @section tblend
  17751. Blend successive video frames.
  17752. See @ref{blend}
  17753. @section telecine
  17754. Apply telecine process to the video.
  17755. This filter accepts the following options:
  17756. @table @option
  17757. @item first_field
  17758. @table @samp
  17759. @item top, t
  17760. top field first
  17761. @item bottom, b
  17762. bottom field first
  17763. The default value is @code{top}.
  17764. @end table
  17765. @item pattern
  17766. A string of numbers representing the pulldown pattern you wish to apply.
  17767. The default value is @code{23}.
  17768. @end table
  17769. @example
  17770. Some typical patterns:
  17771. NTSC output (30i):
  17772. 27.5p: 32222
  17773. 24p: 23 (classic)
  17774. 24p: 2332 (preferred)
  17775. 20p: 33
  17776. 18p: 334
  17777. 16p: 3444
  17778. PAL output (25i):
  17779. 27.5p: 12222
  17780. 24p: 222222222223 ("Euro pulldown")
  17781. 16.67p: 33
  17782. 16p: 33333334
  17783. @end example
  17784. @section thistogram
  17785. Compute and draw a color distribution histogram for the input video across time.
  17786. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  17787. at certain time, this filter shows also past histograms of number of frames defined
  17788. by @code{width} option.
  17789. The computed histogram is a representation of the color component
  17790. distribution in an image.
  17791. The filter accepts the following options:
  17792. @table @option
  17793. @item width, w
  17794. Set width of single color component output. Default value is @code{0}.
  17795. Value of @code{0} means width will be picked from input video.
  17796. This also set number of passed histograms to keep.
  17797. Allowed range is [0, 8192].
  17798. @item display_mode, d
  17799. Set display mode.
  17800. It accepts the following values:
  17801. @table @samp
  17802. @item stack
  17803. Per color component graphs are placed below each other.
  17804. @item parade
  17805. Per color component graphs are placed side by side.
  17806. @item overlay
  17807. Presents information identical to that in the @code{parade}, except
  17808. that the graphs representing color components are superimposed directly
  17809. over one another.
  17810. @end table
  17811. Default is @code{stack}.
  17812. @item levels_mode, m
  17813. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  17814. Default is @code{linear}.
  17815. @item components, c
  17816. Set what color components to display.
  17817. Default is @code{7}.
  17818. @item bgopacity, b
  17819. Set background opacity. Default is @code{0.9}.
  17820. @item envelope, e
  17821. Show envelope. Default is disabled.
  17822. @item ecolor, ec
  17823. Set envelope color. Default is @code{gold}.
  17824. @item slide
  17825. Set slide mode.
  17826. Available values for slide is:
  17827. @table @samp
  17828. @item frame
  17829. Draw new frame when right border is reached.
  17830. @item replace
  17831. Replace old columns with new ones.
  17832. @item scroll
  17833. Scroll from right to left.
  17834. @item rscroll
  17835. Scroll from left to right.
  17836. @item picture
  17837. Draw single picture.
  17838. @end table
  17839. Default is @code{replace}.
  17840. @end table
  17841. @section threshold
  17842. Apply threshold effect to video stream.
  17843. This filter needs four video streams to perform thresholding.
  17844. First stream is stream we are filtering.
  17845. Second stream is holding threshold values, third stream is holding min values,
  17846. and last, fourth stream is holding max values.
  17847. The filter accepts the following option:
  17848. @table @option
  17849. @item planes
  17850. Set which planes will be processed, unprocessed planes will be copied.
  17851. By default value 0xf, all planes will be processed.
  17852. @end table
  17853. For example if first stream pixel's component value is less then threshold value
  17854. of pixel component from 2nd threshold stream, third stream value will picked,
  17855. otherwise fourth stream pixel component value will be picked.
  17856. Using color source filter one can perform various types of thresholding:
  17857. @subsection Commands
  17858. This filter supports the all options as @ref{commands}.
  17859. @subsection Examples
  17860. @itemize
  17861. @item
  17862. Binary threshold, using gray color as threshold:
  17863. @example
  17864. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17865. @end example
  17866. @item
  17867. Inverted binary threshold, using gray color as threshold:
  17868. @example
  17869. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17870. @end example
  17871. @item
  17872. Truncate binary threshold, using gray color as threshold:
  17873. @example
  17874. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17875. @end example
  17876. @item
  17877. Threshold to zero, using gray color as threshold:
  17878. @example
  17879. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17880. @end example
  17881. @item
  17882. Inverted threshold to zero, using gray color as threshold:
  17883. @example
  17884. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17885. @end example
  17886. @end itemize
  17887. @section thumbnail
  17888. Select the most representative frame in a given sequence of consecutive frames.
  17889. The filter accepts the following options:
  17890. @table @option
  17891. @item n
  17892. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  17893. will pick one of them, and then handle the next batch of @var{n} frames until
  17894. the end. Default is @code{100}.
  17895. @item log
  17896. Set the log level to display picked frame stats.
  17897. Default is @code{info}.
  17898. @end table
  17899. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  17900. value will result in a higher memory usage, so a high value is not recommended.
  17901. @subsection Examples
  17902. @itemize
  17903. @item
  17904. Extract one picture each 50 frames:
  17905. @example
  17906. thumbnail=50
  17907. @end example
  17908. @item
  17909. Complete example of a thumbnail creation with @command{ffmpeg}:
  17910. @example
  17911. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  17912. @end example
  17913. @end itemize
  17914. @anchor{tile}
  17915. @section tile
  17916. Tile several successive frames together.
  17917. The @ref{untile} filter can do the reverse.
  17918. The filter accepts the following options:
  17919. @table @option
  17920. @item layout
  17921. Set the grid size in the form @code{COLUMNSxROWS}. Range is up to UINT_MAX cells.
  17922. Default is @code{6x5}.
  17923. @item nb_frames
  17924. Set the maximum number of frames to render in the given area. It must be less
  17925. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  17926. the area will be used.
  17927. @item margin
  17928. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  17929. @item padding
  17930. Set the inner border thickness (i.e. the number of pixels between frames). For
  17931. more advanced padding options (such as having different values for the edges),
  17932. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  17933. @item color
  17934. Specify the color of the unused area. For the syntax of this option, check the
  17935. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17936. The default value of @var{color} is "black".
  17937. @item overlap
  17938. Set the number of frames to overlap when tiling several successive frames together.
  17939. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17940. @item init_padding
  17941. Set the number of frames to initially be empty before displaying first output frame.
  17942. This controls how soon will one get first output frame.
  17943. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  17944. @end table
  17945. @subsection Examples
  17946. @itemize
  17947. @item
  17948. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  17949. @example
  17950. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  17951. @end example
  17952. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  17953. duplicating each output frame to accommodate the originally detected frame
  17954. rate.
  17955. @item
  17956. Display @code{5} pictures in an area of @code{3x2} frames,
  17957. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  17958. mixed flat and named options:
  17959. @example
  17960. tile=3x2:nb_frames=5:padding=7:margin=2
  17961. @end example
  17962. @end itemize
  17963. @section tiltandshift
  17964. Apply tilt-and-shift effet.
  17965. What happens when you invert time and space?
  17966. Normally a video is composed of several frames that represent a different
  17967. instant of time and shows a scene that evolves in the space captured by the
  17968. frame. This filter is the antipode of that concept, taking inspiration by
  17969. tilt and shift photography.
  17970. A filtered frame contains the whole timeline of events composing the sequence,
  17971. and this is obtained by placing a slice of pixels from each frame into a single
  17972. one. However, since there are no infinite-width frames, this is done up the
  17973. width of the input frame, and a video is recomposed by shifting away one
  17974. column for each subsequent frame. In order to map space to time, the filter
  17975. tilts each input frame as well, so that motion is preserved. This is accomplished
  17976. by progressively selecting a different column from each input frame.
  17977. The end result is a sort of inverted parallax, so that far away objects move
  17978. much faster that the ones in the front. The ideal conditions for this video
  17979. effect are when there is either very little motion and the backgroud is static,
  17980. or when there is a lot of motion and a very wide depth of field (e.g. wide
  17981. panorama, while moving on a train).
  17982. The filter accepts the following parameters:
  17983. @table @option
  17984. @item tilt
  17985. Tilt video while shifting (default). When unset, video will be sliding a
  17986. static image, composed of the first column of each frame.
  17987. @item start
  17988. What to do at the start of filtering (see below).
  17989. @item end
  17990. What to do at the end of filtering (see below).
  17991. @item hold
  17992. How many columns should pass through before start of filtering.
  17993. @item pad
  17994. How many columns should be inserted before end of filtering.
  17995. @end table
  17996. Normally the filter shifts and tils from the very first frame, and stops when
  17997. the last one is received. However, before filtering starts, normal video may
  17998. be preseved, so that the effect is slowly shifted in its place. Similarly,
  17999. the last video frame may be reconstructed at the end. Alternatively it is
  18000. possible to just start and end with black.
  18001. @table @samp
  18002. @item none
  18003. Filtering is starts immediately and ends when the last frame is received.
  18004. @item frame
  18005. The first frames or the very last frame are kept intact during processing.
  18006. @item black
  18007. Black is padded at the beginning or at the end of filtering.
  18008. @end table
  18009. @section tinterlace
  18010. Perform various types of temporal field interlacing.
  18011. Frames are counted starting from 1, so the first input frame is
  18012. considered odd.
  18013. The filter accepts the following options:
  18014. @table @option
  18015. @item mode
  18016. Specify the mode of the interlacing. This option can also be specified
  18017. as a value alone. See below for a list of values for this option.
  18018. Available values are:
  18019. @table @samp
  18020. @item merge, 0
  18021. Move odd frames into the upper field, even into the lower field,
  18022. generating a double height frame at half frame rate.
  18023. @example
  18024. ------> time
  18025. Input:
  18026. Frame 1 Frame 2 Frame 3 Frame 4
  18027. 11111 22222 33333 44444
  18028. 11111 22222 33333 44444
  18029. 11111 22222 33333 44444
  18030. 11111 22222 33333 44444
  18031. Output:
  18032. 11111 33333
  18033. 22222 44444
  18034. 11111 33333
  18035. 22222 44444
  18036. 11111 33333
  18037. 22222 44444
  18038. 11111 33333
  18039. 22222 44444
  18040. @end example
  18041. @item drop_even, 1
  18042. Only output odd frames, even frames are dropped, generating a frame with
  18043. unchanged height at half frame rate.
  18044. @example
  18045. ------> time
  18046. Input:
  18047. Frame 1 Frame 2 Frame 3 Frame 4
  18048. 11111 22222 33333 44444
  18049. 11111 22222 33333 44444
  18050. 11111 22222 33333 44444
  18051. 11111 22222 33333 44444
  18052. Output:
  18053. 11111 33333
  18054. 11111 33333
  18055. 11111 33333
  18056. 11111 33333
  18057. @end example
  18058. @item drop_odd, 2
  18059. Only output even frames, odd frames are dropped, generating a frame with
  18060. unchanged height at half frame rate.
  18061. @example
  18062. ------> time
  18063. Input:
  18064. Frame 1 Frame 2 Frame 3 Frame 4
  18065. 11111 22222 33333 44444
  18066. 11111 22222 33333 44444
  18067. 11111 22222 33333 44444
  18068. 11111 22222 33333 44444
  18069. Output:
  18070. 22222 44444
  18071. 22222 44444
  18072. 22222 44444
  18073. 22222 44444
  18074. @end example
  18075. @item pad, 3
  18076. Expand each frame to full height, but pad alternate lines with black,
  18077. generating a frame with double height at the same input frame rate.
  18078. @example
  18079. ------> time
  18080. Input:
  18081. Frame 1 Frame 2 Frame 3 Frame 4
  18082. 11111 22222 33333 44444
  18083. 11111 22222 33333 44444
  18084. 11111 22222 33333 44444
  18085. 11111 22222 33333 44444
  18086. Output:
  18087. 11111 ..... 33333 .....
  18088. ..... 22222 ..... 44444
  18089. 11111 ..... 33333 .....
  18090. ..... 22222 ..... 44444
  18091. 11111 ..... 33333 .....
  18092. ..... 22222 ..... 44444
  18093. 11111 ..... 33333 .....
  18094. ..... 22222 ..... 44444
  18095. @end example
  18096. @item interleave_top, 4
  18097. Interleave the upper field from odd frames with the lower field from
  18098. even frames, generating a frame with unchanged height at half frame rate.
  18099. @example
  18100. ------> time
  18101. Input:
  18102. Frame 1 Frame 2 Frame 3 Frame 4
  18103. 11111<- 22222 33333<- 44444
  18104. 11111 22222<- 33333 44444<-
  18105. 11111<- 22222 33333<- 44444
  18106. 11111 22222<- 33333 44444<-
  18107. Output:
  18108. 11111 33333
  18109. 22222 44444
  18110. 11111 33333
  18111. 22222 44444
  18112. @end example
  18113. @item interleave_bottom, 5
  18114. Interleave the lower field from odd frames with the upper field from
  18115. even frames, generating a frame with unchanged height at half frame rate.
  18116. @example
  18117. ------> time
  18118. Input:
  18119. Frame 1 Frame 2 Frame 3 Frame 4
  18120. 11111 22222<- 33333 44444<-
  18121. 11111<- 22222 33333<- 44444
  18122. 11111 22222<- 33333 44444<-
  18123. 11111<- 22222 33333<- 44444
  18124. Output:
  18125. 22222 44444
  18126. 11111 33333
  18127. 22222 44444
  18128. 11111 33333
  18129. @end example
  18130. @item interlacex2, 6
  18131. Double frame rate with unchanged height. Frames are inserted each
  18132. containing the second temporal field from the previous input frame and
  18133. the first temporal field from the next input frame. This mode relies on
  18134. the top_field_first flag. Useful for interlaced video displays with no
  18135. field synchronisation.
  18136. @example
  18137. ------> time
  18138. Input:
  18139. Frame 1 Frame 2 Frame 3 Frame 4
  18140. 11111 22222 33333 44444
  18141. 11111 22222 33333 44444
  18142. 11111 22222 33333 44444
  18143. 11111 22222 33333 44444
  18144. Output:
  18145. 11111 22222 22222 33333 33333 44444 44444
  18146. 11111 11111 22222 22222 33333 33333 44444
  18147. 11111 22222 22222 33333 33333 44444 44444
  18148. 11111 11111 22222 22222 33333 33333 44444
  18149. @end example
  18150. @item mergex2, 7
  18151. Move odd frames into the upper field, even into the lower field,
  18152. generating a double height frame at same frame rate.
  18153. @example
  18154. ------> time
  18155. Input:
  18156. Frame 1 Frame 2 Frame 3 Frame 4
  18157. 11111 22222 33333 44444
  18158. 11111 22222 33333 44444
  18159. 11111 22222 33333 44444
  18160. 11111 22222 33333 44444
  18161. Output:
  18162. 11111 33333 33333 55555
  18163. 22222 22222 44444 44444
  18164. 11111 33333 33333 55555
  18165. 22222 22222 44444 44444
  18166. 11111 33333 33333 55555
  18167. 22222 22222 44444 44444
  18168. 11111 33333 33333 55555
  18169. 22222 22222 44444 44444
  18170. @end example
  18171. @end table
  18172. Numeric values are deprecated but are accepted for backward
  18173. compatibility reasons.
  18174. Default mode is @code{merge}.
  18175. @item flags
  18176. Specify flags influencing the filter process.
  18177. Available value for @var{flags} is:
  18178. @table @option
  18179. @item low_pass_filter, vlpf
  18180. Enable linear vertical low-pass filtering in the filter.
  18181. Vertical low-pass filtering is required when creating an interlaced
  18182. destination from a progressive source which contains high-frequency
  18183. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  18184. patterning.
  18185. @item complex_filter, cvlpf
  18186. Enable complex vertical low-pass filtering.
  18187. This will slightly less reduce interlace 'twitter' and Moire
  18188. patterning but better retain detail and subjective sharpness impression.
  18189. @item bypass_il
  18190. Bypass already interlaced frames, only adjust the frame rate.
  18191. @end table
  18192. Vertical low-pass filtering and bypassing already interlaced frames can only be
  18193. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  18194. @end table
  18195. @section tmedian
  18196. Pick median pixels from several successive input video frames.
  18197. The filter accepts the following options:
  18198. @table @option
  18199. @item radius
  18200. Set radius of median filter.
  18201. Default is 1. Allowed range is from 1 to 127.
  18202. @item planes
  18203. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18204. @item percentile
  18205. Set median percentile. Default value is @code{0.5}.
  18206. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18207. minimum values, and @code{1} maximum values.
  18208. @end table
  18209. @subsection Commands
  18210. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  18211. @section tmidequalizer
  18212. Apply Temporal Midway Video Equalization effect.
  18213. Midway Video Equalization adjusts a sequence of video frames to have the same
  18214. histograms, while maintaining their dynamics as much as possible. It's
  18215. useful for e.g. matching exposures from a video frames sequence.
  18216. This filter accepts the following option:
  18217. @table @option
  18218. @item radius
  18219. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  18220. @item sigma
  18221. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  18222. Setting this option to 0 effectively does nothing.
  18223. @item planes
  18224. Set which planes to process. Default is @code{15}, which is all available planes.
  18225. @end table
  18226. @section tmix
  18227. Mix successive video frames.
  18228. A description of the accepted options follows.
  18229. @table @option
  18230. @item frames
  18231. The number of successive frames to mix. If unspecified, it defaults to 3.
  18232. @item weights
  18233. Specify weight of each input video frame.
  18234. Each weight is separated by space. If number of weights is smaller than
  18235. number of @var{frames} last specified weight will be used for all remaining
  18236. unset weights.
  18237. @item scale
  18238. Specify scale, if it is set it will be multiplied with sum
  18239. of each weight multiplied with pixel values to give final destination
  18240. pixel value. By default @var{scale} is auto scaled to sum of weights.
  18241. @item planes
  18242. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  18243. @end table
  18244. @subsection Examples
  18245. @itemize
  18246. @item
  18247. Average 7 successive frames:
  18248. @example
  18249. tmix=frames=7:weights="1 1 1 1 1 1 1"
  18250. @end example
  18251. @item
  18252. Apply simple temporal convolution:
  18253. @example
  18254. tmix=frames=3:weights="-1 3 -1"
  18255. @end example
  18256. @item
  18257. Similar as above but only showing temporal differences:
  18258. @example
  18259. tmix=frames=3:weights="-1 2 -1":scale=1
  18260. @end example
  18261. @end itemize
  18262. @subsection Commands
  18263. This filter supports the following commands:
  18264. @table @option
  18265. @item weights
  18266. @item scale
  18267. @item planes
  18268. Syntax is same as option with same name.
  18269. @end table
  18270. @anchor{tonemap}
  18271. @section tonemap
  18272. Tone map colors from different dynamic ranges.
  18273. This filter expects data in single precision floating point, as it needs to
  18274. operate on (and can output) out-of-range values. Another filter, such as
  18275. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  18276. The tonemapping algorithms implemented only work on linear light, so input
  18277. data should be linearized beforehand (and possibly correctly tagged).
  18278. @example
  18279. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  18280. @end example
  18281. @subsection Options
  18282. The filter accepts the following options.
  18283. @table @option
  18284. @item tonemap
  18285. Set the tone map algorithm to use.
  18286. Possible values are:
  18287. @table @var
  18288. @item none
  18289. Do not apply any tone map, only desaturate overbright pixels.
  18290. @item clip
  18291. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  18292. in-range values, while distorting out-of-range values.
  18293. @item linear
  18294. Stretch the entire reference gamut to a linear multiple of the display.
  18295. @item gamma
  18296. Fit a logarithmic transfer between the tone curves.
  18297. @item reinhard
  18298. Preserve overall image brightness with a simple curve, using nonlinear
  18299. contrast, which results in flattening details and degrading color accuracy.
  18300. @item hable
  18301. Preserve both dark and bright details better than @var{reinhard}, at the cost
  18302. of slightly darkening everything. Use it when detail preservation is more
  18303. important than color and brightness accuracy.
  18304. @item mobius
  18305. Smoothly map out-of-range values, while retaining contrast and colors for
  18306. in-range material as much as possible. Use it when color accuracy is more
  18307. important than detail preservation.
  18308. @end table
  18309. Default is none.
  18310. @item param
  18311. Tune the tone mapping algorithm.
  18312. This affects the following algorithms:
  18313. @table @var
  18314. @item none
  18315. Ignored.
  18316. @item linear
  18317. Specifies the scale factor to use while stretching.
  18318. Default to 1.0.
  18319. @item gamma
  18320. Specifies the exponent of the function.
  18321. Default to 1.8.
  18322. @item clip
  18323. Specify an extra linear coefficient to multiply into the signal before clipping.
  18324. Default to 1.0.
  18325. @item reinhard
  18326. Specify the local contrast coefficient at the display peak.
  18327. Default to 0.5, which means that in-gamut values will be about half as bright
  18328. as when clipping.
  18329. @item hable
  18330. Ignored.
  18331. @item mobius
  18332. Specify the transition point from linear to mobius transform. Every value
  18333. below this point is guaranteed to be mapped 1:1. The higher the value, the
  18334. more accurate the result will be, at the cost of losing bright details.
  18335. Default to 0.3, which due to the steep initial slope still preserves in-range
  18336. colors fairly accurately.
  18337. @end table
  18338. @item desat
  18339. Apply desaturation for highlights that exceed this level of brightness. The
  18340. higher the parameter, the more color information will be preserved. This
  18341. setting helps prevent unnaturally blown-out colors for super-highlights, by
  18342. (smoothly) turning into white instead. This makes images feel more natural,
  18343. at the cost of reducing information about out-of-range colors.
  18344. The default of 2.0 is somewhat conservative and will mostly just apply to
  18345. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  18346. This option works only if the input frame has a supported color tag.
  18347. @item peak
  18348. Override signal/nominal/reference peak with this value. Useful when the
  18349. embedded peak information in display metadata is not reliable or when tone
  18350. mapping from a lower range to a higher range.
  18351. @end table
  18352. @section tpad
  18353. Temporarily pad video frames.
  18354. The filter accepts the following options:
  18355. @table @option
  18356. @item start
  18357. Specify number of delay frames before input video stream. Default is 0.
  18358. @item stop
  18359. Specify number of padding frames after input video stream.
  18360. Set to -1 to pad indefinitely. Default is 0.
  18361. @item start_mode
  18362. Set kind of frames added to beginning of stream.
  18363. Can be either @var{add} or @var{clone}.
  18364. With @var{add} frames of solid-color are added.
  18365. With @var{clone} frames are clones of first frame.
  18366. Default is @var{add}.
  18367. @item stop_mode
  18368. Set kind of frames added to end of stream.
  18369. Can be either @var{add} or @var{clone}.
  18370. With @var{add} frames of solid-color are added.
  18371. With @var{clone} frames are clones of last frame.
  18372. Default is @var{add}.
  18373. @item start_duration, stop_duration
  18374. Specify the duration of the start/stop delay. See
  18375. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18376. for the accepted syntax.
  18377. These options override @var{start} and @var{stop}. Default is 0.
  18378. @item color
  18379. Specify the color of the padded area. For the syntax of this option,
  18380. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  18381. manual,ffmpeg-utils}.
  18382. The default value of @var{color} is "black".
  18383. @end table
  18384. @anchor{transpose}
  18385. @section transpose
  18386. Transpose rows with columns in the input video and optionally flip it.
  18387. It accepts the following parameters:
  18388. @table @option
  18389. @item dir
  18390. Specify the transposition direction.
  18391. Can assume the following values:
  18392. @table @samp
  18393. @item 0, 4, cclock_flip
  18394. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  18395. @example
  18396. L.R L.l
  18397. . . -> . .
  18398. l.r R.r
  18399. @end example
  18400. @item 1, 5, clock
  18401. Rotate by 90 degrees clockwise, that is:
  18402. @example
  18403. L.R l.L
  18404. . . -> . .
  18405. l.r r.R
  18406. @end example
  18407. @item 2, 6, cclock
  18408. Rotate by 90 degrees counterclockwise, that is:
  18409. @example
  18410. L.R R.r
  18411. . . -> . .
  18412. l.r L.l
  18413. @end example
  18414. @item 3, 7, clock_flip
  18415. Rotate by 90 degrees clockwise and vertically flip, that is:
  18416. @example
  18417. L.R r.R
  18418. . . -> . .
  18419. l.r l.L
  18420. @end example
  18421. @end table
  18422. For values between 4-7, the transposition is only done if the input
  18423. video geometry is portrait and not landscape. These values are
  18424. deprecated, the @code{passthrough} option should be used instead.
  18425. Numerical values are deprecated, and should be dropped in favor of
  18426. symbolic constants.
  18427. @item passthrough
  18428. Do not apply the transposition if the input geometry matches the one
  18429. specified by the specified value. It accepts the following values:
  18430. @table @samp
  18431. @item none
  18432. Always apply transposition.
  18433. @item portrait
  18434. Preserve portrait geometry (when @var{height} >= @var{width}).
  18435. @item landscape
  18436. Preserve landscape geometry (when @var{width} >= @var{height}).
  18437. @end table
  18438. Default value is @code{none}.
  18439. @end table
  18440. For example to rotate by 90 degrees clockwise and preserve portrait
  18441. layout:
  18442. @example
  18443. transpose=dir=1:passthrough=portrait
  18444. @end example
  18445. The command above can also be specified as:
  18446. @example
  18447. transpose=1:portrait
  18448. @end example
  18449. @section transpose_npp
  18450. Transpose rows with columns in the input video and optionally flip it.
  18451. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  18452. It accepts the following parameters:
  18453. @table @option
  18454. @item dir
  18455. Specify the transposition direction.
  18456. Can assume the following values:
  18457. @table @samp
  18458. @item cclock_flip
  18459. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  18460. @item clock
  18461. Rotate by 90 degrees clockwise.
  18462. @item cclock
  18463. Rotate by 90 degrees counterclockwise.
  18464. @item clock_flip
  18465. Rotate by 90 degrees clockwise and vertically flip.
  18466. @end table
  18467. @item passthrough
  18468. Do not apply the transposition if the input geometry matches the one
  18469. specified by the specified value. It accepts the following values:
  18470. @table @samp
  18471. @item none
  18472. Always apply transposition. (default)
  18473. @item portrait
  18474. Preserve portrait geometry (when @var{height} >= @var{width}).
  18475. @item landscape
  18476. Preserve landscape geometry (when @var{width} >= @var{height}).
  18477. @end table
  18478. @end table
  18479. @section trim
  18480. Trim the input so that the output contains one continuous subpart of the input.
  18481. It accepts the following parameters:
  18482. @table @option
  18483. @item start
  18484. Specify the time of the start of the kept section, i.e. the frame with the
  18485. timestamp @var{start} will be the first frame in the output.
  18486. @item end
  18487. Specify the time of the first frame that will be dropped, i.e. the frame
  18488. immediately preceding the one with the timestamp @var{end} will be the last
  18489. frame in the output.
  18490. @item start_pts
  18491. This is the same as @var{start}, except this option sets the start timestamp
  18492. in timebase units instead of seconds.
  18493. @item end_pts
  18494. This is the same as @var{end}, except this option sets the end timestamp
  18495. in timebase units instead of seconds.
  18496. @item duration
  18497. The maximum duration of the output in seconds.
  18498. @item start_frame
  18499. The number of the first frame that should be passed to the output.
  18500. @item end_frame
  18501. The number of the first frame that should be dropped.
  18502. @end table
  18503. @option{start}, @option{end}, and @option{duration} are expressed as time
  18504. duration specifications; see
  18505. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18506. for the accepted syntax.
  18507. Note that the first two sets of the start/end options and the @option{duration}
  18508. option look at the frame timestamp, while the _frame variants simply count the
  18509. frames that pass through the filter. Also note that this filter does not modify
  18510. the timestamps. If you wish for the output timestamps to start at zero, insert a
  18511. setpts filter after the trim filter.
  18512. If multiple start or end options are set, this filter tries to be greedy and
  18513. keep all the frames that match at least one of the specified constraints. To keep
  18514. only the part that matches all the constraints at once, chain multiple trim
  18515. filters.
  18516. The defaults are such that all the input is kept. So it is possible to set e.g.
  18517. just the end values to keep everything before the specified time.
  18518. Examples:
  18519. @itemize
  18520. @item
  18521. Drop everything except the second minute of input:
  18522. @example
  18523. ffmpeg -i INPUT -vf trim=60:120
  18524. @end example
  18525. @item
  18526. Keep only the first second:
  18527. @example
  18528. ffmpeg -i INPUT -vf trim=duration=1
  18529. @end example
  18530. @end itemize
  18531. @section unpremultiply
  18532. Apply alpha unpremultiply effect to input video stream using first plane
  18533. of second stream as alpha.
  18534. Both streams must have same dimensions and same pixel format.
  18535. The filter accepts the following option:
  18536. @table @option
  18537. @item planes
  18538. Set which planes will be processed, unprocessed planes will be copied.
  18539. By default value 0xf, all planes will be processed.
  18540. If the format has 1 or 2 components, then luma is bit 0.
  18541. If the format has 3 or 4 components:
  18542. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  18543. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  18544. If present, the alpha channel is always the last bit.
  18545. @item inplace
  18546. Do not require 2nd input for processing, instead use alpha plane from input stream.
  18547. @end table
  18548. @anchor{unsharp}
  18549. @section unsharp
  18550. Sharpen or blur the input video.
  18551. It accepts the following parameters:
  18552. @table @option
  18553. @item luma_msize_x, lx
  18554. Set the luma matrix horizontal size. It must be an odd integer between
  18555. 3 and 23. The default value is 5.
  18556. @item luma_msize_y, ly
  18557. Set the luma matrix vertical size. It must be an odd integer between 3
  18558. and 23. The default value is 5.
  18559. @item luma_amount, la
  18560. Set the luma effect strength. It must be a floating point number, reasonable
  18561. values lay between -1.5 and 1.5.
  18562. Negative values will blur the input video, while positive values will
  18563. sharpen it, a value of zero will disable the effect.
  18564. Default value is 1.0.
  18565. @item chroma_msize_x, cx
  18566. Set the chroma matrix horizontal size. It must be an odd integer
  18567. between 3 and 23. The default value is 5.
  18568. @item chroma_msize_y, cy
  18569. Set the chroma matrix vertical size. It must be an odd integer
  18570. between 3 and 23. The default value is 5.
  18571. @item chroma_amount, ca
  18572. Set the chroma effect strength. It must be a floating point number, reasonable
  18573. values lay between -1.5 and 1.5.
  18574. Negative values will blur the input video, while positive values will
  18575. sharpen it, a value of zero will disable the effect.
  18576. Default value is 0.0.
  18577. @item alpha_msize_x, ax
  18578. Set the alpha matrix horizontal size. It must be an odd integer
  18579. between 3 and 23. The default value is 5.
  18580. @item alpha_msize_y, ay
  18581. Set the alpha matrix vertical size. It must be an odd integer
  18582. between 3 and 23. The default value is 5.
  18583. @item alpha_amount, aa
  18584. Set the alpha effect strength. It must be a floating point number, reasonable
  18585. values lay between -1.5 and 1.5.
  18586. Negative values will blur the input video, while positive values will
  18587. sharpen it, a value of zero will disable the effect.
  18588. Default value is 0.0.
  18589. @end table
  18590. All parameters are optional and default to the equivalent of the
  18591. string '5:5:1.0:5:5:0.0'.
  18592. @subsection Examples
  18593. @itemize
  18594. @item
  18595. Apply strong luma sharpen effect:
  18596. @example
  18597. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  18598. @end example
  18599. @item
  18600. Apply a strong blur of both luma and chroma parameters:
  18601. @example
  18602. unsharp=7:7:-2:7:7:-2
  18603. @end example
  18604. @end itemize
  18605. @anchor{untile}
  18606. @section untile
  18607. Decompose a video made of tiled images into the individual images.
  18608. The frame rate of the output video is the frame rate of the input video
  18609. multiplied by the number of tiles.
  18610. This filter does the reverse of @ref{tile}.
  18611. The filter accepts the following options:
  18612. @table @option
  18613. @item layout
  18614. Set the grid size (i.e. the number of lines and columns). For the syntax of
  18615. this option, check the
  18616. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18617. @end table
  18618. @subsection Examples
  18619. @itemize
  18620. @item
  18621. Produce a 1-second video from a still image file made of 25 frames stacked
  18622. vertically, like an analogic film reel:
  18623. @example
  18624. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  18625. @end example
  18626. @end itemize
  18627. @section uspp
  18628. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  18629. the image at several (or - in the case of @option{quality} level @code{8} - all)
  18630. shifts and average the results.
  18631. The way this differs from the behavior of spp is that uspp actually encodes &
  18632. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  18633. DCT similar to MJPEG.
  18634. This filter is only available in ffmpeg version 4.4 or earlier.
  18635. The filter accepts the following options:
  18636. @table @option
  18637. @item quality
  18638. Set quality. This option defines the number of levels for averaging. It accepts
  18639. an integer in the range 0-8. If set to @code{0}, the filter will have no
  18640. effect. A value of @code{8} means the higher quality. For each increment of
  18641. that value the speed drops by a factor of approximately 2. Default value is
  18642. @code{3}.
  18643. @item qp
  18644. Force a constant quantization parameter. If not set, the filter will use the QP
  18645. from the video stream (if available).
  18646. @item codec
  18647. Use specified codec instead of snow.
  18648. @end table
  18649. @section v360
  18650. Convert 360 videos between various formats.
  18651. The filter accepts the following options:
  18652. @table @option
  18653. @item input
  18654. @item output
  18655. Set format of the input/output video.
  18656. Available formats:
  18657. @table @samp
  18658. @item e
  18659. @item equirect
  18660. Equirectangular projection.
  18661. @item c3x2
  18662. @item c6x1
  18663. @item c1x6
  18664. Cubemap with 3x2/6x1/1x6 layout.
  18665. Format specific options:
  18666. @table @option
  18667. @item in_pad
  18668. @item out_pad
  18669. Set padding proportion for the input/output cubemap. Values in decimals.
  18670. Example values:
  18671. @table @samp
  18672. @item 0
  18673. No padding.
  18674. @item 0.01
  18675. 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)
  18676. @end table
  18677. Default value is @b{@samp{0}}.
  18678. Maximum value is @b{@samp{0.1}}.
  18679. @item fin_pad
  18680. @item fout_pad
  18681. Set fixed padding for the input/output cubemap. Values in pixels.
  18682. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  18683. @item in_forder
  18684. @item out_forder
  18685. Set order of faces for the input/output cubemap. Choose one direction for each position.
  18686. Designation of directions:
  18687. @table @samp
  18688. @item r
  18689. right
  18690. @item l
  18691. left
  18692. @item u
  18693. up
  18694. @item d
  18695. down
  18696. @item f
  18697. forward
  18698. @item b
  18699. back
  18700. @end table
  18701. Default value is @b{@samp{rludfb}}.
  18702. @item in_frot
  18703. @item out_frot
  18704. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  18705. Designation of angles:
  18706. @table @samp
  18707. @item 0
  18708. 0 degrees clockwise
  18709. @item 1
  18710. 90 degrees clockwise
  18711. @item 2
  18712. 180 degrees clockwise
  18713. @item 3
  18714. 270 degrees clockwise
  18715. @end table
  18716. Default value is @b{@samp{000000}}.
  18717. @end table
  18718. @item eac
  18719. Equi-Angular Cubemap.
  18720. @item flat
  18721. @item gnomonic
  18722. @item rectilinear
  18723. Regular video.
  18724. Format specific options:
  18725. @table @option
  18726. @item h_fov
  18727. @item v_fov
  18728. @item d_fov
  18729. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18730. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18731. @item ih_fov
  18732. @item iv_fov
  18733. @item id_fov
  18734. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18735. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18736. @end table
  18737. @item dfisheye
  18738. Dual fisheye.
  18739. Format specific options:
  18740. @table @option
  18741. @item h_fov
  18742. @item v_fov
  18743. @item d_fov
  18744. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18745. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18746. @item ih_fov
  18747. @item iv_fov
  18748. @item id_fov
  18749. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18750. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18751. @end table
  18752. @item barrel
  18753. @item fb
  18754. @item barrelsplit
  18755. Facebook's 360 formats.
  18756. @item sg
  18757. Stereographic format.
  18758. Format specific options:
  18759. @table @option
  18760. @item h_fov
  18761. @item v_fov
  18762. @item d_fov
  18763. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18764. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18765. @item ih_fov
  18766. @item iv_fov
  18767. @item id_fov
  18768. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18769. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18770. @end table
  18771. @item mercator
  18772. Mercator format.
  18773. @item ball
  18774. Ball format, gives significant distortion toward the back.
  18775. @item hammer
  18776. Hammer-Aitoff map projection format.
  18777. @item sinusoidal
  18778. Sinusoidal map projection format.
  18779. @item fisheye
  18780. Fisheye projection.
  18781. Format specific options:
  18782. @table @option
  18783. @item h_fov
  18784. @item v_fov
  18785. @item d_fov
  18786. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18787. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18788. @item ih_fov
  18789. @item iv_fov
  18790. @item id_fov
  18791. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18792. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18793. @end table
  18794. @item pannini
  18795. Pannini projection.
  18796. Format specific options:
  18797. @table @option
  18798. @item h_fov
  18799. Set output pannini parameter.
  18800. @item ih_fov
  18801. Set input pannini parameter.
  18802. @end table
  18803. @item cylindrical
  18804. Cylindrical projection.
  18805. Format specific options:
  18806. @table @option
  18807. @item h_fov
  18808. @item v_fov
  18809. @item d_fov
  18810. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18811. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18812. @item ih_fov
  18813. @item iv_fov
  18814. @item id_fov
  18815. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18816. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18817. @end table
  18818. @item perspective
  18819. Perspective projection. @i{(output only)}
  18820. Format specific options:
  18821. @table @option
  18822. @item v_fov
  18823. Set perspective parameter.
  18824. @end table
  18825. @item tetrahedron
  18826. Tetrahedron projection.
  18827. @item tsp
  18828. Truncated square pyramid projection.
  18829. @item he
  18830. @item hequirect
  18831. Half equirectangular projection.
  18832. @item equisolid
  18833. Equisolid format.
  18834. Format specific options:
  18835. @table @option
  18836. @item h_fov
  18837. @item v_fov
  18838. @item d_fov
  18839. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18840. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18841. @item ih_fov
  18842. @item iv_fov
  18843. @item id_fov
  18844. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18845. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18846. @end table
  18847. @item og
  18848. Orthographic format.
  18849. Format specific options:
  18850. @table @option
  18851. @item h_fov
  18852. @item v_fov
  18853. @item d_fov
  18854. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18855. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18856. @item ih_fov
  18857. @item iv_fov
  18858. @item id_fov
  18859. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18860. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18861. @end table
  18862. @item octahedron
  18863. Octahedron projection.
  18864. @item cylindricalea
  18865. Cylindrical Equal Area projection.
  18866. @end table
  18867. @item interp
  18868. Set interpolation method.@*
  18869. @i{Note: more complex interpolation methods require much more memory to run.}
  18870. Available methods:
  18871. @table @samp
  18872. @item near
  18873. @item nearest
  18874. Nearest neighbour.
  18875. @item line
  18876. @item linear
  18877. Bilinear interpolation.
  18878. @item lagrange9
  18879. Lagrange9 interpolation.
  18880. @item cube
  18881. @item cubic
  18882. Bicubic interpolation.
  18883. @item lanc
  18884. @item lanczos
  18885. Lanczos interpolation.
  18886. @item sp16
  18887. @item spline16
  18888. Spline16 interpolation.
  18889. @item gauss
  18890. @item gaussian
  18891. Gaussian interpolation.
  18892. @item mitchell
  18893. Mitchell interpolation.
  18894. @end table
  18895. Default value is @b{@samp{line}}.
  18896. @item w
  18897. @item h
  18898. Set the output video resolution.
  18899. Default resolution depends on formats.
  18900. @item in_stereo
  18901. @item out_stereo
  18902. Set the input/output stereo format.
  18903. @table @samp
  18904. @item 2d
  18905. 2D mono
  18906. @item sbs
  18907. Side by side
  18908. @item tb
  18909. Top bottom
  18910. @end table
  18911. Default value is @b{@samp{2d}} for input and output format.
  18912. @item yaw
  18913. @item pitch
  18914. @item roll
  18915. Set rotation for the output video. Values in degrees.
  18916. @item rorder
  18917. Set rotation order for the output video. Choose one item for each position.
  18918. @table @samp
  18919. @item y, Y
  18920. yaw
  18921. @item p, P
  18922. pitch
  18923. @item r, R
  18924. roll
  18925. @end table
  18926. Default value is @b{@samp{ypr}}.
  18927. @item h_flip
  18928. @item v_flip
  18929. @item d_flip
  18930. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  18931. @item ih_flip
  18932. @item iv_flip
  18933. Set if input video is flipped horizontally/vertically. Boolean values.
  18934. @item in_trans
  18935. Set if input video is transposed. Boolean value, by default disabled.
  18936. @item out_trans
  18937. Set if output video needs to be transposed. Boolean value, by default disabled.
  18938. @item h_offset
  18939. @item v_offset
  18940. Set output horizontal/vertical off-axis offset. Default is set to 0.
  18941. Allowed range is from -1 to 1.
  18942. @item alpha_mask
  18943. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  18944. @item reset_rot
  18945. Reset rotation of output video. Boolean value, by default disabled.
  18946. @end table
  18947. @subsection Examples
  18948. @itemize
  18949. @item
  18950. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  18951. @example
  18952. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  18953. @end example
  18954. @item
  18955. Extract back view of Equi-Angular Cubemap:
  18956. @example
  18957. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  18958. @end example
  18959. @item
  18960. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  18961. @example
  18962. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  18963. @end example
  18964. @end itemize
  18965. @subsection Commands
  18966. This filter supports subset of above options as @ref{commands}.
  18967. @section vaguedenoiser
  18968. Apply a wavelet based denoiser.
  18969. It transforms each frame from the video input into the wavelet domain,
  18970. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  18971. the obtained coefficients. It does an inverse wavelet transform after.
  18972. Due to wavelet properties, it should give a nice smoothed result, and
  18973. reduced noise, without blurring picture features.
  18974. This filter accepts the following options:
  18975. @table @option
  18976. @item threshold
  18977. The filtering strength. The higher, the more filtered the video will be.
  18978. Hard thresholding can use a higher threshold than soft thresholding
  18979. before the video looks overfiltered. Default value is 2.
  18980. @item method
  18981. The filtering method the filter will use.
  18982. It accepts the following values:
  18983. @table @samp
  18984. @item hard
  18985. All values under the threshold will be zeroed.
  18986. @item soft
  18987. All values under the threshold will be zeroed. All values above will be
  18988. reduced by the threshold.
  18989. @item garrote
  18990. Scales or nullifies coefficients - intermediary between (more) soft and
  18991. (less) hard thresholding.
  18992. @end table
  18993. Default is garrote.
  18994. @item nsteps
  18995. Number of times, the wavelet will decompose the picture. Picture can't
  18996. be decomposed beyond a particular point (typically, 8 for a 640x480
  18997. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  18998. @item percent
  18999. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  19000. @item planes
  19001. A list of the planes to process. By default all planes are processed.
  19002. @item type
  19003. The threshold type the filter will use.
  19004. It accepts the following values:
  19005. @table @samp
  19006. @item universal
  19007. Threshold used is same for all decompositions.
  19008. @item bayes
  19009. Threshold used depends also on each decomposition coefficients.
  19010. @end table
  19011. Default is universal.
  19012. @end table
  19013. @section varblur
  19014. Apply variable blur filter by using 2nd video stream to set blur radius.
  19015. The 2nd stream must have the same dimensions.
  19016. This filter accepts the following options:
  19017. @table @option
  19018. @item min_r
  19019. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  19020. @item max_r
  19021. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  19022. @item planes
  19023. Set which planes to process. By default, all are used.
  19024. @end table
  19025. The @code{varblur} filter also supports the @ref{framesync} options.
  19026. @subsection Commands
  19027. This filter supports all the above options as @ref{commands}.
  19028. @section vectorscope
  19029. Display 2 color component values in the two dimensional graph (which is called
  19030. a vectorscope).
  19031. This filter accepts the following options:
  19032. @table @option
  19033. @item mode, m
  19034. Set vectorscope mode.
  19035. It accepts the following values:
  19036. @table @samp
  19037. @item gray
  19038. @item tint
  19039. Gray values are displayed on graph, higher brightness means more pixels have
  19040. same component color value on location in graph. This is the default mode.
  19041. @item color
  19042. Gray values are displayed on graph. Surrounding pixels values which are not
  19043. present in video frame are drawn in gradient of 2 color components which are
  19044. set by option @code{x} and @code{y}. The 3rd color component is static.
  19045. @item color2
  19046. Actual color components values present in video frame are displayed on graph.
  19047. @item color3
  19048. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  19049. on graph increases value of another color component, which is luminance by
  19050. default values of @code{x} and @code{y}.
  19051. @item color4
  19052. Actual colors present in video frame are displayed on graph. If two different
  19053. colors map to same position on graph then color with higher value of component
  19054. not present in graph is picked.
  19055. @item color5
  19056. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  19057. component picked from radial gradient.
  19058. @end table
  19059. @item x
  19060. Set which color component will be represented on X-axis. Default is @code{1}.
  19061. @item y
  19062. Set which color component will be represented on Y-axis. Default is @code{2}.
  19063. @item intensity, i
  19064. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  19065. of color component which represents frequency of (X, Y) location in graph.
  19066. @item envelope, e
  19067. @table @samp
  19068. @item none
  19069. No envelope, this is default.
  19070. @item instant
  19071. Instant envelope, even darkest single pixel will be clearly highlighted.
  19072. @item peak
  19073. Hold maximum and minimum values presented in graph over time. This way you
  19074. can still spot out of range values without constantly looking at vectorscope.
  19075. @item peak+instant
  19076. Peak and instant envelope combined together.
  19077. @end table
  19078. @item graticule, g
  19079. Set what kind of graticule to draw.
  19080. @table @samp
  19081. @item none
  19082. @item green
  19083. @item color
  19084. @item invert
  19085. @end table
  19086. @item opacity, o
  19087. Set graticule opacity.
  19088. @item flags, f
  19089. Set graticule flags.
  19090. @table @samp
  19091. @item white
  19092. Draw graticule for white point.
  19093. @item black
  19094. Draw graticule for black point.
  19095. @item name
  19096. Draw color points short names.
  19097. @end table
  19098. @item bgopacity, b
  19099. Set background opacity.
  19100. @item lthreshold, l
  19101. Set low threshold for color component not represented on X or Y axis.
  19102. Values lower than this value will be ignored. Default is 0.
  19103. Note this value is multiplied with actual max possible value one pixel component
  19104. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  19105. is 0.1 * 255 = 25.
  19106. @item hthreshold, h
  19107. Set high threshold for color component not represented on X or Y axis.
  19108. Values higher than this value will be ignored. Default is 1.
  19109. Note this value is multiplied with actual max possible value one pixel component
  19110. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  19111. is 0.9 * 255 = 230.
  19112. @item colorspace, c
  19113. Set what kind of colorspace to use when drawing graticule.
  19114. @table @samp
  19115. @item auto
  19116. @item 601
  19117. @item 709
  19118. @end table
  19119. Default is auto.
  19120. @item tint0, t0
  19121. @item tint1, t1
  19122. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  19123. This means no tint, and output will remain gray.
  19124. @end table
  19125. @anchor{vidstabdetect}
  19126. @section vidstabdetect
  19127. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  19128. @ref{vidstabtransform} for pass 2.
  19129. This filter generates a file with relative translation and rotation
  19130. transform information about subsequent frames, which is then used by
  19131. the @ref{vidstabtransform} filter.
  19132. To enable compilation of this filter you need to configure FFmpeg with
  19133. @code{--enable-libvidstab}.
  19134. This filter accepts the following options:
  19135. @table @option
  19136. @item result
  19137. Set the path to the file used to write the transforms information.
  19138. Default value is @file{transforms.trf}.
  19139. @item shakiness
  19140. Set how shaky the video is and how quick the camera is. It accepts an
  19141. integer in the range 1-10, a value of 1 means little shakiness, a
  19142. value of 10 means strong shakiness. Default value is 5.
  19143. @item accuracy
  19144. Set the accuracy of the detection process. It must be a value in the
  19145. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  19146. accuracy. Default value is 15.
  19147. @item stepsize
  19148. Set stepsize of the search process. The region around minimum is
  19149. scanned with 1 pixel resolution. Default value is 6.
  19150. @item mincontrast
  19151. Set minimum contrast. Below this value a local measurement field is
  19152. discarded. Must be a floating point value in the range 0-1. Default
  19153. value is 0.3.
  19154. @item tripod
  19155. Set reference frame number for tripod mode.
  19156. If enabled, the motion of the frames is compared to a reference frame
  19157. in the filtered stream, identified by the specified number. The idea
  19158. is to compensate all movements in a more-or-less static scene and keep
  19159. the camera view absolutely still.
  19160. If set to 0, it is disabled. The frames are counted starting from 1.
  19161. @item show
  19162. Show fields and transforms in the resulting frames. It accepts an
  19163. integer in the range 0-2. Default value is 0, which disables any
  19164. visualization.
  19165. @item fileformat
  19166. Format for the transforms data file to be written.
  19167. Acceptable values are
  19168. @table @samp
  19169. @item ascii
  19170. Human-readable plain text
  19171. @item binary
  19172. Binary format, roughly 40% smaller than @code{ascii}. (@emph{default})
  19173. @end table
  19174. @end table
  19175. @subsection Examples
  19176. @itemize
  19177. @item
  19178. Use default values:
  19179. @example
  19180. vidstabdetect
  19181. @end example
  19182. @item
  19183. Analyze strongly shaky movie and put the results in file
  19184. @file{mytransforms.trf}:
  19185. @example
  19186. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  19187. @end example
  19188. @item
  19189. Visualize the result of internal transformations in the resulting
  19190. video:
  19191. @example
  19192. vidstabdetect=show=1
  19193. @end example
  19194. @item
  19195. Analyze a video with medium shakiness using @command{ffmpeg}:
  19196. @example
  19197. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  19198. @end example
  19199. @end itemize
  19200. @anchor{vidstabtransform}
  19201. @section vidstabtransform
  19202. Video stabilization/deshaking: pass 2 of 2,
  19203. see @ref{vidstabdetect} for pass 1.
  19204. Read a file with transform information for each frame and
  19205. apply/compensate them. Together with the @ref{vidstabdetect}
  19206. filter this can be used to deshake videos. See also
  19207. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  19208. the @ref{unsharp} filter, see below.
  19209. To enable compilation of this filter you need to configure FFmpeg with
  19210. @code{--enable-libvidstab}.
  19211. @subsection Options
  19212. @table @option
  19213. @item input
  19214. Set path to the file used to read the transforms. Default value is
  19215. @file{transforms.trf}.
  19216. @item smoothing
  19217. Set the number of frames (value*2 + 1) used for lowpass filtering the
  19218. camera movements. Default value is 10.
  19219. For example a number of 10 means that 21 frames are used (10 in the
  19220. past and 10 in the future) to smoothen the motion in the video. A
  19221. larger value leads to a smoother video, but limits the acceleration of
  19222. the camera (pan/tilt movements). 0 is a special case where a static
  19223. camera is simulated.
  19224. @item optalgo
  19225. Set the camera path optimization algorithm.
  19226. Accepted values are:
  19227. @table @samp
  19228. @item gauss
  19229. gaussian kernel low-pass filter on camera motion (default)
  19230. @item avg
  19231. averaging on transformations
  19232. @end table
  19233. @item maxshift
  19234. Set maximal number of pixels to translate frames. Default value is -1,
  19235. meaning no limit.
  19236. @item maxangle
  19237. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  19238. value is -1, meaning no limit.
  19239. @item crop
  19240. Specify how to deal with borders that may be visible due to movement
  19241. compensation.
  19242. Available values are:
  19243. @table @samp
  19244. @item keep
  19245. keep image information from previous frame (default)
  19246. @item black
  19247. fill the border black
  19248. @end table
  19249. @item invert
  19250. Invert transforms if set to 1. Default value is 0.
  19251. @item relative
  19252. Consider transforms as relative to previous frame if set to 1,
  19253. absolute if set to 0. Default value is 0.
  19254. @item zoom
  19255. Set percentage to zoom. A positive value will result in a zoom-in
  19256. effect, a negative value in a zoom-out effect. Default value is 0 (no
  19257. zoom).
  19258. @item optzoom
  19259. Set optimal zooming to avoid borders.
  19260. Accepted values are:
  19261. @table @samp
  19262. @item 0
  19263. disabled
  19264. @item 1
  19265. optimal static zoom value is determined (only very strong movements
  19266. will lead to visible borders) (default)
  19267. @item 2
  19268. optimal adaptive zoom value is determined (no borders will be
  19269. visible), see @option{zoomspeed}
  19270. @end table
  19271. Note that the value given at zoom is added to the one calculated here.
  19272. @item zoomspeed
  19273. Set percent to zoom maximally each frame (enabled when
  19274. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  19275. 0.25.
  19276. @item interpol
  19277. Specify type of interpolation.
  19278. Available values are:
  19279. @table @samp
  19280. @item no
  19281. no interpolation
  19282. @item linear
  19283. linear only horizontal
  19284. @item bilinear
  19285. linear in both directions (default)
  19286. @item bicubic
  19287. cubic in both directions (slow)
  19288. @end table
  19289. @item tripod
  19290. Enable virtual tripod mode if set to 1, which is equivalent to
  19291. @code{relative=0:smoothing=0}. Default value is 0.
  19292. Use also @code{tripod} option of @ref{vidstabdetect}.
  19293. @item debug
  19294. Increase log verbosity if set to 1. Also the detected global motions
  19295. are written to the temporary file @file{global_motions.trf}. Default
  19296. value is 0.
  19297. @end table
  19298. @subsection Examples
  19299. @itemize
  19300. @item
  19301. Use @command{ffmpeg} for a typical stabilization with default values:
  19302. @example
  19303. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  19304. @end example
  19305. Note the use of the @ref{unsharp} filter which is always recommended.
  19306. @item
  19307. Zoom in a bit more and load transform data from a given file:
  19308. @example
  19309. vidstabtransform=zoom=5:input="mytransforms.trf"
  19310. @end example
  19311. @item
  19312. Smoothen the video even more:
  19313. @example
  19314. vidstabtransform=smoothing=30
  19315. @end example
  19316. @end itemize
  19317. @section vflip
  19318. Flip the input video vertically.
  19319. For example, to vertically flip a video with @command{ffmpeg}:
  19320. @example
  19321. ffmpeg -i in.avi -vf "vflip" out.avi
  19322. @end example
  19323. @section vfrdet
  19324. Detect variable frame rate video.
  19325. This filter tries to detect if the input is variable or constant frame rate.
  19326. At end it will output number of frames detected as having variable delta pts,
  19327. and ones with constant delta pts.
  19328. If there was frames with variable delta, than it will also show min, max and
  19329. average delta encountered.
  19330. @section vibrance
  19331. Boost or alter saturation.
  19332. The filter accepts the following options:
  19333. @table @option
  19334. @item intensity
  19335. Set strength of boost if positive value or strength of alter if negative value.
  19336. Default is 0. Allowed range is from -2 to 2.
  19337. @item rbal
  19338. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  19339. @item gbal
  19340. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  19341. @item bbal
  19342. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  19343. @item rlum
  19344. Set the red luma coefficient.
  19345. @item glum
  19346. Set the green luma coefficient.
  19347. @item blum
  19348. Set the blue luma coefficient.
  19349. @item alternate
  19350. If @code{intensity} is negative and this is set to 1, colors will change,
  19351. otherwise colors will be less saturated, more towards gray.
  19352. @end table
  19353. @subsection Commands
  19354. This filter supports the all above options as @ref{commands}.
  19355. @section vif
  19356. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  19357. This filter takes two input videos.
  19358. Both input videos must have the same resolution and pixel format for
  19359. this filter to work correctly. Also it assumes that both inputs
  19360. have the same number of frames, which are compared one by one.
  19361. The obtained average VIF score is printed through the logging system.
  19362. The filter stores the calculated VIF score of each frame.
  19363. This filter also supports the @ref{framesync} options.
  19364. In the below example the input file @file{main.mpg} being processed is compared
  19365. with the reference file @file{ref.mpg}.
  19366. @example
  19367. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  19368. @end example
  19369. @anchor{vignette}
  19370. @section vignette
  19371. Make or reverse a natural vignetting effect.
  19372. The filter accepts the following options:
  19373. @table @option
  19374. @item angle, a
  19375. Set lens angle expression as a number of radians.
  19376. The value is clipped in the @code{[0,PI/2]} range.
  19377. Default value: @code{"PI/5"}
  19378. @item x0
  19379. @item y0
  19380. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  19381. by default.
  19382. @item mode
  19383. Set forward/backward mode.
  19384. Available modes are:
  19385. @table @samp
  19386. @item forward
  19387. The larger the distance from the central point, the darker the image becomes.
  19388. @item backward
  19389. The larger the distance from the central point, the brighter the image becomes.
  19390. This can be used to reverse a vignette effect, though there is no automatic
  19391. detection to extract the lens @option{angle} and other settings (yet). It can
  19392. also be used to create a burning effect.
  19393. @end table
  19394. Default value is @samp{forward}.
  19395. @item eval
  19396. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  19397. It accepts the following values:
  19398. @table @samp
  19399. @item init
  19400. Evaluate expressions only once during the filter initialization.
  19401. @item frame
  19402. Evaluate expressions for each incoming frame. This is way slower than the
  19403. @samp{init} mode since it requires all the scalers to be re-computed, but it
  19404. allows advanced dynamic expressions.
  19405. @end table
  19406. Default value is @samp{init}.
  19407. @item dither
  19408. Set dithering to reduce the circular banding effects. Default is @code{1}
  19409. (enabled).
  19410. @item aspect
  19411. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  19412. Setting this value to the SAR of the input will make a rectangular vignetting
  19413. following the dimensions of the video.
  19414. Default is @code{1/1}.
  19415. @end table
  19416. @subsection Expressions
  19417. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  19418. following parameters.
  19419. @table @option
  19420. @item w
  19421. @item h
  19422. input width and height
  19423. @item n
  19424. the number of input frame, starting from 0
  19425. @item pts
  19426. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  19427. @var{TB} units, NAN if undefined
  19428. @item r
  19429. frame rate of the input video, NAN if the input frame rate is unknown
  19430. @item t
  19431. the PTS (Presentation TimeStamp) of the filtered video frame,
  19432. expressed in seconds, NAN if undefined
  19433. @item tb
  19434. time base of the input video
  19435. @end table
  19436. @subsection Examples
  19437. @itemize
  19438. @item
  19439. Apply simple strong vignetting effect:
  19440. @example
  19441. vignette=PI/4
  19442. @end example
  19443. @item
  19444. Make a flickering vignetting:
  19445. @example
  19446. vignette='PI/4+random(1)*PI/50':eval=frame
  19447. @end example
  19448. @end itemize
  19449. @section vmafmotion
  19450. Obtain the average VMAF motion score of a video.
  19451. It is one of the component metrics of VMAF.
  19452. The obtained average motion score is printed through the logging system.
  19453. The filter accepts the following options:
  19454. @table @option
  19455. @item stats_file
  19456. If specified, the filter will use the named file to save the motion score of
  19457. each frame with respect to the previous frame.
  19458. When filename equals "-" the data is sent to standard output.
  19459. @end table
  19460. Example:
  19461. @example
  19462. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  19463. @end example
  19464. @anchor{vstack}
  19465. @section vstack
  19466. Stack input videos vertically.
  19467. All streams must be of same pixel format and of same width.
  19468. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  19469. to create same output.
  19470. The filter accepts the following options:
  19471. @table @option
  19472. @item inputs
  19473. Set number of input streams. Default is 2.
  19474. @item shortest
  19475. If set to 1, force the output to terminate when the shortest input
  19476. terminates. Default value is 0.
  19477. @end table
  19478. @section w3fdif
  19479. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  19480. Deinterlacing Filter").
  19481. Based on the process described by Martin Weston for BBC R&D, and
  19482. implemented based on the de-interlace algorithm written by Jim
  19483. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  19484. uses filter coefficients calculated by BBC R&D.
  19485. This filter uses field-dominance information in frame to decide which
  19486. of each pair of fields to place first in the output.
  19487. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  19488. There are two sets of filter coefficients, so called "simple"
  19489. and "complex". Which set of filter coefficients is used can
  19490. be set by passing an optional parameter:
  19491. @table @option
  19492. @item filter
  19493. Set the interlacing filter coefficients. Accepts one of the following values:
  19494. @table @samp
  19495. @item simple
  19496. Simple filter coefficient set.
  19497. @item complex
  19498. More-complex filter coefficient set.
  19499. @end table
  19500. Default value is @samp{complex}.
  19501. @item mode
  19502. The interlacing mode to adopt. It accepts one of the following values:
  19503. @table @option
  19504. @item frame
  19505. Output one frame for each frame.
  19506. @item field
  19507. Output one frame for each field.
  19508. @end table
  19509. The default value is @code{field}.
  19510. @item parity
  19511. The picture field parity assumed for the input interlaced video. It accepts one
  19512. of the following values:
  19513. @table @option
  19514. @item tff
  19515. Assume the top field is first.
  19516. @item bff
  19517. Assume the bottom field is first.
  19518. @item auto
  19519. Enable automatic detection of field parity.
  19520. @end table
  19521. The default value is @code{auto}.
  19522. If the interlacing is unknown or the decoder does not export this information,
  19523. top field first will be assumed.
  19524. @item deint
  19525. Specify which frames to deinterlace. Accepts one of the following values:
  19526. @table @samp
  19527. @item all
  19528. Deinterlace all frames,
  19529. @item interlaced
  19530. Only deinterlace frames marked as interlaced.
  19531. @end table
  19532. Default value is @samp{all}.
  19533. @end table
  19534. @subsection Commands
  19535. This filter supports same @ref{commands} as options.
  19536. @section waveform
  19537. Video waveform monitor.
  19538. The waveform monitor plots color component intensity. By default luma
  19539. only. Each column of the waveform corresponds to a column of pixels in the
  19540. source video.
  19541. It accepts the following options:
  19542. @table @option
  19543. @item mode, m
  19544. Can be either @code{row}, or @code{column}. Default is @code{column}.
  19545. In row mode, the graph on the left side represents color component value 0 and
  19546. the right side represents value = 255. In column mode, the top side represents
  19547. color component value = 0 and bottom side represents value = 255.
  19548. @item intensity, i
  19549. Set intensity. Smaller values are useful to find out how many values of the same
  19550. luminance are distributed across input rows/columns.
  19551. Default value is @code{0.04}. Allowed range is [0, 1].
  19552. @item mirror, r
  19553. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  19554. In mirrored mode, higher values will be represented on the left
  19555. side for @code{row} mode and at the top for @code{column} mode. Default is
  19556. @code{1} (mirrored).
  19557. @item display, d
  19558. Set display mode.
  19559. It accepts the following values:
  19560. @table @samp
  19561. @item overlay
  19562. Presents information identical to that in the @code{parade}, except
  19563. that the graphs representing color components are superimposed directly
  19564. over one another.
  19565. This display mode makes it easier to spot relative differences or similarities
  19566. in overlapping areas of the color components that are supposed to be identical,
  19567. such as neutral whites, grays, or blacks.
  19568. @item stack
  19569. Display separate graph for the color components side by side in
  19570. @code{row} mode or one below the other in @code{column} mode.
  19571. @item parade
  19572. Display separate graph for the color components side by side in
  19573. @code{column} mode or one below the other in @code{row} mode.
  19574. Using this display mode makes it easy to spot color casts in the highlights
  19575. and shadows of an image, by comparing the contours of the top and the bottom
  19576. graphs of each waveform. Since whites, grays, and blacks are characterized
  19577. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  19578. should display three waveforms of roughly equal width/height. If not, the
  19579. correction is easy to perform by making level adjustments the three waveforms.
  19580. @end table
  19581. Default is @code{stack}.
  19582. @item components, c
  19583. Set which color components to display. Default is 1, which means only luma
  19584. or red color component if input is in RGB colorspace. If is set for example to
  19585. 7 it will display all 3 (if) available color components.
  19586. @item envelope, e
  19587. @table @samp
  19588. @item none
  19589. No envelope, this is default.
  19590. @item instant
  19591. Instant envelope, minimum and maximum values presented in graph will be easily
  19592. visible even with small @code{step} value.
  19593. @item peak
  19594. Hold minimum and maximum values presented in graph across time. This way you
  19595. can still spot out of range values without constantly looking at waveforms.
  19596. @item peak+instant
  19597. Peak and instant envelope combined together.
  19598. @end table
  19599. @item filter, f
  19600. @table @samp
  19601. @item lowpass
  19602. No filtering, this is default.
  19603. @item flat
  19604. Luma and chroma combined together.
  19605. @item aflat
  19606. Similar as above, but shows difference between blue and red chroma.
  19607. @item xflat
  19608. Similar as above, but use different colors.
  19609. @item yflat
  19610. Similar as above, but again with different colors.
  19611. @item chroma
  19612. Displays only chroma.
  19613. @item color
  19614. Displays actual color value on waveform.
  19615. @item acolor
  19616. Similar as above, but with luma showing frequency of chroma values.
  19617. @end table
  19618. @item graticule, g
  19619. Set which graticule to display.
  19620. @table @samp
  19621. @item none
  19622. Do not display graticule.
  19623. @item green
  19624. Display green graticule showing legal broadcast ranges.
  19625. @item orange
  19626. Display orange graticule showing legal broadcast ranges.
  19627. @item invert
  19628. Display invert graticule showing legal broadcast ranges.
  19629. @end table
  19630. @item opacity, o
  19631. Set graticule opacity.
  19632. @item flags, fl
  19633. Set graticule flags.
  19634. @table @samp
  19635. @item numbers
  19636. Draw numbers above lines. By default enabled.
  19637. @item dots
  19638. Draw dots instead of lines.
  19639. @end table
  19640. @item scale, s
  19641. Set scale used for displaying graticule.
  19642. @table @samp
  19643. @item digital
  19644. @item millivolts
  19645. @item ire
  19646. @end table
  19647. Default is digital.
  19648. @item bgopacity, b
  19649. Set background opacity.
  19650. @item tint0, t0
  19651. @item tint1, t1
  19652. Set tint for output.
  19653. Only used with lowpass filter and when display is not overlay and input
  19654. pixel formats are not RGB.
  19655. @item fitmode, fm
  19656. Set sample aspect ratio of video output frames.
  19657. Can be used to configure waveform so it is not
  19658. streched too much in one of directions.
  19659. @table @samp
  19660. @item none
  19661. Set sample aspect ration to 1/1.
  19662. @item size
  19663. Set sample aspect ratio to match input size of video
  19664. @end table
  19665. Default is @samp{none}.
  19666. @item input
  19667. Set input formats for filter to pick from.
  19668. Can be @samp{all}, for selecting from all available formats,
  19669. or @samp{first}, for selecting first available format.
  19670. Default is @samp{first}.
  19671. @end table
  19672. @section weave, doubleweave
  19673. The @code{weave} takes a field-based video input and join
  19674. each two sequential fields into single frame, producing a new double
  19675. height clip with half the frame rate and half the frame count.
  19676. The @code{doubleweave} works same as @code{weave} but without
  19677. halving frame rate and frame count.
  19678. It accepts the following option:
  19679. @table @option
  19680. @item first_field
  19681. Set first field. Available values are:
  19682. @table @samp
  19683. @item top, t
  19684. Set the frame as top-field-first.
  19685. @item bottom, b
  19686. Set the frame as bottom-field-first.
  19687. @end table
  19688. @end table
  19689. @subsection Examples
  19690. @itemize
  19691. @item
  19692. Interlace video using @ref{select} and @ref{separatefields} filter:
  19693. @example
  19694. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  19695. @end example
  19696. @end itemize
  19697. @section xbr
  19698. Apply the xBR high-quality magnification filter which is designed for pixel
  19699. art. It follows a set of edge-detection rules, see
  19700. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  19701. It accepts the following option:
  19702. @table @option
  19703. @item n
  19704. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  19705. @code{3xBR} and @code{4} for @code{4xBR}.
  19706. Default is @code{3}.
  19707. @end table
  19708. @section xcorrelate
  19709. Apply normalized cross-correlation between first and second input video stream.
  19710. Second input video stream dimensions must be lower than first input video stream.
  19711. The filter accepts the following options:
  19712. @table @option
  19713. @item planes
  19714. Set which planes to process.
  19715. @item secondary
  19716. Set which secondary video frames will be processed from second input video stream,
  19717. can be @var{first} or @var{all}. Default is @var{all}.
  19718. @end table
  19719. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  19720. @section xfade
  19721. Apply cross fade from one input video stream to another input video stream.
  19722. The cross fade is applied for specified duration.
  19723. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  19724. frame rate and timebase.
  19725. The filter accepts the following options:
  19726. @table @option
  19727. @item transition
  19728. Set one of available transition effects:
  19729. @table @samp
  19730. @item custom
  19731. @item fade
  19732. @item wipeleft
  19733. @item wiperight
  19734. @item wipeup
  19735. @item wipedown
  19736. @item slideleft
  19737. @item slideright
  19738. @item slideup
  19739. @item slidedown
  19740. @item circlecrop
  19741. @item rectcrop
  19742. @item distance
  19743. @item fadeblack
  19744. @item fadewhite
  19745. @item radial
  19746. @item smoothleft
  19747. @item smoothright
  19748. @item smoothup
  19749. @item smoothdown
  19750. @item circleopen
  19751. @item circleclose
  19752. @item vertopen
  19753. @item vertclose
  19754. @item horzopen
  19755. @item horzclose
  19756. @item dissolve
  19757. @item pixelize
  19758. @item diagtl
  19759. @item diagtr
  19760. @item diagbl
  19761. @item diagbr
  19762. @item hlslice
  19763. @item hrslice
  19764. @item vuslice
  19765. @item vdslice
  19766. @item hblur
  19767. @item fadegrays
  19768. @item wipetl
  19769. @item wipetr
  19770. @item wipebl
  19771. @item wipebr
  19772. @item squeezeh
  19773. @item squeezev
  19774. @item zoomin
  19775. @item fadefast
  19776. @item fadeslow
  19777. @item hlwind
  19778. @item hrwind
  19779. @item vuwind
  19780. @item vdwind
  19781. @item coverleft
  19782. @item coverright
  19783. @item coverup
  19784. @item coverdown
  19785. @item revealleft
  19786. @item revealright
  19787. @item revealup
  19788. @item revealdown
  19789. @end table
  19790. Default transition effect is fade.
  19791. @item duration
  19792. Set cross fade duration in seconds.
  19793. Range is 0 to 60 seconds.
  19794. Default duration is 1 second.
  19795. @item offset
  19796. Set cross fade start relative to first input stream in seconds.
  19797. Default offset is 0.
  19798. @item expr
  19799. Set expression for custom transition effect.
  19800. The expressions can use the following variables and functions:
  19801. @table @option
  19802. @item X
  19803. @item Y
  19804. The coordinates of the current sample.
  19805. @item W
  19806. @item H
  19807. The width and height of the image.
  19808. @item P
  19809. Progress of transition effect.
  19810. @item PLANE
  19811. Currently processed plane.
  19812. @item A
  19813. Return value of first input at current location and plane.
  19814. @item B
  19815. Return value of second input at current location and plane.
  19816. @item a0(x, y)
  19817. @item a1(x, y)
  19818. @item a2(x, y)
  19819. @item a3(x, y)
  19820. Return the value of the pixel at location (@var{x},@var{y}) of the
  19821. first/second/third/fourth component of first input.
  19822. @item b0(x, y)
  19823. @item b1(x, y)
  19824. @item b2(x, y)
  19825. @item b3(x, y)
  19826. Return the value of the pixel at location (@var{x},@var{y}) of the
  19827. first/second/third/fourth component of second input.
  19828. @end table
  19829. @end table
  19830. @subsection Examples
  19831. @itemize
  19832. @item
  19833. Cross fade from one input video to another input video, with fade transition and duration of transition
  19834. of 2 seconds starting at offset of 5 seconds:
  19835. @example
  19836. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  19837. @end example
  19838. @end itemize
  19839. @section xmedian
  19840. Pick median pixels from several input videos.
  19841. The filter accepts the following options:
  19842. @table @option
  19843. @item inputs
  19844. Set number of inputs.
  19845. Default is 3. Allowed range is from 3 to 255.
  19846. If number of inputs is even number, than result will be mean value between two median values.
  19847. @item planes
  19848. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  19849. @item percentile
  19850. Set median percentile. Default value is @code{0.5}.
  19851. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  19852. minimum values, and @code{1} maximum values.
  19853. @end table
  19854. @subsection Commands
  19855. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  19856. @anchor{xstack}
  19857. @section xstack
  19858. Stack video inputs into custom layout.
  19859. All streams must be of same pixel format.
  19860. The filter accepts the following options:
  19861. @table @option
  19862. @item inputs
  19863. Set number of input streams. Default is 2.
  19864. @item layout
  19865. Specify layout of inputs.
  19866. This option requires the desired layout configuration to be explicitly set by the user.
  19867. This sets position of each video input in output. Each input
  19868. is separated by '|'.
  19869. The first number represents the column, and the second number represents the row.
  19870. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  19871. where X is video input from which to take width or height.
  19872. Multiple values can be used when separated by '+'. In such
  19873. case values are summed together.
  19874. Note that if inputs are of different sizes gaps may appear, as not all of
  19875. the output video frame will be filled. Similarly, videos can overlap each
  19876. other if their position doesn't leave enough space for the full frame of
  19877. adjoining videos.
  19878. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  19879. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  19880. the user. Either @code{grid} or @code{layout} can be specified at a time.
  19881. Specifying both will result in an error.
  19882. @item grid
  19883. Specify a fixed size grid of inputs.
  19884. This option is used to create a fixed size grid of the input streams. Set the
  19885. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  19886. input streams and they will be arranged as a grid with @code{ROWS} rows and
  19887. @code{COLUMNS} columns. When using this option, each input stream within a row
  19888. must have the same height and all the rows must have the same width.
  19889. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  19890. set to @code{ROWS * COLUMNS}.
  19891. For 2 inputs, a default grid of @code{2x1} (equivalent to
  19892. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  19893. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  19894. Specifying both will result in an error.
  19895. @item shortest
  19896. If set to 1, force the output to terminate when the shortest input
  19897. terminates. Default value is 0.
  19898. @item fill
  19899. If set to valid color, all unused pixels will be filled with that color.
  19900. By default fill is set to none, so it is disabled.
  19901. @end table
  19902. @subsection Examples
  19903. @itemize
  19904. @item
  19905. Display 4 inputs into 2x2 grid.
  19906. Layout:
  19907. @example
  19908. input1(0, 0) | input3(w0, 0)
  19909. input2(0, h0) | input4(w0, h0)
  19910. @end example
  19911. @example
  19912. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  19913. @end example
  19914. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19915. @item
  19916. Display 4 inputs into 1x4 grid.
  19917. Layout:
  19918. @example
  19919. input1(0, 0)
  19920. input2(0, h0)
  19921. input3(0, h0+h1)
  19922. input4(0, h0+h1+h2)
  19923. @end example
  19924. @example
  19925. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  19926. @end example
  19927. Note that if inputs are of different widths, unused space will appear.
  19928. @item
  19929. Display 9 inputs into 3x3 grid.
  19930. Layout:
  19931. @example
  19932. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  19933. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  19934. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  19935. @end example
  19936. @example
  19937. 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
  19938. @end example
  19939. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19940. @item
  19941. Display 16 inputs into 4x4 grid.
  19942. Layout:
  19943. @example
  19944. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  19945. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  19946. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  19947. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  19948. @end example
  19949. @example
  19950. 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|
  19951. 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
  19952. @end example
  19953. Note that if inputs are of different sizes, gaps or overlaps may occur.
  19954. @end itemize
  19955. @anchor{yadif}
  19956. @section yadif
  19957. Deinterlace the input video ("yadif" means "yet another deinterlacing
  19958. filter").
  19959. It accepts the following parameters:
  19960. @table @option
  19961. @item mode
  19962. The interlacing mode to adopt. It accepts one of the following values:
  19963. @table @option
  19964. @item 0, send_frame
  19965. Output one frame for each frame.
  19966. @item 1, send_field
  19967. Output one frame for each field.
  19968. @item 2, send_frame_nospatial
  19969. Like @code{send_frame}, but it skips the spatial interlacing check.
  19970. @item 3, send_field_nospatial
  19971. Like @code{send_field}, but it skips the spatial interlacing check.
  19972. @end table
  19973. The default value is @code{send_frame}.
  19974. @item parity
  19975. The picture field parity assumed for the input interlaced video. It accepts one
  19976. of the following values:
  19977. @table @option
  19978. @item 0, tff
  19979. Assume the top field is first.
  19980. @item 1, bff
  19981. Assume the bottom field is first.
  19982. @item -1, auto
  19983. Enable automatic detection of field parity.
  19984. @end table
  19985. The default value is @code{auto}.
  19986. If the interlacing is unknown or the decoder does not export this information,
  19987. top field first will be assumed.
  19988. @item deint
  19989. Specify which frames to deinterlace. Accepts one of the following
  19990. values:
  19991. @table @option
  19992. @item 0, all
  19993. Deinterlace all frames.
  19994. @item 1, interlaced
  19995. Only deinterlace frames marked as interlaced.
  19996. @end table
  19997. The default value is @code{all}.
  19998. @end table
  19999. @section yadif_cuda
  20000. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  20001. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  20002. and/or nvenc.
  20003. It accepts the following parameters:
  20004. @table @option
  20005. @item mode
  20006. The interlacing mode to adopt. It accepts one of the following values:
  20007. @table @option
  20008. @item 0, send_frame
  20009. Output one frame for each frame.
  20010. @item 1, send_field
  20011. Output one frame for each field.
  20012. @item 2, send_frame_nospatial
  20013. Like @code{send_frame}, but it skips the spatial interlacing check.
  20014. @item 3, send_field_nospatial
  20015. Like @code{send_field}, but it skips the spatial interlacing check.
  20016. @end table
  20017. The default value is @code{send_frame}.
  20018. @item parity
  20019. The picture field parity assumed for the input interlaced video. It accepts one
  20020. of the following values:
  20021. @table @option
  20022. @item 0, tff
  20023. Assume the top field is first.
  20024. @item 1, bff
  20025. Assume the bottom field is first.
  20026. @item -1, auto
  20027. Enable automatic detection of field parity.
  20028. @end table
  20029. The default value is @code{auto}.
  20030. If the interlacing is unknown or the decoder does not export this information,
  20031. top field first will be assumed.
  20032. @item deint
  20033. Specify which frames to deinterlace. Accepts one of the following
  20034. values:
  20035. @table @option
  20036. @item 0, all
  20037. Deinterlace all frames.
  20038. @item 1, interlaced
  20039. Only deinterlace frames marked as interlaced.
  20040. @end table
  20041. The default value is @code{all}.
  20042. @end table
  20043. @section yaepblur
  20044. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  20045. The algorithm is described in
  20046. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  20047. It accepts the following parameters:
  20048. @table @option
  20049. @item radius, r
  20050. Set the window radius. Default value is 3.
  20051. @item planes, p
  20052. Set which planes to filter. Default is only the first plane.
  20053. @item sigma, s
  20054. Set blur strength. Default value is 128.
  20055. @end table
  20056. @subsection Commands
  20057. This filter supports same @ref{commands} as options.
  20058. @section zoompan
  20059. Apply Zoom & Pan effect.
  20060. This filter accepts the following options:
  20061. @table @option
  20062. @item zoom, z
  20063. Set the zoom expression. Range is 1-10. Default is 1.
  20064. @item x
  20065. @item y
  20066. Set the x and y expression. Default is 0.
  20067. @item d
  20068. Set the duration expression in number of frames.
  20069. This sets for how many number of frames effect will last for
  20070. single input image. Default is 90.
  20071. @item s
  20072. Set the output image size, default is 'hd720'.
  20073. @item fps
  20074. Set the output frame rate, default is '25'.
  20075. @end table
  20076. Each expression can contain the following constants:
  20077. @table @option
  20078. @item in_w, iw
  20079. Input width.
  20080. @item in_h, ih
  20081. Input height.
  20082. @item out_w, ow
  20083. Output width.
  20084. @item out_h, oh
  20085. Output height.
  20086. @item in
  20087. Input frame count.
  20088. @item on
  20089. Output frame count.
  20090. @item in_time, it
  20091. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  20092. @item out_time, time, ot
  20093. The output timestamp expressed in seconds.
  20094. @item x
  20095. @item y
  20096. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  20097. for current input frame.
  20098. @item px
  20099. @item py
  20100. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  20101. not yet such frame (first input frame).
  20102. @item zoom
  20103. Last calculated zoom from 'z' expression for current input frame.
  20104. @item pzoom
  20105. Last calculated zoom of last output frame of previous input frame.
  20106. @item duration
  20107. Number of output frames for current input frame. Calculated from 'd' expression
  20108. for each input frame.
  20109. @item pduration
  20110. number of output frames created for previous input frame
  20111. @item a
  20112. Rational number: input width / input height
  20113. @item sar
  20114. sample aspect ratio
  20115. @item dar
  20116. display aspect ratio
  20117. @end table
  20118. @subsection Examples
  20119. @itemize
  20120. @item
  20121. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  20122. @example
  20123. 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
  20124. @end example
  20125. @item
  20126. Zoom in up to 1.5x and pan always at center of picture:
  20127. @example
  20128. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20129. @end example
  20130. @item
  20131. Same as above but without pausing:
  20132. @example
  20133. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20134. @end example
  20135. @item
  20136. Zoom in 2x into center of picture only for the first second of the input video:
  20137. @example
  20138. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20139. @end example
  20140. @end itemize
  20141. @anchor{zscale}
  20142. @section zscale
  20143. Scale (resize) the input video, using the z.lib library:
  20144. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  20145. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  20146. The zscale filter forces the output display aspect ratio to be the same
  20147. as the input, by changing the output sample aspect ratio.
  20148. If the input image format is different from the format requested by
  20149. the next filter, the zscale filter will convert the input to the
  20150. requested format.
  20151. @subsection Options
  20152. The filter accepts the following options.
  20153. @table @option
  20154. @item width, w
  20155. @item height, h
  20156. Set the output video dimension expression. Default value is the input
  20157. dimension.
  20158. If the @var{width} or @var{w} value is 0, the input width is used for
  20159. the output. If the @var{height} or @var{h} value is 0, the input height
  20160. is used for the output.
  20161. If one and only one of the values is -n with n >= 1, the zscale filter
  20162. will use a value that maintains the aspect ratio of the input image,
  20163. calculated from the other specified dimension. After that it will,
  20164. however, make sure that the calculated dimension is divisible by n and
  20165. adjust the value if necessary.
  20166. If both values are -n with n >= 1, the behavior will be identical to
  20167. both values being set to 0 as previously detailed.
  20168. See below for the list of accepted constants for use in the dimension
  20169. expression.
  20170. @item size, s
  20171. Set the video size. For the syntax of this option, check the
  20172. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20173. @item dither, d
  20174. Set the dither type.
  20175. Possible values are:
  20176. @table @var
  20177. @item none
  20178. @item ordered
  20179. @item random
  20180. @item error_diffusion
  20181. @end table
  20182. Default is none.
  20183. @item filter, f
  20184. Set the resize filter type.
  20185. Possible values are:
  20186. @table @var
  20187. @item point
  20188. @item bilinear
  20189. @item bicubic
  20190. @item spline16
  20191. @item spline36
  20192. @item lanczos
  20193. @end table
  20194. Default is bilinear.
  20195. @item range, r
  20196. Set the color range.
  20197. Possible values are:
  20198. @table @var
  20199. @item input
  20200. @item limited
  20201. @item full
  20202. @end table
  20203. Default is same as input.
  20204. @item primaries, p
  20205. Set the color primaries.
  20206. Possible values are:
  20207. @table @var
  20208. @item input
  20209. @item 709
  20210. @item unspecified
  20211. @item 170m
  20212. @item 240m
  20213. @item 2020
  20214. @end table
  20215. Default is same as input.
  20216. @item transfer, t
  20217. Set the transfer characteristics.
  20218. Possible values are:
  20219. @table @var
  20220. @item input
  20221. @item 709
  20222. @item unspecified
  20223. @item 601
  20224. @item linear
  20225. @item 2020_10
  20226. @item 2020_12
  20227. @item smpte2084
  20228. @item iec61966-2-1
  20229. @item arib-std-b67
  20230. @end table
  20231. Default is same as input.
  20232. @item matrix, m
  20233. Set the colorspace matrix.
  20234. Possible value are:
  20235. @table @var
  20236. @item input
  20237. @item 709
  20238. @item unspecified
  20239. @item 470bg
  20240. @item 170m
  20241. @item 2020_ncl
  20242. @item 2020_cl
  20243. @end table
  20244. Default is same as input.
  20245. @item rangein, rin
  20246. Set the input color range.
  20247. Possible values are:
  20248. @table @var
  20249. @item input
  20250. @item limited
  20251. @item full
  20252. @end table
  20253. Default is same as input.
  20254. @item primariesin, pin
  20255. Set the input color primaries.
  20256. Possible values are:
  20257. @table @var
  20258. @item input
  20259. @item 709
  20260. @item unspecified
  20261. @item 170m
  20262. @item 240m
  20263. @item 2020
  20264. @end table
  20265. Default is same as input.
  20266. @item transferin, tin
  20267. Set the input transfer characteristics.
  20268. Possible values are:
  20269. @table @var
  20270. @item input
  20271. @item 709
  20272. @item unspecified
  20273. @item 601
  20274. @item linear
  20275. @item 2020_10
  20276. @item 2020_12
  20277. @end table
  20278. Default is same as input.
  20279. @item matrixin, min
  20280. Set the input colorspace matrix.
  20281. Possible value are:
  20282. @table @var
  20283. @item input
  20284. @item 709
  20285. @item unspecified
  20286. @item 470bg
  20287. @item 170m
  20288. @item 2020_ncl
  20289. @item 2020_cl
  20290. @end table
  20291. @item chromal, c
  20292. Set the output chroma location.
  20293. Possible values are:
  20294. @table @var
  20295. @item input
  20296. @item left
  20297. @item center
  20298. @item topleft
  20299. @item top
  20300. @item bottomleft
  20301. @item bottom
  20302. @end table
  20303. @item chromalin, cin
  20304. Set the input chroma location.
  20305. Possible values are:
  20306. @table @var
  20307. @item input
  20308. @item left
  20309. @item center
  20310. @item topleft
  20311. @item top
  20312. @item bottomleft
  20313. @item bottom
  20314. @end table
  20315. @item npl
  20316. Set the nominal peak luminance.
  20317. @item param_a
  20318. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  20319. filter taps for lanczos.
  20320. @item param_b
  20321. Parameter B for scaling filters. Parameter "c" for bicubic.
  20322. @end table
  20323. The values of the @option{w} and @option{h} options are expressions
  20324. containing the following constants:
  20325. @table @var
  20326. @item in_w
  20327. @item in_h
  20328. The input width and height
  20329. @item iw
  20330. @item ih
  20331. These are the same as @var{in_w} and @var{in_h}.
  20332. @item out_w
  20333. @item out_h
  20334. The output (scaled) width and height
  20335. @item ow
  20336. @item oh
  20337. These are the same as @var{out_w} and @var{out_h}
  20338. @item a
  20339. The same as @var{iw} / @var{ih}
  20340. @item sar
  20341. input sample aspect ratio
  20342. @item dar
  20343. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  20344. @item hsub
  20345. @item vsub
  20346. horizontal and vertical input chroma subsample values. For example for the
  20347. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20348. @item ohsub
  20349. @item ovsub
  20350. horizontal and vertical output chroma subsample values. For example for the
  20351. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20352. @end table
  20353. @subsection Commands
  20354. This filter supports the following commands:
  20355. @table @option
  20356. @item width, w
  20357. @item height, h
  20358. Set the output video dimension expression.
  20359. The command accepts the same syntax of the corresponding option.
  20360. If the specified expression is not valid, it is kept at its current
  20361. value.
  20362. @end table
  20363. @c man end VIDEO FILTERS
  20364. @chapter OpenCL Video Filters
  20365. @c man begin OPENCL VIDEO FILTERS
  20366. Below is a description of the currently available OpenCL video filters.
  20367. To enable compilation of these filters you need to configure FFmpeg with
  20368. @code{--enable-opencl}.
  20369. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20370. @table @option
  20371. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  20372. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  20373. given device parameters.
  20374. @item -filter_hw_device @var{name}
  20375. Pass the hardware device called @var{name} to all filters in any filter graph.
  20376. @end table
  20377. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20378. @itemize
  20379. @item
  20380. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  20381. @example
  20382. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  20383. @end example
  20384. @end itemize
  20385. 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.
  20386. @section avgblur_opencl
  20387. Apply average blur filter.
  20388. The filter accepts the following options:
  20389. @table @option
  20390. @item sizeX
  20391. Set horizontal radius size.
  20392. Range is @code{[1, 1024]} and default value is @code{1}.
  20393. @item planes
  20394. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20395. @item sizeY
  20396. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  20397. @end table
  20398. @subsection Example
  20399. @itemize
  20400. @item
  20401. 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.
  20402. @example
  20403. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  20404. @end example
  20405. @end itemize
  20406. @section boxblur_opencl
  20407. Apply a boxblur algorithm to the input video.
  20408. It accepts the following parameters:
  20409. @table @option
  20410. @item luma_radius, lr
  20411. @item luma_power, lp
  20412. @item chroma_radius, cr
  20413. @item chroma_power, cp
  20414. @item alpha_radius, ar
  20415. @item alpha_power, ap
  20416. @end table
  20417. A description of the accepted options follows.
  20418. @table @option
  20419. @item luma_radius, lr
  20420. @item chroma_radius, cr
  20421. @item alpha_radius, ar
  20422. Set an expression for the box radius in pixels used for blurring the
  20423. corresponding input plane.
  20424. The radius value must be a non-negative number, and must not be
  20425. greater than the value of the expression @code{min(w,h)/2} for the
  20426. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  20427. planes.
  20428. Default value for @option{luma_radius} is "2". If not specified,
  20429. @option{chroma_radius} and @option{alpha_radius} default to the
  20430. corresponding value set for @option{luma_radius}.
  20431. The expressions can contain the following constants:
  20432. @table @option
  20433. @item w
  20434. @item h
  20435. The input width and height in pixels.
  20436. @item cw
  20437. @item ch
  20438. The input chroma image width and height in pixels.
  20439. @item hsub
  20440. @item vsub
  20441. The horizontal and vertical chroma subsample values. For example, for the
  20442. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  20443. @end table
  20444. @item luma_power, lp
  20445. @item chroma_power, cp
  20446. @item alpha_power, ap
  20447. Specify how many times the boxblur filter is applied to the
  20448. corresponding plane.
  20449. Default value for @option{luma_power} is 2. If not specified,
  20450. @option{chroma_power} and @option{alpha_power} default to the
  20451. corresponding value set for @option{luma_power}.
  20452. A value of 0 will disable the effect.
  20453. @end table
  20454. @subsection Examples
  20455. 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.
  20456. @itemize
  20457. @item
  20458. Apply a boxblur filter with the luma, chroma, and alpha radius
  20459. 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.
  20460. @example
  20461. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  20462. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  20463. @end example
  20464. @item
  20465. 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.
  20466. For the luma plane, a 2x2 box radius will be run once.
  20467. For the chroma plane, a 4x4 box radius will be run 5 times.
  20468. For the alpha plane, a 3x3 box radius will be run 7 times.
  20469. @example
  20470. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  20471. @end example
  20472. @end itemize
  20473. @section colorkey_opencl
  20474. RGB colorspace color keying.
  20475. The filter accepts the following options:
  20476. @table @option
  20477. @item color
  20478. The color which will be replaced with transparency.
  20479. @item similarity
  20480. Similarity percentage with the key color.
  20481. 0.01 matches only the exact key color, while 1.0 matches everything.
  20482. @item blend
  20483. Blend percentage.
  20484. 0.0 makes pixels either fully transparent, or not transparent at all.
  20485. Higher values result in semi-transparent pixels, with a higher transparency
  20486. the more similar the pixels color is to the key color.
  20487. @end table
  20488. @subsection Examples
  20489. @itemize
  20490. @item
  20491. Make every semi-green pixel in the input transparent with some slight blending:
  20492. @example
  20493. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  20494. @end example
  20495. @end itemize
  20496. @section convolution_opencl
  20497. Apply convolution of 3x3, 5x5, 7x7 matrix.
  20498. The filter accepts the following options:
  20499. @table @option
  20500. @item 0m
  20501. @item 1m
  20502. @item 2m
  20503. @item 3m
  20504. Set matrix for each plane.
  20505. Matrix is sequence of 9, 25 or 49 signed numbers.
  20506. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  20507. @item 0rdiv
  20508. @item 1rdiv
  20509. @item 2rdiv
  20510. @item 3rdiv
  20511. Set multiplier for calculated value for each plane.
  20512. If unset or 0, it will be sum of all matrix elements.
  20513. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  20514. @item 0bias
  20515. @item 1bias
  20516. @item 2bias
  20517. @item 3bias
  20518. Set bias for each plane. This value is added to the result of the multiplication.
  20519. Useful for making the overall image brighter or darker.
  20520. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  20521. @end table
  20522. @subsection Examples
  20523. @itemize
  20524. @item
  20525. Apply sharpen:
  20526. @example
  20527. -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
  20528. @end example
  20529. @item
  20530. Apply blur:
  20531. @example
  20532. -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
  20533. @end example
  20534. @item
  20535. Apply edge enhance:
  20536. @example
  20537. -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
  20538. @end example
  20539. @item
  20540. Apply edge detect:
  20541. @example
  20542. -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
  20543. @end example
  20544. @item
  20545. Apply laplacian edge detector which includes diagonals:
  20546. @example
  20547. -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
  20548. @end example
  20549. @item
  20550. Apply emboss:
  20551. @example
  20552. -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
  20553. @end example
  20554. @end itemize
  20555. @section erosion_opencl
  20556. Apply erosion effect to the video.
  20557. This filter replaces the pixel by the local(3x3) minimum.
  20558. It accepts the following options:
  20559. @table @option
  20560. @item threshold0
  20561. @item threshold1
  20562. @item threshold2
  20563. @item threshold3
  20564. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20565. If @code{0}, plane will remain unchanged.
  20566. @item coordinates
  20567. Flag which specifies the pixel to refer to.
  20568. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20569. Flags to local 3x3 coordinates region centered on @code{x}:
  20570. 1 2 3
  20571. 4 x 5
  20572. 6 7 8
  20573. @end table
  20574. @subsection Example
  20575. @itemize
  20576. @item
  20577. 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.
  20578. @example
  20579. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20580. @end example
  20581. @end itemize
  20582. @section deshake_opencl
  20583. Feature-point based video stabilization filter.
  20584. The filter accepts the following options:
  20585. @table @option
  20586. @item tripod
  20587. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  20588. @item debug
  20589. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  20590. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  20591. Viewing point matches in the output video is only supported for RGB input.
  20592. Defaults to @code{0}.
  20593. @item adaptive_crop
  20594. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  20595. Defaults to @code{1}.
  20596. @item refine_features
  20597. Whether or not feature points should be refined at a sub-pixel level.
  20598. This can be turned off for a slight performance gain at the cost of precision.
  20599. Defaults to @code{1}.
  20600. @item smooth_strength
  20601. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  20602. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  20603. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  20604. Defaults to @code{0.0}.
  20605. @item smooth_window_multiplier
  20606. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  20607. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  20608. Acceptable values range from @code{0.1} to @code{10.0}.
  20609. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  20610. potentially improving smoothness, but also increase latency and memory usage.
  20611. Defaults to @code{2.0}.
  20612. @end table
  20613. @subsection Examples
  20614. @itemize
  20615. @item
  20616. Stabilize a video with a fixed, medium smoothing strength:
  20617. @example
  20618. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  20619. @end example
  20620. @item
  20621. Stabilize a video with debugging (both in console and in rendered video):
  20622. @example
  20623. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  20624. @end example
  20625. @end itemize
  20626. @section dilation_opencl
  20627. Apply dilation effect to the video.
  20628. This filter replaces the pixel by the local(3x3) maximum.
  20629. It accepts the following options:
  20630. @table @option
  20631. @item threshold0
  20632. @item threshold1
  20633. @item threshold2
  20634. @item threshold3
  20635. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20636. If @code{0}, plane will remain unchanged.
  20637. @item coordinates
  20638. Flag which specifies the pixel to refer to.
  20639. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20640. Flags to local 3x3 coordinates region centered on @code{x}:
  20641. 1 2 3
  20642. 4 x 5
  20643. 6 7 8
  20644. @end table
  20645. @subsection Example
  20646. @itemize
  20647. @item
  20648. 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.
  20649. @example
  20650. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20651. @end example
  20652. @end itemize
  20653. @anchor{nlmeans_opencl}
  20654. @section nlmeans_opencl
  20655. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  20656. @section overlay_opencl
  20657. Overlay one video on top of another.
  20658. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20659. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  20660. The filter accepts the following options:
  20661. @table @option
  20662. @item x
  20663. Set the x coordinate of the overlaid video on the main video.
  20664. Default value is @code{0}.
  20665. @item y
  20666. Set the y coordinate of the overlaid video on the main video.
  20667. Default value is @code{0}.
  20668. @end table
  20669. @subsection Examples
  20670. @itemize
  20671. @item
  20672. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  20673. @example
  20674. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20675. @end example
  20676. @item
  20677. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20678. @example
  20679. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20680. @end example
  20681. @end itemize
  20682. @section pad_opencl
  20683. Add paddings to the input image, and place the original input at the
  20684. provided @var{x}, @var{y} coordinates.
  20685. It accepts the following options:
  20686. @table @option
  20687. @item width, w
  20688. @item height, h
  20689. Specify an expression for the size of the output image with the
  20690. paddings added. If the value for @var{width} or @var{height} is 0, the
  20691. corresponding input size is used for the output.
  20692. The @var{width} expression can reference the value set by the
  20693. @var{height} expression, and vice versa.
  20694. The default value of @var{width} and @var{height} is 0.
  20695. @item x
  20696. @item y
  20697. Specify the offsets to place the input image at within the padded area,
  20698. with respect to the top/left border of the output image.
  20699. The @var{x} expression can reference the value set by the @var{y}
  20700. expression, and vice versa.
  20701. The default value of @var{x} and @var{y} is 0.
  20702. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  20703. so the input image is centered on the padded area.
  20704. @item color
  20705. Specify the color of the padded area. For the syntax of this option,
  20706. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20707. manual,ffmpeg-utils}.
  20708. @item aspect
  20709. Pad to an aspect instead to a resolution.
  20710. @end table
  20711. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  20712. options are expressions containing the following constants:
  20713. @table @option
  20714. @item in_w
  20715. @item in_h
  20716. The input video width and height.
  20717. @item iw
  20718. @item ih
  20719. These are the same as @var{in_w} and @var{in_h}.
  20720. @item out_w
  20721. @item out_h
  20722. The output width and height (the size of the padded area), as
  20723. specified by the @var{width} and @var{height} expressions.
  20724. @item ow
  20725. @item oh
  20726. These are the same as @var{out_w} and @var{out_h}.
  20727. @item x
  20728. @item y
  20729. The x and y offsets as specified by the @var{x} and @var{y}
  20730. expressions, or NAN if not yet specified.
  20731. @item a
  20732. same as @var{iw} / @var{ih}
  20733. @item sar
  20734. input sample aspect ratio
  20735. @item dar
  20736. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  20737. @end table
  20738. @section prewitt_opencl
  20739. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  20740. The filter accepts the following option:
  20741. @table @option
  20742. @item planes
  20743. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20744. @item scale
  20745. Set value which will be multiplied with filtered result.
  20746. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20747. @item delta
  20748. Set value which will be added to filtered result.
  20749. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20750. @end table
  20751. @subsection Example
  20752. @itemize
  20753. @item
  20754. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  20755. @example
  20756. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20757. @end example
  20758. @end itemize
  20759. @anchor{program_opencl}
  20760. @section program_opencl
  20761. Filter video using an OpenCL program.
  20762. @table @option
  20763. @item source
  20764. OpenCL program source file.
  20765. @item kernel
  20766. Kernel name in program.
  20767. @item inputs
  20768. Number of inputs to the filter. Defaults to 1.
  20769. @item size, s
  20770. Size of output frames. Defaults to the same as the first input.
  20771. @end table
  20772. The @code{program_opencl} filter also supports the @ref{framesync} options.
  20773. The program source file must contain a kernel function with the given name,
  20774. which will be run once for each plane of the output. Each run on a plane
  20775. gets enqueued as a separate 2D global NDRange with one work-item for each
  20776. pixel to be generated. The global ID offset for each work-item is therefore
  20777. the coordinates of a pixel in the destination image.
  20778. The kernel function needs to take the following arguments:
  20779. @itemize
  20780. @item
  20781. Destination image, @var{__write_only image2d_t}.
  20782. This image will become the output; the kernel should write all of it.
  20783. @item
  20784. Frame index, @var{unsigned int}.
  20785. This is a counter starting from zero and increasing by one for each frame.
  20786. @item
  20787. Source images, @var{__read_only image2d_t}.
  20788. These are the most recent images on each input. The kernel may read from
  20789. them to generate the output, but they can't be written to.
  20790. @end itemize
  20791. Example programs:
  20792. @itemize
  20793. @item
  20794. Copy the input to the output (output must be the same size as the input).
  20795. @verbatim
  20796. __kernel void copy(__write_only image2d_t destination,
  20797. unsigned int index,
  20798. __read_only image2d_t source)
  20799. {
  20800. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  20801. int2 location = (int2)(get_global_id(0), get_global_id(1));
  20802. float4 value = read_imagef(source, sampler, location);
  20803. write_imagef(destination, location, value);
  20804. }
  20805. @end verbatim
  20806. @item
  20807. Apply a simple transformation, rotating the input by an amount increasing
  20808. with the index counter. Pixel values are linearly interpolated by the
  20809. sampler, and the output need not have the same dimensions as the input.
  20810. @verbatim
  20811. __kernel void rotate_image(__write_only image2d_t dst,
  20812. unsigned int index,
  20813. __read_only image2d_t src)
  20814. {
  20815. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20816. CLK_FILTER_LINEAR);
  20817. float angle = (float)index / 100.0f;
  20818. float2 dst_dim = convert_float2(get_image_dim(dst));
  20819. float2 src_dim = convert_float2(get_image_dim(src));
  20820. float2 dst_cen = dst_dim / 2.0f;
  20821. float2 src_cen = src_dim / 2.0f;
  20822. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20823. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  20824. float2 src_pos = {
  20825. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  20826. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  20827. };
  20828. src_pos = src_pos * src_dim / dst_dim;
  20829. float2 src_loc = src_pos + src_cen;
  20830. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  20831. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  20832. write_imagef(dst, dst_loc, 0.5f);
  20833. else
  20834. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  20835. }
  20836. @end verbatim
  20837. @item
  20838. Blend two inputs together, with the amount of each input used varying
  20839. with the index counter.
  20840. @verbatim
  20841. __kernel void blend_images(__write_only image2d_t dst,
  20842. unsigned int index,
  20843. __read_only image2d_t src1,
  20844. __read_only image2d_t src2)
  20845. {
  20846. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20847. CLK_FILTER_LINEAR);
  20848. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  20849. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20850. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  20851. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  20852. float4 val1 = read_imagef(src1, sampler, src1_loc);
  20853. float4 val2 = read_imagef(src2, sampler, src2_loc);
  20854. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  20855. }
  20856. @end verbatim
  20857. @end itemize
  20858. @section remap_opencl
  20859. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  20860. Destination pixel at position (X, Y) will be picked from source (x, y) position
  20861. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  20862. value for pixel will be used for destination pixel.
  20863. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  20864. will have Xmap/Ymap video stream dimensions.
  20865. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  20866. @table @option
  20867. @item interp
  20868. Specify interpolation used for remapping of pixels.
  20869. Allowed values are @code{near} and @code{linear}.
  20870. Default value is @code{linear}.
  20871. @item fill
  20872. Specify the color of the unmapped pixels. For the syntax of this option,
  20873. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20874. manual,ffmpeg-utils}. Default color is @code{black}.
  20875. @end table
  20876. @section roberts_opencl
  20877. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  20878. The filter accepts the following option:
  20879. @table @option
  20880. @item planes
  20881. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20882. @item scale
  20883. Set value which will be multiplied with filtered result.
  20884. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20885. @item delta
  20886. Set value which will be added to filtered result.
  20887. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20888. @end table
  20889. @subsection Example
  20890. @itemize
  20891. @item
  20892. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  20893. @example
  20894. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20895. @end example
  20896. @end itemize
  20897. @section sobel_opencl
  20898. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  20899. The filter accepts the following option:
  20900. @table @option
  20901. @item planes
  20902. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20903. @item scale
  20904. Set value which will be multiplied with filtered result.
  20905. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20906. @item delta
  20907. Set value which will be added to filtered result.
  20908. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20909. @end table
  20910. @subsection Example
  20911. @itemize
  20912. @item
  20913. Apply sobel operator with scale set to 2 and delta set to 10
  20914. @example
  20915. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20916. @end example
  20917. @end itemize
  20918. @section tonemap_opencl
  20919. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  20920. It accepts the following parameters:
  20921. @table @option
  20922. @item tonemap
  20923. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  20924. @item param
  20925. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  20926. @item desat
  20927. Apply desaturation for highlights that exceed this level of brightness. The
  20928. higher the parameter, the more color information will be preserved. This
  20929. setting helps prevent unnaturally blown-out colors for super-highlights, by
  20930. (smoothly) turning into white instead. This makes images feel more natural,
  20931. at the cost of reducing information about out-of-range colors.
  20932. The default value is 0.5, and the algorithm here is a little different from
  20933. the cpu version tonemap currently. A setting of 0.0 disables this option.
  20934. @item threshold
  20935. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  20936. is used to detect whether the scene has changed or not. If the distance between
  20937. the current frame average brightness and the current running average exceeds
  20938. a threshold value, we would re-calculate scene average and peak brightness.
  20939. The default value is 0.2.
  20940. @item format
  20941. Specify the output pixel format.
  20942. Currently supported formats are:
  20943. @table @var
  20944. @item p010
  20945. @item nv12
  20946. @end table
  20947. @item range, r
  20948. Set the output color range.
  20949. Possible values are:
  20950. @table @var
  20951. @item tv/mpeg
  20952. @item pc/jpeg
  20953. @end table
  20954. Default is same as input.
  20955. @item primaries, p
  20956. Set the output color primaries.
  20957. Possible values are:
  20958. @table @var
  20959. @item bt709
  20960. @item bt2020
  20961. @end table
  20962. Default is same as input.
  20963. @item transfer, t
  20964. Set the output transfer characteristics.
  20965. Possible values are:
  20966. @table @var
  20967. @item bt709
  20968. @item bt2020
  20969. @end table
  20970. Default is bt709.
  20971. @item matrix, m
  20972. Set the output colorspace matrix.
  20973. Possible value are:
  20974. @table @var
  20975. @item bt709
  20976. @item bt2020
  20977. @end table
  20978. Default is same as input.
  20979. @end table
  20980. @subsection Example
  20981. @itemize
  20982. @item
  20983. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  20984. @example
  20985. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  20986. @end example
  20987. @end itemize
  20988. @section unsharp_opencl
  20989. Sharpen or blur the input video.
  20990. It accepts the following parameters:
  20991. @table @option
  20992. @item luma_msize_x, lx
  20993. Set the luma matrix horizontal size.
  20994. Range is @code{[1, 23]} and default value is @code{5}.
  20995. @item luma_msize_y, ly
  20996. Set the luma matrix vertical size.
  20997. Range is @code{[1, 23]} and default value is @code{5}.
  20998. @item luma_amount, la
  20999. Set the luma effect strength.
  21000. Range is @code{[-10, 10]} and default value is @code{1.0}.
  21001. Negative values will blur the input video, while positive values will
  21002. sharpen it, a value of zero will disable the effect.
  21003. @item chroma_msize_x, cx
  21004. Set the chroma matrix horizontal size.
  21005. Range is @code{[1, 23]} and default value is @code{5}.
  21006. @item chroma_msize_y, cy
  21007. Set the chroma matrix vertical size.
  21008. Range is @code{[1, 23]} and default value is @code{5}.
  21009. @item chroma_amount, ca
  21010. Set the chroma effect strength.
  21011. Range is @code{[-10, 10]} and default value is @code{0.0}.
  21012. Negative values will blur the input video, while positive values will
  21013. sharpen it, a value of zero will disable the effect.
  21014. @end table
  21015. All parameters are optional and default to the equivalent of the
  21016. string '5:5:1.0:5:5:0.0'.
  21017. @subsection Examples
  21018. @itemize
  21019. @item
  21020. Apply strong luma sharpen effect:
  21021. @example
  21022. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  21023. @end example
  21024. @item
  21025. Apply a strong blur of both luma and chroma parameters:
  21026. @example
  21027. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  21028. @end example
  21029. @end itemize
  21030. @section xfade_opencl
  21031. Cross fade two videos with custom transition effect by using OpenCL.
  21032. It accepts the following options:
  21033. @table @option
  21034. @item transition
  21035. Set one of possible transition effects.
  21036. @table @option
  21037. @item custom
  21038. Select custom transition effect, the actual transition description
  21039. will be picked from source and kernel options.
  21040. @item fade
  21041. @item wipeleft
  21042. @item wiperight
  21043. @item wipeup
  21044. @item wipedown
  21045. @item slideleft
  21046. @item slideright
  21047. @item slideup
  21048. @item slidedown
  21049. Default transition is fade.
  21050. @end table
  21051. @item source
  21052. OpenCL program source file for custom transition.
  21053. @item kernel
  21054. Set name of kernel to use for custom transition from program source file.
  21055. @item duration
  21056. Set duration of video transition.
  21057. @item offset
  21058. Set time of start of transition relative to first video.
  21059. @end table
  21060. The program source file must contain a kernel function with the given name,
  21061. which will be run once for each plane of the output. Each run on a plane
  21062. gets enqueued as a separate 2D global NDRange with one work-item for each
  21063. pixel to be generated. The global ID offset for each work-item is therefore
  21064. the coordinates of a pixel in the destination image.
  21065. The kernel function needs to take the following arguments:
  21066. @itemize
  21067. @item
  21068. Destination image, @var{__write_only image2d_t}.
  21069. This image will become the output; the kernel should write all of it.
  21070. @item
  21071. First Source image, @var{__read_only image2d_t}.
  21072. Second Source image, @var{__read_only image2d_t}.
  21073. These are the most recent images on each input. The kernel may read from
  21074. them to generate the output, but they can't be written to.
  21075. @item
  21076. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  21077. @end itemize
  21078. Example programs:
  21079. @itemize
  21080. @item
  21081. Apply dots curtain transition effect:
  21082. @verbatim
  21083. __kernel void blend_images(__write_only image2d_t dst,
  21084. __read_only image2d_t src1,
  21085. __read_only image2d_t src2,
  21086. float progress)
  21087. {
  21088. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21089. CLK_FILTER_LINEAR);
  21090. int2 p = (int2)(get_global_id(0), get_global_id(1));
  21091. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  21092. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  21093. rp = rp / dim;
  21094. float2 dots = (float2)(20.0, 20.0);
  21095. float2 center = (float2)(0,0);
  21096. float2 unused;
  21097. float4 val1 = read_imagef(src1, sampler, p);
  21098. float4 val2 = read_imagef(src2, sampler, p);
  21099. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  21100. write_imagef(dst, p, next ? val1 : val2);
  21101. }
  21102. @end verbatim
  21103. @end itemize
  21104. @c man end OPENCL VIDEO FILTERS
  21105. @chapter VAAPI Video Filters
  21106. @c man begin VAAPI VIDEO FILTERS
  21107. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  21108. To enable compilation of these filters you need to configure FFmpeg with
  21109. @code{--enable-vaapi}.
  21110. 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}
  21111. @section overlay_vaapi
  21112. Overlay one video on the top of another.
  21113. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21114. The filter accepts the following options:
  21115. @table @option
  21116. @item x
  21117. @item y
  21118. Set expressions for the x and y coordinates of the overlaid video
  21119. on the main video.
  21120. Default value is "0" for both expressions.
  21121. @item w
  21122. @item h
  21123. Set expressions for the width and height the overlaid video
  21124. on the main video.
  21125. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  21126. The expressions can contain the following parameters:
  21127. @table @option
  21128. @item main_w, W
  21129. @item main_h, H
  21130. The main input width and height.
  21131. @item overlay_iw
  21132. @item overlay_ih
  21133. The overlay input width and height.
  21134. @item overlay_w, w
  21135. @item overlay_h, h
  21136. The overlay output width and height.
  21137. @item overlay_x, x
  21138. @item overlay_y, y
  21139. Position of the overlay layer inside of main
  21140. @end table
  21141. @item alpha
  21142. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  21143. Higher value means lower transparency.
  21144. Default value is @code{1.0}.
  21145. @item eof_action
  21146. See @ref{framesync}.
  21147. @item shortest
  21148. See @ref{framesync}.
  21149. @item repeatlast
  21150. See @ref{framesync}.
  21151. @end table
  21152. This filter also supports the @ref{framesync} options.
  21153. @subsection Examples
  21154. @itemize
  21155. @item
  21156. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  21157. @example
  21158. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  21159. @end example
  21160. @item
  21161. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  21162. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  21163. @example
  21164. -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
  21165. @end example
  21166. @end itemize
  21167. @section tonemap_vaapi
  21168. Perform HDR-to-SDR or HDR-to-HDR tone-mapping.
  21169. It currently only accepts HDR10 as input.
  21170. It accepts the following parameters:
  21171. @table @option
  21172. @item format
  21173. Specify the output pixel format.
  21174. Default is nv12 for HDR-to-SDR tone-mapping and p010 for HDR-to-HDR
  21175. tone-mapping.
  21176. @item primaries, p
  21177. Set the output color primaries.
  21178. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21179. tone-mapping.
  21180. @item transfer, t
  21181. Set the output transfer characteristics.
  21182. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21183. tone-mapping.
  21184. @item matrix, m
  21185. Set the output colorspace matrix.
  21186. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21187. tone-mapping.
  21188. @item display
  21189. Set the output mastering display colour volume. It is given by a '|'-separated
  21190. list of two values, two values are space separated. It set display primaries
  21191. x & y in G, B, R order, then white point x & y, the nominal minimum & maximum
  21192. display luminances.
  21193. HDR-to-HDR tone-mapping will be performed when this option is set.
  21194. @item light
  21195. Set the output content light level information. It accepts 2 space-separated
  21196. values, the first input is the maximum light level and the second input is
  21197. the maximum average light level.
  21198. It is ignored for HDR-to-SDR tone-mapping, and optional for HDR-to-HDR
  21199. tone-mapping.
  21200. @end table
  21201. @subsection Example
  21202. @itemize
  21203. @item
  21204. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  21205. @example
  21206. tonemap_vaapi=format=p010:t=bt2020-10
  21207. @end example
  21208. @item
  21209. Convert HDR video to HDR video
  21210. @example
  21211. tonemap_vaapi=display=7500\ 3000|34000\ 16000|13250\ 34500|15635\ 16450|500\ 10000000
  21212. @end example
  21213. @end itemize
  21214. @section hstack_vaapi
  21215. Stack input videos horizontally.
  21216. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  21217. have different height, this filter will scale down/up each input stream while
  21218. keeping the original aspect.
  21219. It accepts the following options:
  21220. @table @option
  21221. @item inputs
  21222. See @ref{hstack}.
  21223. @item shortest
  21224. See @ref{hstack}.
  21225. @item height
  21226. Set height of output. If set to 0, this filter will set height of output to
  21227. height of the first input stream. Default value is 0.
  21228. @end table
  21229. @section vstack_vaapi
  21230. Stack input videos vertically.
  21231. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  21232. have different width, this filter will scale down/up each input stream while
  21233. keeping the original aspect.
  21234. It accepts the following options:
  21235. @table @option
  21236. @item inputs
  21237. See @ref{vstack}.
  21238. @item shortest
  21239. See @ref{vstack}.
  21240. @item width
  21241. Set width of output. If set to 0, this filter will set width of output to
  21242. width of the first input stream. Default value is 0.
  21243. @end table
  21244. @section xstack_vaapi
  21245. Stack video inputs into custom layout.
  21246. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  21247. have different size, this filter will scale down/up each input stream to the
  21248. given output size, or the size of the first input stream.
  21249. It accepts the following options:
  21250. @table @option
  21251. @item inputs
  21252. See @ref{xstack}.
  21253. @item shortest
  21254. See @ref{xstack}.
  21255. @item layout
  21256. See @ref{xstack}.
  21257. Moreover, this permits the user to supply output size for each input stream.
  21258. @example
  21259. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21260. @end example
  21261. @item grid
  21262. See @ref{xstack}.
  21263. @item grid_tile_size
  21264. Set output size for each input stream when @option{grid} is set. If this option
  21265. is not set, this filter will set output size by default to the size of the
  21266. first input stream. For the syntax of this option, check the
  21267. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21268. @item fill
  21269. See @ref{xstack}.
  21270. @end table
  21271. @section pad_vaapi
  21272. Add paddings to the input image, and place the original input at the
  21273. provided @var{x}, @var{y} coordinates.
  21274. It accepts the following options:
  21275. @table @option
  21276. @item width, w
  21277. @item height, h
  21278. Specify an expression for the size of the output image with the
  21279. paddings added. If the value for @var{width} or @var{height} is 0, the
  21280. corresponding input size is used for the output.
  21281. The @var{width} expression can reference the value set by the
  21282. @var{height} expression, and vice versa.
  21283. The default value of @var{width} and @var{height} is 0.
  21284. @item x
  21285. @item y
  21286. Specify the offsets to place the input image at within the padded area,
  21287. with respect to the top/left border of the output image.
  21288. The @var{x} expression can reference the value set by the @var{y}
  21289. expression, and vice versa.
  21290. The default value of @var{x} and @var{y} is 0.
  21291. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  21292. so the input image is centered on the padded area.
  21293. @item color
  21294. Specify the color of the padded area. For the syntax of this option,
  21295. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21296. manual,ffmpeg-utils}.
  21297. @item aspect
  21298. Pad to an aspect instead to a resolution.
  21299. @end table
  21300. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  21301. options are expressions containing the following constants:
  21302. @table @option
  21303. @item in_w
  21304. @item in_h
  21305. The input video width and height.
  21306. @item iw
  21307. @item ih
  21308. These are the same as @var{in_w} and @var{in_h}.
  21309. @item out_w
  21310. @item out_h
  21311. The output width and height (the size of the padded area), as
  21312. specified by the @var{width} and @var{height} expressions.
  21313. @item ow
  21314. @item oh
  21315. These are the same as @var{out_w} and @var{out_h}.
  21316. @item x
  21317. @item y
  21318. The x and y offsets as specified by the @var{x} and @var{y}
  21319. expressions, or NAN if not yet specified.
  21320. @item a
  21321. same as @var{iw} / @var{ih}
  21322. @item sar
  21323. input sample aspect ratio
  21324. @item dar
  21325. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  21326. @end table
  21327. @section drawbox_vaapi
  21328. Draw a colored box on the input image.
  21329. It accepts the following parameters:
  21330. @table @option
  21331. @item x
  21332. @item y
  21333. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  21334. @item width, w
  21335. @item height, h
  21336. The expressions which specify the width and height of the box; if 0 they are interpreted as
  21337. the input width and height. It defaults to 0.
  21338. @item color, c
  21339. Specify the color of the box to write. For the general syntax of this option,
  21340. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21341. @item thickness, t
  21342. The expression which sets the thickness of the box edge.
  21343. A value of @code{fill} will create a filled box. Default value is @code{3}.
  21344. See below for the list of accepted constants.
  21345. @item replace
  21346. With value @code{1}, the pixels of the painted box will overwrite the video's color and alpha pixels.
  21347. Default is @code{0}, which composites the box onto the input video.
  21348. @end table
  21349. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  21350. following constants:
  21351. @table @option
  21352. @item in_h, ih
  21353. @item in_w, iw
  21354. The input width and height.
  21355. @item x
  21356. @item y
  21357. The x and y offset coordinates where the box is drawn.
  21358. @item w
  21359. @item h
  21360. The width and height of the drawn box.
  21361. @item t
  21362. The thickness of the drawn box.
  21363. @end table
  21364. @subsection Examples
  21365. @itemize
  21366. @item
  21367. Draw a black box around the edge of the input image:
  21368. @example
  21369. drawbox
  21370. @end example
  21371. @item
  21372. Draw a box with color red and an opacity of 50%:
  21373. @example
  21374. drawbox=10:20:200:60:red@@0.5
  21375. @end example
  21376. The previous example can be specified as:
  21377. @example
  21378. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  21379. @end example
  21380. @item
  21381. Fill the box with pink color:
  21382. @example
  21383. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  21384. @end example
  21385. @item
  21386. Draw a 2-pixel red 2.40:1 mask:
  21387. @example
  21388. 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
  21389. @end example
  21390. @end itemize
  21391. @c man end VAAPI VIDEO FILTERS
  21392. @chapter Vulkan Video Filters
  21393. @c man begin VULKAN VIDEO FILTERS
  21394. Below is a description of the currently available Vulkan video filters.
  21395. To enable compilation of these filters you need to configure FFmpeg with
  21396. @code{--enable-vulkan} and either @code{--enable-libglslang} or @code{--enable-libshaderc}.
  21397. Running Vulkan filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  21398. @table @option
  21399. @item -init_hw_device vulkan[=@var{name}][:@var{device}[,@var{key=value}...]]
  21400. Initialise a new hardware device of type @var{vulkan} called @var{name}, using the
  21401. given device parameters and options in @var{key=value}. The following options
  21402. are supported:
  21403. @table @option
  21404. @item debug
  21405. Switches validation layers on if set to 1.
  21406. @item linear_images
  21407. Allocates linear images. Does not apply to decoding.
  21408. @item disable_multiplane
  21409. Disables multiplane images. Does not apply to decoding.
  21410. @end table
  21411. @item -filter_hw_device @var{name}
  21412. Pass the hardware device called @var{name} to all filters in any filter graph.
  21413. @end table
  21414. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  21415. @itemize
  21416. @item
  21417. Example of choosing the first device and running nlmeans_vulkan filter with default parameters on it.
  21418. @example
  21419. -init_hw_device vulkan=vk:0 -filter_hw_device vk -i INPUT -vf "hwupload,nlmeans_vulkan,hwdownload" OUTPUT
  21420. @end example
  21421. @end itemize
  21422. 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.
  21423. @section avgblur_vulkan
  21424. Apply an average blur filter, implemented on the GPU using Vulkan.
  21425. The filter accepts the following options:
  21426. @table @option
  21427. @item sizeX
  21428. Set horizontal radius size.
  21429. Range is @code{[1, 32]} and default value is @code{3}.
  21430. @item sizeY
  21431. Set vertical radius size. Range is @code{[1, 32]} and default value is @code{3}.
  21432. @item planes
  21433. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21434. @end table
  21435. @section blend_vulkan
  21436. Blend two Vulkan frames into each other.
  21437. The @code{blend} filter takes two input streams and outputs one
  21438. stream, the first input is the "top" layer and second input is
  21439. "bottom" layer. By default, the output terminates when the longest input terminates.
  21440. A description of the accepted options follows.
  21441. @table @option
  21442. @item c0_mode
  21443. @item c1_mode
  21444. @item c2_mode
  21445. @item c3_mode
  21446. @item all_mode
  21447. Set blend mode for specific pixel component or all pixel components in case
  21448. of @var{all_mode}. Default value is @code{normal}.
  21449. Available values for component modes are:
  21450. @table @samp
  21451. @item normal
  21452. @item multiply
  21453. @end table
  21454. @end table
  21455. @section bwdif_vulkan
  21456. Deinterlacer using @ref{bwdif}, the "Bob Weaver Deinterlacing Filter" algorithm, implemented
  21457. on the GPU using Vulkan.
  21458. It accepts the following parameters:
  21459. @table @option
  21460. @item mode
  21461. The interlacing mode to adopt. It accepts one of the following values:
  21462. @table @option
  21463. @item 0, send_frame
  21464. Output one frame for each frame.
  21465. @item 1, send_field
  21466. Output one frame for each field.
  21467. @end table
  21468. The default value is @code{send_field}.
  21469. @item parity
  21470. The picture field parity assumed for the input interlaced video. It accepts one
  21471. of the following values:
  21472. @table @option
  21473. @item 0, tff
  21474. Assume the top field is first.
  21475. @item 1, bff
  21476. Assume the bottom field is first.
  21477. @item -1, auto
  21478. Enable automatic detection of field parity.
  21479. @end table
  21480. The default value is @code{auto}.
  21481. If the interlacing is unknown or the decoder does not export this information,
  21482. top field first will be assumed.
  21483. @item deint
  21484. Specify which frames to deinterlace. Accepts one of the following
  21485. values:
  21486. @table @option
  21487. @item 0, all
  21488. Deinterlace all frames.
  21489. @item 1, interlaced
  21490. Only deinterlace frames marked as interlaced.
  21491. @end table
  21492. The default value is @code{all}.
  21493. @end table
  21494. @section chromaber_vulkan
  21495. Apply an effect that emulates chromatic aberration. Works best with RGB inputs,
  21496. but provides a similar effect with YCbCr inputs too.
  21497. @table @option
  21498. @item dist_x
  21499. Horizontal displacement multiplier. Each chroma pixel's position will be multiplied
  21500. by this amount, starting from the center of the image. Default is @code{0}.
  21501. @item dist_y
  21502. Similarly, this sets the vertical displacement multiplier. Default is @code{0}.
  21503. @end table
  21504. @section color_vulkan
  21505. Video source that creates a Vulkan frame of a solid color.
  21506. Useful for benchmarking, or overlaying.
  21507. It accepts the following parameters:
  21508. @table @option
  21509. @item color
  21510. The color to use. Either a name, or a hexadecimal value.
  21511. The default value is @code{black}.
  21512. @item size
  21513. The size of the output frame. Default value is @code{1920x1080}.
  21514. @item rate
  21515. The framerate to output at. Default value is @code{60} frames per second.
  21516. @item duration
  21517. The video duration. Default value is @code{-0.000001}.
  21518. @item sar
  21519. The video signal aspect ratio. Default value is @code{1/1}.
  21520. @item format
  21521. The pixel format of the output Vulkan frames. Default value is @code{yuv444p}.
  21522. @item out_range
  21523. Set the output YCbCr sample range.
  21524. This allows the autodetected value to be overridden as well as allows forcing
  21525. a specific value used for the output and encoder. If not specified, the
  21526. range depends on the pixel format. Possible values:
  21527. @table @samp
  21528. @item auto/unknown
  21529. Choose automatically.
  21530. @item jpeg/full/pc
  21531. Set full range (0-255 in case of 8-bit luma).
  21532. @item mpeg/limited/tv
  21533. Set "MPEG" range (16-235 in case of 8-bit luma).
  21534. @end table
  21535. @end table
  21536. @section vflip_vulkan
  21537. Flips an image vertically.
  21538. @section hflip_vulkan
  21539. Flips an image horizontally.
  21540. @section flip_vulkan
  21541. Flips an image along both the vertical and horizontal axis.
  21542. @section gblur_vulkan
  21543. Apply Gaussian blur filter on Vulkan frames.
  21544. The filter accepts the following options:
  21545. @table @option
  21546. @item sigma
  21547. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  21548. @item sigmaV
  21549. Set vertical sigma, if negative it will be same as @code{sigma}.
  21550. Default is @code{-1}.
  21551. @item planes
  21552. Set which planes to filter. By default all planes are filtered.
  21553. @item size
  21554. Set the kernel size along the horizontal axis. Default is @code{19}.
  21555. @item sizeV
  21556. Set the kernel size along the vertical axis. Default is @code{0},
  21557. which sets to use the same value as @var{size}.
  21558. @end table
  21559. @section nlmeans_vulkan
  21560. Denoise frames using Non-Local Means algorithm, implemented on the GPU using
  21561. Vulkan.
  21562. Supports more pixel formats than @ref{nlmeans} or @ref{nlmeans_opencl}, including
  21563. alpha channel support.
  21564. The filter accepts the following options.
  21565. @table @option
  21566. @item s
  21567. Set denoising strength for all components. Default is 1.0. Must be in range [1.0, 100.0].
  21568. @item p
  21569. Set patch size for all planes. Default is 7. Must be odd number in range [0, 99].
  21570. @item r
  21571. Set research size. Default is 15. Must be odd number in range [0, 99].
  21572. @item t
  21573. Set parallelism. Default is 36. Must be a number in the range [1, 168].
  21574. Larger values may speed up processing, at the cost of more VRAM.
  21575. Lower values will slow it down, reducing VRAM usage.
  21576. Only supported on GPUs with atomic float operations (RDNA3+, Ampere+).
  21577. @item s0
  21578. @item s1
  21579. @item s2
  21580. @item s3
  21581. Set denoising strength for a specific component. Default is @var{1}, equal to @option{s}.
  21582. Must be odd number in range [1, 100].
  21583. @item p0
  21584. @item p1
  21585. @item p2
  21586. @item p3
  21587. Set patch size for a specific component. Default is @var{7}, equal to @option{p}.
  21588. Must be odd number in range [0, 99].
  21589. @end table
  21590. @section overlay_vulkan
  21591. Overlay one video on top of another.
  21592. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21593. This filter requires all inputs to use the same pixel format. So, format conversion may be needed.
  21594. The filter accepts the following options:
  21595. @table @option
  21596. @item x
  21597. Set the x coordinate of the overlaid video on the main video.
  21598. Default value is @code{0}.
  21599. @item y
  21600. Set the y coordinate of the overlaid video on the main video.
  21601. Default value is @code{0}.
  21602. @end table
  21603. @section transpose_vt
  21604. Transpose rows with columns in the input video and optionally flip it.
  21605. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21606. It accepts the following parameters:
  21607. @table @option
  21608. @item dir
  21609. Specify the transposition direction.
  21610. Can assume the following values:
  21611. @table @samp
  21612. @item cclock_flip
  21613. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21614. @item clock
  21615. Rotate by 90 degrees clockwise.
  21616. @item cclock
  21617. Rotate by 90 degrees counterclockwise.
  21618. @item clock_flip
  21619. Rotate by 90 degrees clockwise and vertically flip.
  21620. @item hflip
  21621. Flip the input video horizontally.
  21622. @item vflip
  21623. Flip the input video vertically.
  21624. @end table
  21625. @item passthrough
  21626. Do not apply the transposition if the input geometry matches the one
  21627. specified by the specified value. It accepts the following values:
  21628. @table @samp
  21629. @item none
  21630. Always apply transposition. (default)
  21631. @item portrait
  21632. Preserve portrait geometry (when @var{height} >= @var{width}).
  21633. @item landscape
  21634. Preserve landscape geometry (when @var{width} >= @var{height}).
  21635. @end table
  21636. @end table
  21637. @section transpose_vulkan
  21638. Transpose rows with columns in the input video and optionally flip it.
  21639. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21640. It accepts the following parameters:
  21641. @table @option
  21642. @item dir
  21643. Specify the transposition direction.
  21644. Can assume the following values:
  21645. @table @samp
  21646. @item cclock_flip
  21647. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21648. @item clock
  21649. Rotate by 90 degrees clockwise.
  21650. @item cclock
  21651. Rotate by 90 degrees counterclockwise.
  21652. @item clock_flip
  21653. Rotate by 90 degrees clockwise and vertically flip.
  21654. @end table
  21655. @item passthrough
  21656. Do not apply the transposition if the input geometry matches the one
  21657. specified by the specified value. It accepts the following values:
  21658. @table @samp
  21659. @item none
  21660. Always apply transposition. (default)
  21661. @item portrait
  21662. Preserve portrait geometry (when @var{height} >= @var{width}).
  21663. @item landscape
  21664. Preserve landscape geometry (when @var{width} >= @var{height}).
  21665. @end table
  21666. @end table
  21667. @c man end VULKAN VIDEO FILTERS
  21668. @chapter QSV Video Filters
  21669. @c man begin QSV VIDEO FILTERS
  21670. Below is a description of the currently available QSV video filters.
  21671. To enable compilation of these filters you need to configure FFmpeg with
  21672. @code{--enable-libmfx} or @code{--enable-libvpl}.
  21673. 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}
  21674. @section hstack_qsv
  21675. Stack input videos horizontally.
  21676. This is the QSV variant of the @ref{hstack} filter, each input stream may
  21677. have different height, this filter will scale down/up each input stream while
  21678. keeping the original aspect.
  21679. It accepts the following options:
  21680. @table @option
  21681. @item inputs
  21682. See @ref{hstack}.
  21683. @item shortest
  21684. See @ref{hstack}.
  21685. @item height
  21686. Set height of output. If set to 0, this filter will set height of output to
  21687. height of the first input stream. Default value is 0.
  21688. @end table
  21689. @section vstack_qsv
  21690. Stack input videos vertically.
  21691. This is the QSV variant of the @ref{vstack} filter, each input stream may
  21692. have different width, this filter will scale down/up each input stream while
  21693. keeping the original aspect.
  21694. It accepts the following options:
  21695. @table @option
  21696. @item inputs
  21697. See @ref{vstack}.
  21698. @item shortest
  21699. See @ref{vstack}.
  21700. @item width
  21701. Set width of output. If set to 0, this filter will set width of output to
  21702. width of the first input stream. Default value is 0.
  21703. @end table
  21704. @section xstack_qsv
  21705. Stack video inputs into custom layout.
  21706. This is the QSV variant of the @ref{xstack} filter.
  21707. It accepts the following options:
  21708. @table @option
  21709. @item inputs
  21710. See @ref{xstack}.
  21711. @item shortest
  21712. See @ref{xstack}.
  21713. @item layout
  21714. See @ref{xstack}.
  21715. Moreover, this permits the user to supply output size for each input stream.
  21716. @example
  21717. xstack_qsv=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21718. @end example
  21719. @item grid
  21720. See @ref{xstack}.
  21721. @item grid_tile_size
  21722. Set output size for each input stream when @option{grid} is set. If this option
  21723. is not set, this filter will set output size by default to the size of the
  21724. first input stream. For the syntax of this option, check the
  21725. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21726. @item fill
  21727. See @ref{xstack}.
  21728. @end table
  21729. @c man end QSV VIDEO FILTERS
  21730. @chapter Video Sources
  21731. @c man begin VIDEO SOURCES
  21732. Below is a description of the currently available video sources.
  21733. @section buffer
  21734. Buffer video frames, and make them available to the filter chain.
  21735. This source is mainly intended for a programmatic use, in particular
  21736. through the interface defined in @file{libavfilter/buffersrc.h}.
  21737. It accepts the following parameters:
  21738. @table @option
  21739. @item video_size
  21740. Specify the size (width and height) of the buffered video frames. For the
  21741. syntax of this option, check the
  21742. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21743. @item width
  21744. The input video width.
  21745. @item height
  21746. The input video height.
  21747. @item pix_fmt
  21748. A string representing the pixel format of the buffered video frames.
  21749. It may be a number corresponding to a pixel format, or a pixel format
  21750. name.
  21751. @item time_base
  21752. Specify the timebase assumed by the timestamps of the buffered frames.
  21753. @item frame_rate
  21754. Specify the frame rate expected for the video stream.
  21755. @item colorspace
  21756. A string representing the color space of the buffered video frames.
  21757. It may be a number corresponding to a color space, or a color space
  21758. name.
  21759. @item range
  21760. A string representing the color range of the buffered video frames.
  21761. It may be a number corresponding to a color range, or a color range
  21762. name.
  21763. @item pixel_aspect, sar
  21764. The sample (pixel) aspect ratio of the input video.
  21765. @item hw_frames_ctx
  21766. When using a hardware pixel format, this should be a reference to an
  21767. AVHWFramesContext describing input frames.
  21768. @end table
  21769. For example:
  21770. @example
  21771. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  21772. @end example
  21773. will instruct the source to accept video frames with size 320x240 and
  21774. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  21775. square pixels (1:1 sample aspect ratio).
  21776. Since the pixel format with name "yuv410p" corresponds to the number 6
  21777. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  21778. this example corresponds to:
  21779. @example
  21780. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  21781. @end example
  21782. Alternatively, the options can be specified as a flat string, but this
  21783. syntax is deprecated:
  21784. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  21785. @section cellauto
  21786. Create a pattern generated by an elementary cellular automaton.
  21787. The initial state of the cellular automaton can be defined through the
  21788. @option{filename} and @option{pattern} options. If such options are
  21789. not specified an initial state is created randomly.
  21790. At each new frame a new row in the video is filled with the result of
  21791. the cellular automaton next generation. The behavior when the whole
  21792. frame is filled is defined by the @option{scroll} option.
  21793. This source accepts the following options:
  21794. @table @option
  21795. @item filename, f
  21796. Read the initial cellular automaton state, i.e. the starting row, from
  21797. the specified file.
  21798. In the file, each non-whitespace character is considered an alive
  21799. cell, a newline will terminate the row, and further characters in the
  21800. file will be ignored.
  21801. @item pattern, p
  21802. Read the initial cellular automaton state, i.e. the starting row, from
  21803. the specified string.
  21804. Each non-whitespace character in the string is considered an alive
  21805. cell, a newline will terminate the row, and further characters in the
  21806. string will be ignored.
  21807. @item rate, r
  21808. Set the video rate, that is the number of frames generated per second.
  21809. Default is 25.
  21810. @item random_fill_ratio, ratio
  21811. Set the random fill ratio for the initial cellular automaton row. It
  21812. is a floating point number value ranging from 0 to 1, defaults to
  21813. 1/PHI.
  21814. This option is ignored when a file or a pattern is specified.
  21815. @item random_seed, seed
  21816. Set the seed for filling randomly the initial row, must be an integer
  21817. included between 0 and UINT32_MAX. If not specified, or if explicitly
  21818. set to -1, the filter will try to use a good random seed on a best
  21819. effort basis.
  21820. @item rule
  21821. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  21822. Default value is 110.
  21823. @item size, s
  21824. Set the size of the output video. For the syntax of this option, check the
  21825. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21826. If @option{filename} or @option{pattern} is specified, the size is set
  21827. by default to the width of the specified initial state row, and the
  21828. height is set to @var{width} * PHI.
  21829. If @option{size} is set, it must contain the width of the specified
  21830. pattern string, and the specified pattern will be centered in the
  21831. larger row.
  21832. If a filename or a pattern string is not specified, the size value
  21833. defaults to "320x518" (used for a randomly generated initial state).
  21834. @item scroll
  21835. If set to 1, scroll the output upward when all the rows in the output
  21836. have been already filled. If set to 0, the new generated row will be
  21837. written over the top row just after the bottom row is filled.
  21838. Defaults to 1.
  21839. @item start_full, full
  21840. If set to 1, completely fill the output with generated rows before
  21841. outputting the first frame.
  21842. This is the default behavior, for disabling set the value to 0.
  21843. @item stitch
  21844. If set to 1, stitch the left and right row edges together.
  21845. This is the default behavior, for disabling set the value to 0.
  21846. @end table
  21847. @subsection Examples
  21848. @itemize
  21849. @item
  21850. Read the initial state from @file{pattern}, and specify an output of
  21851. size 200x400.
  21852. @example
  21853. cellauto=f=pattern:s=200x400
  21854. @end example
  21855. @item
  21856. Generate a random initial row with a width of 200 cells, with a fill
  21857. ratio of 2/3:
  21858. @example
  21859. cellauto=ratio=2/3:s=200x200
  21860. @end example
  21861. @item
  21862. Create a pattern generated by rule 18 starting by a single alive cell
  21863. centered on an initial row with width 100:
  21864. @example
  21865. cellauto=p=@@:s=100x400:full=0:rule=18
  21866. @end example
  21867. @item
  21868. Specify a more elaborated initial pattern:
  21869. @example
  21870. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  21871. @end example
  21872. @end itemize
  21873. @anchor{coreimagesrc}
  21874. @section coreimagesrc
  21875. Video source generated on GPU using Apple's CoreImage API on OSX.
  21876. This video source is a specialized version of the @ref{coreimage} video filter.
  21877. Use a core image generator at the beginning of the applied filterchain to
  21878. generate the content.
  21879. The coreimagesrc video source accepts the following options:
  21880. @table @option
  21881. @item list_generators
  21882. List all available generators along with all their respective options as well as
  21883. possible minimum and maximum values along with the default values.
  21884. @example
  21885. list_generators=true
  21886. @end example
  21887. @item size, s
  21888. Specify the size of the sourced video. For the syntax of this option, check the
  21889. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21890. The default value is @code{320x240}.
  21891. @item rate, r
  21892. Specify the frame rate of the sourced video, as the number of frames
  21893. generated per second. It has to be a string in the format
  21894. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  21895. number or a valid video frame rate abbreviation. The default value is
  21896. "25".
  21897. @item sar
  21898. Set the sample aspect ratio of the sourced video.
  21899. @item duration, d
  21900. Set the duration of the sourced video. See
  21901. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  21902. for the accepted syntax.
  21903. If not specified, or the expressed duration is negative, the video is
  21904. supposed to be generated forever.
  21905. @end table
  21906. Additionally, all options of the @ref{coreimage} video filter are accepted.
  21907. A complete filterchain can be used for further processing of the
  21908. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  21909. and examples for details.
  21910. @subsection Examples
  21911. @itemize
  21912. @item
  21913. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  21914. given as complete and escaped command-line for Apple's standard bash shell:
  21915. @example
  21916. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  21917. @end example
  21918. This example is equivalent to the QRCode example of @ref{coreimage} without the
  21919. need for a nullsrc video source.
  21920. @end itemize
  21921. @section ddagrab
  21922. Captures the Windows Desktop via Desktop Duplication API.
  21923. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  21924. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  21925. software processing.
  21926. It accepts the following options:
  21927. @table @option
  21928. @item output_idx
  21929. DXGI Output Index to capture.
  21930. Usually corresponds to the index Windows has given the screen minus one,
  21931. so it's starting at 0.
  21932. Defaults to output 0.
  21933. @item draw_mouse
  21934. Whether to draw the mouse cursor.
  21935. Defaults to true.
  21936. Only affects hardware cursors. If a game or application renders its own cursor,
  21937. it'll always be captured.
  21938. @item framerate
  21939. Maximum framerate at which the desktop will be captured - the interval between
  21940. successive frames will not be smaller than the inverse of the framerate. When
  21941. @var{dup_frames} is true (the default) and the desktop is not being updated
  21942. often enough, the filter will duplicate a previous frame. Note that there is no
  21943. background buffering going on, so when the filter is not polled often enough
  21944. then the actual inter-frame interval may be significantly larger.
  21945. Defaults to 30 FPS.
  21946. @item video_size
  21947. Specify the size of the captured video.
  21948. Defaults to the full size of the screen.
  21949. Cropped from the bottom/right if smaller than screen size.
  21950. @item offset_x
  21951. Horizontal offset of the captured video.
  21952. @item offset_y
  21953. Vertical offset of the captured video.
  21954. @item output_fmt
  21955. Desired filter output format.
  21956. Defaults to 8 Bit BGRA.
  21957. It accepts the following values:
  21958. @table @samp
  21959. @item auto
  21960. Passes all supported output formats to DDA and returns what DDA decides to use.
  21961. @item 8bit
  21962. @item bgra
  21963. 8 Bit formats always work, and DDA will convert to them if necessary.
  21964. @item 10bit
  21965. @item x2bgr10
  21966. Filter initialization will fail if 10 bit format is requested but unavailable.
  21967. @end table
  21968. @item dup_frames
  21969. When this option is set to true (the default), the filter will duplicate frames
  21970. when the desktop has not been updated in order to maintain approximately
  21971. constant target framerate. When this option is set to false, the filter will
  21972. wait for the desktop to be updated (inter-frame intervals may vary significantly
  21973. in this case).
  21974. @end table
  21975. @subsection Examples
  21976. Capture primary screen and encode using nvenc:
  21977. @example
  21978. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  21979. @end example
  21980. You can also skip the lavfi device and directly use the filter.
  21981. Also demonstrates downloading the frame and encoding with libx264.
  21982. Explicit output format specification is required in this case:
  21983. @example
  21984. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  21985. @end example
  21986. If you want to capture only a subsection of the desktop, this can be achieved
  21987. by specifying a smaller size and its offsets into the screen:
  21988. @example
  21989. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  21990. @end example
  21991. @section gradients
  21992. Generate several gradients.
  21993. @table @option
  21994. @item size, s
  21995. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  21996. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  21997. @item rate, r
  21998. Set frame rate, expressed as number of frames per second. Default
  21999. value is "25".
  22000. @item c0, c1, c2, c3, c4, c5, c6, c7
  22001. Set 8 colors. Default values for colors is to pick random one.
  22002. @item x0, y0, y0, y1
  22003. Set gradient line source and destination points. If negative or out of range, random ones
  22004. are picked.
  22005. @item nb_colors, n
  22006. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  22007. @item seed
  22008. Set seed for picking gradient line points.
  22009. @item duration, d
  22010. Set the duration of the sourced video. See
  22011. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22012. for the accepted syntax.
  22013. If not specified, or the expressed duration is negative, the video is
  22014. supposed to be generated forever.
  22015. @item speed
  22016. Set speed of gradients rotation.
  22017. @item type, t
  22018. Set type of gradients.
  22019. Available values are:
  22020. @table @samp
  22021. @item linear
  22022. @item radial
  22023. @item circular
  22024. @item spiral
  22025. @item square
  22026. @end table
  22027. Default type is @var{linear}.
  22028. @end table
  22029. @subsection Commands
  22030. This source supports the some above options as @ref{commands}.
  22031. @section mandelbrot
  22032. Generate a Mandelbrot set fractal, and progressively zoom towards the
  22033. point specified with @var{start_x} and @var{start_y}.
  22034. This source accepts the following options:
  22035. @table @option
  22036. @item end_pts
  22037. Set the terminal pts value. Default value is 400.
  22038. @item end_scale
  22039. Set the terminal scale value.
  22040. Must be a floating point value. Default value is 0.3.
  22041. @item inner
  22042. Set the inner coloring mode, that is the algorithm used to draw the
  22043. Mandelbrot fractal internal region.
  22044. It shall assume one of the following values:
  22045. @table @option
  22046. @item black
  22047. Set black mode.
  22048. @item convergence
  22049. Show time until convergence.
  22050. @item mincol
  22051. Set color based on point closest to the origin of the iterations.
  22052. @item period
  22053. Set period mode.
  22054. @end table
  22055. Default value is @var{mincol}.
  22056. @item bailout
  22057. Set the bailout value. Default value is 10.0.
  22058. @item maxiter
  22059. Set the maximum of iterations performed by the rendering
  22060. algorithm. Default value is 7189.
  22061. @item outer
  22062. Set outer coloring mode.
  22063. It shall assume one of following values:
  22064. @table @option
  22065. @item iteration_count
  22066. Set iteration count mode.
  22067. @item normalized_iteration_count
  22068. set normalized iteration count mode.
  22069. @end table
  22070. Default value is @var{normalized_iteration_count}.
  22071. @item rate, r
  22072. Set frame rate, expressed as number of frames per second. Default
  22073. value is "25".
  22074. @item size, s
  22075. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22076. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22077. @item start_scale
  22078. Set the initial scale value. Default value is 3.0.
  22079. @item start_x
  22080. Set the initial x position. Must be a floating point value between
  22081. -100 and 100. Default value is -0.743643887037158704752191506114774.
  22082. @item start_y
  22083. Set the initial y position. Must be a floating point value between
  22084. -100 and 100. Default value is -0.131825904205311970493132056385139.
  22085. @end table
  22086. @section mptestsrc
  22087. Generate various test patterns, as generated by the MPlayer test filter.
  22088. The size of the generated video is fixed, and is 256x256.
  22089. This source is useful in particular for testing encoding features.
  22090. This source accepts the following options:
  22091. @table @option
  22092. @item rate, r
  22093. Specify the frame rate of the sourced video, as the number of frames
  22094. generated per second. It has to be a string in the format
  22095. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22096. number or a valid video frame rate abbreviation. The default value is
  22097. "25".
  22098. @item duration, d
  22099. Set the duration of the sourced video. See
  22100. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22101. for the accepted syntax.
  22102. If not specified, or the expressed duration is negative, the video is
  22103. supposed to be generated forever.
  22104. @item test, t
  22105. Set the number or the name of the test to perform. Supported tests are:
  22106. @table @option
  22107. @item dc_luma
  22108. @item dc_chroma
  22109. @item freq_luma
  22110. @item freq_chroma
  22111. @item amp_luma
  22112. @item amp_chroma
  22113. @item cbp
  22114. @item mv
  22115. @item ring1
  22116. @item ring2
  22117. @item all
  22118. @item max_frames, m
  22119. Set the maximum number of frames generated for each test, default value is 30.
  22120. @end table
  22121. Default value is "all", which will cycle through the list of all tests.
  22122. @end table
  22123. Some examples:
  22124. @example
  22125. mptestsrc=t=dc_luma
  22126. @end example
  22127. will generate a "dc_luma" test pattern.
  22128. @section frei0r_src
  22129. Provide a frei0r source.
  22130. To enable compilation of this filter you need to install the frei0r
  22131. header and configure FFmpeg with @code{--enable-frei0r}.
  22132. This source accepts the following parameters:
  22133. @table @option
  22134. @item size
  22135. The size of the video to generate. For the syntax of this option, check the
  22136. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22137. @item framerate
  22138. The framerate of the generated video. It may be a string of the form
  22139. @var{num}/@var{den} or a frame rate abbreviation.
  22140. @item filter_name
  22141. The name to the frei0r source to load. For more information regarding frei0r and
  22142. how to set the parameters, read the @ref{frei0r} section in the video filters
  22143. documentation.
  22144. @item filter_params
  22145. A '|'-separated list of parameters to pass to the frei0r source.
  22146. @end table
  22147. For example, to generate a frei0r partik0l source with size 200x200
  22148. and frame rate 10 which is overlaid on the overlay filter main input:
  22149. @example
  22150. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  22151. @end example
  22152. @section life
  22153. Generate a life pattern.
  22154. This source is based on a generalization of John Conway's life game.
  22155. The sourced input represents a life grid, each pixel represents a cell
  22156. which can be in one of two possible states, alive or dead. Every cell
  22157. interacts with its eight neighbours, which are the cells that are
  22158. horizontally, vertically, or diagonally adjacent.
  22159. At each interaction the grid evolves according to the adopted rule,
  22160. which specifies the number of neighbor alive cells which will make a
  22161. cell stay alive or born. The @option{rule} option allows one to specify
  22162. the rule to adopt.
  22163. This source accepts the following options:
  22164. @table @option
  22165. @item filename, f
  22166. Set the file from which to read the initial grid state. In the file,
  22167. each non-whitespace character is considered an alive cell, and newline
  22168. is used to delimit the end of each row.
  22169. If this option is not specified, the initial grid is generated
  22170. randomly.
  22171. @item rate, r
  22172. Set the video rate, that is the number of frames generated per second.
  22173. Default is 25.
  22174. @item random_fill_ratio, ratio
  22175. Set the random fill ratio for the initial random grid. It is a
  22176. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  22177. It is ignored when a file is specified.
  22178. @item random_seed, seed
  22179. Set the seed for filling the initial random grid, 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 life rule.
  22185. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  22186. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  22187. @var{NS} specifies the number of alive neighbor cells which make a
  22188. live cell stay alive, and @var{NB} the number of alive neighbor cells
  22189. which make a dead cell to become alive (i.e. to "born").
  22190. "s" and "b" can be used in place of "S" and "B", respectively.
  22191. Alternatively a rule can be specified by an 18-bits integer. The 9
  22192. high order bits are used to encode the next cell state if it is alive
  22193. for each number of neighbor alive cells, the low order bits specify
  22194. the rule for "borning" new cells. Higher order bits encode for an
  22195. higher number of neighbor cells.
  22196. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  22197. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  22198. Default value is "S23/B3", which is the original Conway's game of life
  22199. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  22200. cells, and will born a new cell if there are three alive cells around
  22201. a dead cell.
  22202. @item size, s
  22203. Set the size of the output video. For the syntax of this option, check the
  22204. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22205. If @option{filename} is specified, the size is set by default to the
  22206. same size of the input file. If @option{size} is set, it must contain
  22207. the size specified in the input file, and the initial grid defined in
  22208. that file is centered in the larger resulting area.
  22209. If a filename is not specified, the size value defaults to "320x240"
  22210. (used for a randomly generated initial grid).
  22211. @item stitch
  22212. If set to 1, stitch the left and right grid edges together, and the
  22213. top and bottom edges also. Defaults to 1.
  22214. @item mold
  22215. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  22216. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  22217. value from 0 to 255.
  22218. @item life_color
  22219. Set the color of living (or new born) cells.
  22220. @item death_color
  22221. Set the color of dead cells. If @option{mold} is set, this is the first color
  22222. used to represent a dead cell.
  22223. @item mold_color
  22224. Set mold color, for definitely dead and moldy cells.
  22225. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  22226. ffmpeg-utils manual,ffmpeg-utils}.
  22227. @end table
  22228. @subsection Examples
  22229. @itemize
  22230. @item
  22231. Read a grid from @file{pattern}, and center it on a grid of size
  22232. 300x300 pixels:
  22233. @example
  22234. life=f=pattern:s=300x300
  22235. @end example
  22236. @item
  22237. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  22238. @example
  22239. life=ratio=2/3:s=200x200
  22240. @end example
  22241. @item
  22242. Specify a custom rule for evolving a randomly generated grid:
  22243. @example
  22244. life=rule=S14/B34
  22245. @end example
  22246. @item
  22247. Full example with slow death effect (mold) using @command{ffplay}:
  22248. @example
  22249. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  22250. @end example
  22251. @end itemize
  22252. @section perlin
  22253. Generate Perlin noise.
  22254. Perlin noise is a kind of noise with local continuity in space. This
  22255. can be used to generate patterns with continuity in space and time,
  22256. e.g. to simulate smoke, fluids, or terrain.
  22257. In case more than one octave is specified through the @option{octaves}
  22258. option, Perlin noise is generated as a sum of components, each one
  22259. with doubled frequency. In this case the @option{persistence} option
  22260. specify the ratio of the amplitude with respect to the previous
  22261. component. More octave components enable to specify more high
  22262. frequency details in the generated noise (e.g. small size variations
  22263. due to boulders in a generated terrain).
  22264. @subsection Options
  22265. @table @option
  22266. @item size, s
  22267. Specify the size (width and height) of the buffered video frames. For the
  22268. syntax of this option, check the
  22269. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22270. @item rate, r
  22271. Specify the frame rate expected for the video stream, expressed as a
  22272. number of frames per second.
  22273. @item octaves
  22274. Specify the total number of components making up the noise, each one
  22275. with doubled frequency.
  22276. @item persistence
  22277. Set the ratio used to compute the amplitude of the next octave
  22278. component with respect to the previous component amplitude.
  22279. @item xscale
  22280. @item yscale
  22281. Define a scale factor used to multiple the x, y coordinates. This can
  22282. be useful to define an effect with a pattern stretched along the x or
  22283. y axis.
  22284. @item tscale
  22285. Define a scale factor used to multiple the time coordinate. This can
  22286. be useful to change the time variation speed.
  22287. @item random_mode
  22288. Set random mode used to compute initial pattern.
  22289. Supported values are:
  22290. @table @option
  22291. @item random
  22292. Compute and use random seed.
  22293. @item ken
  22294. Use the predefined initial pattern defined by Ken Perlin in the
  22295. original article, can be useful to compare the output with other
  22296. sources.
  22297. @item seed
  22298. Use the value specified by @option{random_seed} option.
  22299. @end table
  22300. @item random_seed, seed
  22301. When @option{random_mode} is set to @var{random_seed}, use this value
  22302. to compute the initial pattern.
  22303. @end table
  22304. @subsection Examples
  22305. @itemize
  22306. @item
  22307. Generate single component:
  22308. @example
  22309. perlin
  22310. @end example
  22311. @item
  22312. Use Perlin noise with 7 components, each one with a halved contribution
  22313. to total amplitude:
  22314. @example
  22315. perlin=octaves=7:persistence=0.5
  22316. @end example
  22317. @item
  22318. Chain Perlin noise with the @ref{lutyuv} to generate a black&white
  22319. effect:
  22320. @example
  22321. perlin=octaves=3:tscale=0.3,lutyuv=y='if(lt(val\,128)\,255\,0)'
  22322. @end example
  22323. @item
  22324. Stretch noise along the y axis, and convert gray level to red-only
  22325. signal:
  22326. @example
  22327. perlin=octaves=7:tscale=0.4:yscale=0.3,lutrgb=r=val:b=0:g=0
  22328. @end example
  22329. @end itemize
  22330. @section qrencodesrc
  22331. Generate a QR code using the libqrencode library (see
  22332. @url{https://fukuchi.org/works/qrencode/}).
  22333. To enable the compilation of this source, you need to configure FFmpeg with
  22334. @code{--enable-libqrencode}.
  22335. The QR code is generated from the provided text or text pattern. The
  22336. corresponding QR code is scaled and put in the video output according to the
  22337. specified output size options.
  22338. In case no text is specified, the QR code is not generated, but an empty colored
  22339. output is returned instead.
  22340. This source accepts the following options:
  22341. @table @option
  22342. @item qrcode_width, q
  22343. @item padded_qrcode_width, Q
  22344. Specify an expression for the width of the rendered QR code, with and without
  22345. padding. The @var{qrcode_width} expression can reference the value set by the
  22346. @var{padded_qrcode_width} expression, and vice versa.
  22347. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  22348. there is no padding.
  22349. These expressions are evaluated only once, when initializing the source.
  22350. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  22351. Note that some of the constants are missing for the source (for example the
  22352. @var{x} or @var{t} or ¸@var{n}), since they only makes sense when evaluating the
  22353. expression for each frame rather than at initialization time.
  22354. @item rate, r
  22355. Specify the frame rate of the sourced video, as the number of frames
  22356. generated per second. It has to be a string in the format
  22357. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22358. number or a valid video frame rate abbreviation. The default value is
  22359. "25".
  22360. @item case_sensitive, cs
  22361. Instruct libqrencode to use case sensitive encoding. This is enabled by
  22362. default. This can be disabled to reduce the QR encoding size.
  22363. @item level, l
  22364. Specify the QR encoding error correction level. With an higher correction level,
  22365. the encoding size will increase but the code will be more robust to corruption.
  22366. Lower level is @var{L}.
  22367. It accepts the following values:
  22368. @table @samp
  22369. @item L
  22370. @item M
  22371. @item Q
  22372. @item H
  22373. @end table
  22374. @item expansion
  22375. Select how the input text is expanded. Can be either @code{none}, or
  22376. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  22377. section for details.
  22378. @item text
  22379. @item textfile
  22380. Define the text to be rendered. In case neither is specified, no QR is encoded
  22381. (just an empty colored frame).
  22382. In case expansion is enabled, the text is treated as a text template, using the
  22383. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  22384. Text expansion} section for details.
  22385. @item background_color, bc
  22386. @item foreground_color, fc
  22387. Set the QR code and background color. The default value of
  22388. @var{foreground_color} is "black", the default value of @var{background_color}
  22389. is "white".
  22390. For the syntax of the color options, check the @ref{color syntax,,"Color"
  22391. section in the ffmpeg-utils manual,ffmpeg-utils}.
  22392. @end table
  22393. @subsection Examples
  22394. @itemize
  22395. @item
  22396. Generate a QR code encoding the specified text with the default size:
  22397. @example
  22398. qrencodesrc=text=www.ffmpeg.org
  22399. @end example
  22400. @item
  22401. Same as below, but select blue on pink colors:
  22402. @example
  22403. qrencodesrc=text=www.ffmpeg.org:bc=pink:fc=blue
  22404. @end example
  22405. @item
  22406. Generate a QR code with width of 200 pixels and padding, making the padded width
  22407. 4/3 of the QR code width:
  22408. @example
  22409. qrencodesrc=text=www.ffmpeg.org:q=200:Q=4/3*q
  22410. @end example
  22411. @item
  22412. Generate a QR code with padded width of 200 pixels and padding, making the QR
  22413. code width 3/4 of the padded width:
  22414. @example
  22415. qrencodesrc=text=www.ffmpeg.org:Q=200:q=3/4*Q
  22416. @end example
  22417. @item
  22418. Generate a QR code encoding the frame number:
  22419. @example
  22420. qrencodesrc=text=%@{n@}
  22421. @end example
  22422. @item
  22423. Generate a QR code encoding the GMT timestamp:
  22424. @example
  22425. qrencodesrc=text=%@{gmtime@}
  22426. @end example
  22427. @item
  22428. Generate a QR code encoding the timestamp expressed as a float:
  22429. @example
  22430. qrencodesrc=text=%@{pts@}
  22431. @end example
  22432. @end itemize
  22433. @anchor{allrgb}
  22434. @anchor{allyuv}
  22435. @anchor{color}
  22436. @anchor{colorchart}
  22437. @anchor{colorspectrum}
  22438. @anchor{haldclutsrc}
  22439. @anchor{nullsrc}
  22440. @anchor{pal75bars}
  22441. @anchor{pal100bars}
  22442. @anchor{rgbtestsrc}
  22443. @anchor{smptebars}
  22444. @anchor{smptehdbars}
  22445. @anchor{testsrc}
  22446. @anchor{testsrc2}
  22447. @anchor{yuvtestsrc}
  22448. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  22449. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  22450. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  22451. The @code{color} source provides an uniformly colored input.
  22452. The @code{colorchart} source provides a colors checker chart.
  22453. The @code{colorspectrum} source provides a color spectrum input.
  22454. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  22455. @ref{haldclut} filter.
  22456. The @code{nullsrc} source returns unprocessed video frames. It is
  22457. mainly useful to be employed in analysis / debugging tools, or as the
  22458. source for filters which ignore the input data.
  22459. The @code{pal75bars} source generates a color bars pattern, based on
  22460. EBU PAL recommendations with 75% color levels.
  22461. The @code{pal100bars} source generates a color bars pattern, based on
  22462. EBU PAL recommendations with 100% color levels.
  22463. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  22464. detecting RGB vs BGR issues. You should see a red, green and blue
  22465. stripe from top to bottom.
  22466. The @code{smptebars} source generates a color bars pattern, based on
  22467. the SMPTE Engineering Guideline EG 1-1990.
  22468. The @code{smptehdbars} source generates a color bars pattern, based on
  22469. the SMPTE RP 219-2002.
  22470. The @code{testsrc} source generates a test video pattern, showing a
  22471. color pattern, a scrolling gradient and a timestamp. This is mainly
  22472. intended for testing purposes.
  22473. The @code{testsrc2} source is similar to testsrc, but supports more
  22474. pixel formats instead of just @code{rgb24}. This allows using it as an
  22475. input for other tests without requiring a format conversion.
  22476. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  22477. see a y, cb and cr stripe from top to bottom.
  22478. The sources accept the following parameters:
  22479. @table @option
  22480. @item level
  22481. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  22482. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  22483. pixels to be used as identity matrix for 3D lookup tables. Each component is
  22484. coded on a @code{1/(N*N)} scale.
  22485. @item color, c
  22486. Specify the color of the source, only available in the @code{color}
  22487. source. For the syntax of this option, check the
  22488. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22489. @item size, s
  22490. Specify the size of the sourced video. For the syntax of this option, check the
  22491. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22492. The default value is @code{320x240}.
  22493. This option is not available with the @code{allrgb}, @code{allyuv}, and
  22494. @code{haldclutsrc} filters.
  22495. @item rate, r
  22496. Specify the frame rate of the sourced video, as the number of frames
  22497. generated per second. It has to be a string in the format
  22498. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22499. number or a valid video frame rate abbreviation. The default value is
  22500. "25".
  22501. @item duration, d
  22502. Set the duration of the sourced video. See
  22503. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22504. for the accepted syntax.
  22505. If not specified, or the expressed duration is negative, the video is
  22506. supposed to be generated forever.
  22507. Since the frame rate is used as time base, all frames including the last one
  22508. will have their full duration. If the specified duration is not a multiple
  22509. of the frame duration, it will be rounded up.
  22510. @item sar
  22511. Set the sample aspect ratio of the sourced video.
  22512. @item alpha
  22513. Specify the alpha (opacity) of the background, only available in the
  22514. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  22515. 255 (fully opaque, the default).
  22516. @item decimals, n
  22517. Set the number of decimals to show in the timestamp, only available in the
  22518. @code{testsrc} source.
  22519. The displayed timestamp value will correspond to the original
  22520. timestamp value multiplied by the power of 10 of the specified
  22521. value. Default value is 0.
  22522. @item type
  22523. Set the type of the color spectrum, only available in the
  22524. @code{colorspectrum} source. Can be one of the following:
  22525. @table @samp
  22526. @item black
  22527. @item white
  22528. @item all
  22529. @end table
  22530. @item patch_size
  22531. Set patch size of single color patch, only available in the
  22532. @code{colorchart} source. Default is @code{64x64}.
  22533. @item preset
  22534. Set colorchecker colors preset, only available in the
  22535. @code{colorchart} source.
  22536. Available values are:
  22537. @table @samp
  22538. @item reference
  22539. @item skintones
  22540. @end table
  22541. Default value is @code{reference}.
  22542. @end table
  22543. @subsection Examples
  22544. @itemize
  22545. @item
  22546. Generate a video with a duration of 5.3 seconds, with size
  22547. 176x144 and a frame rate of 10 frames per second:
  22548. @example
  22549. testsrc=duration=5.3:size=qcif:rate=10
  22550. @end example
  22551. @item
  22552. The following graph description will generate a red source
  22553. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  22554. frames per second:
  22555. @example
  22556. color=c=red@@0.2:s=qcif:r=10
  22557. @end example
  22558. @item
  22559. If the input content is to be ignored, @code{nullsrc} can be used. The
  22560. following command generates noise in the luma plane by employing
  22561. the @code{geq} filter:
  22562. @example
  22563. nullsrc=s=256x256, geq=random(1)*255:128:128
  22564. @end example
  22565. @end itemize
  22566. @subsection Commands
  22567. The @code{color} source supports the following commands:
  22568. @table @option
  22569. @item c, color
  22570. Set the color of the created image. Accepts the same syntax of the
  22571. corresponding @option{color} option.
  22572. @end table
  22573. @section openclsrc
  22574. Generate video using an OpenCL program.
  22575. @table @option
  22576. @item source
  22577. OpenCL program source file.
  22578. @item kernel
  22579. Kernel name in program.
  22580. @item size, s
  22581. Size of frames to generate. This must be set.
  22582. @item format
  22583. Pixel format to use for the generated frames. This must be set.
  22584. @item rate, r
  22585. Number of frames generated every second. Default value is '25'.
  22586. @end table
  22587. For details of how the program loading works, see the @ref{program_opencl}
  22588. filter.
  22589. Example programs:
  22590. @itemize
  22591. @item
  22592. Generate a colour ramp by setting pixel values from the position of the pixel
  22593. in the output image. (Note that this will work with all pixel formats, but
  22594. the generated output will not be the same.)
  22595. @verbatim
  22596. __kernel void ramp(__write_only image2d_t dst,
  22597. unsigned int index)
  22598. {
  22599. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22600. float4 val;
  22601. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  22602. write_imagef(dst, loc, val);
  22603. }
  22604. @end verbatim
  22605. @item
  22606. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  22607. @verbatim
  22608. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  22609. unsigned int index)
  22610. {
  22611. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22612. float4 value = 0.0f;
  22613. int x = loc.x + index;
  22614. int y = loc.y + index;
  22615. while (x > 0 || y > 0) {
  22616. if (x % 3 == 1 && y % 3 == 1) {
  22617. value = 1.0f;
  22618. break;
  22619. }
  22620. x /= 3;
  22621. y /= 3;
  22622. }
  22623. write_imagef(dst, loc, value);
  22624. }
  22625. @end verbatim
  22626. @end itemize
  22627. @section sierpinski
  22628. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  22629. This source accepts the following options:
  22630. @table @option
  22631. @item size, s
  22632. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22633. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22634. @item rate, r
  22635. Set frame rate, expressed as number of frames per second. Default
  22636. value is "25".
  22637. @item seed
  22638. Set seed which is used for random panning.
  22639. @item jump
  22640. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  22641. @item type
  22642. Set fractal type, can be default @code{carpet} or @code{triangle}.
  22643. @end table
  22644. @section zoneplate
  22645. Generate a zoneplate test video pattern.
  22646. This source accepts the following options:
  22647. @table @option
  22648. @item size, s
  22649. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22650. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "320x240".
  22651. @item rate, r
  22652. Set frame rate, expressed as number of frames per second. Default
  22653. value is "25".
  22654. @item duration, d
  22655. Set the duration of the sourced video. See
  22656. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22657. for the accepted syntax.
  22658. If not specified, or the expressed duration is negative, the video is
  22659. supposed to be generated forever.
  22660. @item sar
  22661. Set the sample aspect ratio of the sourced video.
  22662. @item precision
  22663. Set precision in bits for look-up table for sine calculations. Default value is 10.
  22664. Allowed range is from 4 to 16.
  22665. @item xo
  22666. Set horizontal axis offset for output signal. Default value is 0.
  22667. @item yo
  22668. Set vertical axis offset for output signal. Default value is 0.
  22669. @item to
  22670. Set time axis offset for output signal. Default value is 0.
  22671. @item k0
  22672. Set 0-order, constant added to signal phase. Default value is 0.
  22673. @item kx
  22674. Set 1-order, phase factor multiplier for horizontal axis. Default value is 0.
  22675. @item ky
  22676. Set 1-order, phase factor multiplier for vertical axis. Default value is 0.
  22677. @item kt
  22678. Set 1-order, phase factor multiplier for time axis. Default value is 0.
  22679. @item kxt, kyt, kxy
  22680. Set phase factor multipliers for combination of spatial and temporal axis.
  22681. Default value is 0.
  22682. @item kx2
  22683. Set 2-order, phase factor multiplier for horizontal axis. Default value is 0.
  22684. @item ky2
  22685. Set 2-order, phase factor multiplier for vertical axis. Default value is 0.
  22686. @item kt2
  22687. Set 2-order, phase factor multiplier for time axis. Default value is 0.
  22688. @item ku
  22689. Set the constant added to final phase to produce chroma-blue component of signal.
  22690. Default value is 0.
  22691. @item kv
  22692. Set the constant added to final phase to produce chroma-red component of signal.
  22693. Default value is 0.
  22694. @end table
  22695. @subsection Commands
  22696. This source supports the some above options as @ref{commands}.
  22697. @subsection Examples
  22698. @itemize
  22699. @item
  22700. Generate horizontal color sine sweep:
  22701. @example
  22702. zoneplate=ku=512:kv=0:kt2=0:kx2=256:s=wvga:xo=-426:kt=11
  22703. @end example
  22704. @item
  22705. Generate vertical color sine sweep:
  22706. @example
  22707. zoneplate=ku=512:kv=0:kt2=0:ky2=156:s=wvga:yo=-240:kt=11
  22708. @end example
  22709. @item
  22710. Generate circular zone-plate:
  22711. @example
  22712. zoneplate=ku=512:kv=100:kt2=0:ky2=256:kx2=556:s=wvga:yo=0:kt=11
  22713. @end example
  22714. @end itemize
  22715. @c man end VIDEO SOURCES
  22716. @chapter Video Sinks
  22717. @c man begin VIDEO SINKS
  22718. Below is a description of the currently available video sinks.
  22719. @section buffersink
  22720. Buffer video frames, and make them available to the end of the filter
  22721. graph.
  22722. This sink is mainly intended for programmatic use, in particular
  22723. through the interface defined in @file{libavfilter/buffersink.h}
  22724. or the options system.
  22725. It accepts a pointer to an AVBufferSinkContext structure, which
  22726. defines the incoming buffers' formats, to be passed as the opaque
  22727. parameter to @code{avfilter_init_filter} for initialization.
  22728. @section nullsink
  22729. Null video sink: do absolutely nothing with the input video. It is
  22730. mainly useful as a template and for use in analysis / debugging
  22731. tools.
  22732. @c man end VIDEO SINKS
  22733. @chapter Multimedia Filters
  22734. @c man begin MULTIMEDIA FILTERS
  22735. Below is a description of the currently available multimedia filters.
  22736. @section a3dscope
  22737. Convert input audio to 3d scope video output.
  22738. The filter accepts the following options:
  22739. @table @option
  22740. @item rate, r
  22741. Set frame rate, expressed as number of frames per second. Default
  22742. value is "25".
  22743. @item size, s
  22744. Specify the video size for the output. For the syntax of this option, check the
  22745. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22746. Default value is @code{hd720}.
  22747. @item fov
  22748. Set the camera field of view. Default is 90 degrees.
  22749. Allowed range is from 40 to 150.
  22750. @item roll
  22751. Set the camera roll.
  22752. @item pitch
  22753. Set the camera pitch.
  22754. @item yaw
  22755. Set the camera yaw.
  22756. @item xzoom
  22757. Set the camera zoom on X-axis.
  22758. @item yzoom
  22759. Set the camera zoom on Y-axis.
  22760. @item zzoom
  22761. Set the camera zoom on Z-axis.
  22762. @item xpos
  22763. Set the camera position on X-axis.
  22764. @item ypos
  22765. Set the camera position on Y-axis.
  22766. @item zpos
  22767. Set the camera position on Z-axis.
  22768. @item length
  22769. Set the length of displayed audio waves in number of frames.
  22770. @end table
  22771. @subsection Commands
  22772. Filter supports the some above options as @ref{commands}.
  22773. @section abitscope
  22774. Convert input audio to a video output, displaying the audio bit scope.
  22775. The filter accepts the following options:
  22776. @table @option
  22777. @item rate, r
  22778. Set frame rate, expressed as number of frames per second. Default
  22779. value is "25".
  22780. @item size, s
  22781. Specify the video size for the output. For the syntax of this option, check the
  22782. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22783. Default value is @code{1024x256}.
  22784. @item colors
  22785. Specify list of colors separated by space or by '|' which will be used to
  22786. draw channels. Unrecognized or missing colors will be replaced
  22787. by white color.
  22788. @item mode, m
  22789. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  22790. @end table
  22791. @section adrawgraph
  22792. Draw a graph using input audio metadata.
  22793. See @ref{drawgraph}
  22794. @section agraphmonitor
  22795. See @ref{graphmonitor}.
  22796. @section ahistogram
  22797. Convert input audio to a video output, displaying the volume histogram.
  22798. The filter accepts the following options:
  22799. @table @option
  22800. @item dmode
  22801. Specify how histogram is calculated.
  22802. It accepts the following values:
  22803. @table @samp
  22804. @item single
  22805. Use single histogram for all channels.
  22806. @item separate
  22807. Use separate histogram for each channel.
  22808. @end table
  22809. Default is @code{single}.
  22810. @item rate, r
  22811. Set frame rate, expressed as number of frames per second. Default
  22812. value is "25".
  22813. @item size, s
  22814. Specify the video size for the output. For the syntax of this option, check the
  22815. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22816. Default value is @code{hd720}.
  22817. @item scale
  22818. Set display scale.
  22819. It accepts the following values:
  22820. @table @samp
  22821. @item log
  22822. logarithmic
  22823. @item sqrt
  22824. square root
  22825. @item cbrt
  22826. cubic root
  22827. @item lin
  22828. linear
  22829. @item rlog
  22830. reverse logarithmic
  22831. @end table
  22832. Default is @code{log}.
  22833. @item ascale
  22834. Set amplitude scale.
  22835. It accepts the following values:
  22836. @table @samp
  22837. @item log
  22838. logarithmic
  22839. @item lin
  22840. linear
  22841. @end table
  22842. Default is @code{log}.
  22843. @item acount
  22844. Set how much frames to accumulate in histogram.
  22845. Default is 1. Setting this to -1 accumulates all frames.
  22846. @item rheight
  22847. Set histogram ratio of window height.
  22848. @item slide
  22849. Set sonogram sliding.
  22850. It accepts the following values:
  22851. @table @samp
  22852. @item replace
  22853. replace old rows with new ones.
  22854. @item scroll
  22855. scroll from top to bottom.
  22856. @end table
  22857. Default is @code{replace}.
  22858. @item hmode
  22859. Set histogram mode.
  22860. It accepts the following values:
  22861. @table @samp
  22862. @item abs
  22863. Use absolute values of samples.
  22864. @item sign
  22865. Use untouched values of samples.
  22866. @end table
  22867. Default is @code{abs}.
  22868. @end table
  22869. @section aphasemeter
  22870. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  22871. representing mean phase of current audio frame. A video output can also be produced and is
  22872. enabled by default. The audio is passed through as first output.
  22873. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  22874. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  22875. and @code{1} means channels are in phase.
  22876. The filter accepts the following options, all related to its video output:
  22877. @table @option
  22878. @item rate, r
  22879. Set the output frame rate. Default value is @code{25}.
  22880. @item size, s
  22881. Set the video size for the output. For the syntax of this option, check the
  22882. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22883. Default value is @code{800x400}.
  22884. @item rc
  22885. @item gc
  22886. @item bc
  22887. Specify the red, green, blue contrast. Default values are @code{2},
  22888. @code{7} and @code{1}.
  22889. Allowed range is @code{[0, 255]}.
  22890. @item mpc
  22891. Set color which will be used for drawing median phase. If color is
  22892. @code{none} which is default, no median phase value will be drawn.
  22893. @item video
  22894. Enable video output. Default is enabled.
  22895. @end table
  22896. @subsection phasing detection
  22897. The filter also detects out of phase and mono sequences in stereo streams.
  22898. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  22899. The filter accepts the following options for this detection:
  22900. @table @option
  22901. @item phasing
  22902. Enable mono and out of phase detection. Default is disabled.
  22903. @item tolerance, t
  22904. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  22905. Allowed range is @code{[0, 1]}.
  22906. @item angle, a
  22907. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  22908. Allowed range is @code{[90, 180]}.
  22909. @item duration, d
  22910. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  22911. @end table
  22912. @subsection Examples
  22913. @itemize
  22914. @item
  22915. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  22916. @example
  22917. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  22918. @end example
  22919. @end itemize
  22920. @section avectorscope
  22921. Convert input audio to a video output, representing the audio vector
  22922. scope.
  22923. The filter is used to measure the difference between channels of stereo
  22924. audio stream. A monaural signal, consisting of identical left and right
  22925. signal, results in straight vertical line. Any stereo separation is visible
  22926. as a deviation from this line, creating a Lissajous figure.
  22927. If the straight (or deviation from it) but horizontal line appears this
  22928. indicates that the left and right channels are out of phase.
  22929. The filter accepts the following options:
  22930. @table @option
  22931. @item mode, m
  22932. Set the vectorscope mode.
  22933. Available values are:
  22934. @table @samp
  22935. @item lissajous
  22936. Lissajous rotated by 45 degrees.
  22937. @item lissajous_xy
  22938. Same as above but not rotated.
  22939. @item polar
  22940. Shape resembling half of circle.
  22941. @end table
  22942. Default value is @samp{lissajous}.
  22943. @item size, s
  22944. Set the video size for the output. For the syntax of this option, check the
  22945. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22946. Default value is @code{400x400}.
  22947. @item rate, r
  22948. Set the output frame rate. Default value is @code{25}.
  22949. @item rc
  22950. @item gc
  22951. @item bc
  22952. @item ac
  22953. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  22954. @code{160}, @code{80} and @code{255}.
  22955. Allowed range is @code{[0, 255]}.
  22956. @item rf
  22957. @item gf
  22958. @item bf
  22959. @item af
  22960. Specify the red, green, blue and alpha fade. Default values are @code{15},
  22961. @code{10}, @code{5} and @code{5}.
  22962. Allowed range is @code{[0, 255]}.
  22963. @item zoom
  22964. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  22965. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  22966. @item draw
  22967. Set the vectorscope drawing mode.
  22968. Available values are:
  22969. @table @samp
  22970. @item dot
  22971. Draw dot for each sample.
  22972. @item line
  22973. Draw line between previous and current sample.
  22974. @item aaline
  22975. Draw anti-aliased line between previous and current sample.
  22976. @end table
  22977. Default value is @samp{dot}.
  22978. @item scale
  22979. Specify amplitude scale of audio samples.
  22980. Available values are:
  22981. @table @samp
  22982. @item lin
  22983. Linear.
  22984. @item sqrt
  22985. Square root.
  22986. @item cbrt
  22987. Cubic root.
  22988. @item log
  22989. Logarithmic.
  22990. @end table
  22991. @item swap
  22992. Swap left channel axis with right channel axis.
  22993. @item mirror
  22994. Mirror axis.
  22995. @table @samp
  22996. @item none
  22997. No mirror.
  22998. @item x
  22999. Mirror only x axis.
  23000. @item y
  23001. Mirror only y axis.
  23002. @item xy
  23003. Mirror both axis.
  23004. @end table
  23005. @end table
  23006. @subsection Examples
  23007. @itemize
  23008. @item
  23009. Complete example using @command{ffplay}:
  23010. @example
  23011. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  23012. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  23013. @end example
  23014. @end itemize
  23015. @subsection Commands
  23016. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  23017. @section bench, abench
  23018. Benchmark part of a filtergraph.
  23019. The filter accepts the following options:
  23020. @table @option
  23021. @item action
  23022. Start or stop a timer.
  23023. Available values are:
  23024. @table @samp
  23025. @item start
  23026. Get the current time, set it as frame metadata (using the key
  23027. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  23028. @item stop
  23029. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  23030. the input frame metadata to get the time difference. Time difference, average,
  23031. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  23032. @code{min}) are then printed. The timestamps are expressed in seconds.
  23033. @end table
  23034. @end table
  23035. @subsection Examples
  23036. @itemize
  23037. @item
  23038. Benchmark @ref{selectivecolor} filter:
  23039. @example
  23040. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  23041. @end example
  23042. @end itemize
  23043. @section concat
  23044. Concatenate audio and video streams, joining them together one after the
  23045. other.
  23046. The filter works on segments of synchronized video and audio streams. All
  23047. segments must have the same number of streams of each type, and that will
  23048. also be the number of streams at output.
  23049. The filter accepts the following options:
  23050. @table @option
  23051. @item n
  23052. Set the number of segments. Default is 2.
  23053. @item v
  23054. Set the number of output video streams, that is also the number of video
  23055. streams in each segment. Default is 1.
  23056. @item a
  23057. Set the number of output audio streams, that is also the number of audio
  23058. streams in each segment. Default is 0.
  23059. @item unsafe
  23060. Activate unsafe mode: do not fail if segments have a different format.
  23061. @end table
  23062. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  23063. @var{a} audio outputs.
  23064. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  23065. segment, in the same order as the outputs, then the inputs for the second
  23066. segment, etc.
  23067. Related streams do not always have exactly the same duration, for various
  23068. reasons including codec frame size or sloppy authoring. For that reason,
  23069. related synchronized streams (e.g. a video and its audio track) should be
  23070. concatenated at once. The concat filter will use the duration of the longest
  23071. stream in each segment (except the last one), and if necessary pad shorter
  23072. audio streams with silence.
  23073. For this filter to work correctly, all segments must start at timestamp 0.
  23074. All corresponding streams must have the same parameters in all segments; the
  23075. filtering system will automatically select a common pixel format for video
  23076. streams, and a common sample format, sample rate and channel layout for
  23077. audio streams, but other settings, such as resolution, must be converted
  23078. explicitly by the user.
  23079. Different frame rates are acceptable but will result in variable frame rate
  23080. at output; be sure to configure the output file to handle it.
  23081. @subsection Examples
  23082. @itemize
  23083. @item
  23084. Concatenate an opening, an episode and an ending, all in bilingual version
  23085. (video in stream 0, audio in streams 1 and 2):
  23086. @example
  23087. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  23088. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  23089. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  23090. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  23091. @end example
  23092. @item
  23093. Concatenate two parts, handling audio and video separately, using the
  23094. (a)movie sources, and adjusting the resolution:
  23095. @example
  23096. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  23097. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  23098. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  23099. @end example
  23100. Note that a desync will happen at the stitch if the audio and video streams
  23101. do not have exactly the same duration in the first file.
  23102. @end itemize
  23103. @subsection Commands
  23104. This filter supports the following commands:
  23105. @table @option
  23106. @item next
  23107. Close the current segment and step to the next one
  23108. @end table
  23109. @anchor{ebur128}
  23110. @section ebur128
  23111. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  23112. level. By default, it logs a message at a frequency of 10Hz with the
  23113. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  23114. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  23115. The filter can only analyze streams which have
  23116. sample format is double-precision floating point. The input stream will be converted to
  23117. this specification, if needed. Users may need to insert aformat and/or aresample filters
  23118. after this filter to obtain the original parameters.
  23119. The filter also has a video output (see the @var{video} option) with a real
  23120. time graph to observe the loudness evolution. The graphic contains the logged
  23121. message mentioned above, so it is not printed anymore when this option is set,
  23122. unless the verbose logging is set. The main graphing area contains the
  23123. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  23124. the momentary loudness (400 milliseconds), but can optionally be configured
  23125. to instead display short-term loudness (see @var{gauge}).
  23126. The green area marks a +/- 1LU target range around the target loudness
  23127. (-23LUFS by default, unless modified through @var{target}).
  23128. More information about the Loudness Recommendation EBU R128 on
  23129. @url{http://tech.ebu.ch/loudness}.
  23130. The filter accepts the following options:
  23131. @table @option
  23132. @item video
  23133. Activate the video output. The audio stream is passed unchanged whether this
  23134. option is set or no. The video stream will be the first output stream if
  23135. activated. Default is @code{0}.
  23136. @item size
  23137. Set the video size. This option is for video only. For the syntax of this
  23138. option, check the
  23139. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23140. Default and minimum resolution is @code{640x480}.
  23141. @item meter
  23142. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  23143. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  23144. other integer value between this range is allowed.
  23145. @item metadata
  23146. Set metadata injection. If set to @code{1}, the audio input will be segmented
  23147. into 100ms output frames, each of them containing various loudness information
  23148. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  23149. Default is @code{0}.
  23150. @item framelog
  23151. Force the frame logging level.
  23152. Available values are:
  23153. @table @samp
  23154. @item quiet
  23155. logging disabled
  23156. @item info
  23157. information logging level
  23158. @item verbose
  23159. verbose logging level
  23160. @end table
  23161. By default, the logging level is set to @var{info}. If the @option{video} or
  23162. the @option{metadata} options are set, it switches to @var{verbose}.
  23163. @item peak
  23164. Set peak mode(s).
  23165. Available modes can be cumulated (the option is a @code{flag} type). Possible
  23166. values are:
  23167. @table @samp
  23168. @item none
  23169. Disable any peak mode (default).
  23170. @item sample
  23171. Enable sample-peak mode.
  23172. Simple peak mode looking for the higher sample value. It logs a message
  23173. for sample-peak (identified by @code{SPK}).
  23174. @item true
  23175. Enable true-peak mode.
  23176. If enabled, the peak lookup is done on an over-sampled version of the input
  23177. stream for better peak accuracy. It logs a message for true-peak.
  23178. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  23179. This mode requires a build with @code{libswresample}.
  23180. @end table
  23181. @item dualmono
  23182. Treat mono input files as "dual mono". If a mono file is intended for playback
  23183. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  23184. If set to @code{true}, this option will compensate for this effect.
  23185. Multi-channel input files are not affected by this option.
  23186. @item panlaw
  23187. Set a specific pan law to be used for the measurement of dual mono files.
  23188. This parameter is optional, and has a default value of -3.01dB.
  23189. @item target
  23190. Set a specific target level (in LUFS) used as relative zero in the visualization.
  23191. This parameter is optional and has a default value of -23LUFS as specified
  23192. by EBU R128. However, material published online may prefer a level of -16LUFS
  23193. (e.g. for use with podcasts or video platforms).
  23194. @item gauge
  23195. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  23196. @code{shortterm}. By default the momentary value will be used, but in certain
  23197. scenarios it may be more useful to observe the short term value instead (e.g.
  23198. live mixing).
  23199. @item scale
  23200. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  23201. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  23202. video output, not the summary or continuous log output.
  23203. @item integrated
  23204. Read-only exported value for measured integrated loudness, in LUFS.
  23205. @item range
  23206. Read-only exported value for measured loudness range, in LU.
  23207. @item lra_low
  23208. Read-only exported value for measured LRA low, in LUFS.
  23209. @item lra_high
  23210. Read-only exported value for measured LRA high, in LUFS.
  23211. @item sample_peak
  23212. Read-only exported value for measured sample peak, in dBFS.
  23213. @item true_peak
  23214. Read-only exported value for measured true peak, in dBFS.
  23215. @end table
  23216. @subsection Examples
  23217. @itemize
  23218. @item
  23219. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  23220. @example
  23221. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  23222. @end example
  23223. @item
  23224. Run an analysis with @command{ffmpeg}:
  23225. @example
  23226. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  23227. @end example
  23228. @end itemize
  23229. @section interleave, ainterleave
  23230. Temporally interleave frames from several inputs.
  23231. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  23232. These filters read frames from several inputs and send the oldest
  23233. queued frame to the output.
  23234. Input streams must have well defined, monotonically increasing frame
  23235. timestamp values.
  23236. In order to submit one frame to output, these filters need to enqueue
  23237. at least one frame for each input, so they cannot work in case one
  23238. input is not yet terminated and will not receive incoming frames.
  23239. For example consider the case when one input is a @code{select} filter
  23240. which always drops input frames. The @code{interleave} filter will keep
  23241. reading from that input, but it will never be able to send new frames
  23242. to output until the input sends an end-of-stream signal.
  23243. Also, depending on inputs synchronization, the filters will drop
  23244. frames in case one input receives more frames than the other ones, and
  23245. the queue is already filled.
  23246. These filters accept the following options:
  23247. @table @option
  23248. @item nb_inputs, n
  23249. Set the number of different inputs, it is 2 by default.
  23250. @item duration
  23251. How to determine the end-of-stream.
  23252. @table @option
  23253. @item longest
  23254. The duration of the longest input. (default)
  23255. @item shortest
  23256. The duration of the shortest input.
  23257. @item first
  23258. The duration of the first input.
  23259. @end table
  23260. @end table
  23261. @subsection Examples
  23262. @itemize
  23263. @item
  23264. Interleave frames belonging to different streams using @command{ffmpeg}:
  23265. @example
  23266. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  23267. @end example
  23268. @item
  23269. Add flickering blur effect:
  23270. @example
  23271. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  23272. @end example
  23273. @end itemize
  23274. @section latency, alatency
  23275. Measure filtering latency.
  23276. Report previous filter filtering latency, delay in number of audio samples for audio filters
  23277. or number of video frames for video filters.
  23278. On end of input stream, filter will report min and max measured latency for previous running filter
  23279. in filtergraph.
  23280. @section metadata, ametadata
  23281. Manipulate frame metadata.
  23282. This filter accepts the following options:
  23283. @table @option
  23284. @item mode
  23285. Set mode of operation of the filter.
  23286. Can be one of the following:
  23287. @table @samp
  23288. @item select
  23289. If both @code{value} and @code{key} is set, select frames
  23290. which have such metadata. If only @code{key} is set, select
  23291. every frame that has such key in metadata.
  23292. @item add
  23293. Add new metadata @code{key} and @code{value}. If key is already available
  23294. do nothing.
  23295. @item modify
  23296. Modify value of already present key.
  23297. @item delete
  23298. If @code{value} is set, delete only keys that have such value.
  23299. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  23300. the frame.
  23301. @item print
  23302. Print key and its value if metadata was found. If @code{key} is not set print all
  23303. metadata values available in frame.
  23304. @end table
  23305. @item key
  23306. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  23307. @item value
  23308. Set metadata value which will be used. This option is mandatory for
  23309. @code{modify} and @code{add} mode.
  23310. @item function
  23311. Which function to use when comparing metadata value and @code{value}.
  23312. Can be one of following:
  23313. @table @samp
  23314. @item same_str
  23315. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  23316. @item starts_with
  23317. Values are interpreted as strings, returns true if metadata value starts with
  23318. the @code{value} option string.
  23319. @item less
  23320. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  23321. @item equal
  23322. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  23323. @item greater
  23324. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  23325. @item expr
  23326. Values are interpreted as floats, returns true if expression from option @code{expr}
  23327. evaluates to true.
  23328. @item ends_with
  23329. Values are interpreted as strings, returns true if metadata value ends with
  23330. the @code{value} option string.
  23331. @end table
  23332. @item expr
  23333. Set expression which is used when @code{function} is set to @code{expr}.
  23334. The expression is evaluated through the eval API and can contain the following
  23335. constants:
  23336. @table @option
  23337. @item VALUE1, FRAMEVAL
  23338. Float representation of @code{value} from metadata key.
  23339. @item VALUE2, USERVAL
  23340. Float representation of @code{value} as supplied by user in @code{value} option.
  23341. @end table
  23342. @item file
  23343. If specified in @code{print} mode, output is written to the named file. Instead of
  23344. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  23345. for standard output. If @code{file} option is not set, output is written to the log
  23346. with AV_LOG_INFO loglevel.
  23347. @item direct
  23348. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  23349. @end table
  23350. @subsection Examples
  23351. @itemize
  23352. @item
  23353. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  23354. between 0 and 1.
  23355. @example
  23356. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  23357. @end example
  23358. @item
  23359. Print silencedetect output to file @file{metadata.txt}.
  23360. @example
  23361. silencedetect,ametadata=mode=print:file=metadata.txt
  23362. @end example
  23363. @item
  23364. Direct all metadata to a pipe with file descriptor 4.
  23365. @example
  23366. metadata=mode=print:file='pipe\:4'
  23367. @end example
  23368. @end itemize
  23369. @section perms, aperms
  23370. Set read/write permissions for the output frames.
  23371. These filters are mainly aimed at developers to test direct path in the
  23372. following filter in the filtergraph.
  23373. The filters accept the following options:
  23374. @table @option
  23375. @item mode
  23376. Select the permissions mode.
  23377. It accepts the following values:
  23378. @table @samp
  23379. @item none
  23380. Do nothing. This is the default.
  23381. @item ro
  23382. Set all the output frames read-only.
  23383. @item rw
  23384. Set all the output frames directly writable.
  23385. @item toggle
  23386. Make the frame read-only if writable, and writable if read-only.
  23387. @item random
  23388. Set each output frame read-only or writable randomly.
  23389. @end table
  23390. @item seed
  23391. Set the seed for the @var{random} mode, must be an integer included between
  23392. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  23393. @code{-1}, the filter will try to use a good random seed on a best effort
  23394. basis.
  23395. @end table
  23396. Note: in case of auto-inserted filter between the permission filter and the
  23397. following one, the permission might not be received as expected in that
  23398. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  23399. perms/aperms filter can avoid this problem.
  23400. @section realtime, arealtime
  23401. Slow down filtering to match real time approximately.
  23402. These filters will pause the filtering for a variable amount of time to
  23403. match the output rate with the input timestamps.
  23404. They are similar to the @option{re} option to @code{ffmpeg}.
  23405. They accept the following options:
  23406. @table @option
  23407. @item limit
  23408. Time limit for the pauses. Any pause longer than that will be considered
  23409. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  23410. @item speed
  23411. Speed factor for processing. The value must be a float larger than zero.
  23412. Values larger than 1.0 will result in faster than realtime processing,
  23413. smaller will slow processing down. The @var{limit} is automatically adapted
  23414. accordingly. Default is 1.0.
  23415. A processing speed faster than what is possible without these filters cannot
  23416. be achieved.
  23417. @end table
  23418. @subsection Commands
  23419. Both filters supports the all above options as @ref{commands}.
  23420. @section segment, asegment
  23421. Split single input stream into multiple streams.
  23422. This filter does opposite of concat filters.
  23423. @code{segment} works on video frames, @code{asegment} on audio samples.
  23424. This filter accepts the following options:
  23425. @table @option
  23426. @item timestamps
  23427. Timestamps of output segments separated by '|'. The first segment will run
  23428. from the beginning of the input stream. The last segment will run until
  23429. the end of the input stream
  23430. @item frames, samples
  23431. Exact frame/sample count to split the segments.
  23432. @end table
  23433. In all cases, prefixing an each segment with '+' will make it relative to the
  23434. previous segment.
  23435. @subsection Examples
  23436. @itemize
  23437. @item
  23438. Split input audio stream into three output audio streams, starting at start of input audio stream
  23439. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  23440. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  23441. @example
  23442. asegment=timestamps="60|150"
  23443. @end example
  23444. @end itemize
  23445. @anchor{select}
  23446. @section select, aselect
  23447. Select frames to pass in output.
  23448. This filter accepts the following options:
  23449. @table @option
  23450. @item expr, e
  23451. Set expression, which is evaluated for each input frame.
  23452. If the expression is evaluated to zero, the frame is discarded.
  23453. If the evaluation result is negative or NaN, the frame is sent to the
  23454. first output; otherwise it is sent to the output with index
  23455. @code{ceil(val)-1}, assuming that the input index starts from 0.
  23456. For example a value of @code{1.2} corresponds to the output with index
  23457. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  23458. @item outputs, n
  23459. Set the number of outputs. The output to which to send the selected
  23460. frame is based on the result of the evaluation. Default value is 1.
  23461. @end table
  23462. The expression can contain the following constants:
  23463. @table @option
  23464. @item n
  23465. The (sequential) number of the filtered frame, starting from 0.
  23466. @item selected_n
  23467. The (sequential) number of the selected frame, starting from 0.
  23468. @item prev_selected_n
  23469. The sequential number of the last selected frame. It's NAN if undefined.
  23470. @item TB
  23471. The timebase of the input timestamps.
  23472. @item pts
  23473. The PTS (Presentation TimeStamp) of the filtered frame,
  23474. expressed in @var{TB} units. It's NAN if undefined.
  23475. @item t
  23476. The PTS of the filtered frame,
  23477. expressed in seconds. It's NAN if undefined.
  23478. @item prev_pts
  23479. The PTS of the previously filtered frame. It's NAN if undefined.
  23480. @item prev_selected_pts
  23481. The PTS of the last previously filtered frame. It's NAN if undefined.
  23482. @item prev_selected_t
  23483. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  23484. @item start_pts
  23485. The first PTS in the stream which is not NAN. It remains NAN if not found.
  23486. @item start_t
  23487. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  23488. @item pict_type @emph{(video only)}
  23489. The type of the filtered frame. It can assume one of the following
  23490. values:
  23491. @table @option
  23492. @item I
  23493. @item P
  23494. @item B
  23495. @item S
  23496. @item SI
  23497. @item SP
  23498. @item BI
  23499. @end table
  23500. @item interlace_type @emph{(video only)}
  23501. The frame interlace type. It can assume one of the following values:
  23502. @table @option
  23503. @item PROGRESSIVE
  23504. The frame is progressive (not interlaced).
  23505. @item TOPFIRST
  23506. The frame is top-field-first.
  23507. @item BOTTOMFIRST
  23508. The frame is bottom-field-first.
  23509. @end table
  23510. @item consumed_sample_n @emph{(audio only)}
  23511. the number of selected samples before the current frame
  23512. @item samples_n @emph{(audio only)}
  23513. the number of samples in the current frame
  23514. @item sample_rate @emph{(audio only)}
  23515. the input sample rate
  23516. @item key
  23517. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  23518. @item pos
  23519. the position in the file of the filtered frame, -1 if the information
  23520. is not available (e.g. for synthetic video); deprecated, do not use
  23521. @item scene @emph{(video only)}
  23522. value between 0 and 1 to indicate a new scene; a low value reflects a low
  23523. probability for the current frame to introduce a new scene, while a higher
  23524. value means the current frame is more likely to be one (see the example below)
  23525. @item concatdec_select
  23526. The concat demuxer can select only part of a concat input file by setting an
  23527. inpoint and an outpoint, but the output packets may not be entirely contained
  23528. in the selected interval. By using this variable, it is possible to skip frames
  23529. generated by the concat demuxer which are not exactly contained in the selected
  23530. interval.
  23531. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  23532. and the @var{lavf.concat.duration} packet metadata values which are also
  23533. present in the decoded frames.
  23534. The @var{concatdec_select} variable is -1 if the frame pts is at least
  23535. start_time and either the duration metadata is missing or the frame pts is less
  23536. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  23537. missing.
  23538. That basically means that an input frame is selected if its pts is within the
  23539. interval set by the concat demuxer.
  23540. @item iw @emph{(video only)}
  23541. Represents the width of the input video frame.
  23542. @item ih @emph{(video only)}
  23543. Represents the height of the input video frame.
  23544. @end table
  23545. The default value of the select expression is "1".
  23546. @subsection Examples
  23547. @itemize
  23548. @item
  23549. Select all frames in input:
  23550. @example
  23551. select
  23552. @end example
  23553. The example above is the same as:
  23554. @example
  23555. select=1
  23556. @end example
  23557. @item
  23558. Skip all frames:
  23559. @example
  23560. select=0
  23561. @end example
  23562. @item
  23563. Select only I-frames:
  23564. @example
  23565. select='eq(pict_type\,I)'
  23566. @end example
  23567. @item
  23568. Select one frame every 100:
  23569. @example
  23570. select='not(mod(n\,100))'
  23571. @end example
  23572. @item
  23573. Select only frames contained in the 10-20 time interval:
  23574. @example
  23575. select=between(t\,10\,20)
  23576. @end example
  23577. @item
  23578. Select only I-frames contained in the 10-20 time interval:
  23579. @example
  23580. select=between(t\,10\,20)*eq(pict_type\,I)
  23581. @end example
  23582. @item
  23583. Select frames with a minimum distance of 10 seconds:
  23584. @example
  23585. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  23586. @end example
  23587. @item
  23588. Use aselect to select only audio frames with samples number > 100:
  23589. @example
  23590. aselect='gt(samples_n\,100)'
  23591. @end example
  23592. @item
  23593. Create a mosaic of the first scenes:
  23594. @example
  23595. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  23596. @end example
  23597. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  23598. choice.
  23599. @item
  23600. Send even and odd frames to separate outputs, and compose them:
  23601. @example
  23602. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  23603. @end example
  23604. @item
  23605. Select useful frames from an ffconcat file which is using inpoints and
  23606. outpoints but where the source files are not intra frame only.
  23607. @example
  23608. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  23609. @end example
  23610. @end itemize
  23611. @section sendcmd, asendcmd
  23612. Send commands to filters in the filtergraph.
  23613. These filters read commands to be sent to other filters in the
  23614. filtergraph.
  23615. @code{sendcmd} must be inserted between two video filters,
  23616. @code{asendcmd} must be inserted between two audio filters, but apart
  23617. from that they act the same way.
  23618. The specification of commands can be provided in the filter arguments
  23619. with the @var{commands} option, or in a file specified by the
  23620. @var{filename} option.
  23621. These filters accept the following options:
  23622. @table @option
  23623. @item commands, c
  23624. Set the commands to be read and sent to the other filters.
  23625. @item filename, f
  23626. Set the filename of the commands to be read and sent to the other
  23627. filters.
  23628. @end table
  23629. @subsection Commands syntax
  23630. A commands description consists of a sequence of interval
  23631. specifications, comprising a list of commands to be executed when a
  23632. particular event related to that interval occurs. The occurring event
  23633. is typically the current frame time entering or leaving a given time
  23634. interval.
  23635. An interval is specified by the following syntax:
  23636. @example
  23637. @var{START}[-@var{END}] @var{COMMANDS};
  23638. @end example
  23639. The time interval is specified by the @var{START} and @var{END} times.
  23640. @var{END} is optional and defaults to the maximum time.
  23641. The current frame time is considered within the specified interval if
  23642. it is included in the interval [@var{START}, @var{END}), that is when
  23643. the time is greater or equal to @var{START} and is lesser than
  23644. @var{END}.
  23645. @var{COMMANDS} consists of a sequence of one or more command
  23646. specifications, separated by ",", relating to that interval. The
  23647. syntax of a command specification is given by:
  23648. @example
  23649. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  23650. @end example
  23651. @var{FLAGS} is optional and specifies the type of events relating to
  23652. the time interval which enable sending the specified command, and must
  23653. be a non-null sequence of identifier flags separated by "+" or "|" and
  23654. enclosed between "[" and "]".
  23655. The following flags are recognized:
  23656. @table @option
  23657. @item enter
  23658. The command is sent when the current frame timestamp enters the
  23659. specified interval. In other words, the command is sent when the
  23660. previous frame timestamp was not in the given interval, and the
  23661. current is.
  23662. @item leave
  23663. The command is sent when the current frame timestamp leaves the
  23664. specified interval. In other words, the command is sent when the
  23665. previous frame timestamp was in the given interval, and the
  23666. current is not.
  23667. @item expr
  23668. The command @var{ARG} is interpreted as expression and result of
  23669. expression is passed as @var{ARG}.
  23670. The expression is evaluated through the eval API and can contain the following
  23671. constants:
  23672. @table @option
  23673. @item POS
  23674. Original position in the file of the frame, or undefined if undefined
  23675. for the current frame. Deprecated, do not use.
  23676. @item PTS
  23677. The presentation timestamp in input.
  23678. @item N
  23679. The count of the input frame for video or audio, starting from 0.
  23680. @item T
  23681. The time in seconds of the current frame.
  23682. @item TS
  23683. The start time in seconds of the current command interval.
  23684. @item TE
  23685. The end time in seconds of the current command interval.
  23686. @item TI
  23687. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  23688. @item W
  23689. The video frame width.
  23690. @item H
  23691. The video frame height.
  23692. @end table
  23693. @end table
  23694. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  23695. assumed.
  23696. @var{TARGET} specifies the target of the command, usually the name of
  23697. the filter class or a specific filter instance name.
  23698. @var{COMMAND} specifies the name of the command for the target filter.
  23699. @var{ARG} is optional and specifies the optional list of argument for
  23700. the given @var{COMMAND}.
  23701. Between one interval specification and another, whitespaces, or
  23702. sequences of characters starting with @code{#} until the end of line,
  23703. are ignored and can be used to annotate comments.
  23704. A simplified BNF description of the commands specification syntax
  23705. follows:
  23706. @example
  23707. @var{COMMAND_FLAG} ::= "enter" | "leave"
  23708. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  23709. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  23710. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  23711. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  23712. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  23713. @end example
  23714. @subsection Examples
  23715. @itemize
  23716. @item
  23717. Specify audio tempo change at second 4:
  23718. @example
  23719. asendcmd=c='4.0 atempo tempo 1.5',atempo
  23720. @end example
  23721. @item
  23722. Target a specific filter instance:
  23723. @example
  23724. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  23725. @end example
  23726. @item
  23727. Specify a list of drawtext and hue commands in a file.
  23728. @example
  23729. # show text in the interval 5-10
  23730. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  23731. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  23732. # desaturate the image in the interval 15-20
  23733. 15.0-20.0 [enter] hue s 0,
  23734. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  23735. [leave] hue s 1,
  23736. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  23737. # apply an exponential saturation fade-out effect, starting from time 25
  23738. 25 [enter] hue s exp(25-t)
  23739. @end example
  23740. A filtergraph allowing to read and process the above command list
  23741. stored in a file @file{test.cmd}, can be specified with:
  23742. @example
  23743. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  23744. @end example
  23745. @end itemize
  23746. @anchor{setpts}
  23747. @section setpts, asetpts
  23748. Change the PTS (presentation timestamp) of the input frames.
  23749. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  23750. This filter accepts the following options:
  23751. @table @option
  23752. @item expr
  23753. The expression which is evaluated for each frame to construct its timestamp.
  23754. @end table
  23755. The expression is evaluated through the eval API and can contain the following
  23756. constants:
  23757. @table @option
  23758. @item FRAME_RATE, FR
  23759. frame rate, only defined for constant frame-rate video
  23760. @item PTS
  23761. The presentation timestamp in input
  23762. @item N
  23763. The count of the input frame for video or the number of consumed samples,
  23764. not including the current frame for audio, starting from 0.
  23765. @item NB_CONSUMED_SAMPLES
  23766. The number of consumed samples, not including the current frame (only
  23767. audio)
  23768. @item NB_SAMPLES, S
  23769. The number of samples in the current frame (only audio)
  23770. @item SAMPLE_RATE, SR
  23771. The audio sample rate.
  23772. @item STARTPTS
  23773. The PTS of the first frame.
  23774. @item STARTT
  23775. the time in seconds of the first frame
  23776. @item INTERLACED
  23777. State whether the current frame is interlaced.
  23778. @item T
  23779. the time in seconds of the current frame
  23780. @item POS
  23781. original position in the file of the frame, or undefined if undefined
  23782. for the current frame; deprecated, do not use
  23783. @item PREV_INPTS
  23784. The previous input PTS.
  23785. @item PREV_INT
  23786. previous input time in seconds
  23787. @item PREV_OUTPTS
  23788. The previous output PTS.
  23789. @item PREV_OUTT
  23790. previous output time in seconds
  23791. @item RTCTIME
  23792. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  23793. instead.
  23794. @item RTCSTART
  23795. The wallclock (RTC) time at the start of the movie in microseconds.
  23796. @item TB
  23797. The timebase of the input timestamps.
  23798. @item T_CHANGE
  23799. Time of the first frame after command was applied or time of the first frame if no commands.
  23800. @end table
  23801. @subsection Examples
  23802. @itemize
  23803. @item
  23804. Start counting PTS from zero
  23805. @example
  23806. setpts=PTS-STARTPTS
  23807. @end example
  23808. @item
  23809. Apply fast motion effect:
  23810. @example
  23811. setpts=0.5*PTS
  23812. @end example
  23813. @item
  23814. Apply slow motion effect:
  23815. @example
  23816. setpts=2.0*PTS
  23817. @end example
  23818. @item
  23819. Set fixed rate of 25 frames per second:
  23820. @example
  23821. setpts=N/(25*TB)
  23822. @end example
  23823. @item
  23824. Apply a random jitter effect of +/-100 TB units:
  23825. @example
  23826. setpts=PTS+randomi(0, -100\,100)
  23827. @end example
  23828. @item
  23829. Set fixed rate 25 fps with some jitter:
  23830. @example
  23831. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  23832. @end example
  23833. @item
  23834. Apply an offset of 10 seconds to the input PTS:
  23835. @example
  23836. setpts=PTS+10/TB
  23837. @end example
  23838. @item
  23839. Generate timestamps from a "live source" and rebase onto the current timebase:
  23840. @example
  23841. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  23842. @end example
  23843. @item
  23844. Generate timestamps by counting samples:
  23845. @example
  23846. asetpts=N/SR/TB
  23847. @end example
  23848. @end itemize
  23849. @subsection Commands
  23850. Both filters support all above options as @ref{commands}.
  23851. @section setrange
  23852. Force color range for the output video frame.
  23853. The @code{setrange} filter marks the color range property for the
  23854. output frames. It does not change the input frame, but only sets the
  23855. corresponding property, which affects how the frame is treated by
  23856. following filters.
  23857. The filter accepts the following options:
  23858. @table @option
  23859. @item range
  23860. Available values are:
  23861. @table @samp
  23862. @item auto
  23863. Keep the same color range property.
  23864. @item unspecified, unknown
  23865. Set the color range as unspecified.
  23866. @item limited, tv, mpeg
  23867. Set the color range as limited.
  23868. @item full, pc, jpeg
  23869. Set the color range as full.
  23870. @end table
  23871. @end table
  23872. @section settb, asettb
  23873. Set the timebase to use for the output frames timestamps.
  23874. It is mainly useful for testing timebase configuration.
  23875. It accepts the following parameters:
  23876. @table @option
  23877. @item expr, tb
  23878. The expression which is evaluated into the output timebase.
  23879. @end table
  23880. The value for @option{tb} is an arithmetic expression representing a
  23881. rational. The expression can contain the constants "AVTB" (the default
  23882. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  23883. audio only). Default value is "intb".
  23884. @subsection Examples
  23885. @itemize
  23886. @item
  23887. Set the timebase to 1/25:
  23888. @example
  23889. settb=expr=1/25
  23890. @end example
  23891. @item
  23892. Set the timebase to 1/10:
  23893. @example
  23894. settb=expr=0.1
  23895. @end example
  23896. @item
  23897. Set the timebase to 1001/1000:
  23898. @example
  23899. settb=1+0.001
  23900. @end example
  23901. @item
  23902. Set the timebase to 2*intb:
  23903. @example
  23904. settb=2*intb
  23905. @end example
  23906. @item
  23907. Set the default timebase value:
  23908. @example
  23909. settb=AVTB
  23910. @end example
  23911. @end itemize
  23912. @section showcqt
  23913. Convert input audio to a video output representing frequency spectrum
  23914. logarithmically using Brown-Puckette constant Q transform algorithm with
  23915. direct frequency domain coefficient calculation (but the transform itself
  23916. is not really constant Q, instead the Q factor is actually variable/clamped),
  23917. with musical tone scale, from E0 to D#10.
  23918. The filter accepts the following options:
  23919. @table @option
  23920. @item size, s
  23921. Specify the video size for the output. It must be even. For the syntax of this option,
  23922. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23923. Default value is @code{1920x1080}.
  23924. @item fps, rate, r
  23925. Set the output frame rate. Default value is @code{25}.
  23926. @item bar_h
  23927. Set the bargraph height. It must be even. Default value is @code{-1} which
  23928. computes the bargraph height automatically.
  23929. @item axis_h
  23930. Set the axis height. It must be even. Default value is @code{-1} which computes
  23931. the axis height automatically.
  23932. @item sono_h
  23933. Set the sonogram height. It must be even. Default value is @code{-1} which
  23934. computes the sonogram height automatically.
  23935. @item fullhd
  23936. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  23937. instead. Default value is @code{1}.
  23938. @item sono_v, volume
  23939. Specify the sonogram volume expression. It can contain variables:
  23940. @table @option
  23941. @item bar_v
  23942. the @var{bar_v} evaluated expression
  23943. @item frequency, freq, f
  23944. the frequency where it is evaluated
  23945. @item timeclamp, tc
  23946. the value of @var{timeclamp} option
  23947. @end table
  23948. and functions:
  23949. @table @option
  23950. @item a_weighting(f)
  23951. A-weighting of equal loudness
  23952. @item b_weighting(f)
  23953. B-weighting of equal loudness
  23954. @item c_weighting(f)
  23955. C-weighting of equal loudness.
  23956. @end table
  23957. Default value is @code{16}.
  23958. @item bar_v, volume2
  23959. Specify the bargraph volume expression. It can contain variables:
  23960. @table @option
  23961. @item sono_v
  23962. the @var{sono_v} evaluated expression
  23963. @item frequency, freq, f
  23964. the frequency where it is evaluated
  23965. @item timeclamp, tc
  23966. the value of @var{timeclamp} option
  23967. @end table
  23968. and functions:
  23969. @table @option
  23970. @item a_weighting(f)
  23971. A-weighting of equal loudness
  23972. @item b_weighting(f)
  23973. B-weighting of equal loudness
  23974. @item c_weighting(f)
  23975. C-weighting of equal loudness.
  23976. @end table
  23977. Default value is @code{sono_v}.
  23978. @item sono_g, gamma
  23979. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  23980. higher gamma makes the spectrum having more range. Default value is @code{3}.
  23981. Acceptable range is @code{[1, 7]}.
  23982. @item bar_g, gamma2
  23983. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  23984. @code{[1, 7]}.
  23985. @item bar_t
  23986. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  23987. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  23988. @item timeclamp, tc
  23989. Specify the transform timeclamp. At low frequency, there is trade-off between
  23990. accuracy in time domain and frequency domain. If timeclamp is lower,
  23991. event in time domain is represented more accurately (such as fast bass drum),
  23992. otherwise event in frequency domain is represented more accurately
  23993. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  23994. @item attack
  23995. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  23996. limits future samples by applying asymmetric windowing in time domain, useful
  23997. when low latency is required. Accepted range is @code{[0, 1]}.
  23998. @item basefreq
  23999. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  24000. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  24001. @item endfreq
  24002. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  24003. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  24004. @item coeffclamp
  24005. This option is deprecated and ignored.
  24006. @item tlength
  24007. Specify the transform length in time domain. Use this option to control accuracy
  24008. trade-off between time domain and frequency domain at every frequency sample.
  24009. It can contain variables:
  24010. @table @option
  24011. @item frequency, freq, f
  24012. the frequency where it is evaluated
  24013. @item timeclamp, tc
  24014. the value of @var{timeclamp} option.
  24015. @end table
  24016. Default value is @code{384*tc/(384+tc*f)}.
  24017. @item count
  24018. Specify the transform count for every video frame. Default value is @code{6}.
  24019. Acceptable range is @code{[1, 30]}.
  24020. @item fcount
  24021. Specify the transform count for every single pixel. Default value is @code{0},
  24022. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  24023. @item fontfile
  24024. Specify font file for use with freetype to draw the axis. If not specified,
  24025. use embedded font. Note that drawing with font file or embedded font is not
  24026. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  24027. option instead.
  24028. @item font
  24029. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  24030. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  24031. escaping.
  24032. @item fontcolor
  24033. Specify font color expression. This is arithmetic expression that should return
  24034. integer value 0xRRGGBB. It can contain variables:
  24035. @table @option
  24036. @item frequency, freq, f
  24037. the frequency where it is evaluated
  24038. @item timeclamp, tc
  24039. the value of @var{timeclamp} option
  24040. @end table
  24041. and functions:
  24042. @table @option
  24043. @item midi(f)
  24044. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  24045. @item r(x), g(x), b(x)
  24046. red, green, and blue value of intensity x.
  24047. @end table
  24048. Default value is @code{st(0, (midi(f)-59.5)/12);
  24049. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  24050. r(1-ld(1)) + b(ld(1))}.
  24051. @item axisfile
  24052. Specify image file to draw the axis. This option override @var{fontfile} and
  24053. @var{fontcolor} option.
  24054. @item axis, text
  24055. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  24056. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  24057. Default value is @code{1}.
  24058. @item csp
  24059. Set colorspace. The accepted values are:
  24060. @table @samp
  24061. @item unspecified
  24062. Unspecified (default)
  24063. @item bt709
  24064. BT.709
  24065. @item fcc
  24066. FCC
  24067. @item bt470bg
  24068. BT.470BG or BT.601-6 625
  24069. @item smpte170m
  24070. SMPTE-170M or BT.601-6 525
  24071. @item smpte240m
  24072. SMPTE-240M
  24073. @item bt2020ncl
  24074. BT.2020 with non-constant luminance
  24075. @end table
  24076. @item cscheme
  24077. Set spectrogram color scheme. This is list of floating point values with format
  24078. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  24079. The default is @code{1|0.5|0|0|0.5|1}.
  24080. @end table
  24081. @subsection Examples
  24082. @itemize
  24083. @item
  24084. Playing audio while showing the spectrum:
  24085. @example
  24086. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  24087. @end example
  24088. @item
  24089. Same as above, but with frame rate 30 fps:
  24090. @example
  24091. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  24092. @end example
  24093. @item
  24094. Playing at 1280x720:
  24095. @example
  24096. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  24097. @end example
  24098. @item
  24099. Disable sonogram display:
  24100. @example
  24101. sono_h=0
  24102. @end example
  24103. @item
  24104. A1 and its harmonics: A1, A2, (near)E3, A3:
  24105. @example
  24106. 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),
  24107. asplit[a][out1]; [a] showcqt [out0]'
  24108. @end example
  24109. @item
  24110. Same as above, but with more accuracy in frequency domain:
  24111. @example
  24112. 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),
  24113. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  24114. @end example
  24115. @item
  24116. Custom volume:
  24117. @example
  24118. bar_v=10:sono_v=bar_v*a_weighting(f)
  24119. @end example
  24120. @item
  24121. Custom gamma, now spectrum is linear to the amplitude.
  24122. @example
  24123. bar_g=2:sono_g=2
  24124. @end example
  24125. @item
  24126. Custom tlength equation:
  24127. @example
  24128. 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)))'
  24129. @end example
  24130. @item
  24131. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  24132. @example
  24133. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  24134. @end example
  24135. @item
  24136. Custom font using fontconfig:
  24137. @example
  24138. font='Courier New,Monospace,mono|bold'
  24139. @end example
  24140. @item
  24141. Custom frequency range with custom axis using image file:
  24142. @example
  24143. axisfile=myaxis.png:basefreq=40:endfreq=10000
  24144. @end example
  24145. @end itemize
  24146. @section showcwt
  24147. Convert input audio to video output representing frequency spectrum
  24148. using Continuous Wavelet Transform and Morlet wavelet.
  24149. The filter accepts the following options:
  24150. @table @option
  24151. @item size, s
  24152. Specify the video size for the output. For the syntax of this option,
  24153. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24154. Default value is @code{640x512}.
  24155. @item rate, r
  24156. Set the output frame rate. Default value is @code{25}.
  24157. @item scale
  24158. Set the frequency scale used. Allowed values are:
  24159. @table @option
  24160. @item linear
  24161. @item log
  24162. @item bark
  24163. @item mel
  24164. @item erbs
  24165. @item sqrt
  24166. @item cbrt
  24167. @item qdrt
  24168. @item fm
  24169. @end table
  24170. Default value is @code{linear}.
  24171. @item iscale
  24172. Set the intensity scale used. Allowed values are:
  24173. @table @option
  24174. @item linear
  24175. @item log
  24176. @item sqrt
  24177. @item cbrt
  24178. @item qdrt
  24179. @end table
  24180. Default value is @code{log}.
  24181. @item min
  24182. Set the minimum frequency that will be used in output.
  24183. Default is @code{20} Hz.
  24184. @item max
  24185. Set the maximum frequency that will be used in output.
  24186. Default is @code{20000} Hz. The real frequency upper limit
  24187. depends on input audio's sample rate and such will be enforced
  24188. on this value when it is set to value greater than Nyquist frequency.
  24189. @item imin
  24190. Set the minimum intensity that will be used in output.
  24191. @item imax
  24192. Set the maximum intensity that will be used in output.
  24193. @item logb
  24194. Set the logarithmic basis for brightness strength when
  24195. mapping calculated magnitude values to pixel values.
  24196. Allowed range is from @code{0} to @code{1}.
  24197. Default value is @code{0.0001}.
  24198. @item deviation
  24199. Set the frequency deviation.
  24200. Lower values than @code{1} are more frequency oriented,
  24201. while higher values than @code{1} are more time oriented.
  24202. Allowed range is from @code{0} to @code{10}.
  24203. Default value is @code{1}.
  24204. @item pps
  24205. Set the number of pixel output per each second in one row.
  24206. Allowed range is from @code{1} to @code{1024}.
  24207. Default value is @code{64}.
  24208. @item mode
  24209. Set the output visual mode. Allowed values are:
  24210. @table @option
  24211. @item magnitude
  24212. Show magnitude.
  24213. @item phase
  24214. Show only phase.
  24215. @item magphase
  24216. Show combination of magnitude and phase.
  24217. Magnitude is mapped to brightness and phase to color.
  24218. @item channel
  24219. Show unique color per channel magnitude.
  24220. @item stereo
  24221. Show unique color per stereo difference.
  24222. @end table
  24223. Default value is @code{magnitude}.
  24224. @item slide
  24225. Set the output slide method. Allowed values are:
  24226. @table @option
  24227. @item replace
  24228. @item scroll
  24229. @item frame
  24230. @end table
  24231. @item direction
  24232. Set the direction method for output slide method. Allowed values are:
  24233. @table @option
  24234. @item lr
  24235. Direction from left to right.
  24236. @item rl
  24237. Direction from right to left.
  24238. @item ud
  24239. Direction from up to down.
  24240. @item du
  24241. Direction from down to up.
  24242. @end table
  24243. @item bar
  24244. Set the ratio of bargraph display to display size. Default is 0.
  24245. @item rotation
  24246. Set color rotation, must be in [-1.0, 1.0] range.
  24247. Default value is @code{0}.
  24248. @end table
  24249. @section showfreqs
  24250. Convert input audio to video output representing the audio power spectrum.
  24251. Audio amplitude is on Y-axis while frequency is on X-axis.
  24252. The filter accepts the following options:
  24253. @table @option
  24254. @item size, s
  24255. Specify size of video. For the syntax of this option, check the
  24256. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24257. Default is @code{1024x512}.
  24258. @item rate, r
  24259. Set video rate. Default is @code{25}.
  24260. @item mode
  24261. Set display mode.
  24262. This set how each frequency bin will be represented.
  24263. It accepts the following values:
  24264. @table @samp
  24265. @item line
  24266. @item bar
  24267. @item dot
  24268. @end table
  24269. Default is @code{bar}.
  24270. @item ascale
  24271. Set amplitude scale.
  24272. It accepts the following values:
  24273. @table @samp
  24274. @item lin
  24275. Linear scale.
  24276. @item sqrt
  24277. Square root scale.
  24278. @item cbrt
  24279. Cubic root scale.
  24280. @item log
  24281. Logarithmic scale.
  24282. @end table
  24283. Default is @code{log}.
  24284. @item fscale
  24285. Set frequency scale.
  24286. It accepts the following values:
  24287. @table @samp
  24288. @item lin
  24289. Linear scale.
  24290. @item log
  24291. Logarithmic scale.
  24292. @item rlog
  24293. Reverse logarithmic scale.
  24294. @end table
  24295. Default is @code{lin}.
  24296. @item win_size
  24297. Set window size. Allowed range is from 16 to 65536.
  24298. Default is @code{2048}
  24299. @item win_func
  24300. Set windowing function.
  24301. It accepts the following values:
  24302. @table @samp
  24303. @item rect
  24304. @item bartlett
  24305. @item hanning
  24306. @item hamming
  24307. @item blackman
  24308. @item welch
  24309. @item flattop
  24310. @item bharris
  24311. @item bnuttall
  24312. @item bhann
  24313. @item sine
  24314. @item nuttall
  24315. @item lanczos
  24316. @item gauss
  24317. @item tukey
  24318. @item dolph
  24319. @item cauchy
  24320. @item parzen
  24321. @item poisson
  24322. @item bohman
  24323. @item kaiser
  24324. @end table
  24325. Default is @code{hanning}.
  24326. @item overlap
  24327. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  24328. which means optimal overlap for selected window function will be picked.
  24329. @item averaging
  24330. Set time averaging. Setting this to 0 will display current maximal peaks.
  24331. Default is @code{1}, which means time averaging is disabled.
  24332. @item colors
  24333. Specify list of colors separated by space or by '|' which will be used to
  24334. draw channel frequencies. Unrecognized or missing colors will be replaced
  24335. by white color.
  24336. @item cmode
  24337. Set channel display mode.
  24338. It accepts the following values:
  24339. @table @samp
  24340. @item combined
  24341. @item separate
  24342. @end table
  24343. Default is @code{combined}.
  24344. @item minamp
  24345. Set minimum amplitude used in @code{log} amplitude scaler.
  24346. @item data
  24347. Set data display mode.
  24348. It accepts the following values:
  24349. @table @samp
  24350. @item magnitude
  24351. @item phase
  24352. @item delay
  24353. @end table
  24354. Default is @code{magnitude}.
  24355. @item channels
  24356. Set channels to use when processing audio. By default all are processed.
  24357. @end table
  24358. @section showspatial
  24359. Convert stereo input audio to a video output, representing the spatial relationship
  24360. between two channels.
  24361. The filter accepts the following options:
  24362. @table @option
  24363. @item size, s
  24364. Specify the video size for the output. For the syntax of this option, check the
  24365. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24366. Default value is @code{512x512}.
  24367. @item win_size
  24368. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  24369. @item win_func
  24370. Set window function.
  24371. It accepts the following values:
  24372. @table @samp
  24373. @item rect
  24374. @item bartlett
  24375. @item hann
  24376. @item hanning
  24377. @item hamming
  24378. @item blackman
  24379. @item welch
  24380. @item flattop
  24381. @item bharris
  24382. @item bnuttall
  24383. @item bhann
  24384. @item sine
  24385. @item nuttall
  24386. @item lanczos
  24387. @item gauss
  24388. @item tukey
  24389. @item dolph
  24390. @item cauchy
  24391. @item parzen
  24392. @item poisson
  24393. @item bohman
  24394. @item kaiser
  24395. @end table
  24396. Default value is @code{hann}.
  24397. @item rate, r
  24398. Set output framerate.
  24399. @end table
  24400. @anchor{showspectrum}
  24401. @section showspectrum
  24402. Convert input audio to a video output, representing the audio frequency
  24403. spectrum.
  24404. The filter accepts the following options:
  24405. @table @option
  24406. @item size, s
  24407. Specify the video size for the output. For the syntax of this option, check the
  24408. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24409. Default value is @code{640x512}.
  24410. @item slide
  24411. Specify how the spectrum should slide along the window.
  24412. It accepts the following values:
  24413. @table @samp
  24414. @item replace
  24415. the samples start again on the left when they reach the right
  24416. @item scroll
  24417. the samples scroll from right to left
  24418. @item fullframe
  24419. frames are only produced when the samples reach the right
  24420. @item rscroll
  24421. the samples scroll from left to right
  24422. @item lreplace
  24423. the samples start again on the right when they reach the left
  24424. @end table
  24425. Default value is @code{replace}.
  24426. @item mode
  24427. Specify display mode.
  24428. It accepts the following values:
  24429. @table @samp
  24430. @item combined
  24431. all channels are displayed in the same row
  24432. @item separate
  24433. all channels are displayed in separate rows
  24434. @end table
  24435. Default value is @samp{combined}.
  24436. @item color
  24437. Specify display color mode.
  24438. It accepts the following values:
  24439. @table @samp
  24440. @item channel
  24441. each channel is displayed in a separate color
  24442. @item intensity
  24443. each channel is displayed using the same color scheme
  24444. @item rainbow
  24445. each channel is displayed using the rainbow color scheme
  24446. @item moreland
  24447. each channel is displayed using the moreland color scheme
  24448. @item nebulae
  24449. each channel is displayed using the nebulae color scheme
  24450. @item fire
  24451. each channel is displayed using the fire color scheme
  24452. @item fiery
  24453. each channel is displayed using the fiery color scheme
  24454. @item fruit
  24455. each channel is displayed using the fruit color scheme
  24456. @item cool
  24457. each channel is displayed using the cool color scheme
  24458. @item magma
  24459. each channel is displayed using the magma color scheme
  24460. @item green
  24461. each channel is displayed using the green color scheme
  24462. @item viridis
  24463. each channel is displayed using the viridis color scheme
  24464. @item plasma
  24465. each channel is displayed using the plasma color scheme
  24466. @item cividis
  24467. each channel is displayed using the cividis color scheme
  24468. @item terrain
  24469. each channel is displayed using the terrain color scheme
  24470. @end table
  24471. Default value is @samp{channel}.
  24472. @item scale
  24473. Specify scale used for calculating intensity color values.
  24474. It accepts the following values:
  24475. @table @samp
  24476. @item lin
  24477. linear
  24478. @item sqrt
  24479. square root, default
  24480. @item cbrt
  24481. cubic root
  24482. @item log
  24483. logarithmic
  24484. @item 4thrt
  24485. 4th root
  24486. @item 5thrt
  24487. 5th root
  24488. @end table
  24489. Default value is @samp{sqrt}.
  24490. @item fscale
  24491. Specify frequency scale.
  24492. It accepts the following values:
  24493. @table @samp
  24494. @item lin
  24495. linear
  24496. @item log
  24497. logarithmic
  24498. @end table
  24499. Default value is @samp{lin}.
  24500. @item saturation
  24501. Set saturation modifier for displayed colors. Negative values provide
  24502. alternative color scheme. @code{0} is no saturation at all.
  24503. Saturation must be in [-10.0, 10.0] range.
  24504. Default value is @code{1}.
  24505. @item win_func
  24506. Set window function.
  24507. It accepts the following values:
  24508. @table @samp
  24509. @item rect
  24510. @item bartlett
  24511. @item hann
  24512. @item hanning
  24513. @item hamming
  24514. @item blackman
  24515. @item welch
  24516. @item flattop
  24517. @item bharris
  24518. @item bnuttall
  24519. @item bhann
  24520. @item sine
  24521. @item nuttall
  24522. @item lanczos
  24523. @item gauss
  24524. @item tukey
  24525. @item dolph
  24526. @item cauchy
  24527. @item parzen
  24528. @item poisson
  24529. @item bohman
  24530. @item kaiser
  24531. @end table
  24532. Default value is @code{hann}.
  24533. @item orientation
  24534. Set orientation of time vs frequency axis. Can be @code{vertical} or
  24535. @code{horizontal}. Default is @code{vertical}.
  24536. @item overlap
  24537. Set ratio of overlap window. Default value is @code{0}.
  24538. When value is @code{1} overlap is set to recommended size for specific
  24539. window function currently used.
  24540. @item gain
  24541. Set scale gain for calculating intensity color values.
  24542. Default value is @code{1}.
  24543. @item data
  24544. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  24545. or unwrapped phase: @code{uphase}.
  24546. @item rotation
  24547. Set color rotation, must be in [-1.0, 1.0] range.
  24548. Default value is @code{0}.
  24549. @item start
  24550. Set start frequency from which to display spectrogram. Default is @code{0}.
  24551. @item stop
  24552. Set stop frequency to which to display spectrogram. Default is @code{0}.
  24553. @item fps
  24554. Set upper frame rate limit. Default is @code{auto}, unlimited.
  24555. @item legend
  24556. Draw time and frequency axes and legends. Default is disabled.
  24557. @item drange
  24558. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  24559. Allowed range is from 10 to 200.
  24560. @item limit
  24561. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  24562. Allowed range is from -100 to 100.
  24563. @item opacity
  24564. Set opacity strength when using pixel format output with alpha component.
  24565. @end table
  24566. The usage is very similar to the showwaves filter; see the examples in that
  24567. section.
  24568. @subsection Examples
  24569. @itemize
  24570. @item
  24571. Large window with logarithmic color scaling:
  24572. @example
  24573. showspectrum=s=1280x480:scale=log
  24574. @end example
  24575. @item
  24576. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  24577. @example
  24578. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  24579. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  24580. @end example
  24581. @end itemize
  24582. @section showspectrumpic
  24583. Convert input audio to a single video frame, representing the audio frequency
  24584. spectrum.
  24585. The filter accepts the following options:
  24586. @table @option
  24587. @item size, s
  24588. Specify the video size for the output. For the syntax of this option, check the
  24589. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24590. Default value is @code{4096x2048}.
  24591. @item mode
  24592. Specify display mode.
  24593. It accepts the following values:
  24594. @table @samp
  24595. @item combined
  24596. all channels are displayed in the same row
  24597. @item separate
  24598. all channels are displayed in separate rows
  24599. @end table
  24600. Default value is @samp{combined}.
  24601. @item color
  24602. Specify display color mode.
  24603. It accepts the following values:
  24604. @table @samp
  24605. @item channel
  24606. each channel is displayed in a separate color
  24607. @item intensity
  24608. each channel is displayed using the same color scheme
  24609. @item rainbow
  24610. each channel is displayed using the rainbow color scheme
  24611. @item moreland
  24612. each channel is displayed using the moreland color scheme
  24613. @item nebulae
  24614. each channel is displayed using the nebulae color scheme
  24615. @item fire
  24616. each channel is displayed using the fire color scheme
  24617. @item fiery
  24618. each channel is displayed using the fiery color scheme
  24619. @item fruit
  24620. each channel is displayed using the fruit color scheme
  24621. @item cool
  24622. each channel is displayed using the cool color scheme
  24623. @item magma
  24624. each channel is displayed using the magma color scheme
  24625. @item green
  24626. each channel is displayed using the green color scheme
  24627. @item viridis
  24628. each channel is displayed using the viridis color scheme
  24629. @item plasma
  24630. each channel is displayed using the plasma color scheme
  24631. @item cividis
  24632. each channel is displayed using the cividis color scheme
  24633. @item terrain
  24634. each channel is displayed using the terrain color scheme
  24635. @end table
  24636. Default value is @samp{intensity}.
  24637. @item scale
  24638. Specify scale used for calculating intensity color values.
  24639. It accepts the following values:
  24640. @table @samp
  24641. @item lin
  24642. linear
  24643. @item sqrt
  24644. square root, default
  24645. @item cbrt
  24646. cubic root
  24647. @item log
  24648. logarithmic
  24649. @item 4thrt
  24650. 4th root
  24651. @item 5thrt
  24652. 5th root
  24653. @end table
  24654. Default value is @samp{log}.
  24655. @item fscale
  24656. Specify frequency scale.
  24657. It accepts the following values:
  24658. @table @samp
  24659. @item lin
  24660. linear
  24661. @item log
  24662. logarithmic
  24663. @end table
  24664. Default value is @samp{lin}.
  24665. @item saturation
  24666. Set saturation modifier for displayed colors. Negative values provide
  24667. alternative color scheme. @code{0} is no saturation at all.
  24668. Saturation must be in [-10.0, 10.0] range.
  24669. Default value is @code{1}.
  24670. @item win_func
  24671. Set window function.
  24672. It accepts the following values:
  24673. @table @samp
  24674. @item rect
  24675. @item bartlett
  24676. @item hann
  24677. @item hanning
  24678. @item hamming
  24679. @item blackman
  24680. @item welch
  24681. @item flattop
  24682. @item bharris
  24683. @item bnuttall
  24684. @item bhann
  24685. @item sine
  24686. @item nuttall
  24687. @item lanczos
  24688. @item gauss
  24689. @item tukey
  24690. @item dolph
  24691. @item cauchy
  24692. @item parzen
  24693. @item poisson
  24694. @item bohman
  24695. @item kaiser
  24696. @end table
  24697. Default value is @code{hann}.
  24698. @item orientation
  24699. Set orientation of time vs frequency axis. Can be @code{vertical} or
  24700. @code{horizontal}. Default is @code{vertical}.
  24701. @item gain
  24702. Set scale gain for calculating intensity color values.
  24703. Default value is @code{1}.
  24704. @item legend
  24705. Draw time and frequency axes and legends. Default is enabled.
  24706. @item rotation
  24707. Set color rotation, must be in [-1.0, 1.0] range.
  24708. Default value is @code{0}.
  24709. @item start
  24710. Set start frequency from which to display spectrogram. Default is @code{0}.
  24711. @item stop
  24712. Set stop frequency to which to display spectrogram. Default is @code{0}.
  24713. @item drange
  24714. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  24715. Allowed range is from 10 to 200.
  24716. @item limit
  24717. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  24718. Allowed range is from -100 to 100.
  24719. @item opacity
  24720. Set opacity strength when using pixel format output with alpha component.
  24721. @end table
  24722. @subsection Examples
  24723. @itemize
  24724. @item
  24725. Extract an audio spectrogram of a whole audio track
  24726. in a 1024x1024 picture using @command{ffmpeg}:
  24727. @example
  24728. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  24729. @end example
  24730. @end itemize
  24731. @section showvolume
  24732. Convert input audio volume to a video output.
  24733. The filter accepts the following options:
  24734. @table @option
  24735. @item rate, r
  24736. Set video rate.
  24737. @item b
  24738. Set border width, allowed range is [0, 5]. Default is 1.
  24739. @item w
  24740. Set channel width, allowed range is [80, 8192]. Default is 400.
  24741. @item h
  24742. Set channel height, allowed range is [1, 900]. Default is 20.
  24743. @item f
  24744. Set fade, allowed range is [0, 1]. Default is 0.95.
  24745. @item c
  24746. Set volume color expression.
  24747. The expression can use the following variables:
  24748. @table @option
  24749. @item VOLUME
  24750. Current max volume of channel in dB.
  24751. @item PEAK
  24752. Current peak.
  24753. @item CHANNEL
  24754. Current channel number, starting from 0.
  24755. @end table
  24756. @item t
  24757. If set, displays channel names. Default is enabled.
  24758. @item v
  24759. If set, displays volume values. Default is enabled.
  24760. @item o
  24761. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  24762. default is @code{h}.
  24763. @item s
  24764. Set step size, allowed range is [0, 5]. Default is 0, which means
  24765. step is disabled.
  24766. @item p
  24767. Set background opacity, allowed range is [0, 1]. Default is 0.
  24768. @item m
  24769. Set metering mode, can be peak: @code{p} or rms: @code{r},
  24770. default is @code{p}.
  24771. @item ds
  24772. Set display scale, can be linear: @code{lin} or log: @code{log},
  24773. default is @code{lin}.
  24774. @item dm
  24775. In second.
  24776. If set to > 0., display a line for the max level
  24777. in the previous seconds.
  24778. default is disabled: @code{0.}
  24779. @item dmc
  24780. The color of the max line. Use when @code{dm} option is set to > 0.
  24781. default is: @code{orange}
  24782. @end table
  24783. @section showwaves
  24784. Convert input audio to a video output, representing the samples waves.
  24785. The filter accepts the following options:
  24786. @table @option
  24787. @item size, s
  24788. Specify the video size for the output. For the syntax of this option, check the
  24789. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24790. Default value is @code{600x240}.
  24791. @item mode
  24792. Set display mode.
  24793. Available values are:
  24794. @table @samp
  24795. @item point
  24796. Draw a point for each sample.
  24797. @item line
  24798. Draw a vertical line for each sample.
  24799. @item p2p
  24800. Draw a point for each sample and a line between them.
  24801. @item cline
  24802. Draw a centered vertical line for each sample.
  24803. @end table
  24804. Default value is @code{point}.
  24805. @item n
  24806. Set the number of samples which are printed on the same column. A
  24807. larger value will decrease the frame rate. Must be a positive
  24808. integer. This option can be set only if the value for @var{rate}
  24809. is not explicitly specified.
  24810. @item rate, r
  24811. Set the (approximate) output frame rate. This is done by setting the
  24812. option @var{n}. Default value is "25".
  24813. @item split_channels
  24814. Set if channels should be drawn separately or overlap. Default value is 0.
  24815. @item colors
  24816. Set colors separated by '|' which are going to be used for drawing of each channel.
  24817. @item scale
  24818. Set amplitude scale.
  24819. Available values are:
  24820. @table @samp
  24821. @item lin
  24822. Linear.
  24823. @item log
  24824. Logarithmic.
  24825. @item sqrt
  24826. Square root.
  24827. @item cbrt
  24828. Cubic root.
  24829. @end table
  24830. Default is linear.
  24831. @item draw
  24832. Set the draw mode. This is mostly useful to set for high @var{n}.
  24833. Available values are:
  24834. @table @samp
  24835. @item scale
  24836. Scale pixel values for each drawn sample.
  24837. @item full
  24838. Draw every sample directly.
  24839. @end table
  24840. Default value is @code{scale}.
  24841. @end table
  24842. @subsection Examples
  24843. @itemize
  24844. @item
  24845. Output the input file audio and the corresponding video representation
  24846. at the same time:
  24847. @example
  24848. amovie=a.mp3,asplit[out0],showwaves[out1]
  24849. @end example
  24850. @item
  24851. Create a synthetic signal and show it with showwaves, forcing a
  24852. frame rate of 30 frames per second:
  24853. @example
  24854. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  24855. @end example
  24856. @end itemize
  24857. @section showwavespic
  24858. Convert input audio to a single video frame, representing the samples waves.
  24859. The filter accepts the following options:
  24860. @table @option
  24861. @item size, s
  24862. Specify the video size for the output. For the syntax of this option, check the
  24863. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24864. Default value is @code{600x240}.
  24865. @item split_channels
  24866. Set if channels should be drawn separately or overlap. Default value is 0.
  24867. @item colors
  24868. Set colors separated by '|' which are going to be used for drawing of each channel.
  24869. @item scale
  24870. Set amplitude scale.
  24871. Available values are:
  24872. @table @samp
  24873. @item lin
  24874. Linear.
  24875. @item log
  24876. Logarithmic.
  24877. @item sqrt
  24878. Square root.
  24879. @item cbrt
  24880. Cubic root.
  24881. @end table
  24882. Default is linear.
  24883. @item draw
  24884. Set the draw mode.
  24885. Available values are:
  24886. @table @samp
  24887. @item scale
  24888. Scale pixel values for each drawn sample.
  24889. @item full
  24890. Draw every sample directly.
  24891. @end table
  24892. Default value is @code{scale}.
  24893. @item filter
  24894. Set the filter mode.
  24895. Available values are:
  24896. @table @samp
  24897. @item average
  24898. Use average samples values for each drawn sample.
  24899. @item peak
  24900. Use peak samples values for each drawn sample.
  24901. @end table
  24902. Default value is @code{average}.
  24903. @end table
  24904. @subsection Examples
  24905. @itemize
  24906. @item
  24907. Extract a channel split representation of the wave form of a whole audio track
  24908. in a 1024x800 picture using @command{ffmpeg}:
  24909. @example
  24910. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  24911. @end example
  24912. @end itemize
  24913. @section sidedata, asidedata
  24914. Delete frame side data, or select frames based on it.
  24915. This filter accepts the following options:
  24916. @table @option
  24917. @item mode
  24918. Set mode of operation of the filter.
  24919. Can be one of the following:
  24920. @table @samp
  24921. @item select
  24922. Select every frame with side data of @code{type}.
  24923. @item delete
  24924. Delete side data of @code{type}. If @code{type} is not set, delete all side
  24925. data in the frame.
  24926. @end table
  24927. @item type
  24928. Set side data type used with all modes. Must be set for @code{select} mode. For
  24929. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  24930. in @file{libavutil/frame.h}. For example, to choose
  24931. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  24932. @end table
  24933. @section spectrumsynth
  24934. Synthesize audio from 2 input video spectrums, first input stream represents
  24935. magnitude across time and second represents phase across time.
  24936. The filter will transform from frequency domain as displayed in videos back
  24937. to time domain as presented in audio output.
  24938. This filter is primarily created for reversing processed @ref{showspectrum}
  24939. filter outputs, but can synthesize sound from other spectrograms too.
  24940. But in such case results are going to be poor if the phase data is not
  24941. available, because in such cases phase data need to be recreated, usually
  24942. it's just recreated from random noise.
  24943. For best results use gray only output (@code{channel} color mode in
  24944. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  24945. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  24946. @code{data} option. Inputs videos should generally use @code{fullframe}
  24947. slide mode as that saves resources needed for decoding video.
  24948. The filter accepts the following options:
  24949. @table @option
  24950. @item sample_rate
  24951. Specify sample rate of output audio, the sample rate of audio from which
  24952. spectrum was generated may differ.
  24953. @item channels
  24954. Set number of channels represented in input video spectrums.
  24955. @item scale
  24956. Set scale which was used when generating magnitude input spectrum.
  24957. Can be @code{lin} or @code{log}. Default is @code{log}.
  24958. @item slide
  24959. Set slide which was used when generating inputs spectrums.
  24960. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  24961. Default is @code{fullframe}.
  24962. @item win_func
  24963. Set window function used for resynthesis.
  24964. @item overlap
  24965. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  24966. which means optimal overlap for selected window function will be picked.
  24967. @item orientation
  24968. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  24969. Default is @code{vertical}.
  24970. @end table
  24971. @subsection Examples
  24972. @itemize
  24973. @item
  24974. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  24975. then resynthesize videos back to audio with spectrumsynth:
  24976. @example
  24977. 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
  24978. 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
  24979. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  24980. @end example
  24981. @end itemize
  24982. @section split, asplit
  24983. Split input into several identical outputs.
  24984. @code{asplit} works with audio input, @code{split} with video.
  24985. The filter accepts a single parameter which specifies the number of outputs. If
  24986. unspecified, it defaults to 2.
  24987. @subsection Examples
  24988. @itemize
  24989. @item
  24990. Create two separate outputs from the same input:
  24991. @example
  24992. [in] split [out0][out1]
  24993. @end example
  24994. @item
  24995. To create 3 or more outputs, you need to specify the number of
  24996. outputs, like in:
  24997. @example
  24998. [in] asplit=3 [out0][out1][out2]
  24999. @end example
  25000. @item
  25001. Create two separate outputs from the same input, one cropped and
  25002. one padded:
  25003. @example
  25004. [in] split [splitout1][splitout2];
  25005. [splitout1] crop=100:100:0:0 [cropout];
  25006. [splitout2] pad=200:200:100:100 [padout];
  25007. @end example
  25008. @item
  25009. Create 5 copies of the input audio with @command{ffmpeg}:
  25010. @example
  25011. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  25012. @end example
  25013. @end itemize
  25014. @section zmq, azmq
  25015. Receive commands sent through a libzmq client, and forward them to
  25016. filters in the filtergraph.
  25017. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  25018. must be inserted between two video filters, @code{azmq} between two
  25019. audio filters. Both are capable to send messages to any filter type.
  25020. To enable these filters you need to install the libzmq library and
  25021. headers and configure FFmpeg with @code{--enable-libzmq}.
  25022. For more information about libzmq see:
  25023. @url{http://www.zeromq.org/}
  25024. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  25025. receives messages sent through a network interface defined by the
  25026. @option{bind_address} (or the abbreviation "@option{b}") option.
  25027. Default value of this option is @file{tcp://localhost:5555}. You may
  25028. want to alter this value to your needs, but do not forget to escape any
  25029. ':' signs (see @ref{filtergraph escaping}).
  25030. The received message must be in the form:
  25031. @example
  25032. @var{TARGET} @var{COMMAND} [@var{ARG}]
  25033. @end example
  25034. @var{TARGET} specifies the target of the command, usually the name of
  25035. the filter class or a specific filter instance name. The default
  25036. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  25037. but you can override this by using the @samp{filter_name@@id} syntax
  25038. (see @ref{Filtergraph syntax}).
  25039. @var{COMMAND} specifies the name of the command for the target filter.
  25040. @var{ARG} is optional and specifies the optional argument list for the
  25041. given @var{COMMAND}.
  25042. Upon reception, the message is processed and the corresponding command
  25043. is injected into the filtergraph. Depending on the result, the filter
  25044. will send a reply to the client, adopting the format:
  25045. @example
  25046. @var{ERROR_CODE} @var{ERROR_REASON}
  25047. @var{MESSAGE}
  25048. @end example
  25049. @var{MESSAGE} is optional.
  25050. @subsection Examples
  25051. Look at @file{tools/zmqsend} for an example of a zmq client which can
  25052. be used to send commands processed by these filters.
  25053. Consider the following filtergraph generated by @command{ffplay}.
  25054. In this example the last overlay filter has an instance name. All other
  25055. filters will have default instance names.
  25056. @example
  25057. ffplay -dumpgraph 1 -f lavfi "
  25058. color=s=100x100:c=red [l];
  25059. color=s=100x100:c=blue [r];
  25060. nullsrc=s=200x100, zmq [bg];
  25061. [bg][l] overlay [bg+l];
  25062. [bg+l][r] overlay@@my=x=100 "
  25063. @end example
  25064. To change the color of the left side of the video, the following
  25065. command can be used:
  25066. @example
  25067. echo Parsed_color_0 c yellow | tools/zmqsend
  25068. @end example
  25069. To change the right side:
  25070. @example
  25071. echo Parsed_color_1 c pink | tools/zmqsend
  25072. @end example
  25073. To change the position of the right side:
  25074. @example
  25075. echo overlay@@my x 150 | tools/zmqsend
  25076. @end example
  25077. @c man end MULTIMEDIA FILTERS
  25078. @chapter Multimedia Sources
  25079. @c man begin MULTIMEDIA SOURCES
  25080. Below is a description of the currently available multimedia sources.
  25081. @section amovie
  25082. This is the same as @ref{movie} source, except it selects an audio
  25083. stream by default.
  25084. @section avsynctest
  25085. Generate an Audio/Video Sync Test.
  25086. Generated stream periodically shows flash video frame and emits beep in audio.
  25087. Useful to inspect A/V sync issues.
  25088. It accepts the following options:
  25089. @table @option
  25090. @item size, s
  25091. Set output video size. Default value is @code{hd720}.
  25092. @item framerate, fr
  25093. Set output video frame rate. Default value is @code{30}.
  25094. @item samplerate, sr
  25095. Set output audio sample rate. Default value is @code{44100}.
  25096. @item amplitude, a
  25097. Set output audio beep amplitude. Default value is @code{0.7}.
  25098. @item period, p
  25099. Set output audio beep period in seconds. Default value is @code{3}.
  25100. @item delay, dl
  25101. Set output video flash delay in number of frames. Default value is @code{0}.
  25102. @item cycle, c
  25103. Enable cycling of video delays, by default is disabled.
  25104. @item duration, d
  25105. Set stream output duration. By default duration is unlimited.
  25106. @item fg, bg, ag
  25107. Set foreground/background/additional color.
  25108. @end table
  25109. @subsection Commands
  25110. This source supports the some above options as @ref{commands}.
  25111. @anchor{movie}
  25112. @section movie
  25113. Read audio and/or video stream(s) from a movie container.
  25114. It accepts the following parameters:
  25115. @table @option
  25116. @item filename
  25117. The name of the resource to read (not necessarily a file; it can also be a
  25118. device or a stream accessed through some protocol).
  25119. @item format_name, f
  25120. Specifies the format assumed for the movie to read, and can be either
  25121. the name of a container or an input device. If not specified, the
  25122. format is guessed from @var{movie_name} or by probing.
  25123. @item seek_point, sp
  25124. Specifies the seek point in seconds. The frames will be output
  25125. starting from this seek point. The parameter is evaluated with
  25126. @code{av_strtod}, so the numerical value may be suffixed by an IS
  25127. postfix. The default value is "0".
  25128. @item streams, s
  25129. Specifies the streams to read. Several streams can be specified,
  25130. separated by "+". The source will then have as many outputs, in the
  25131. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  25132. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  25133. respectively the default (best suited) video and audio stream. Default
  25134. is "dv", or "da" if the filter is called as "amovie".
  25135. @item stream_index, si
  25136. Specifies the index of the video stream to read. If the value is -1,
  25137. the most suitable video stream will be automatically selected. The default
  25138. value is "-1". Deprecated. If the filter is called "amovie", it will select
  25139. audio instead of video.
  25140. @item loop
  25141. Specifies how many times to read the stream in sequence.
  25142. If the value is 0, the stream will be looped infinitely.
  25143. Default value is "1".
  25144. Note that when the movie is looped the source timestamps are not
  25145. changed, so it will generate non monotonically increasing timestamps.
  25146. @item discontinuity
  25147. Specifies the time difference between frames above which the point is
  25148. considered a timestamp discontinuity which is removed by adjusting the later
  25149. timestamps.
  25150. @item dec_threads
  25151. Specifies the number of threads for decoding
  25152. @item format_opts
  25153. Specify format options for the opened file. Format options can be specified
  25154. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  25155. shows how to add protocol_whitelist and protocol_blacklist options:
  25156. @example
  25157. ffplay -f lavfi
  25158. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  25159. @end example
  25160. @end table
  25161. It allows overlaying a second video on top of the main input of
  25162. a filtergraph, as shown in this graph:
  25163. @example
  25164. input -----------> deltapts0 --> overlay --> output
  25165. ^
  25166. |
  25167. movie --> scale--> deltapts1 -------+
  25168. @end example
  25169. @subsection Examples
  25170. @itemize
  25171. @item
  25172. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  25173. on top of the input labelled "in":
  25174. @example
  25175. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25176. [in] setpts=PTS-STARTPTS [main];
  25177. [main][over] overlay=16:16 [out]
  25178. @end example
  25179. @item
  25180. Read from a video4linux2 device, and overlay it on top of the input
  25181. labelled "in":
  25182. @example
  25183. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25184. [in] setpts=PTS-STARTPTS [main];
  25185. [main][over] overlay=16:16 [out]
  25186. @end example
  25187. @item
  25188. Read the first video stream and the audio stream with id 0x81 from
  25189. dvd.vob; the video is connected to the pad named "video" and the audio is
  25190. connected to the pad named "audio":
  25191. @example
  25192. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  25193. @end example
  25194. @end itemize
  25195. @subsection Commands
  25196. Both movie and amovie support the following commands:
  25197. @table @option
  25198. @item seek
  25199. Perform seek using "av_seek_frame".
  25200. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  25201. @itemize
  25202. @item
  25203. @var{stream_index}: If stream_index is -1, a default
  25204. stream is selected, and @var{timestamp} is automatically converted
  25205. from AV_TIME_BASE units to the stream specific time_base.
  25206. @item
  25207. @var{timestamp}: Timestamp in AVStream.time_base units
  25208. or, if no stream is specified, in AV_TIME_BASE units.
  25209. @item
  25210. @var{flags}: Flags which select direction and seeking mode.
  25211. @end itemize
  25212. @item get_duration
  25213. Get movie duration in AV_TIME_BASE units.
  25214. @end table
  25215. @c man end MULTIMEDIA SOURCES