filters.texi 896 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347
  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 lcevc
  12508. Low Complexity Enhancement Video Codec filter based on liblcevc_dec
  12509. (@url{https://github.com/v-novaltd/LCEVCdec}).
  12510. @section libplacebo
  12511. Flexible GPU-accelerated processing filter based on libplacebo
  12512. (@url{https://code.videolan.org/videolan/libplacebo}).
  12513. @subsection Options
  12514. The options for this filter are divided into the following sections:
  12515. @subsubsection Output mode
  12516. These options control the overall output mode. By default, libplacebo will try
  12517. to preserve the source colorimetry and size as best as it can, but it will
  12518. apply any embedded film grain, dolby vision metadata or anamorphic SAR present
  12519. in source frames.
  12520. @table @option
  12521. @item inputs
  12522. Set the number of inputs. This can be used, alongside the @code{idx} variable,
  12523. to allow placing/blending multiple inputs inside the output frame. This
  12524. effectively enables functionality similar to @ref{hstack}, @ref{overlay}, etc.
  12525. @item w
  12526. @item h
  12527. Set the output video dimension expression. Default values are @code{iw} and
  12528. @code{ih}.
  12529. Allows for the same expressions as the @ref{scale} filter.
  12530. @item crop_x
  12531. @item crop_y
  12532. Set the input crop x/y expressions, default values are @code{(iw-cw)/2} and
  12533. @code{(ih-ch)/2}.
  12534. @item crop_w
  12535. @item crop_h
  12536. Set the input crop width/height expressions, default values are @code{iw} and
  12537. @code{ih}.
  12538. @item pos_x
  12539. @item pos_y
  12540. Set the output placement x/y expressions, default values are @code{(ow-pw)/2}
  12541. and @code{(oh-ph)/2}.
  12542. @item pos_w
  12543. @item pos_h
  12544. Set the output placement width/height expressions, default values are @code{ow}
  12545. and @code{oh}.
  12546. @item fps
  12547. Set the output frame rate. This can be rational, e.g. @code{60000/1001}. If
  12548. set to the special string @code{none} (the default), input timestamps will
  12549. instead be passed through to the output unmodified. Otherwise, the input video
  12550. frames will be interpolated as necessary to rescale the video to the specified
  12551. target framerate, in a manner as determined by the @option{frame_mixer} option.
  12552. @item format
  12553. Set the output format override. If unset (the default), frames will be output
  12554. in the same format as the respective input frames. Otherwise, format conversion
  12555. will be performed.
  12556. @item force_original_aspect_ratio
  12557. @item force_divisible_by
  12558. Work the same as the identical @ref{scale} filter options.
  12559. @item normalize_sar
  12560. If enabled, output frames will always have a pixel aspect ratio of 1:1. This
  12561. will introduce additional padding/cropping as necessary. If disabled (the
  12562. default), any aspect ratio mismatches, including those from e.g. anamorphic
  12563. video sources, are forwarded to the output pixel aspect ratio.
  12564. @item pad_crop_ratio
  12565. Specifies a ratio (between @code{0.0} and @code{1.0}) between padding and
  12566. cropping when the input aspect ratio does not match the output aspect ratio and
  12567. @option{normalize_sar} is in effect. The default of @code{0.0} always pads the
  12568. content with black borders, while a value of @code{1.0} always crops off parts
  12569. of the content. Intermediate values are possible, leading to a mix of the two
  12570. approaches.
  12571. @item fillcolor
  12572. Set the color used to fill the output area not covered by the output image, for
  12573. example as a result of @option{normalize_sar}. For the general syntax of this
  12574. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  12575. manual,ffmpeg-utils}. Defaults to @code{black}.
  12576. @item corner_rounding
  12577. Render frames with rounded corners. The value, given as a float ranging from
  12578. @code{0.0} to @code{1.0}, indicates the relative degree of rounding, from fully
  12579. square to fully circular. In other words, it gives the radius divided by half
  12580. the smaller side length. Defaults to @code{0.0}.
  12581. @item extra_opts
  12582. Pass extra libplacebo internal configuration options. These can be specified
  12583. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  12584. shows how to configure a custom filter kernel ("EWA LanczosSharp") and use it
  12585. to double the input image resolution:
  12586. @example
  12587. -vf "libplacebo=w=iw*2:h=ih*2:extra_opts='upscaler=custom\:upscaler_preset=ewa_lanczos\:upscaler_blur=0.9812505644269356'"
  12588. @end example
  12589. @item colorspace
  12590. @item color_primaries
  12591. @item color_trc
  12592. @item range
  12593. Configure the colorspace that output frames will be delivered in. The default
  12594. value of @code{auto} outputs frames in the same format as the input frames,
  12595. leading to no change. For any other value, conversion will be performed.
  12596. See the @ref{setparams} filter for a list of possible values.
  12597. @item apply_filmgrain
  12598. Apply film grain (e.g. AV1 or H.274) if present in source frames, and strip
  12599. it from the output. Enabled by default.
  12600. @item apply_dolbyvision
  12601. Apply Dolby Vision RPU metadata if present in source frames, and strip it from
  12602. the output. Enabled by default. Note that Dolby Vision will always output
  12603. BT.2020+PQ, overriding the usual input frame metadata. These will also be
  12604. picked as the values of @code{auto} for the respective frame output options.
  12605. @end table
  12606. In addition to the expression constants documented for the @ref{scale} filter,
  12607. the @option{crop_w}, @option{crop_h}, @option{crop_x}, @option{crop_y},
  12608. @option{pos_w}, @option{pos_h}, @option{pos_x} and @option{pos_y} options can
  12609. also contain the following constants:
  12610. @table @option
  12611. @item in_idx, idx
  12612. The (0-based) numeric index of the currently active input stream.
  12613. @item crop_w, cw
  12614. @item crop_h, ch
  12615. The computed values of @option{crop_w} and @option{crop_h}.
  12616. @item pos_w, pw
  12617. @item pos_h, ph
  12618. The computed values of @option{pos_w} and @option{pos_h}.
  12619. @item in_t, t
  12620. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12621. @item out_t, ot
  12622. The input frame timestamp, in seconds. NAN if input timestamp is unknown.
  12623. @item n
  12624. The input frame number, starting with 0.
  12625. @end table
  12626. @subsubsection Scaling
  12627. The options in this section control how libplacebo performs upscaling and (if
  12628. necessary) downscaling. Note that libplacebo will always internally operate on
  12629. 4:4:4 content, so any sub-sampled chroma formats such as @code{yuv420p} will
  12630. necessarily be upsampled and downsampled as part of the rendering process. That
  12631. means scaling might be in effect even if the source and destination resolution
  12632. are the same.
  12633. @table @option
  12634. @item upscaler
  12635. @item downscaler
  12636. Configure the filter kernel used for upscaling and downscaling. The respective
  12637. defaults are @code{spline36} and @code{mitchell}. For a full list of possible
  12638. values, pass @code{help} to these options. The most important values are:
  12639. @table @samp
  12640. @item none
  12641. Forces the use of built-in GPU texture sampling (typically bilinear). Extremely
  12642. fast but poor quality, especially when downscaling.
  12643. @item bilinear
  12644. Bilinear interpolation. Can generally be done for free on GPUs, except when
  12645. doing so would lead to aliasing. Fast and low quality.
  12646. @item nearest
  12647. Nearest-neighbour interpolation. Sharp but highly aliasing.
  12648. @item oversample
  12649. Algorithm that looks visually similar to nearest-neighbour interpolation but
  12650. tries to preserve pixel aspect ratio. Good for pixel art, since it results in
  12651. minimal distortion of the artistic appearance.
  12652. @item lanczos
  12653. Standard sinc-sinc interpolation kernel.
  12654. @item spline36
  12655. Cubic spline approximation of lanczos. No difference in performance, but has
  12656. very slightly less ringing.
  12657. @item ewa_lanczos
  12658. Elliptically weighted average version of lanczos, based on a jinc-sinc kernel.
  12659. This is also popularly referred to as just "Jinc scaling". Slow but very high
  12660. quality.
  12661. @item gaussian
  12662. Gaussian kernel. Has certain ideal mathematical properties, but subjectively
  12663. very blurry.
  12664. @item mitchell
  12665. Cubic BC spline with parameters recommended by Mitchell and Netravali. Very
  12666. little ringing.
  12667. @end table
  12668. @item frame_mixer
  12669. Controls the kernel used for mixing frames temporally. The default value is
  12670. @code{none}, which disables frame mixing. For a full list of possible values,
  12671. pass @code{help} to this option. The most important values are:
  12672. @table @samp
  12673. @item none
  12674. Disables frame mixing, giving a result equivalent to "nearest neighbour"
  12675. semantics.
  12676. @item oversample
  12677. Oversamples the input video to create a "Smooth Motion"-type effect: if an
  12678. output frame would exactly fall on the transition between two video frames, it
  12679. is blended according to the relative overlap. This is the recommended option
  12680. whenever preserving the original subjective appearance is desired.
  12681. @item mitchell_clamp
  12682. Larger filter kernel that smoothly interpolates multiple frames in a manner
  12683. designed to eliminate ringing and other artefacts as much as possible. This is
  12684. the recommended option wherever maximum visual smoothness is desired.
  12685. @item linear
  12686. Linear blend/fade between frames. Especially useful for constructing e.g.
  12687. slideshows.
  12688. @end table
  12689. @item lut_entries
  12690. Configures the size of scaler LUTs, ranging from @code{1} to @code{256}. The
  12691. default of @code{0} will pick libplacebo's internal default, typically
  12692. @code{64}.
  12693. @item antiringing
  12694. Enables anti-ringing (for non-EWA filters). The value (between @code{0.0} and
  12695. @code{1.0}) configures the strength of the anti-ringing algorithm. May increase
  12696. aliasing if set too high. Disabled by default.
  12697. @item sigmoid
  12698. Enable sigmoidal compression during upscaling. Reduces ringing slightly.
  12699. Enabled by default.
  12700. @end table
  12701. @subsubsection Debanding
  12702. Libplacebo comes with a built-in debanding filter that is good at counteracting
  12703. many common sources of banding and blocking. Turning this on is highly
  12704. recommended whenever quality is desired.
  12705. @table @option
  12706. @item deband
  12707. Enable (fast) debanding algorithm. Disabled by default.
  12708. @item deband_iterations
  12709. Number of deband iterations of the debanding algorithm. Each iteration is
  12710. performed with progressively increased radius (and diminished threshold).
  12711. Recommended values are in the range @code{1} to @code{4}. Defaults to @code{1}.
  12712. @item deband_threshold
  12713. Debanding filter strength. Higher numbers lead to more aggressive debanding.
  12714. Defaults to @code{4.0}.
  12715. @item deband_radius
  12716. Debanding filter radius. A higher radius is better for slow gradients, while
  12717. a lower radius is better for steep gradients. Defaults to @code{16.0}.
  12718. @item deband_grain
  12719. Amount of extra output grain to add. Helps hide imperfections. Defaults to
  12720. @code{6.0}.
  12721. @end table
  12722. @subsubsection Color adjustment
  12723. A collection of subjective color controls. Not very rigorous, so the exact
  12724. effect will vary somewhat depending on the input primaries and colorspace.
  12725. @table @option
  12726. @item brightness
  12727. Brightness boost, between @code{-1.0} and @code{1.0}. Defaults to @code{0.0}.
  12728. @item contrast
  12729. Contrast gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12730. @item saturation
  12731. Saturation gain, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12732. @item hue
  12733. Hue shift in radians, between @code{-3.14} and @code{3.14}. Defaults to
  12734. @code{0.0}. This will rotate the UV subvector, defaulting to BT.709
  12735. coefficients for RGB inputs.
  12736. @item gamma
  12737. Gamma adjustment, between @code{0.0} and @code{16.0}. Defaults to @code{1.0}.
  12738. @item cones
  12739. Cone model to use for color blindness simulation. Accepts any combination of
  12740. @code{l}, @code{m} and @code{s}. Here are some examples:
  12741. @table @samp
  12742. @item m
  12743. Deuteranomaly / deuteranopia (affecting 3%-4% of the population)
  12744. @item l
  12745. Protanomaly / protanopia (affecting 1%-2% of the population)
  12746. @item l+m
  12747. Monochromacy (very rare)
  12748. @item l+m+s
  12749. Achromatopsy (complete loss of daytime vision, extremely rare)
  12750. @end table
  12751. @item cone-strength
  12752. Gain factor for the cones specified by @code{cones}, between @code{0.0} and
  12753. @code{10.0}. A value of @code{1.0} results in no change to color vision. A
  12754. value of @code{0.0} (the default) simulates complete loss of those cones. Values
  12755. above @code{1.0} result in exaggerating the differences between cones, which
  12756. may help compensate for reduced color vision.
  12757. @end table
  12758. @subsubsection Peak detection
  12759. To help deal with sources that only have static HDR10 metadata (or no tagging
  12760. whatsoever), libplacebo uses its own internal frame analysis compute shader to
  12761. analyze source frames and adapt the tone mapping function in realtime. If this
  12762. is too slow, or if exactly reproducible frame-perfect results are needed, it's
  12763. recommended to turn this feature off.
  12764. @table @option
  12765. @item peak_detect
  12766. Enable HDR peak detection. Ignores static MaxCLL/MaxFALL values in favor of
  12767. dynamic detection from the input. Note that the detected values do not get
  12768. written back to the output frames, they merely guide the internal tone mapping
  12769. process. Enabled by default.
  12770. @item smoothing_period
  12771. Peak detection smoothing period, between @code{0.0} and @code{1000.0}. Higher
  12772. values result in peak detection becoming less responsive to changes in the
  12773. input. Defaults to @code{100.0}.
  12774. @item minimum_peak
  12775. Lower bound on the detected peak (relative to SDR white), between @code{0.0}
  12776. and @code{100.0}. Defaults to @code{1.0}.
  12777. @item scene_threshold_low
  12778. @item scene_threshold_high
  12779. Lower and upper thresholds for scene change detection. Expressed in a
  12780. logarithmic scale between @code{0.0} and @code{100.0}. Default to @code{5.5}
  12781. and @code{10.0}, respectively. Setting either to a negative value disables
  12782. this functionality.
  12783. @item percentile
  12784. Which percentile of the frame brightness histogram to use as the source peak
  12785. for tone-mapping. Defaults to @code{99.995}, a fairly conservative value.
  12786. Setting this to @code{100.0} disables frame histogram measurement and instead
  12787. uses the true peak brightness for tone-mapping.
  12788. @end table
  12789. @subsubsection Tone mapping
  12790. The options in this section control how libplacebo performs tone-mapping and
  12791. gamut-mapping when dealing with mismatches between wide-gamut or HDR content.
  12792. In general, libplacebo relies on accurate source tagging and mastering display
  12793. gamut information to produce the best results.
  12794. @table @option
  12795. @item gamut_mode
  12796. How to handle out-of-gamut colors that can occur as a result of colorimetric
  12797. gamut mapping.
  12798. @table @samp
  12799. @item clip
  12800. Do nothing, simply clip out-of-range colors to the RGB volume. Low quality but
  12801. extremely fast.
  12802. @item perceptual
  12803. Perceptually soft-clip colors to the gamut volume. This is the default.
  12804. @item relative
  12805. Relative colorimetric hard-clip. Similar to @code{perceptual} but without
  12806. the soft knee.
  12807. @item saturation
  12808. Saturation mapping, maps primaries directly to primaries in RGB space.
  12809. Not recommended except for artificial computer graphics for which a bright,
  12810. saturated display is desired.
  12811. @item absolute
  12812. Absolute colorimetric hard-clip. Performs no adjustment of the white point.
  12813. @item desaturate
  12814. Hard-desaturates out-of-gamut colors towards white, while preserving the
  12815. luminance. Has a tendency to distort the visual appearance of bright objects.
  12816. @item darken
  12817. Linearly reduces content brightness to preserves saturated details, followed by
  12818. clipping the remaining out-of-gamut colors.
  12819. @item warn
  12820. Highlight out-of-gamut pixels (by inverting/marking them).
  12821. @item linear
  12822. Linearly reduces chromaticity of the entire image to make it fit within the
  12823. target color volume. Be careful when using this on BT.2020 sources without
  12824. proper mastering metadata, as doing so will lead to excessive desaturation.
  12825. @end table
  12826. @item tonemapping
  12827. Tone-mapping algorithm to use. Available values are:
  12828. @table @samp
  12829. @item auto
  12830. Automatic selection based on internal heuristics. This is the default.
  12831. @item clip
  12832. Performs no tone-mapping, just clips out-of-range colors. Retains perfect color
  12833. accuracy for in-range colors but completely destroys out-of-range information.
  12834. Does not perform any black point adaptation. Not configurable.
  12835. @item st2094-40
  12836. EETF from SMPTE ST 2094-40 Annex B, which applies the Bezier curves from HDR10+
  12837. dynamic metadata based on Bezier curves to perform tone-mapping. The OOTF used
  12838. is adjusted based on the ratio between the targeted and actual display peak
  12839. luminances.
  12840. @item st2094-10
  12841. EETF from SMPTE ST 2094-10 Annex B.2, which takes into account the input signal
  12842. average luminance in addition to the maximum/minimum. The configurable contrast
  12843. parameter influences the slope of the linear output segment, defaulting to
  12844. @code{1.0} for no increase/decrease in contrast. Note that this does not
  12845. currently include the subjective gain/offset/gamma controls defined in Annex
  12846. B.3.
  12847. @item bt.2390
  12848. EETF from the ITU-R Report BT.2390, a hermite spline roll-off with linear
  12849. segment. The knee point offset is configurable. Note that this parameter
  12850. defaults to @code{1.0}, rather than the value of @code{0.5} from the ITU-R
  12851. spec.
  12852. @item bt.2446a
  12853. EETF from ITU-R Report BT.2446, method A. Designed for well-mastered HDR
  12854. sources. Can be used for both forward and inverse tone mapping. Not
  12855. configurable.
  12856. @item spline
  12857. Simple spline consisting of two polynomials, joined by a single pivot point.
  12858. The parameter gives the pivot point (in PQ space), defaulting to @code{0.30}.
  12859. Can be used for both forward and inverse tone mapping.
  12860. @item reinhard
  12861. Simple non-linear, global tone mapping algorithm. The parameter specifies the
  12862. local contrast coefficient at the display peak. Essentially, a parameter of
  12863. @code{0.5} implies that the reference white will be about half as bright as
  12864. when clipping. Defaults to @code{0.5}, which results in the simplest
  12865. formulation of this function.
  12866. @item mobius
  12867. Generalization of the reinhard tone mapping algorithm to support an additional
  12868. linear slope near black. The tone mapping parameter indicates the trade-off
  12869. between the linear section and the non-linear section. Essentially, for a given
  12870. parameter @var{x}, every color value below @var{x} will be mapped linearly,
  12871. while higher values get non-linearly tone-mapped. Values near @code{1.0} make
  12872. this curve behave like @code{clip}, while values near @code{0.0} make this
  12873. curve behave like @code{reinhard}. The default value is @code{0.3}, which
  12874. provides a good balance between colorimetric accuracy and preserving
  12875. out-of-gamut details.
  12876. @item hable
  12877. Piece-wise, filmic tone-mapping algorithm developed by John Hable for use in
  12878. Uncharted 2, inspired by a similar tone-mapping algorithm used by Kodak.
  12879. Popularized by its use in video games with HDR rendering. Preserves both dark
  12880. and bright details very well, but comes with the drawback of changing the
  12881. average brightness quite significantly. This is sort of similar to
  12882. @code{reinhard} with parameter @code{0.24}.
  12883. @item gamma
  12884. Fits a gamma (power) function to transfer between the source and target color
  12885. spaces, effectively resulting in a perceptual hard-knee joining two roughly
  12886. linear sections. This preserves details at all scales fairly accurately, but
  12887. can result in an image with a muted or dull appearance. The parameter is used
  12888. as the cutoff point, defaulting to @code{0.5}.
  12889. @item linear
  12890. Linearly stretches the input range to the output range, in PQ space. This will
  12891. preserve all details accurately, but results in a significantly different
  12892. average brightness. Can be used for inverse tone-mapping in addition to regular
  12893. tone-mapping. The parameter can be used as an additional linear gain
  12894. coefficient (defaulting to @code{1.0}).
  12895. @end table
  12896. @item tonemapping_param
  12897. For tunable tone mapping functions, this parameter can be used to fine-tune the
  12898. curve behavior. Refer to the documentation of @code{tonemapping}. The default
  12899. value of @code{0.0} is replaced by the curve's preferred default setting.
  12900. @item inverse_tonemapping
  12901. If enabled, this filter will also attempt stretching SDR signals to fill HDR
  12902. output color volumes. Disabled by default.
  12903. @item tonemapping_lut_size
  12904. Size of the tone-mapping LUT, between @code{2} and @code{1024}. Defaults to
  12905. @code{256}. Note that this figure is squared when combined with
  12906. @code{peak_detect}.
  12907. @item contrast_recovery
  12908. Contrast recovery strength. If set to a value above @code{0.0}, the source
  12909. image will be divided into high-frequency and low-frequency components, and a
  12910. portion of the high-frequency image is added back onto the tone-mapped output.
  12911. May cause excessive ringing artifacts for some HDR sources, but can improve the
  12912. subjective sharpness and detail left over in the image after tone-mapping.
  12913. Defaults to @code{0.30}.
  12914. @item contrast_smoothness
  12915. Contrast recovery lowpass kernel size. Defaults to @code{3.5}. Increasing or
  12916. decreasing this will affect the visual appearance substantially. Has no effect
  12917. when @code{contrast_recovery} is disabled.
  12918. @end table
  12919. @subsubsection Dithering
  12920. By default, libplacebo will dither whenever necessary, which includes rendering
  12921. to any integer format below 16-bit precision. It's recommended to always leave
  12922. this on, since not doing so may result in visible banding in the output, even
  12923. if the @code{debanding} filter is enabled. If maximum performance is needed,
  12924. use @code{ordered_fixed} instead of disabling dithering.
  12925. @table @option
  12926. @item dithering
  12927. Dithering method to use. Accepts the following values:
  12928. @table @samp
  12929. @item none
  12930. Disables dithering completely. May result in visible banding.
  12931. @item blue
  12932. Dither with pseudo-blue noise. This is the default.
  12933. @item ordered
  12934. Tunable ordered dither pattern.
  12935. @item ordered_fixed
  12936. Faster ordered dither with a fixed size of @code{6}. Texture-less.
  12937. @item white
  12938. Dither with white noise. Texture-less.
  12939. @end table
  12940. @item dither_lut_size
  12941. Dither LUT size, as log base2 between @code{1} and @code{8}. Defaults to
  12942. @code{6}, corresponding to a LUT size of @code{64x64}.
  12943. @item dither_temporal
  12944. Enables temporal dithering. Disabled by default.
  12945. @end table
  12946. @subsubsection Custom shaders
  12947. libplacebo supports a number of custom shaders based on the mpv .hook GLSL
  12948. syntax. A collection of such shaders can be found here:
  12949. @url{https://github.com/mpv-player/mpv/wiki/User-Scripts#user-shaders}
  12950. A full description of the mpv shader format is beyond the scope of this
  12951. section, but a summary can be found here:
  12952. @url{https://mpv.io/manual/master/#options-glsl-shader}
  12953. @table @option
  12954. @item custom_shader_path
  12955. Specifies a path to a custom shader file to load at runtime.
  12956. @item custom_shader_bin
  12957. Specifies a complete custom shader as a raw string.
  12958. @end table
  12959. @subsubsection Debugging / performance
  12960. All of the options in this section default off. They may be of assistance when
  12961. attempting to squeeze the maximum performance at the cost of quality.
  12962. @table @option
  12963. @item skip_aa
  12964. Disable anti-aliasing when downscaling.
  12965. @item polar_cutoff
  12966. Truncate polar (EWA) scaler kernels below this absolute magnitude, between
  12967. @code{0.0} and @code{1.0}.
  12968. @item disable_linear
  12969. Disable linear light scaling.
  12970. @item disable_builtin
  12971. Disable built-in GPU sampling (forces LUT).
  12972. @item disable_fbos
  12973. Forcibly disable FBOs, resulting in loss of almost all functionality, but
  12974. offering the maximum possible speed.
  12975. @end table
  12976. @subsection Commands
  12977. This filter supports almost all of the above options as @ref{commands}.
  12978. @subsection Examples
  12979. @itemize
  12980. @item
  12981. Tone-map input to standard gamut BT.709 output:
  12982. @example
  12983. libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
  12984. @end example
  12985. @item
  12986. Rescale input to fit into standard 1080p, with high quality scaling:
  12987. @example
  12988. libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos
  12989. @end example
  12990. @item
  12991. Interpolate low FPS / VFR input to smoothed constant 60 fps output:
  12992. @example
  12993. libplacebo=fps=60:frame_mixer=mitchell_clamp
  12994. @end example
  12995. @item
  12996. Convert input to standard sRGB JPEG:
  12997. @example
  12998. libplacebo=format=yuv420p:colorspace=bt470bg:color_primaries=bt709:color_trc=iec61966-2-1:range=pc
  12999. @end example
  13000. @item
  13001. Use higher quality debanding settings:
  13002. @example
  13003. libplacebo=deband=true:deband_iterations=3:deband_radius=8:deband_threshold=6
  13004. @end example
  13005. @item
  13006. Run this filter on the CPU, on systems with Mesa installed (and with the most
  13007. expensive options disabled):
  13008. @example
  13009. ffmpeg ... -init_hw_device vulkan:llvmpipe ... -vf libplacebo=upscaler=none:downscaler=none:peak_detect=false
  13010. @end example
  13011. @item
  13012. Suppress CPU-based AV1/H.274 film grain application in the decoder, in favor of
  13013. doing it with this filter. Note that this is only a gain if the frames are
  13014. either already on the GPU, or if you're using libplacebo for other purposes,
  13015. since otherwise the VRAM roundtrip will more than offset any expected speedup.
  13016. @example
  13017. ffmpeg -export_side_data +film_grain ... -vf libplacebo=apply_filmgrain=true
  13018. @end example
  13019. @item
  13020. Interop with VAAPI hwdec to avoid round-tripping through RAM:
  13021. @example
  13022. ffmpeg -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi ... -vf libplacebo
  13023. @end example
  13024. @end itemize
  13025. @anchor{libvmaf}
  13026. @section libvmaf
  13027. Calculate the VMAF (Video Multi-Method Assessment Fusion) score for a
  13028. reference/distorted pair of input videos.
  13029. The first input is the distorted video, and the second input is the reference video.
  13030. The obtained VMAF score is printed through the logging system.
  13031. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  13032. After installing the library it can be enabled using:
  13033. @code{./configure --enable-libvmaf}.
  13034. The filter has following options:
  13035. @table @option
  13036. @item model
  13037. A `|` delimited list of vmaf models. Each model can be configured with a number of parameters.
  13038. Default value: @code{"version=vmaf_v0.6.1"}
  13039. @item feature
  13040. A `|` delimited list of features. Each feature can be configured with a number of parameters.
  13041. @item log_path
  13042. Set the file path to be used to store log files.
  13043. @item log_fmt
  13044. Set the format of the log file (xml, json, csv, or sub).
  13045. @item pool
  13046. Set the pool method to be used for computing vmaf.
  13047. Options are @code{min}, @code{harmonic_mean} or @code{mean} (default).
  13048. @item n_threads
  13049. Set number of threads to be used when initializing libvmaf.
  13050. Default value: @code{0}, no threads.
  13051. @item n_subsample
  13052. Set frame subsampling interval to be used.
  13053. @end table
  13054. This filter also supports the @ref{framesync} options.
  13055. @subsection Examples
  13056. @itemize
  13057. @item
  13058. In the examples below, a distorted video @file{distorted.mpg} is
  13059. compared with a reference file @file{reference.mpg}.
  13060. @item
  13061. Basic usage:
  13062. @example
  13063. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf=log_path=output.xml -f null -
  13064. @end example
  13065. @item
  13066. Example with multiple models:
  13067. @example
  13068. 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 -
  13069. @end example
  13070. @item
  13071. Example with multiple additional features:
  13072. @example
  13073. ffmpeg -i distorted.mpg -i reference.mpg -lavfi libvmaf='feature=name=psnr|name=ciede' -f null -
  13074. @end example
  13075. @item
  13076. Example with options and different containers:
  13077. @example
  13078. 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 -
  13079. @end example
  13080. @end itemize
  13081. @section libvmaf_cuda
  13082. This is the CUDA variant of the @ref{libvmaf} filter. It only accepts CUDA frames.
  13083. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  13084. After installing the library it can be enabled using:
  13085. @code{./configure --enable-nonfree --enable-ffnvcodec --enable-libvmaf}.
  13086. @subsection Examples
  13087. @itemize
  13088. @item
  13089. Basic usage showing CUVID hardware decoding and CUDA scaling with @ref{scale_cuda}:
  13090. @example
  13091. ffmpeg \
  13092. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i dis.obu \
  13093. -hwaccel cuda -hwaccel_output_format cuda -codec:v av1_cuvid -i ref.obu \
  13094. -filter_complex "
  13095. [0:v]scale_cuda=format=yuv420p[dis]; \
  13096. [1:v]scale_cuda=format=yuv420p[ref]; \
  13097. [dis][ref]libvmaf_cuda=log_fmt=json:log_path=output.json
  13098. " \
  13099. -f null -
  13100. @end example
  13101. @end itemize
  13102. @section limitdiff
  13103. Apply limited difference filter using second and optionally third video stream.
  13104. The filter accepts the following options:
  13105. @table @option
  13106. @item threshold
  13107. Set the threshold to use when allowing certain differences between video streams.
  13108. Any absolute difference value lower or exact than this threshold will pick pixel components from
  13109. first video stream.
  13110. @item elasticity
  13111. Set the elasticity of soft thresholding when processing video streams.
  13112. This value multiplied with first one sets second threshold.
  13113. Any absolute difference value greater or exact than second threshold will pick pixel components
  13114. from second video stream. For values between those two threshold
  13115. linear interpolation between first and second video stream will be used.
  13116. @item reference
  13117. Enable the reference (third) video stream processing. By default is disabled.
  13118. If set, this video stream will be used for calculating absolute difference with first video
  13119. stream.
  13120. @item planes
  13121. Specify which planes will be processed. Defaults to all available.
  13122. @end table
  13123. @subsection Commands
  13124. This filter supports the all above options as @ref{commands} except option @samp{reference}.
  13125. @section limiter
  13126. Limits the pixel components values to the specified range [min, max].
  13127. The filter accepts the following options:
  13128. @table @option
  13129. @item min
  13130. Lower bound. Defaults to the lowest allowed value for the input.
  13131. @item max
  13132. Upper bound. Defaults to the highest allowed value for the input.
  13133. @item planes
  13134. Specify which planes will be processed. Defaults to all available.
  13135. @end table
  13136. @subsection Commands
  13137. This filter supports the all above options as @ref{commands}.
  13138. @section loop
  13139. Loop video frames.
  13140. The filter accepts the following options:
  13141. @table @option
  13142. @item loop
  13143. Set the number of loops. Setting this value to -1 will result in infinite loops.
  13144. Default is 0.
  13145. @item size
  13146. Set maximal size in number of frames. Default is 0.
  13147. @item start
  13148. Set first frame of loop. Default is 0.
  13149. @item time
  13150. Set the time of loop start in seconds.
  13151. Only used if option named @var{start} is set to @code{-1}.
  13152. @end table
  13153. @subsection Examples
  13154. @itemize
  13155. @item
  13156. Loop single first frame infinitely:
  13157. @example
  13158. loop=loop=-1:size=1:start=0
  13159. @end example
  13160. @item
  13161. Loop single first frame 10 times:
  13162. @example
  13163. loop=loop=10:size=1:start=0
  13164. @end example
  13165. @item
  13166. Loop 10 first frames 5 times:
  13167. @example
  13168. loop=loop=5:size=10:start=0
  13169. @end example
  13170. @end itemize
  13171. @section lut1d
  13172. Apply a 1D LUT to an input video.
  13173. The filter accepts the following options:
  13174. @table @option
  13175. @item file
  13176. Set the 1D LUT file name.
  13177. Currently supported formats:
  13178. @table @samp
  13179. @item cube
  13180. Iridas
  13181. @item csp
  13182. cineSpace
  13183. @end table
  13184. @item interp
  13185. Select interpolation mode.
  13186. Available values are:
  13187. @table @samp
  13188. @item nearest
  13189. Use values from the nearest defined point.
  13190. @item linear
  13191. Interpolate values using the linear interpolation.
  13192. @item cosine
  13193. Interpolate values using the cosine interpolation.
  13194. @item cubic
  13195. Interpolate values using the cubic interpolation.
  13196. @item spline
  13197. Interpolate values using the spline interpolation.
  13198. @end table
  13199. @end table
  13200. @subsection Commands
  13201. This filter supports the all above options as @ref{commands}.
  13202. @anchor{lut3d}
  13203. @section lut3d
  13204. Apply a 3D LUT to an input video.
  13205. The filter accepts the following options:
  13206. @table @option
  13207. @item file
  13208. Set the 3D LUT file name.
  13209. Currently supported formats:
  13210. @table @samp
  13211. @item 3dl
  13212. AfterEffects
  13213. @item cube
  13214. Iridas
  13215. @item dat
  13216. DaVinci
  13217. @item m3d
  13218. Pandora
  13219. @item csp
  13220. cineSpace
  13221. @end table
  13222. @item interp
  13223. Select interpolation mode.
  13224. Available values are:
  13225. @table @samp
  13226. @item nearest
  13227. Use values from the nearest defined point.
  13228. @item trilinear
  13229. Interpolate values using the 8 points defining a cube.
  13230. @item tetrahedral
  13231. Interpolate values using a tetrahedron.
  13232. @item pyramid
  13233. Interpolate values using a pyramid.
  13234. @item prism
  13235. Interpolate values using a prism.
  13236. @end table
  13237. @end table
  13238. @subsection Commands
  13239. This filter supports the @code{interp} option as @ref{commands}.
  13240. @section lumakey
  13241. Turn certain luma values into transparency.
  13242. The filter accepts the following options:
  13243. @table @option
  13244. @item threshold
  13245. Set the luma which will be used as base for transparency.
  13246. Default value is @code{0}.
  13247. @item tolerance
  13248. Set the range of luma values to be keyed out.
  13249. Default value is @code{0.01}.
  13250. @item softness
  13251. Set the range of softness. Default value is @code{0}.
  13252. Use this to control gradual transition from zero to full transparency.
  13253. @end table
  13254. @subsection Commands
  13255. This filter supports same @ref{commands} as options.
  13256. The command accepts the same syntax of the corresponding option.
  13257. If the specified expression is not valid, it is kept at its current
  13258. value.
  13259. @anchor{lutrgb}
  13260. @anchor{lutyuv}
  13261. @anchor{lut}
  13262. @section lut, lutrgb, lutyuv
  13263. Compute a look-up table for binding each pixel component input value
  13264. to an output value, and apply it to the input video.
  13265. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  13266. to an RGB input video.
  13267. These filters accept the following parameters:
  13268. @table @option
  13269. @item c0
  13270. set first pixel component expression
  13271. @item c1
  13272. set second pixel component expression
  13273. @item c2
  13274. set third pixel component expression
  13275. @item c3
  13276. set fourth pixel component expression, corresponds to the alpha component
  13277. @item r
  13278. set red component expression
  13279. @item g
  13280. set green component expression
  13281. @item b
  13282. set blue component expression
  13283. @item a
  13284. alpha component expression
  13285. @item y
  13286. set Y/luma component expression
  13287. @item u
  13288. set U/Cb component expression
  13289. @item v
  13290. set V/Cr component expression
  13291. @end table
  13292. Each of them specifies the expression to use for computing the lookup table for
  13293. the corresponding pixel component values.
  13294. The exact component associated to each of the @var{c*} options depends on the
  13295. format in input.
  13296. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  13297. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  13298. The expressions can contain the following constants and functions:
  13299. @table @option
  13300. @item w
  13301. @item h
  13302. The input width and height.
  13303. @item val
  13304. The input value for the pixel component.
  13305. @item clipval
  13306. The input value, clipped to the @var{minval}-@var{maxval} range.
  13307. @item maxval
  13308. The maximum value for the pixel component.
  13309. @item minval
  13310. The minimum value for the pixel component.
  13311. @item negval
  13312. The negated value for the pixel component value, clipped to the
  13313. @var{minval}-@var{maxval} range; it corresponds to the expression
  13314. "maxval-clipval+minval".
  13315. @item clip(val)
  13316. The computed value in @var{val}, clipped to the
  13317. @var{minval}-@var{maxval} range.
  13318. @item gammaval(gamma)
  13319. The computed gamma correction value of the pixel component value,
  13320. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  13321. expression
  13322. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  13323. @end table
  13324. All expressions default to "clipval".
  13325. @subsection Commands
  13326. This filter supports same @ref{commands} as options.
  13327. @subsection Examples
  13328. @itemize
  13329. @item
  13330. Negate input video:
  13331. @example
  13332. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  13333. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  13334. @end example
  13335. The above is the same as:
  13336. @example
  13337. lutrgb="r=negval:g=negval:b=negval"
  13338. lutyuv="y=negval:u=negval:v=negval"
  13339. @end example
  13340. @item
  13341. Negate luma:
  13342. @example
  13343. lutyuv=y=negval
  13344. @end example
  13345. @item
  13346. Remove chroma components, turning the video into a graytone image:
  13347. @example
  13348. lutyuv="u=128:v=128"
  13349. @end example
  13350. @item
  13351. Apply a luma burning effect:
  13352. @example
  13353. lutyuv="y=2*val"
  13354. @end example
  13355. @item
  13356. Remove green and blue components:
  13357. @example
  13358. lutrgb="g=0:b=0"
  13359. @end example
  13360. @item
  13361. Set a constant alpha channel value on input:
  13362. @example
  13363. format=rgba,lutrgb=a="maxval-minval/2"
  13364. @end example
  13365. @item
  13366. Correct luma gamma by a factor of 0.5:
  13367. @example
  13368. lutyuv=y=gammaval(0.5)
  13369. @end example
  13370. @item
  13371. Discard least significant bits of luma:
  13372. @example
  13373. lutyuv=y='bitand(val, 128+64+32)'
  13374. @end example
  13375. @item
  13376. Technicolor like effect:
  13377. @example
  13378. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  13379. @end example
  13380. @end itemize
  13381. @section lut2, tlut2
  13382. The @code{lut2} filter takes two input streams and outputs one
  13383. stream.
  13384. The @code{tlut2} (time lut2) filter takes two consecutive frames
  13385. from one single stream.
  13386. This filter accepts the following parameters:
  13387. @table @option
  13388. @item c0
  13389. set first pixel component expression
  13390. @item c1
  13391. set second pixel component expression
  13392. @item c2
  13393. set third pixel component expression
  13394. @item c3
  13395. set fourth pixel component expression, corresponds to the alpha component
  13396. @item d
  13397. set output bit depth, only available for @code{lut2} filter. By default is 0,
  13398. which means bit depth is automatically picked from first input format.
  13399. @end table
  13400. The @code{lut2} filter also supports the @ref{framesync} options.
  13401. Each of them specifies the expression to use for computing the lookup table for
  13402. the corresponding pixel component values.
  13403. The exact component associated to each of the @var{c*} options depends on the
  13404. format in inputs.
  13405. The expressions can contain the following constants:
  13406. @table @option
  13407. @item w
  13408. @item h
  13409. The input width and height.
  13410. @item x
  13411. The first input value for the pixel component.
  13412. @item y
  13413. The second input value for the pixel component.
  13414. @item bdx
  13415. The first input video bit depth.
  13416. @item bdy
  13417. The second input video bit depth.
  13418. @end table
  13419. All expressions default to "x".
  13420. @subsection Commands
  13421. This filter supports the all above options as @ref{commands} except option @code{d}.
  13422. @subsection Examples
  13423. @itemize
  13424. @item
  13425. Highlight differences between two RGB video streams:
  13426. @example
  13427. 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)'
  13428. @end example
  13429. @item
  13430. Highlight differences between two YUV video streams:
  13431. @example
  13432. 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)'
  13433. @end example
  13434. @item
  13435. Show max difference between two video streams:
  13436. @example
  13437. 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)))'
  13438. @end example
  13439. @end itemize
  13440. @section maskedclamp
  13441. Clamp the first input stream with the second input and third input stream.
  13442. Returns the value of first stream to be between second input
  13443. stream - @code{undershoot} and third input stream + @code{overshoot}.
  13444. This filter accepts the following options:
  13445. @table @option
  13446. @item undershoot
  13447. Default value is @code{0}.
  13448. @item overshoot
  13449. Default value is @code{0}.
  13450. @item planes
  13451. Set which planes will be processed as bitmap, unprocessed planes will be
  13452. copied from first stream.
  13453. By default value 0xf, all planes will be processed.
  13454. @end table
  13455. @subsection Commands
  13456. This filter supports the all above options as @ref{commands}.
  13457. @section maskedmax
  13458. Merge the second and third input stream into output stream using absolute differences
  13459. between second input stream and first input stream and absolute difference between
  13460. third input stream and first input stream. The picked value will be from second input
  13461. stream if second absolute difference is greater than first one or from third input stream
  13462. otherwise.
  13463. This filter accepts the following options:
  13464. @table @option
  13465. @item planes
  13466. Set which planes will be processed as bitmap, unprocessed planes will be
  13467. copied from first stream.
  13468. By default value 0xf, all planes will be processed.
  13469. @end table
  13470. @subsection Commands
  13471. This filter supports the all above options as @ref{commands}.
  13472. @section maskedmerge
  13473. Merge the first input stream with the second input stream using per pixel
  13474. weights in the third input stream.
  13475. A value of 0 in the third stream pixel component means that pixel component
  13476. from first stream is returned unchanged, while maximum value (eg. 255 for
  13477. 8-bit videos) means that pixel component from second stream is returned
  13478. unchanged. Intermediate values define the amount of merging between both
  13479. input stream's pixel components.
  13480. This filter accepts the following options:
  13481. @table @option
  13482. @item planes
  13483. Set which planes will be processed as bitmap, unprocessed planes will be
  13484. copied from first stream.
  13485. By default value 0xf, all planes will be processed.
  13486. @end table
  13487. @subsection Commands
  13488. This filter supports the all above options as @ref{commands}.
  13489. @section maskedmin
  13490. Merge the second and third input stream into output stream using absolute differences
  13491. between second input stream and first input stream and absolute difference between
  13492. third input stream and first input stream. The picked value will be from second input
  13493. stream if second absolute difference is less than first one or from third input stream
  13494. otherwise.
  13495. This filter accepts the following options:
  13496. @table @option
  13497. @item planes
  13498. Set which planes will be processed as bitmap, unprocessed planes will be
  13499. copied from first stream.
  13500. By default value 0xf, all planes will be processed.
  13501. @end table
  13502. @subsection Commands
  13503. This filter supports the all above options as @ref{commands}.
  13504. @section maskedthreshold
  13505. Pick pixels comparing absolute difference of two video streams with fixed
  13506. threshold.
  13507. If absolute difference between pixel component of first and second video
  13508. stream is equal or lower than user supplied threshold than pixel component
  13509. from first video stream is picked, otherwise pixel component from second
  13510. video stream is picked.
  13511. This filter accepts the following options:
  13512. @table @option
  13513. @item threshold
  13514. Set threshold used when picking pixels from absolute difference from two input
  13515. video streams.
  13516. @item planes
  13517. Set which planes will be processed as bitmap, unprocessed planes will be
  13518. copied from second stream.
  13519. By default value 0xf, all planes will be processed.
  13520. @item mode
  13521. Set mode of filter operation. Can be @code{abs} or @code{diff}.
  13522. Default is @code{abs}.
  13523. @end table
  13524. @subsection Commands
  13525. This filter supports the all above options as @ref{commands}.
  13526. @section maskfun
  13527. Create mask from input video.
  13528. For example it is useful to create motion masks after @code{tblend} filter.
  13529. This filter accepts the following options:
  13530. @table @option
  13531. @item low
  13532. Set low threshold. Any pixel component lower or exact than this value will be set to 0.
  13533. @item high
  13534. Set high threshold. Any pixel component higher than this value will be set to max value
  13535. allowed for current pixel format.
  13536. @item planes
  13537. Set planes to filter, by default all available planes are filtered.
  13538. @item fill
  13539. Fill all frame pixels with this value.
  13540. @item sum
  13541. Set max average pixel value for frame. If sum of all pixel components is higher that this
  13542. average, output frame will be completely filled with value set by @var{fill} option.
  13543. Typically useful for scene changes when used in combination with @code{tblend} filter.
  13544. @end table
  13545. @subsection Commands
  13546. This filter supports the all above options as @ref{commands}.
  13547. @section mcdeint
  13548. Apply motion-compensation deinterlacing.
  13549. It needs one field per frame as input and must thus be used together
  13550. with yadif=1/3 or equivalent.
  13551. This filter accepts the following options:
  13552. @table @option
  13553. @item mode
  13554. Set the deinterlacing mode.
  13555. It accepts one of the following values:
  13556. @table @samp
  13557. @item fast
  13558. @item medium
  13559. @item slow
  13560. use iterative motion estimation
  13561. @item extra_slow
  13562. like @samp{slow}, but use multiple reference frames.
  13563. @end table
  13564. Default value is @samp{fast}.
  13565. @item parity
  13566. Set the picture field parity assumed for the input video. It must be
  13567. one of the following values:
  13568. @table @samp
  13569. @item 0, tff
  13570. assume top field first
  13571. @item 1, bff
  13572. assume bottom field first
  13573. @end table
  13574. Default value is @samp{bff}.
  13575. @item qp
  13576. Set per-block quantization parameter (QP) used by the internal
  13577. encoder.
  13578. Higher values should result in a smoother motion vector field but less
  13579. optimal individual vectors. Default value is 1.
  13580. @end table
  13581. @section median
  13582. Pick median pixel from certain rectangle defined by radius.
  13583. This filter accepts the following options:
  13584. @table @option
  13585. @item radius
  13586. Set horizontal radius size. Default value is @code{1}.
  13587. Allowed range is integer from 1 to 127.
  13588. @item planes
  13589. Set which planes to process. Default is @code{15}, which is all available planes.
  13590. @item radiusV
  13591. Set vertical radius size. Default value is @code{0}.
  13592. Allowed range is integer from 0 to 127.
  13593. If it is 0, value will be picked from horizontal @code{radius} option.
  13594. @item percentile
  13595. Set median percentile. Default value is @code{0.5}.
  13596. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  13597. minimum values, and @code{1} maximum values.
  13598. @end table
  13599. @subsection Commands
  13600. This filter supports same @ref{commands} as options.
  13601. The command accepts the same syntax of the corresponding option.
  13602. If the specified expression is not valid, it is kept at its current
  13603. value.
  13604. @section mergeplanes
  13605. Merge color channel components from several video streams.
  13606. The filter accepts up to 4 input streams, and merge selected input
  13607. planes to the output video.
  13608. This filter accepts the following options:
  13609. @table @option
  13610. @item mapping
  13611. Set input to output plane mapping. Default is @code{0}.
  13612. The mappings is specified as a bitmap. It should be specified as a
  13613. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  13614. mapping for the first plane of the output stream. 'A' sets the number of
  13615. the input stream to use (from 0 to 3), and 'a' the plane number of the
  13616. corresponding input to use (from 0 to 3). The rest of the mappings is
  13617. similar, 'Bb' describes the mapping for the output stream second
  13618. plane, 'Cc' describes the mapping for the output stream third plane and
  13619. 'Dd' describes the mapping for the output stream fourth plane.
  13620. @item format
  13621. Set output pixel format. Default is @code{yuva444p}.
  13622. @item map0s
  13623. @item map1s
  13624. @item map2s
  13625. @item map3s
  13626. Set input to output stream mapping for output Nth plane. Default is @code{0}.
  13627. @item map0p
  13628. @item map1p
  13629. @item map2p
  13630. @item map3p
  13631. Set input to output plane mapping for output Nth plane. Default is @code{0}.
  13632. @end table
  13633. @subsection Examples
  13634. @itemize
  13635. @item
  13636. Merge three gray video streams of same width and height into single video stream:
  13637. @example
  13638. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  13639. @end example
  13640. @item
  13641. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  13642. @example
  13643. [a0][a1]mergeplanes=0x00010210:yuva444p
  13644. @end example
  13645. @item
  13646. Swap Y and A plane in yuva444p stream:
  13647. @example
  13648. format=yuva444p,mergeplanes=0x03010200:yuva444p
  13649. @end example
  13650. @item
  13651. Swap U and V plane in yuv420p stream:
  13652. @example
  13653. format=yuv420p,mergeplanes=0x000201:yuv420p
  13654. @end example
  13655. @item
  13656. Cast a rgb24 clip to yuv444p:
  13657. @example
  13658. format=rgb24,mergeplanes=0x000102:yuv444p
  13659. @end example
  13660. @end itemize
  13661. @section mestimate
  13662. Estimate and export motion vectors using block matching algorithms.
  13663. Motion vectors are stored in frame side data to be used by other filters.
  13664. This filter accepts the following options:
  13665. @table @option
  13666. @item method
  13667. Specify the motion estimation method. Accepts one of the following values:
  13668. @table @samp
  13669. @item esa
  13670. Exhaustive search algorithm.
  13671. @item tss
  13672. Three step search algorithm.
  13673. @item tdls
  13674. Two dimensional logarithmic search algorithm.
  13675. @item ntss
  13676. New three step search algorithm.
  13677. @item fss
  13678. Four step search algorithm.
  13679. @item ds
  13680. Diamond search algorithm.
  13681. @item hexbs
  13682. Hexagon-based search algorithm.
  13683. @item epzs
  13684. Enhanced predictive zonal search algorithm.
  13685. @item umh
  13686. Uneven multi-hexagon search algorithm.
  13687. @end table
  13688. Default value is @samp{esa}.
  13689. @item mb_size
  13690. Macroblock size. Default @code{16}.
  13691. @item search_param
  13692. Search parameter. Default @code{7}.
  13693. @end table
  13694. @section midequalizer
  13695. Apply Midway Image Equalization effect using two video streams.
  13696. Midway Image Equalization adjusts a pair of images to have the same
  13697. histogram, while maintaining their dynamics as much as possible. It's
  13698. useful for e.g. matching exposures from a pair of stereo cameras.
  13699. This filter has two inputs and one output, which must be of same pixel format, but
  13700. may be of different sizes. The output of filter is first input adjusted with
  13701. midway histogram of both inputs.
  13702. This filter accepts the following option:
  13703. @table @option
  13704. @item planes
  13705. Set which planes to process. Default is @code{15}, which is all available planes.
  13706. @end table
  13707. @section minterpolate
  13708. Convert the video to specified frame rate using motion interpolation.
  13709. This filter accepts the following options:
  13710. @table @option
  13711. @item fps
  13712. 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}.
  13713. @item mi_mode
  13714. Motion interpolation mode. Following values are accepted:
  13715. @table @samp
  13716. @item dup
  13717. Duplicate previous or next frame for interpolating new ones.
  13718. @item blend
  13719. Blend source frames. Interpolated frame is mean of previous and next frames.
  13720. @item mci
  13721. Motion compensated interpolation. Following options are effective when this mode is selected:
  13722. @table @samp
  13723. @item mc_mode
  13724. Motion compensation mode. Following values are accepted:
  13725. @table @samp
  13726. @item obmc
  13727. Overlapped block motion compensation.
  13728. @item aobmc
  13729. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  13730. @end table
  13731. Default mode is @samp{obmc}.
  13732. @item me_mode
  13733. Motion estimation mode. Following values are accepted:
  13734. @table @samp
  13735. @item bidir
  13736. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  13737. @item bilat
  13738. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  13739. @end table
  13740. Default mode is @samp{bilat}.
  13741. @item me
  13742. The algorithm to be used for motion estimation. Following values are accepted:
  13743. @table @samp
  13744. @item esa
  13745. Exhaustive search algorithm.
  13746. @item tss
  13747. Three step search algorithm.
  13748. @item tdls
  13749. Two dimensional logarithmic search algorithm.
  13750. @item ntss
  13751. New three step search algorithm.
  13752. @item fss
  13753. Four step search algorithm.
  13754. @item ds
  13755. Diamond search algorithm.
  13756. @item hexbs
  13757. Hexagon-based search algorithm.
  13758. @item epzs
  13759. Enhanced predictive zonal search algorithm.
  13760. @item umh
  13761. Uneven multi-hexagon search algorithm.
  13762. @end table
  13763. Default algorithm is @samp{epzs}.
  13764. @item mb_size
  13765. Macroblock size. Default @code{16}.
  13766. @item search_param
  13767. Motion estimation search parameter. Default @code{32}.
  13768. @item vsbmc
  13769. 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).
  13770. @end table
  13771. @end table
  13772. @item scd
  13773. 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:
  13774. @table @samp
  13775. @item none
  13776. Disable scene change detection.
  13777. @item fdiff
  13778. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  13779. @end table
  13780. Default method is @samp{fdiff}.
  13781. @item scd_threshold
  13782. Scene change detection threshold. Default is @code{10.}.
  13783. @end table
  13784. @section mix
  13785. Mix several video input streams into one video stream.
  13786. A description of the accepted options follows.
  13787. @table @option
  13788. @item inputs
  13789. The number of inputs. If unspecified, it defaults to 2.
  13790. @item weights
  13791. Specify weight of each input video stream as sequence.
  13792. Each weight is separated by space. If number of weights
  13793. is smaller than number of @var{frames} last specified
  13794. weight will be used for all remaining unset weights.
  13795. @item scale
  13796. Specify scale, if it is set it will be multiplied with sum
  13797. of each weight multiplied with pixel values to give final destination
  13798. pixel value. By default @var{scale} is auto scaled to sum of weights.
  13799. @item planes
  13800. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  13801. @item duration
  13802. Specify how end of stream is determined.
  13803. @table @samp
  13804. @item longest
  13805. The duration of the longest input. (default)
  13806. @item shortest
  13807. The duration of the shortest input.
  13808. @item first
  13809. The duration of the first input.
  13810. @end table
  13811. @end table
  13812. @subsection Commands
  13813. This filter supports the following commands:
  13814. @table @option
  13815. @item weights
  13816. @item scale
  13817. @item planes
  13818. Syntax is same as option with same name.
  13819. @end table
  13820. @section monochrome
  13821. Convert video to gray using custom color filter.
  13822. A description of the accepted options follows.
  13823. @table @option
  13824. @item cb
  13825. Set the chroma blue spot. Allowed range is from -1 to 1.
  13826. Default value is 0.
  13827. @item cr
  13828. Set the chroma red spot. Allowed range is from -1 to 1.
  13829. Default value is 0.
  13830. @item size
  13831. Set the color filter size. Allowed range is from .1 to 10.
  13832. Default value is 1.
  13833. @item high
  13834. Set the highlights strength. Allowed range is from 0 to 1.
  13835. Default value is 0.
  13836. @end table
  13837. @subsection Commands
  13838. This filter supports the all above options as @ref{commands}.
  13839. @section morpho
  13840. This filter allows to apply main morphological grayscale transforms,
  13841. erode and dilate with arbitrary structures set in second input stream.
  13842. Unlike naive implementation and much slower performance in @ref{erosion}
  13843. and @ref{dilation} filters, when speed is critical @code{morpho} filter
  13844. should be used instead.
  13845. A description of accepted options follows,
  13846. @table @option
  13847. @item mode
  13848. Set morphological transform to apply, can be:
  13849. @table @samp
  13850. @item erode
  13851. @item dilate
  13852. @item open
  13853. @item close
  13854. @item gradient
  13855. @item tophat
  13856. @item blackhat
  13857. @end table
  13858. Default is @code{erode}.
  13859. @item planes
  13860. Set planes to filter, by default all planes except alpha are filtered.
  13861. @item structure
  13862. Set which structure video frames will be processed from second input stream,
  13863. can be @var{first} or @var{all}. Default is @var{all}.
  13864. @end table
  13865. The @code{morpho} filter also supports the @ref{framesync} options.
  13866. @subsection Commands
  13867. This filter supports same @ref{commands} as options.
  13868. @section mpdecimate
  13869. Drop frames that do not differ greatly from the previous frame in
  13870. order to reduce frame rate.
  13871. The main use of this filter is for very-low-bitrate encoding
  13872. (e.g. streaming over dialup modem), but it could in theory be used for
  13873. fixing movies that were inverse-telecined incorrectly.
  13874. A description of the accepted options follows.
  13875. @table @option
  13876. @item max
  13877. Set the maximum number of consecutive frames which can be dropped (if
  13878. positive), or the minimum interval between dropped frames (if
  13879. negative). If the value is 0, the frame is dropped disregarding the
  13880. number of previous sequentially dropped frames.
  13881. Default value is 0.
  13882. @item keep
  13883. Set the maximum number of consecutive similar frames to ignore before to start dropping them.
  13884. If the value is 0, the frame is dropped disregarding the
  13885. number of previous sequentially similar frames.
  13886. Default value is 0.
  13887. @item hi
  13888. @item lo
  13889. @item frac
  13890. Set the dropping threshold values.
  13891. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  13892. represent actual pixel value differences, so a threshold of 64
  13893. corresponds to 1 unit of difference for each pixel, or the same spread
  13894. out differently over the block.
  13895. A frame is a candidate for dropping if no 8x8 blocks differ by more
  13896. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  13897. meaning the whole image) differ by more than a threshold of @option{lo}.
  13898. Default value for @option{hi} is 64*12, default value for @option{lo} is
  13899. 64*5, and default value for @option{frac} is 0.33.
  13900. @end table
  13901. @section msad
  13902. Obtain the MSAD (Mean Sum of Absolute Differences) between two input videos.
  13903. This filter takes two input videos.
  13904. Both input videos must have the same resolution and pixel format for
  13905. this filter to work correctly. Also it assumes that both inputs
  13906. have the same number of frames, which are compared one by one.
  13907. The obtained per component, average, min and max MSAD is printed through
  13908. the logging system.
  13909. The filter stores the calculated MSAD of each frame in frame metadata.
  13910. This filter also supports the @ref{framesync} options.
  13911. In the below example the input file @file{main.mpg} being processed is compared
  13912. with the reference file @file{ref.mpg}.
  13913. @example
  13914. ffmpeg -i main.mpg -i ref.mpg -lavfi msad -f null -
  13915. @end example
  13916. @section multiply
  13917. Multiply first video stream pixels values with second video stream pixels values.
  13918. The filter accepts the following options:
  13919. @table @option
  13920. @item scale
  13921. Set the scale applied to second video stream. By default is @code{1}.
  13922. Allowed range is from @code{0} to @code{9}.
  13923. @item offset
  13924. Set the offset applied to second video stream. By default is @code{0.5}.
  13925. Allowed range is from @code{-1} to @code{1}.
  13926. @item planes
  13927. Specify planes from input video stream that will be processed.
  13928. By default all planes are processed.
  13929. @end table
  13930. @subsection Commands
  13931. This filter supports same @ref{commands} as options.
  13932. @section negate
  13933. Negate (invert) the input video.
  13934. It accepts the following option:
  13935. @table @option
  13936. @item components
  13937. Set components to negate.
  13938. Available values for components are:
  13939. @table @samp
  13940. @item y
  13941. @item u
  13942. @item v
  13943. @item a
  13944. @item r
  13945. @item g
  13946. @item b
  13947. @end table
  13948. @item negate_alpha
  13949. With value 1, it negates the alpha component, if present. Default value is 0.
  13950. @end table
  13951. @subsection Commands
  13952. This filter supports same @ref{commands} as options.
  13953. @anchor{nlmeans}
  13954. @section nlmeans
  13955. Denoise frames using Non-Local Means algorithm.
  13956. Each pixel is adjusted by looking for other pixels with similar contexts. This
  13957. context similarity is defined by comparing their surrounding patches of size
  13958. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  13959. around the pixel.
  13960. Note that the research area defines centers for patches, which means some
  13961. patches will be made of pixels outside that research area.
  13962. The filter accepts the following options.
  13963. @table @option
  13964. @item s
  13965. Set denoising strength. Default is 1.0. Must be in range [1.0, 30.0].
  13966. @item p
  13967. Set patch size. Default is 7. Must be odd number in range [0, 99].
  13968. @item pc
  13969. Same as @option{p} but for chroma planes.
  13970. The default value is @var{0} and means automatic.
  13971. @item r
  13972. Set research size. Default is 15. Must be odd number in range [0, 99].
  13973. @item rc
  13974. Same as @option{r} but for chroma planes.
  13975. The default value is @var{0} and means automatic.
  13976. @end table
  13977. @section nnedi
  13978. Deinterlace video using neural network edge directed interpolation.
  13979. This filter accepts the following options:
  13980. @table @option
  13981. @item weights
  13982. Mandatory option, without binary file filter can not work.
  13983. Currently file can be found here:
  13984. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  13985. @item deint
  13986. Set which frames to deinterlace, by default it is @code{all}.
  13987. Can be @code{all} or @code{interlaced}.
  13988. @item field
  13989. Set mode of operation.
  13990. Can be one of the following:
  13991. @table @samp
  13992. @item af
  13993. Use frame flags, both fields.
  13994. @item a
  13995. Use frame flags, single field.
  13996. @item t
  13997. Use top field only.
  13998. @item b
  13999. Use bottom field only.
  14000. @item tf
  14001. Use both fields, top first.
  14002. @item bf
  14003. Use both fields, bottom first.
  14004. @end table
  14005. @item planes
  14006. Set which planes to process, by default filter process all frames.
  14007. @item nsize
  14008. Set size of local neighborhood around each pixel, used by the predictor neural
  14009. network.
  14010. Can be one of the following:
  14011. @table @samp
  14012. @item s8x6
  14013. @item s16x6
  14014. @item s32x6
  14015. @item s48x6
  14016. @item s8x4
  14017. @item s16x4
  14018. @item s32x4
  14019. @end table
  14020. @item nns
  14021. Set the number of neurons in predictor neural network.
  14022. Can be one of the following:
  14023. @table @samp
  14024. @item n16
  14025. @item n32
  14026. @item n64
  14027. @item n128
  14028. @item n256
  14029. @end table
  14030. @item qual
  14031. Controls the number of different neural network predictions that are blended
  14032. together to compute the final output value. Can be @code{fast}, default or
  14033. @code{slow}.
  14034. @item etype
  14035. Set which set of weights to use in the predictor.
  14036. Can be one of the following:
  14037. @table @samp
  14038. @item a, abs
  14039. weights trained to minimize absolute error
  14040. @item s, mse
  14041. weights trained to minimize squared error
  14042. @end table
  14043. @item pscrn
  14044. Controls whether or not the prescreener neural network is used to decide
  14045. which pixels should be processed by the predictor neural network and which
  14046. can be handled by simple cubic interpolation.
  14047. The prescreener is trained to know whether cubic interpolation will be
  14048. sufficient for a pixel or whether it should be predicted by the predictor nn.
  14049. The computational complexity of the prescreener nn is much less than that of
  14050. the predictor nn. Since most pixels can be handled by cubic interpolation,
  14051. using the prescreener generally results in much faster processing.
  14052. The prescreener is pretty accurate, so the difference between using it and not
  14053. using it is almost always unnoticeable.
  14054. Can be one of the following:
  14055. @table @samp
  14056. @item none
  14057. @item original
  14058. @item new
  14059. @item new2
  14060. @item new3
  14061. @end table
  14062. Default is @code{new}.
  14063. @end table
  14064. @subsection Commands
  14065. This filter supports same @ref{commands} as options, excluding @var{weights} option.
  14066. @section noformat
  14067. Force libavfilter not to use any of the specified pixel formats for the
  14068. input to the next filter.
  14069. It accepts the following parameters:
  14070. @table @option
  14071. @item pix_fmts
  14072. A '|'-separated list of pixel format names, such as
  14073. pix_fmts=yuv420p|monow|rgb24".
  14074. @end table
  14075. @subsection Examples
  14076. @itemize
  14077. @item
  14078. Force libavfilter to use a format different from @var{yuv420p} for the
  14079. input to the vflip filter:
  14080. @example
  14081. noformat=pix_fmts=yuv420p,vflip
  14082. @end example
  14083. @item
  14084. Convert the input video to any of the formats not contained in the list:
  14085. @example
  14086. noformat=yuv420p|yuv444p|yuv410p
  14087. @end example
  14088. @end itemize
  14089. @section noise
  14090. Add noise on video input frame.
  14091. The filter accepts the following options:
  14092. @table @option
  14093. @item all_seed
  14094. @item c0_seed
  14095. @item c1_seed
  14096. @item c2_seed
  14097. @item c3_seed
  14098. Set noise seed for specific pixel component or all pixel components in case
  14099. of @var{all_seed}. Default value is @code{123457}.
  14100. @item all_strength, alls
  14101. @item c0_strength, c0s
  14102. @item c1_strength, c1s
  14103. @item c2_strength, c2s
  14104. @item c3_strength, c3s
  14105. Set noise strength for specific pixel component or all pixel components in case
  14106. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  14107. @item all_flags, allf
  14108. @item c0_flags, c0f
  14109. @item c1_flags, c1f
  14110. @item c2_flags, c2f
  14111. @item c3_flags, c3f
  14112. Set pixel component flags or set flags for all components if @var{all_flags}.
  14113. Available values for component flags are:
  14114. @table @samp
  14115. @item a
  14116. averaged temporal noise (smoother)
  14117. @item p
  14118. mix random noise with a (semi)regular pattern
  14119. @item t
  14120. temporal noise (noise pattern changes between frames)
  14121. @item u
  14122. uniform noise (gaussian otherwise)
  14123. @end table
  14124. @end table
  14125. @subsection Examples
  14126. Add temporal and uniform noise to input video:
  14127. @example
  14128. noise=alls=20:allf=t+u
  14129. @end example
  14130. @section normalize
  14131. Normalize RGB video (aka histogram stretching, contrast stretching).
  14132. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  14133. For each channel of each frame, the filter computes the input range and maps
  14134. it linearly to the user-specified output range. The output range defaults
  14135. to the full dynamic range from pure black to pure white.
  14136. Temporal smoothing can be used on the input range to reduce flickering (rapid
  14137. changes in brightness) caused when small dark or bright objects enter or leave
  14138. the scene. This is similar to the auto-exposure (automatic gain control) on a
  14139. video camera, and, like a video camera, it may cause a period of over- or
  14140. under-exposure of the video.
  14141. The R,G,B channels can be normalized independently, which may cause some
  14142. color shifting, or linked together as a single channel, which prevents
  14143. color shifting. Linked normalization preserves hue. Independent normalization
  14144. does not, so it can be used to remove some color casts. Independent and linked
  14145. normalization can be combined in any ratio.
  14146. The normalize filter accepts the following options:
  14147. @table @option
  14148. @item blackpt
  14149. @item whitept
  14150. Colors which define the output range. The minimum input value is mapped to
  14151. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  14152. The defaults are black and white respectively. Specifying white for
  14153. @var{blackpt} and black for @var{whitept} will give color-inverted,
  14154. normalized video. Shades of grey can be used to reduce the dynamic range
  14155. (contrast). Specifying saturated colors here can create some interesting
  14156. effects.
  14157. @item smoothing
  14158. The number of previous frames to use for temporal smoothing. The input range
  14159. of each channel is smoothed using a rolling average over the current frame
  14160. and the @var{smoothing} previous frames. The default is 0 (no temporal
  14161. smoothing).
  14162. @item independence
  14163. Controls the ratio of independent (color shifting) channel normalization to
  14164. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  14165. independent. Defaults to 1.0 (fully independent).
  14166. @item strength
  14167. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  14168. expensive no-op. Defaults to 1.0 (full strength).
  14169. @end table
  14170. @subsection Commands
  14171. This filter supports same @ref{commands} as options, excluding @var{smoothing} option.
  14172. The command accepts the same syntax of the corresponding option.
  14173. If the specified expression is not valid, it is kept at its current
  14174. value.
  14175. @subsection Examples
  14176. Stretch video contrast to use the full dynamic range, with no temporal
  14177. smoothing; may flicker depending on the source content:
  14178. @example
  14179. normalize=blackpt=black:whitept=white:smoothing=0
  14180. @end example
  14181. As above, but with 50 frames of temporal smoothing; flicker should be
  14182. reduced, depending on the source content:
  14183. @example
  14184. normalize=blackpt=black:whitept=white:smoothing=50
  14185. @end example
  14186. As above, but with hue-preserving linked channel normalization:
  14187. @example
  14188. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  14189. @end example
  14190. As above, but with half strength:
  14191. @example
  14192. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  14193. @end example
  14194. Map the darkest input color to red, the brightest input color to cyan:
  14195. @example
  14196. normalize=blackpt=red:whitept=cyan
  14197. @end example
  14198. @section null
  14199. Pass the video source unchanged to the output.
  14200. @section ocr
  14201. Optical Character Recognition
  14202. This filter uses Tesseract for optical character recognition. To enable
  14203. compilation of this filter, you need to configure FFmpeg with
  14204. @code{--enable-libtesseract}.
  14205. It accepts the following options:
  14206. @table @option
  14207. @item datapath
  14208. Set datapath to tesseract data. Default is to use whatever was
  14209. set at installation.
  14210. @item language
  14211. Set language, default is "eng".
  14212. @item whitelist
  14213. Set character whitelist.
  14214. @item blacklist
  14215. Set character blacklist.
  14216. @end table
  14217. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  14218. The filter exports confidence of recognized words as the frame metadata @code{lavfi.ocr.confidence}.
  14219. @section ocv
  14220. Apply a video transform using libopencv.
  14221. To enable this filter, install the libopencv library and headers and
  14222. configure FFmpeg with @code{--enable-libopencv}.
  14223. It accepts the following parameters:
  14224. @table @option
  14225. @item filter_name
  14226. The name of the libopencv filter to apply.
  14227. @item filter_params
  14228. The parameters to pass to the libopencv filter. If not specified, the default
  14229. values are assumed.
  14230. @end table
  14231. Refer to the official libopencv documentation for more precise
  14232. information:
  14233. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  14234. Several libopencv filters are supported; see the following subsections.
  14235. @anchor{dilate}
  14236. @subsection dilate
  14237. Dilate an image by using a specific structuring element.
  14238. It corresponds to the libopencv function @code{cvDilate}.
  14239. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  14240. @var{struct_el} represents a structuring element, and has the syntax:
  14241. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  14242. @var{cols} and @var{rows} represent the number of columns and rows of
  14243. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  14244. point, and @var{shape} the shape for the structuring element. @var{shape}
  14245. must be "rect", "cross", "ellipse", or "custom".
  14246. If the value for @var{shape} is "custom", it must be followed by a
  14247. string of the form "=@var{filename}". The file with name
  14248. @var{filename} is assumed to represent a binary image, with each
  14249. printable character corresponding to a bright pixel. When a custom
  14250. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  14251. or columns and rows of the read file are assumed instead.
  14252. The default value for @var{struct_el} is "3x3+0x0/rect".
  14253. @var{nb_iterations} specifies the number of times the transform is
  14254. applied to the image, and defaults to 1.
  14255. Some examples:
  14256. @example
  14257. # Use the default values
  14258. ocv=dilate
  14259. # Dilate using a structuring element with a 5x5 cross, iterating two times
  14260. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  14261. # Read the shape from the file diamond.shape, iterating two times.
  14262. # The file diamond.shape may contain a pattern of characters like this
  14263. # *
  14264. # ***
  14265. # *****
  14266. # ***
  14267. # *
  14268. # The specified columns and rows are ignored
  14269. # but the anchor point coordinates are not
  14270. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  14271. @end example
  14272. @subsection erode
  14273. Erode an image by using a specific structuring element.
  14274. It corresponds to the libopencv function @code{cvErode}.
  14275. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  14276. with the same syntax and semantics as the @ref{dilate} filter.
  14277. @subsection smooth
  14278. Smooth the input video.
  14279. The filter takes the following parameters:
  14280. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  14281. @var{type} is the type of smooth filter to apply, and must be one of
  14282. the following values: "blur", "blur_no_scale", "median", "gaussian",
  14283. or "bilateral". The default value is "gaussian".
  14284. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  14285. depends on the smooth type. @var{param1} and
  14286. @var{param2} accept integer positive values or 0. @var{param3} and
  14287. @var{param4} accept floating point values.
  14288. The default value for @var{param1} is 3. The default value for the
  14289. other parameters is 0.
  14290. These parameters correspond to the parameters assigned to the
  14291. libopencv function @code{cvSmooth}.
  14292. @section oscilloscope
  14293. 2D Video Oscilloscope.
  14294. Useful to measure spatial impulse, step responses, chroma delays, etc.
  14295. It accepts the following parameters:
  14296. @table @option
  14297. @item x
  14298. Set scope center x position.
  14299. @item y
  14300. Set scope center y position.
  14301. @item s
  14302. Set scope size, relative to frame diagonal.
  14303. @item t
  14304. Set scope tilt/rotation.
  14305. @item o
  14306. Set trace opacity.
  14307. @item tx
  14308. Set trace center x position.
  14309. @item ty
  14310. Set trace center y position.
  14311. @item tw
  14312. Set trace width, relative to width of frame.
  14313. @item th
  14314. Set trace height, relative to height of frame.
  14315. @item c
  14316. Set which components to trace. By default it traces first three components.
  14317. @item g
  14318. Draw trace grid. By default is enabled.
  14319. @item st
  14320. Draw some statistics. By default is enabled.
  14321. @item sc
  14322. Draw scope. By default is enabled.
  14323. @end table
  14324. @subsection Commands
  14325. This filter supports same @ref{commands} as options.
  14326. The command accepts the same syntax of the corresponding option.
  14327. If the specified expression is not valid, it is kept at its current
  14328. value.
  14329. @subsection Examples
  14330. @itemize
  14331. @item
  14332. Inspect full first row of video frame.
  14333. @example
  14334. oscilloscope=x=0.5:y=0:s=1
  14335. @end example
  14336. @item
  14337. Inspect full last row of video frame.
  14338. @example
  14339. oscilloscope=x=0.5:y=1:s=1
  14340. @end example
  14341. @item
  14342. Inspect full 5th line of video frame of height 1080.
  14343. @example
  14344. oscilloscope=x=0.5:y=5/1080:s=1
  14345. @end example
  14346. @item
  14347. Inspect full last column of video frame.
  14348. @example
  14349. oscilloscope=x=1:y=0.5:s=1:t=1
  14350. @end example
  14351. @end itemize
  14352. @anchor{overlay}
  14353. @section overlay
  14354. Overlay one video on top of another.
  14355. It takes two inputs and has one output. The first input is the "main"
  14356. video on which the second input is overlaid.
  14357. It accepts the following parameters:
  14358. A description of the accepted options follows.
  14359. @table @option
  14360. @item x
  14361. @item y
  14362. Set the expression for the x and y coordinates of the overlaid video
  14363. on the main video. Default value is "0" for both expressions. In case
  14364. the expression is invalid, it is set to a huge value (meaning that the
  14365. overlay will not be displayed within the output visible area).
  14366. @item eof_action
  14367. See @ref{framesync}.
  14368. @item eval
  14369. Set when the expressions for @option{x}, and @option{y} are evaluated.
  14370. It accepts the following values:
  14371. @table @samp
  14372. @item init
  14373. only evaluate expressions once during the filter initialization or
  14374. when a command is processed
  14375. @item frame
  14376. evaluate expressions for each incoming frame
  14377. @end table
  14378. Default value is @samp{frame}.
  14379. @item shortest
  14380. See @ref{framesync}.
  14381. @item format
  14382. Set the format for the output video.
  14383. It accepts the following values:
  14384. @table @samp
  14385. @item yuv420
  14386. force YUV 4:2:0 8-bit planar output
  14387. @item yuv420p10
  14388. force YUV 4:2:0 10-bit planar output
  14389. @item yuv422
  14390. force YUV 4:2:2 8-bit planar output
  14391. @item yuv422p10
  14392. force YUV 4:2:2 10-bit planar output
  14393. @item yuv444
  14394. force YUV 4:4:4 8-bit planar output
  14395. @item yuv444p10
  14396. force YUV 4:4:4 10-bit planar output
  14397. @item rgb
  14398. force RGB 8-bit packed output
  14399. @item gbrp
  14400. force RGB 8-bit planar output
  14401. @item auto
  14402. automatically pick format
  14403. @end table
  14404. Default value is @samp{yuv420}.
  14405. @item repeatlast
  14406. See @ref{framesync}.
  14407. @item alpha
  14408. Set format of alpha of the overlaid video, it can be @var{straight} or
  14409. @var{premultiplied}. Default is @var{straight}.
  14410. @end table
  14411. The @option{x}, and @option{y} expressions can contain the following
  14412. parameters.
  14413. @table @option
  14414. @item main_w, W
  14415. @item main_h, H
  14416. The main input width and height.
  14417. @item overlay_w, w
  14418. @item overlay_h, h
  14419. The overlay input width and height.
  14420. @item x
  14421. @item y
  14422. The computed values for @var{x} and @var{y}. They are evaluated for
  14423. each new frame.
  14424. @item hsub
  14425. @item vsub
  14426. horizontal and vertical chroma subsample values of the output
  14427. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  14428. @var{vsub} is 1.
  14429. @item n
  14430. the number of input frame, starting from 0
  14431. @item pos
  14432. the position in the file of the input frame, NAN if unknown; deprecated,
  14433. do not use
  14434. @item t
  14435. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  14436. @end table
  14437. This filter also supports the @ref{framesync} options.
  14438. Note that the @var{n}, @var{t} variables are available only
  14439. when evaluation is done @emph{per frame}, and will evaluate to NAN
  14440. when @option{eval} is set to @samp{init}.
  14441. Be aware that frames are taken from each input video in timestamp
  14442. order, hence, if their initial timestamps differ, it is a good idea
  14443. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  14444. have them begin in the same zero timestamp, as the example for
  14445. the @var{movie} filter does.
  14446. You can chain together more overlays but you should test the
  14447. efficiency of such approach.
  14448. @subsection Commands
  14449. This filter supports the following commands:
  14450. @table @option
  14451. @item x
  14452. @item y
  14453. Modify the x and y of the overlay input.
  14454. The command accepts the same syntax of the corresponding option.
  14455. If the specified expression is not valid, it is kept at its current
  14456. value.
  14457. @end table
  14458. @subsection Examples
  14459. @itemize
  14460. @item
  14461. Draw the overlay at 10 pixels from the bottom right corner of the main
  14462. video:
  14463. @example
  14464. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  14465. @end example
  14466. Using named options the example above becomes:
  14467. @example
  14468. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  14469. @end example
  14470. @item
  14471. Insert a transparent PNG logo in the bottom left corner of the input,
  14472. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  14473. @example
  14474. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  14475. @end example
  14476. @item
  14477. Insert 2 different transparent PNG logos (second logo on bottom
  14478. right corner) using the @command{ffmpeg} tool:
  14479. @example
  14480. 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
  14481. @end example
  14482. @item
  14483. Add a transparent color layer on top of the main video; @code{WxH}
  14484. must specify the size of the main input to the overlay filter:
  14485. @example
  14486. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  14487. @end example
  14488. @item
  14489. Play an original video and a filtered version (here with the deshake
  14490. filter) side by side using the @command{ffplay} tool:
  14491. @example
  14492. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  14493. @end example
  14494. The above command is the same as:
  14495. @example
  14496. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  14497. @end example
  14498. @item
  14499. Make a sliding overlay appearing from the left to the right top part of the
  14500. screen starting since time 2:
  14501. @example
  14502. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  14503. @end example
  14504. @item
  14505. Compose output by putting two input videos side to side:
  14506. @example
  14507. ffmpeg -i left.avi -i right.avi -filter_complex "
  14508. nullsrc=size=200x100 [background];
  14509. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  14510. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  14511. [background][left] overlay=shortest=1 [background+left];
  14512. [background+left][right] overlay=shortest=1:x=100 [left+right]
  14513. "
  14514. @end example
  14515. @item
  14516. Mask 10-20 seconds of a video by applying the delogo filter to a section
  14517. @example
  14518. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  14519. -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]'
  14520. masked.avi
  14521. @end example
  14522. @item
  14523. Chain several overlays in cascade:
  14524. @example
  14525. nullsrc=s=200x200 [bg];
  14526. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  14527. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  14528. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  14529. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  14530. [in3] null, [mid2] overlay=100:100 [out0]
  14531. @end example
  14532. @end itemize
  14533. @anchor{overlay_cuda}
  14534. @section overlay_cuda
  14535. Overlay one video on top of another.
  14536. This is the CUDA variant of the @ref{overlay} filter.
  14537. It only accepts CUDA frames. The underlying input pixel formats have to match.
  14538. It takes two inputs and has one output. The first input is the "main"
  14539. video on which the second input is overlaid.
  14540. It accepts the following parameters:
  14541. @table @option
  14542. @item x
  14543. @item y
  14544. Set expressions for the x and y coordinates of the overlaid video
  14545. on the main video.
  14546. They can contain the following parameters:
  14547. @table @option
  14548. @item main_w, W
  14549. @item main_h, H
  14550. The main input width and height.
  14551. @item overlay_w, w
  14552. @item overlay_h, h
  14553. The overlay input width and height.
  14554. @item x
  14555. @item y
  14556. The computed values for @var{x} and @var{y}. They are evaluated for
  14557. each new frame.
  14558. @item n
  14559. The ordinal index of the main input frame, starting from 0.
  14560. @item pos
  14561. The byte offset position in the file of the main input frame, NAN if unknown.
  14562. Deprecated, do not use.
  14563. @item t
  14564. The timestamp of the main input frame, expressed in seconds, NAN if unknown.
  14565. @end table
  14566. Default value is "0" for both expressions.
  14567. @item eval
  14568. Set when the expressions for @option{x} and @option{y} are evaluated.
  14569. It accepts the following values:
  14570. @table @option
  14571. @item init
  14572. Evaluate expressions once during filter initialization or
  14573. when a command is processed.
  14574. @item frame
  14575. Evaluate expressions for each incoming frame
  14576. @end table
  14577. Default value is @option{frame}.
  14578. @item eof_action
  14579. See @ref{framesync}.
  14580. @item shortest
  14581. See @ref{framesync}.
  14582. @item repeatlast
  14583. See @ref{framesync}.
  14584. @end table
  14585. This filter also supports the @ref{framesync} options.
  14586. @section owdenoise
  14587. Apply Overcomplete Wavelet denoiser.
  14588. The filter accepts the following options:
  14589. @table @option
  14590. @item depth
  14591. Set depth.
  14592. Larger depth values will denoise lower frequency components more, but
  14593. slow down filtering.
  14594. Must be an int in the range 8-16, default is @code{8}.
  14595. @item luma_strength, ls
  14596. Set luma strength.
  14597. Must be a double value in the range 0-1000, default is @code{1.0}.
  14598. @item chroma_strength, cs
  14599. Set chroma strength.
  14600. Must be a double value in the range 0-1000, default is @code{1.0}.
  14601. @end table
  14602. @anchor{pad}
  14603. @section pad
  14604. Add paddings to the input image, and place the original input at the
  14605. provided @var{x}, @var{y} coordinates.
  14606. It accepts the following parameters:
  14607. @table @option
  14608. @item width, w
  14609. @item height, h
  14610. Specify an expression for the size of the output image with the
  14611. paddings added. If the value for @var{width} or @var{height} is 0, the
  14612. corresponding input size is used for the output.
  14613. The @var{width} expression can reference the value set by the
  14614. @var{height} expression, and vice versa.
  14615. The default value of @var{width} and @var{height} is 0.
  14616. @item x
  14617. @item y
  14618. Specify the offsets to place the input image at within the padded area,
  14619. with respect to the top/left border of the output image.
  14620. The @var{x} expression can reference the value set by the @var{y}
  14621. expression, and vice versa.
  14622. The default value of @var{x} and @var{y} is 0.
  14623. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  14624. so the input image is centered on the padded area.
  14625. @item color
  14626. Specify the color of the padded area. For the syntax of this option,
  14627. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  14628. manual,ffmpeg-utils}.
  14629. The default value of @var{color} is "black".
  14630. @item eval
  14631. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  14632. It accepts the following values:
  14633. @table @samp
  14634. @item init
  14635. Only evaluate expressions once during the filter initialization or when
  14636. a command is processed.
  14637. @item frame
  14638. Evaluate expressions for each incoming frame.
  14639. @end table
  14640. Default value is @samp{init}.
  14641. @item aspect
  14642. Pad to aspect instead to a resolution.
  14643. @end table
  14644. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  14645. options are expressions containing the following constants:
  14646. @table @option
  14647. @item in_w
  14648. @item in_h
  14649. The input video width and height.
  14650. @item iw
  14651. @item ih
  14652. These are the same as @var{in_w} and @var{in_h}.
  14653. @item out_w
  14654. @item out_h
  14655. The output width and height (the size of the padded area), as
  14656. specified by the @var{width} and @var{height} expressions.
  14657. @item ow
  14658. @item oh
  14659. These are the same as @var{out_w} and @var{out_h}.
  14660. @item x
  14661. @item y
  14662. The x and y offsets as specified by the @var{x} and @var{y}
  14663. expressions, or NAN if not yet specified.
  14664. @item a
  14665. same as @var{iw} / @var{ih}
  14666. @item sar
  14667. input sample aspect ratio
  14668. @item dar
  14669. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  14670. @item hsub
  14671. @item vsub
  14672. The horizontal and vertical chroma subsample values. For example for the
  14673. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  14674. @end table
  14675. @subsection Examples
  14676. @itemize
  14677. @item
  14678. Add paddings with the color "violet" to the input video. The output video
  14679. size is 640x480, and the top-left corner of the input video is placed at
  14680. column 0, row 40
  14681. @example
  14682. pad=640:480:0:40:violet
  14683. @end example
  14684. The example above is equivalent to the following command:
  14685. @example
  14686. pad=width=640:height=480:x=0:y=40:color=violet
  14687. @end example
  14688. @item
  14689. Pad the input to get an output with dimensions increased by 3/2,
  14690. and put the input video at the center of the padded area:
  14691. @example
  14692. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  14693. @end example
  14694. @item
  14695. Pad the input to get a squared output with size equal to the maximum
  14696. value between the input width and height, and put the input video at
  14697. the center of the padded area:
  14698. @example
  14699. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  14700. @end example
  14701. @item
  14702. Pad the input to get a final w/h ratio of 16:9:
  14703. @example
  14704. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  14705. @end example
  14706. @item
  14707. In case of anamorphic video, in order to set the output display aspect
  14708. correctly, it is necessary to use @var{sar} in the expression,
  14709. according to the relation:
  14710. @example
  14711. (ih * X / ih) * sar = output_dar
  14712. X = output_dar / sar
  14713. @end example
  14714. Thus the previous example needs to be modified to:
  14715. @example
  14716. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  14717. @end example
  14718. @item
  14719. Double the output size and put the input video in the bottom-right
  14720. corner of the output padded area:
  14721. @example
  14722. pad="2*iw:2*ih:ow-iw:oh-ih"
  14723. @end example
  14724. @end itemize
  14725. @anchor{palettegen}
  14726. @section palettegen
  14727. Generate one palette for a whole video stream.
  14728. It accepts the following options:
  14729. @table @option
  14730. @item max_colors
  14731. Set the maximum number of colors to quantize in the palette.
  14732. Note: the palette will still contain 256 colors; the unused palette entries
  14733. will be black.
  14734. @item reserve_transparent
  14735. Create a palette of 255 colors maximum and reserve the last one for
  14736. transparency. Reserving the transparency color is useful for GIF optimization.
  14737. If not set, the maximum of colors in the palette will be 256. You probably want
  14738. to disable this option for a standalone image.
  14739. Set by default.
  14740. @item transparency_color
  14741. Set the color that will be used as background for transparency.
  14742. @item stats_mode
  14743. Set statistics mode.
  14744. It accepts the following values:
  14745. @table @samp
  14746. @item full
  14747. Compute full frame histograms.
  14748. @item diff
  14749. Compute histograms only for the part that differs from previous frame. This
  14750. might be relevant to give more importance to the moving part of your input if
  14751. the background is static.
  14752. @item single
  14753. Compute new histogram for each frame.
  14754. @end table
  14755. Default value is @var{full}.
  14756. @end table
  14757. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  14758. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  14759. color quantization of the palette. This information is also visible at
  14760. @var{info} logging level.
  14761. @subsection Examples
  14762. @itemize
  14763. @item
  14764. Generate a representative palette of a given video using @command{ffmpeg}:
  14765. @example
  14766. ffmpeg -i input.mkv -vf palettegen palette.png
  14767. @end example
  14768. @end itemize
  14769. @section paletteuse
  14770. Use a palette to downsample an input video stream.
  14771. The filter takes two inputs: one video stream and a palette. The palette must
  14772. be a 256 pixels image.
  14773. It accepts the following options:
  14774. @table @option
  14775. @item dither
  14776. Select dithering mode. Available algorithms are:
  14777. @table @samp
  14778. @item bayer
  14779. Ordered 8x8 bayer dithering (deterministic)
  14780. @item heckbert
  14781. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  14782. Note: this dithering is sometimes considered "wrong" and is included as a
  14783. reference.
  14784. @item floyd_steinberg
  14785. Floyd and Steingberg dithering (error diffusion)
  14786. @item sierra2
  14787. Frankie Sierra dithering v2 (error diffusion)
  14788. @item sierra2_4a
  14789. Frankie Sierra dithering v2 "Lite" (error diffusion)
  14790. @item sierra3
  14791. Frankie Sierra dithering v3 (error diffusion)
  14792. @item burkes
  14793. Burkes dithering (error diffusion)
  14794. @item atkinson
  14795. Atkinson dithering by Bill Atkinson at Apple Computer (error diffusion)
  14796. @item none
  14797. Disable dithering.
  14798. @end table
  14799. Default is @var{sierra2_4a}.
  14800. @item bayer_scale
  14801. When @var{bayer} dithering is selected, this option defines the scale of the
  14802. pattern (how much the crosshatch pattern is visible). A low value means more
  14803. visible pattern for less banding, and higher value means less visible pattern
  14804. at the cost of more banding.
  14805. The option must be an integer value in the range [0,5]. Default is @var{2}.
  14806. @item diff_mode
  14807. If set, define the zone to process
  14808. @table @samp
  14809. @item rectangle
  14810. Only the changing rectangle will be reprocessed. This is similar to GIF
  14811. cropping/offsetting compression mechanism. This option can be useful for speed
  14812. if only a part of the image is changing, and has use cases such as limiting the
  14813. scope of the error diffusal @option{dither} to the rectangle that bounds the
  14814. moving scene (it leads to more deterministic output if the scene doesn't change
  14815. much, and as a result less moving noise and better GIF compression).
  14816. @end table
  14817. Default is @var{none}.
  14818. @item new
  14819. Take new palette for each output frame.
  14820. @item alpha_threshold
  14821. Sets the alpha threshold for transparency. Alpha values above this threshold
  14822. will be treated as completely opaque, and values below this threshold will be
  14823. treated as completely transparent.
  14824. The option must be an integer value in the range [0,255]. Default is @var{128}.
  14825. @end table
  14826. @subsection Examples
  14827. @itemize
  14828. @item
  14829. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  14830. using @command{ffmpeg}:
  14831. @example
  14832. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  14833. @end example
  14834. @end itemize
  14835. @section perspective
  14836. Correct perspective of video not recorded perpendicular to the screen.
  14837. A description of the accepted parameters follows.
  14838. @table @option
  14839. @item x0
  14840. @item y0
  14841. @item x1
  14842. @item y1
  14843. @item x2
  14844. @item y2
  14845. @item x3
  14846. @item y3
  14847. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  14848. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  14849. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  14850. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  14851. then the corners of the source will be sent to the specified coordinates.
  14852. The expressions can use the following variables:
  14853. @table @option
  14854. @item W
  14855. @item H
  14856. the width and height of video frame.
  14857. @item in
  14858. Input frame count.
  14859. @item on
  14860. Output frame count.
  14861. @end table
  14862. @item interpolation
  14863. Set interpolation for perspective correction.
  14864. It accepts the following values:
  14865. @table @samp
  14866. @item linear
  14867. @item cubic
  14868. @end table
  14869. Default value is @samp{linear}.
  14870. @item sense
  14871. Set interpretation of coordinate options.
  14872. It accepts the following values:
  14873. @table @samp
  14874. @item 0, source
  14875. Send point in the source specified by the given coordinates to
  14876. the corners of the destination.
  14877. @item 1, destination
  14878. Send the corners of the source to the point in the destination specified
  14879. by the given coordinates.
  14880. Default value is @samp{source}.
  14881. @end table
  14882. @item eval
  14883. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  14884. It accepts the following values:
  14885. @table @samp
  14886. @item init
  14887. only evaluate expressions once during the filter initialization or
  14888. when a command is processed
  14889. @item frame
  14890. evaluate expressions for each incoming frame
  14891. @end table
  14892. Default value is @samp{init}.
  14893. @end table
  14894. @section phase
  14895. Delay interlaced video by one field time so that the field order changes.
  14896. The intended use is to fix PAL movies that have been captured with the
  14897. opposite field order to the film-to-video transfer.
  14898. A description of the accepted parameters follows.
  14899. @table @option
  14900. @item mode
  14901. Set phase mode.
  14902. It accepts the following values:
  14903. @table @samp
  14904. @item t
  14905. Capture field order top-first, transfer bottom-first.
  14906. Filter will delay the bottom field.
  14907. @item b
  14908. Capture field order bottom-first, transfer top-first.
  14909. Filter will delay the top field.
  14910. @item p
  14911. Capture and transfer with the same field order. This mode only exists
  14912. for the documentation of the other options to refer to, but if you
  14913. actually select it, the filter will faithfully do nothing.
  14914. @item a
  14915. Capture field order determined automatically by field flags, transfer
  14916. opposite.
  14917. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  14918. basis using field flags. If no field information is available,
  14919. then this works just like @samp{u}.
  14920. @item u
  14921. Capture unknown or varying, transfer opposite.
  14922. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  14923. analyzing the images and selecting the alternative that produces best
  14924. match between the fields.
  14925. @item T
  14926. Capture top-first, transfer unknown or varying.
  14927. Filter selects among @samp{t} and @samp{p} using image analysis.
  14928. @item B
  14929. Capture bottom-first, transfer unknown or varying.
  14930. Filter selects among @samp{b} and @samp{p} using image analysis.
  14931. @item A
  14932. Capture determined by field flags, transfer unknown or varying.
  14933. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  14934. image analysis. If no field information is available, then this works just
  14935. like @samp{U}. This is the default mode.
  14936. @item U
  14937. Both capture and transfer unknown or varying.
  14938. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  14939. @end table
  14940. @end table
  14941. @subsection Commands
  14942. This filter supports the all above options as @ref{commands}.
  14943. @section photosensitivity
  14944. Reduce various flashes in video, so to help users with epilepsy.
  14945. It accepts the following options:
  14946. @table @option
  14947. @item frames, f
  14948. Set how many frames to use when filtering. Default is 30.
  14949. @item threshold, t
  14950. Set detection threshold factor. Default is 1.
  14951. Lower is stricter.
  14952. @item skip
  14953. Set how many pixels to skip when sampling frames. Default is 1.
  14954. Allowed range is from 1 to 1024.
  14955. @item bypass
  14956. Leave frames unchanged. Default is disabled.
  14957. @end table
  14958. @section pixdesctest
  14959. Pixel format descriptor test filter, mainly useful for internal
  14960. testing. The output video should be equal to the input video.
  14961. For example:
  14962. @example
  14963. format=monow, pixdesctest
  14964. @end example
  14965. can be used to test the monowhite pixel format descriptor definition.
  14966. @section pixelize
  14967. Apply pixelization to video stream.
  14968. The filter accepts the following options:
  14969. @table @option
  14970. @item width, w
  14971. @item height, h
  14972. Set block dimensions that will be used for pixelization.
  14973. Default value is @code{16}.
  14974. @item mode, m
  14975. Set the mode of pixelization used.
  14976. Possible values are:
  14977. @table @samp
  14978. @item avg
  14979. @item min
  14980. @item max
  14981. @end table
  14982. Default value is @code{avg}.
  14983. @item planes, p
  14984. Set what planes to filter. Default is to filter all planes.
  14985. @end table
  14986. @subsection Commands
  14987. This filter supports all options as @ref{commands}.
  14988. @section pixscope
  14989. Display sample values of color channels. Mainly useful for checking color
  14990. and levels. Minimum supported resolution is 640x480.
  14991. The filters accept the following options:
  14992. @table @option
  14993. @item x
  14994. Set scope X position, relative offset on X axis.
  14995. @item y
  14996. Set scope Y position, relative offset on Y axis.
  14997. @item w
  14998. Set scope width.
  14999. @item h
  15000. Set scope height.
  15001. @item o
  15002. Set window opacity. This window also holds statistics about pixel area.
  15003. @item wx
  15004. Set window X position, relative offset on X axis.
  15005. @item wy
  15006. Set window Y position, relative offset on Y axis.
  15007. @end table
  15008. @subsection Commands
  15009. This filter supports same @ref{commands} as options.
  15010. @section pp
  15011. Enable the specified chain of postprocessing subfilters using libpostproc. This
  15012. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  15013. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  15014. Each subfilter and some options have a short and a long name that can be used
  15015. interchangeably, i.e. dr/dering are the same.
  15016. The filters accept the following options:
  15017. @table @option
  15018. @item subfilters
  15019. Set postprocessing subfilters string.
  15020. @end table
  15021. All subfilters share common options to determine their scope:
  15022. @table @option
  15023. @item a/autoq
  15024. Honor the quality commands for this subfilter.
  15025. @item c/chrom
  15026. Do chrominance filtering, too (default).
  15027. @item y/nochrom
  15028. Do luma filtering only (no chrominance).
  15029. @item n/noluma
  15030. Do chrominance filtering only (no luma).
  15031. @end table
  15032. These options can be appended after the subfilter name, separated by a '|'.
  15033. Available subfilters are:
  15034. @table @option
  15035. @item hb/hdeblock[|difference[|flatness]]
  15036. Horizontal deblocking filter
  15037. @table @option
  15038. @item difference
  15039. Difference factor where higher values mean more deblocking (default: @code{32}).
  15040. @item flatness
  15041. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15042. @end table
  15043. @item vb/vdeblock[|difference[|flatness]]
  15044. Vertical deblocking filter
  15045. @table @option
  15046. @item difference
  15047. Difference factor where higher values mean more deblocking (default: @code{32}).
  15048. @item flatness
  15049. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15050. @end table
  15051. @item ha/hadeblock[|difference[|flatness]]
  15052. Accurate horizontal deblocking filter
  15053. @table @option
  15054. @item difference
  15055. Difference factor where higher values mean more deblocking (default: @code{32}).
  15056. @item flatness
  15057. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15058. @end table
  15059. @item va/vadeblock[|difference[|flatness]]
  15060. Accurate vertical deblocking filter
  15061. @table @option
  15062. @item difference
  15063. Difference factor where higher values mean more deblocking (default: @code{32}).
  15064. @item flatness
  15065. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  15066. @end table
  15067. @end table
  15068. The horizontal and vertical deblocking filters share the difference and
  15069. flatness values so you cannot set different horizontal and vertical
  15070. thresholds.
  15071. @table @option
  15072. @item h1/x1hdeblock
  15073. Experimental horizontal deblocking filter
  15074. @item v1/x1vdeblock
  15075. Experimental vertical deblocking filter
  15076. @item dr/dering
  15077. Deringing filter
  15078. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  15079. @table @option
  15080. @item threshold1
  15081. larger -> stronger filtering
  15082. @item threshold2
  15083. larger -> stronger filtering
  15084. @item threshold3
  15085. larger -> stronger filtering
  15086. @end table
  15087. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  15088. @table @option
  15089. @item f/fullyrange
  15090. Stretch luma to @code{0-255}.
  15091. @end table
  15092. @item lb/linblenddeint
  15093. Linear blend deinterlacing filter that deinterlaces the given block by
  15094. filtering all lines with a @code{(1 2 1)} filter.
  15095. @item li/linipoldeint
  15096. Linear interpolating deinterlacing filter that deinterlaces the given block by
  15097. linearly interpolating every second line.
  15098. @item ci/cubicipoldeint
  15099. Cubic interpolating deinterlacing filter deinterlaces the given block by
  15100. cubically interpolating every second line.
  15101. @item md/mediandeint
  15102. Median deinterlacing filter that deinterlaces the given block by applying a
  15103. median filter to every second line.
  15104. @item fd/ffmpegdeint
  15105. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  15106. second line with a @code{(-1 4 2 4 -1)} filter.
  15107. @item l5/lowpass5
  15108. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  15109. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  15110. @item fq/forceQuant[|quantizer]
  15111. Overrides the quantizer table from the input with the constant quantizer you
  15112. specify.
  15113. @table @option
  15114. @item quantizer
  15115. Quantizer to use
  15116. @end table
  15117. @item de/default
  15118. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  15119. @item fa/fast
  15120. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  15121. @item ac
  15122. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  15123. @end table
  15124. @subsection Examples
  15125. @itemize
  15126. @item
  15127. Apply horizontal and vertical deblocking, deringing and automatic
  15128. brightness/contrast:
  15129. @example
  15130. pp=hb/vb/dr/al
  15131. @end example
  15132. @item
  15133. Apply default filters without brightness/contrast correction:
  15134. @example
  15135. pp=de/-al
  15136. @end example
  15137. @item
  15138. Apply default filters and temporal denoiser:
  15139. @example
  15140. pp=default/tmpnoise|1|2|3
  15141. @end example
  15142. @item
  15143. Apply deblocking on luma only, and switch vertical deblocking on or off
  15144. automatically depending on available CPU time:
  15145. @example
  15146. pp=hb|y/vb|a
  15147. @end example
  15148. @end itemize
  15149. @section pp7
  15150. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  15151. similar to spp = 6 with 7 point DCT, where only the center sample is
  15152. used after IDCT.
  15153. The filter accepts the following options:
  15154. @table @option
  15155. @item qp
  15156. Force a constant quantization parameter. It accepts an integer in range
  15157. 0 to 63. If not set, the filter will use the QP from the video stream
  15158. (if available).
  15159. @item mode
  15160. Set thresholding mode. Available modes are:
  15161. @table @samp
  15162. @item hard
  15163. Set hard thresholding.
  15164. @item soft
  15165. Set soft thresholding (better de-ringing effect, but likely blurrier).
  15166. @item medium
  15167. Set medium thresholding (good results, default).
  15168. @end table
  15169. @end table
  15170. @section premultiply
  15171. Apply alpha premultiply effect to input video stream using first plane
  15172. of second stream as alpha.
  15173. Both streams must have same dimensions and same pixel format.
  15174. The filter accepts the following option:
  15175. @table @option
  15176. @item planes
  15177. Set which planes will be processed, unprocessed planes will be copied.
  15178. By default value 0xf, all planes will be processed.
  15179. @item inplace
  15180. Do not require 2nd input for processing, instead use alpha plane from input stream.
  15181. @end table
  15182. @section prewitt
  15183. Apply prewitt operator to input video stream.
  15184. The filter accepts the following option:
  15185. @table @option
  15186. @item planes
  15187. Set which planes will be processed, unprocessed planes will be copied.
  15188. By default value 0xf, all planes will be processed.
  15189. @item scale
  15190. Set value which will be multiplied with filtered result.
  15191. @item delta
  15192. Set value which will be added to filtered result.
  15193. @end table
  15194. @subsection Commands
  15195. This filter supports the all above options as @ref{commands}.
  15196. @section pseudocolor
  15197. Alter frame colors in video with pseudocolors.
  15198. This filter accepts the following options:
  15199. @table @option
  15200. @item c0
  15201. set pixel first component expression
  15202. @item c1
  15203. set pixel second component expression
  15204. @item c2
  15205. set pixel third component expression
  15206. @item c3
  15207. set pixel fourth component expression, corresponds to the alpha component
  15208. @item index, i
  15209. set component to use as base for altering colors
  15210. @item preset, p
  15211. Pick one of built-in LUTs. By default is set to none.
  15212. Available LUTs:
  15213. @table @samp
  15214. @item magma
  15215. @item inferno
  15216. @item plasma
  15217. @item viridis
  15218. @item turbo
  15219. @item cividis
  15220. @item range1
  15221. @item range2
  15222. @item shadows
  15223. @item highlights
  15224. @item solar
  15225. @item nominal
  15226. @item preferred
  15227. @item total
  15228. @item spectral
  15229. @item cool
  15230. @item heat
  15231. @item fiery
  15232. @item blues
  15233. @item green
  15234. @item helix
  15235. @end table
  15236. @item opacity
  15237. Set opacity of output colors. Allowed range is from 0 to 1.
  15238. Default value is set to 1.
  15239. @end table
  15240. Each of the expression options specifies the expression to use for computing
  15241. the lookup table for the corresponding pixel component values.
  15242. The expressions can contain the following constants and functions:
  15243. @table @option
  15244. @item w
  15245. @item h
  15246. The input width and height.
  15247. @item val
  15248. The input value for the pixel component.
  15249. @item ymin, umin, vmin, amin
  15250. The minimum allowed component value.
  15251. @item ymax, umax, vmax, amax
  15252. The maximum allowed component value.
  15253. @end table
  15254. All expressions default to "val".
  15255. @subsection Commands
  15256. This filter supports the all above options as @ref{commands}.
  15257. @subsection Examples
  15258. @itemize
  15259. @item
  15260. Change too high luma values to gradient:
  15261. @example
  15262. 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'"
  15263. @end example
  15264. @end itemize
  15265. @anchor{psnr}
  15266. @section psnr
  15267. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  15268. Ratio) between two input videos.
  15269. This filter takes in input two input videos, the first input is
  15270. considered the "main" source and is passed unchanged to the
  15271. output. The second input is used as a "reference" video for computing
  15272. the PSNR.
  15273. Both video inputs must have the same resolution and pixel format for
  15274. this filter to work correctly. Also it assumes that both inputs
  15275. have the same number of frames, which are compared one by one.
  15276. The obtained average PSNR is printed through the logging system.
  15277. The filter stores the accumulated MSE (mean squared error) of each
  15278. frame, and at the end of the processing it is averaged across all frames
  15279. equally, and the following formula is applied to obtain the PSNR:
  15280. @example
  15281. PSNR = 10*log10(MAX^2/MSE)
  15282. @end example
  15283. Where MAX is the average of the maximum values of each component of the
  15284. image.
  15285. The description of the accepted parameters follows.
  15286. @table @option
  15287. @item stats_file, f
  15288. If specified the filter will use the named file to save the PSNR of
  15289. each individual frame. When filename equals "-" the data is sent to
  15290. standard output.
  15291. @item stats_version
  15292. Specifies which version of the stats file format to use. Details of
  15293. each format are written below.
  15294. Default value is 1.
  15295. @item stats_add_max
  15296. Determines whether the max value is output to the stats log.
  15297. Default value is 0.
  15298. Requires stats_version >= 2. If this is set and stats_version < 2,
  15299. the filter will return an error.
  15300. @end table
  15301. This filter also supports the @ref{framesync} options.
  15302. The file printed if @var{stats_file} is selected, contains a sequence of
  15303. key/value pairs of the form @var{key}:@var{value} for each compared
  15304. couple of frames.
  15305. If a @var{stats_version} greater than 1 is specified, a header line precedes
  15306. the list of per-frame-pair stats, with key value pairs following the frame
  15307. format with the following parameters:
  15308. @table @option
  15309. @item psnr_log_version
  15310. The version of the log file format. Will match @var{stats_version}.
  15311. @item fields
  15312. A comma separated list of the per-frame-pair parameters included in
  15313. the log.
  15314. @end table
  15315. A description of each shown per-frame-pair parameter follows:
  15316. @table @option
  15317. @item n
  15318. sequential number of the input frame, starting from 1
  15319. @item mse_avg
  15320. Mean Square Error pixel-by-pixel average difference of the compared
  15321. frames, averaged over all the image components.
  15322. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  15323. Mean Square Error pixel-by-pixel average difference of the compared
  15324. frames for the component specified by the suffix.
  15325. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  15326. Peak Signal to Noise ratio of the compared frames for the component
  15327. specified by the suffix.
  15328. @item max_avg, max_y, max_u, max_v
  15329. Maximum allowed value for each channel, and average over all
  15330. channels.
  15331. @end table
  15332. @subsection Examples
  15333. @itemize
  15334. @item
  15335. For example:
  15336. @example
  15337. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  15338. [main][ref] psnr="stats_file=stats.log" [out]
  15339. @end example
  15340. On this example the input file being processed is compared with the
  15341. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  15342. is stored in @file{stats.log}.
  15343. @item
  15344. Another example with different containers:
  15345. @example
  15346. 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 -
  15347. @end example
  15348. @end itemize
  15349. @anchor{pullup}
  15350. @section pullup
  15351. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  15352. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  15353. content.
  15354. The pullup filter is designed to take advantage of future context in making
  15355. its decisions. This filter is stateless in the sense that it does not lock
  15356. onto a pattern to follow, but it instead looks forward to the following
  15357. fields in order to identify matches and rebuild progressive frames.
  15358. To produce content with an even framerate, insert the fps filter after
  15359. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  15360. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  15361. The filter accepts the following options:
  15362. @table @option
  15363. @item jl
  15364. @item jr
  15365. @item jt
  15366. @item jb
  15367. These options set the amount of "junk" to ignore at the left, right, top, and
  15368. bottom of the image, respectively. Left and right are in units of 8 pixels,
  15369. while top and bottom are in units of 2 lines.
  15370. The default is 8 pixels on each side.
  15371. @item sb
  15372. Set the strict breaks. Setting this option to 1 will reduce the chances of
  15373. filter generating an occasional mismatched frame, but it may also cause an
  15374. excessive number of frames to be dropped during high motion sequences.
  15375. Conversely, setting it to -1 will make filter match fields more easily.
  15376. This may help processing of video where there is slight blurring between
  15377. the fields, but may also cause there to be interlaced frames in the output.
  15378. Default value is @code{0}.
  15379. @item mp
  15380. Set the metric plane to use. It accepts the following values:
  15381. @table @samp
  15382. @item l
  15383. Use luma plane.
  15384. @item u
  15385. Use chroma blue plane.
  15386. @item v
  15387. Use chroma red plane.
  15388. @end table
  15389. This option may be set to use chroma plane instead of the default luma plane
  15390. for doing filter's computations. This may improve accuracy on very clean
  15391. source material, but more likely will decrease accuracy, especially if there
  15392. is chroma noise (rainbow effect) or any grayscale video.
  15393. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  15394. load and make pullup usable in realtime on slow machines.
  15395. @end table
  15396. For best results (without duplicated frames in the output file) it is
  15397. necessary to change the output frame rate. For example, to inverse
  15398. telecine NTSC input:
  15399. @example
  15400. ffmpeg -i input -vf pullup -r 24000/1001 ...
  15401. @end example
  15402. @section qp
  15403. Change video quantization parameters (QP).
  15404. The filter accepts the following option:
  15405. @table @option
  15406. @item qp
  15407. Set expression for quantization parameter.
  15408. @end table
  15409. The expression is evaluated through the eval API and can contain, among others,
  15410. the following constants:
  15411. @table @var
  15412. @item known
  15413. 1 if index is not 129, 0 otherwise.
  15414. @item qp
  15415. Sequential index starting from -129 to 128.
  15416. @end table
  15417. @subsection Examples
  15418. @itemize
  15419. @item
  15420. Some equation like:
  15421. @example
  15422. qp=2+2*sin(PI*qp)
  15423. @end example
  15424. @end itemize
  15425. @section qrencode
  15426. Generate a QR code using the libqrencode library (see
  15427. @url{https://fukuchi.org/works/qrencode/}), and overlay it on top of the current
  15428. frame.
  15429. To enable the compilation of this filter, you need to configure FFmpeg with
  15430. @code{--enable-libqrencode}.
  15431. The QR code is generated from the provided text or text pattern. The
  15432. corresponding QR code is scaled and overlayed into the video output according to
  15433. the specified options.
  15434. In case no text is specified, no QR code is overlaied.
  15435. This filter accepts the following options:
  15436. @table @option
  15437. @item qrcode_width, q
  15438. @item padded_qrcode_width, Q
  15439. Specify an expression for the width of the rendered QR code, with and without
  15440. padding. The @var{qrcode_width} expression can reference the value set by the
  15441. @var{padded_qrcode_width} expression, and vice versa.
  15442. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  15443. there is no padding.
  15444. These expressions are evaluated for each new frame.
  15445. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15446. @item x
  15447. @item y
  15448. Specify an expression for positioning the padded QR code top-left corner. The
  15449. @var{x} expression can reference the value set by the @var{y} expression, and
  15450. vice.
  15451. By default @var{x} and @var{y} are set set to @var{0}, meaning that the QR code
  15452. is placed in the top left corner of the input.
  15453. These expressions are evaluated for each new frame.
  15454. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  15455. @item case_sensitive, cs
  15456. Instruct libqrencode to use case sensitive encoding. This is enabled by
  15457. default. This can be disabled to reduce the QR encoding size.
  15458. @item level, l
  15459. Specify the QR encoding error correction level. With an higher correction level,
  15460. the encoding size will increase but the code will be more robust to corruption.
  15461. Lower level is @var{L}.
  15462. It accepts the following values:
  15463. @table @samp
  15464. @item L
  15465. @item M
  15466. @item Q
  15467. @item H
  15468. @end table
  15469. @item expansion
  15470. Select how the input text is expanded. Can be either @code{none}, or
  15471. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  15472. section below for details.
  15473. @item text
  15474. @item textfile
  15475. Define the text to be rendered. In case neither is specified, no QR is encoded
  15476. (just an empty colored frame).
  15477. In case expansion is enabled, the text is treated as a text template, using the
  15478. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  15479. Text expansion} section below for details.
  15480. @item background_color, bc
  15481. @item foreground_color, fc
  15482. Set the QR code and background color. The default value of
  15483. @var{foreground_color} is "black", the default value of @var{background_color}
  15484. is "white".
  15485. For the syntax of the color options, check the @ref{color syntax,,"Color"
  15486. section in the ffmpeg-utils manual,ffmpeg-utils}.
  15487. @end table
  15488. @anchor{qrencode_expressions}
  15489. @subsection qrencode Expressions
  15490. The expressions set by the options contain the following constants and functions.
  15491. @table @option
  15492. @item dar
  15493. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  15494. @item duration
  15495. the current frame's duration, in seconds
  15496. @item hsub
  15497. @item vsub
  15498. horizontal and vertical chroma subsample values. For example for the
  15499. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15500. @item main_h, H
  15501. the input height
  15502. @item main_w, W
  15503. the input width
  15504. @item n
  15505. the number of input frame, starting from 0
  15506. @item pict_type
  15507. a number representing the picture type
  15508. @item qr_w, w
  15509. the width of the encoded QR code
  15510. @item rendered_qr_w, q
  15511. @item rendered_padded_qr_w, Q
  15512. the width of the rendered QR code, without and without padding.
  15513. These parameters allow the @var{q} and @var{Q} expressions to refer to each
  15514. other, so you can for example specify @code{q=3/4*Q}.
  15515. @item rand(min, max)
  15516. return a random number included between @var{min} and @var{max}
  15517. @item sar
  15518. the input sample aspect ratio
  15519. @item t
  15520. timestamp expressed in seconds, NAN if the input timestamp is unknown
  15521. @item x
  15522. @item y
  15523. the x and y offset coordinates where the text is drawn.
  15524. These parameters allow the @var{x} and @var{y} expressions to refer to each
  15525. other, so you can for example specify @code{y=x/dar}.
  15526. @end table
  15527. @anchor{qrencode_text_expansion}
  15528. @subsection qrencode Text expansion
  15529. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  15530. If @option{expansion} is set to @code{normal} (which is the default),
  15531. the following expansion mechanism is used.
  15532. The backslash character @samp{\}, followed by any character, always expands to
  15533. the second character.
  15534. Sequences of the form @code{%@{...@}} are expanded. The text between the
  15535. braces is a function name, possibly followed by arguments separated by ':'.
  15536. If the arguments contain special characters or delimiters (':' or '@}'),
  15537. they should be escaped.
  15538. Note that they probably must also be escaped as the value for the @option{text}
  15539. option in the filter argument string and as the filter argument in the
  15540. filtergraph description, and possibly also for the shell, that makes up to four
  15541. levels of escaping; using a text file with the @option{textfile} option avoids
  15542. these problems.
  15543. The following functions are available:
  15544. @table @command
  15545. @item n, frame_num
  15546. return the frame number
  15547. @item pts
  15548. Return the presentation timestamp of the current frame.
  15549. It can take up to two arguments.
  15550. The first argument is the format of the timestamp; it defaults to @code{flt} for
  15551. seconds as a decimal number with microsecond accuracy; @code{hms} stands for a
  15552. formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  15553. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  15554. @code{localtime} stands for the timestamp of the frame formatted as local time
  15555. zone time. If the format is set to @code{hms24hh}, the time is formatted in 24h
  15556. format (00-23).
  15557. The second argument is an offset added to the timestamp.
  15558. If the format is set to @code{localtime} or @code{gmtime}, a third argument may
  15559. be supplied: a @code{strftime} C function format string. By default,
  15560. @var{YYYY-MM-DD HH:MM:SS} format will be used.
  15561. @item expr, e
  15562. Evaluate the expression's value and output as a double.
  15563. It must take one argument specifying the expression to be evaluated, accepting
  15564. the constants and functions defined in @ref{qrencode_expressions}.
  15565. @item expr_formatted, ef
  15566. Evaluate the expression's value and output as a formatted string.
  15567. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  15568. The second argument specifies the output format. Allowed values are @samp{x},
  15569. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  15570. @code{printf} function.
  15571. The third parameter is optional and sets the number of positions taken by the output.
  15572. It can be used to add padding with zeros from the left.
  15573. @item gmtime
  15574. The time at which the filter is running, expressed in UTC.
  15575. It can accept an argument: a @code{strftime} C function format string.
  15576. The format string is extended to support the variable @var{%[1-6]N}
  15577. which prints fractions of the second with optionally specified number of digits.
  15578. @item localtime
  15579. The time at which the filter is running, expressed in the local time zone.
  15580. It can accept an argument: a @code{strftime} C function format string.
  15581. The format string is extended to support the variable @var{%[1-6]N}
  15582. which prints fractions of the second with optionally specified number of digits.
  15583. @item metadata
  15584. Frame metadata. Takes one or two arguments.
  15585. The first argument is mandatory and specifies the metadata key.
  15586. The second argument is optional and specifies a default value, used when the
  15587. metadata key is not found or empty.
  15588. Available metadata can be identified by inspecting entries starting with TAG
  15589. included within each frame section printed by running @code{ffprobe
  15590. -show_frames}.
  15591. String metadata generated in filters leading to the qrencode filter are also
  15592. available.
  15593. @item rand(min, max)
  15594. return a random number included between @var{min} and @var{max}
  15595. @end table
  15596. @subsection Examples
  15597. @itemize
  15598. @item
  15599. Generate a QR code encoding the specified text with the default size, overalaid
  15600. in the top left corner of the input video, with the default size:
  15601. @example
  15602. qrencode=text=www.ffmpeg.org
  15603. @end example
  15604. @item
  15605. Same as below, but select blue on pink colors:
  15606. @example
  15607. qrencode=text=www.ffmpeg.org:bc=pink@@0.5:fc=blue
  15608. @end example
  15609. @item
  15610. Place the QR code in the bottom right corner of the input video:
  15611. @example
  15612. qrencode=text=www.ffmpeg.org:x=W-Q:y=H-Q
  15613. @end example
  15614. @item
  15615. Generate a QR code with width of 200 pixels and padding, making the padded width
  15616. 4/3 of the QR code width:
  15617. @example
  15618. qrencode=text=www.ffmpeg.org:q=200:Q=4/3*q
  15619. @end example
  15620. @item
  15621. Generate a QR code with padded width of 200 pixels and padding, making the QR
  15622. code width 3/4 of the padded width:
  15623. @example
  15624. qrencode=text=www.ffmpeg.org:Q=200:q=3/4*Q
  15625. @end example
  15626. @item
  15627. Make the QR code a fraction of the input video width:
  15628. @example
  15629. qrencode=text=www.ffmpeg.org:q=W/5
  15630. @end example
  15631. @item
  15632. Generate a QR code encoding the frame number:
  15633. @example
  15634. qrencode=text=%@{n@}
  15635. @end example
  15636. @item
  15637. Generate a QR code encoding the GMT timestamp:
  15638. @example
  15639. qrencode=text=%@{gmtime@}
  15640. @end example
  15641. @item
  15642. Generate a QR code encoding the timestamp expressed as a float:
  15643. @example
  15644. qrencode=text=%@{pts@}
  15645. @end example
  15646. @end itemize
  15647. @section quirc
  15648. Identify and decode a QR code using the libquirc library (see
  15649. @url{https://github.com/dlbeer/quirc/}), and print the identified QR codes
  15650. positions and payload as metadata.
  15651. To enable the compilation of this filter, you need to configure FFmpeg with
  15652. @code{--enable-libquirc}.
  15653. For each found QR code in the input video, some metadata entries are added with
  15654. the prefix @var{lavfi.quirc.N}, where @var{N} is the index, starting from 0,
  15655. associated to the QR code.
  15656. A description of each metadata value follows:
  15657. @table @option
  15658. @item lavfi.quirc.count
  15659. the number of found QR codes, it is not set in case none was found
  15660. @item lavfi.quirc.N.corner.M.x
  15661. @item lavfi.quirc.N.coreer.M.y
  15662. the x/y positions of the four corners of the square containing the QR code,
  15663. where @var{M} is the index of the corner starting from 0
  15664. @item lavfi.quirc.N.payload
  15665. the payload of the QR code
  15666. @end table
  15667. @section random
  15668. Flush video frames from internal cache of frames into a random order.
  15669. No frame is discarded.
  15670. Inspired by @ref{frei0r} nervous filter.
  15671. @table @option
  15672. @item frames
  15673. Set size in number of frames of internal cache, in range from @code{2} to
  15674. @code{512}. Default is @code{30}.
  15675. @item seed
  15676. Set seed for random number generator, must be an integer included between
  15677. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  15678. less than @code{0}, the filter will try to use a good random seed on a
  15679. best effort basis.
  15680. @end table
  15681. @section readeia608
  15682. Read closed captioning (EIA-608) information from the top lines of a video frame.
  15683. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  15684. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  15685. with EIA-608 data (starting from 0). A description of each metadata value follows:
  15686. @table @option
  15687. @item lavfi.readeia608.X.cc
  15688. The two bytes stored as EIA-608 data (printed in hexadecimal).
  15689. @item lavfi.readeia608.X.line
  15690. The number of the line on which the EIA-608 data was identified and read.
  15691. @end table
  15692. This filter accepts the following options:
  15693. @table @option
  15694. @item scan_min
  15695. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  15696. @item scan_max
  15697. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  15698. @item spw
  15699. Set the ratio of width reserved for sync code detection.
  15700. Default is @code{0.27}. Allowed range is @code{[0.1 - 0.7]}.
  15701. @item chp
  15702. Enable checking the parity bit. In the event of a parity error, the filter will output
  15703. @code{0x00} for that character. Default is false.
  15704. @item lp
  15705. Lowpass lines prior to further processing. Default is enabled.
  15706. @end table
  15707. @subsection Commands
  15708. This filter supports the all above options as @ref{commands}.
  15709. @subsection Examples
  15710. @itemize
  15711. @item
  15712. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  15713. @example
  15714. 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
  15715. @end example
  15716. @end itemize
  15717. @section readvitc
  15718. Read vertical interval timecode (VITC) information from the top lines of a
  15719. video frame.
  15720. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  15721. timecode value, if a valid timecode has been detected. Further metadata key
  15722. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  15723. timecode data has been found or not.
  15724. This filter accepts the following options:
  15725. @table @option
  15726. @item scan_max
  15727. Set the maximum number of lines to scan for VITC data. If the value is set to
  15728. @code{-1} the full video frame is scanned. Default is @code{45}.
  15729. @item thr_b
  15730. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  15731. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  15732. @item thr_w
  15733. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  15734. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  15735. @end table
  15736. @subsection Examples
  15737. @itemize
  15738. @item
  15739. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  15740. draw @code{--:--:--:--} as a placeholder:
  15741. @example
  15742. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  15743. @end example
  15744. @end itemize
  15745. @section remap
  15746. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  15747. Destination pixel at position (X, Y) will be picked from source (x, y) position
  15748. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  15749. value for pixel will be used for destination pixel.
  15750. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  15751. will have Xmap/Ymap video stream dimensions.
  15752. Xmap and Ymap input video streams are 16bit depth, single channel.
  15753. @table @option
  15754. @item format
  15755. Specify pixel format of output from this filter. Can be @code{color} or @code{gray}.
  15756. Default is @code{color}.
  15757. @item fill
  15758. Specify the color of the unmapped pixels. For the syntax of this option,
  15759. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  15760. manual,ffmpeg-utils}. Default color is @code{black}.
  15761. @end table
  15762. @section removegrain
  15763. The removegrain filter is a spatial denoiser for progressive video.
  15764. @table @option
  15765. @item m0
  15766. Set mode for the first plane.
  15767. @item m1
  15768. Set mode for the second plane.
  15769. @item m2
  15770. Set mode for the third plane.
  15771. @item m3
  15772. Set mode for the fourth plane.
  15773. @end table
  15774. Range of mode is from 0 to 24. Description of each mode follows:
  15775. @table @var
  15776. @item 0
  15777. Leave input plane unchanged. Default.
  15778. @item 1
  15779. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  15780. @item 2
  15781. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  15782. @item 3
  15783. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  15784. @item 4
  15785. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  15786. This is equivalent to a median filter.
  15787. @item 5
  15788. Line-sensitive clipping giving the minimal change.
  15789. @item 6
  15790. Line-sensitive clipping, intermediate.
  15791. @item 7
  15792. Line-sensitive clipping, intermediate.
  15793. @item 8
  15794. Line-sensitive clipping, intermediate.
  15795. @item 9
  15796. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  15797. @item 10
  15798. Replaces the target pixel with the closest neighbour.
  15799. @item 11
  15800. [1 2 1] horizontal and vertical kernel blur.
  15801. @item 12
  15802. Same as mode 11.
  15803. @item 13
  15804. Bob mode, interpolates top field from the line where the neighbours
  15805. pixels are the closest.
  15806. @item 14
  15807. Bob mode, interpolates bottom field from the line where the neighbours
  15808. pixels are the closest.
  15809. @item 15
  15810. Bob mode, interpolates top field. Same as 13 but with a more complicated
  15811. interpolation formula.
  15812. @item 16
  15813. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  15814. interpolation formula.
  15815. @item 17
  15816. Clips the pixel with the minimum and maximum of respectively the maximum and
  15817. minimum of each pair of opposite neighbour pixels.
  15818. @item 18
  15819. Line-sensitive clipping using opposite neighbours whose greatest distance from
  15820. the current pixel is minimal.
  15821. @item 19
  15822. Replaces the pixel with the average of its 8 neighbours.
  15823. @item 20
  15824. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  15825. @item 21
  15826. Clips pixels using the averages of opposite neighbour.
  15827. @item 22
  15828. Same as mode 21 but simpler and faster.
  15829. @item 23
  15830. Small edge and halo removal, but reputed useless.
  15831. @item 24
  15832. Similar as 23.
  15833. @end table
  15834. @section removelogo
  15835. Suppress a TV station logo, using an image file to determine which
  15836. pixels comprise the logo. It works by filling in the pixels that
  15837. comprise the logo with neighboring pixels.
  15838. The filter accepts the following options:
  15839. @table @option
  15840. @item filename, f
  15841. Set the filter bitmap file, which can be any image format supported by
  15842. libavformat. The width and height of the image file must match those of the
  15843. video stream being processed.
  15844. @end table
  15845. Pixels in the provided bitmap image with a value of zero are not
  15846. considered part of the logo, non-zero pixels are considered part of
  15847. the logo. If you use white (255) for the logo and black (0) for the
  15848. rest, you will be safe. For making the filter bitmap, it is
  15849. recommended to take a screen capture of a black frame with the logo
  15850. visible, and then using a threshold filter followed by the erode
  15851. filter once or twice.
  15852. If needed, little splotches can be fixed manually. Remember that if
  15853. logo pixels are not covered, the filter quality will be much
  15854. reduced. Marking too many pixels as part of the logo does not hurt as
  15855. much, but it will increase the amount of blurring needed to cover over
  15856. the image and will destroy more information than necessary, and extra
  15857. pixels will slow things down on a large logo.
  15858. @section repeatfields
  15859. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  15860. fields based on its value.
  15861. @section reverse
  15862. Reverse a video clip.
  15863. Warning: This filter requires memory to buffer the entire clip, so trimming
  15864. is suggested.
  15865. @subsection Examples
  15866. @itemize
  15867. @item
  15868. Take the first 5 seconds of a clip, and reverse it.
  15869. @example
  15870. trim=end=5,reverse
  15871. @end example
  15872. @end itemize
  15873. @section rgbashift
  15874. Shift R/G/B/A pixels horizontally and/or vertically.
  15875. The filter accepts the following options:
  15876. @table @option
  15877. @item rh
  15878. Set amount to shift red horizontally.
  15879. @item rv
  15880. Set amount to shift red vertically.
  15881. @item gh
  15882. Set amount to shift green horizontally.
  15883. @item gv
  15884. Set amount to shift green vertically.
  15885. @item bh
  15886. Set amount to shift blue horizontally.
  15887. @item bv
  15888. Set amount to shift blue vertically.
  15889. @item ah
  15890. Set amount to shift alpha horizontally.
  15891. @item av
  15892. Set amount to shift alpha vertically.
  15893. @item edge
  15894. Set edge mode, can be @var{smear}, default, or @var{warp}.
  15895. @end table
  15896. @subsection Commands
  15897. This filter supports the all above options as @ref{commands}.
  15898. @section roberts
  15899. Apply roberts cross operator to input video stream.
  15900. The filter accepts the following option:
  15901. @table @option
  15902. @item planes
  15903. Set which planes will be processed, unprocessed planes will be copied.
  15904. By default value 0xf, all planes will be processed.
  15905. @item scale
  15906. Set value which will be multiplied with filtered result.
  15907. @item delta
  15908. Set value which will be added to filtered result.
  15909. @end table
  15910. @subsection Commands
  15911. This filter supports the all above options as @ref{commands}.
  15912. @section rotate
  15913. Rotate video by an arbitrary angle expressed in radians.
  15914. The filter accepts the following options:
  15915. A description of the optional parameters follows.
  15916. @table @option
  15917. @item angle, a
  15918. Set an expression for the angle by which to rotate the input video
  15919. clockwise, expressed as a number of radians. A negative value will
  15920. result in a counter-clockwise rotation. By default it is set to "0".
  15921. This expression is evaluated for each frame.
  15922. @item out_w, ow
  15923. Set the output width expression, default value is "iw".
  15924. This expression is evaluated just once during configuration.
  15925. @item out_h, oh
  15926. Set the output height expression, default value is "ih".
  15927. This expression is evaluated just once during configuration.
  15928. @item bilinear
  15929. Enable bilinear interpolation if set to 1, a value of 0 disables
  15930. it. Default value is 1.
  15931. @item fillcolor, c
  15932. Set the color used to fill the output area not covered by the rotated
  15933. image. For the general syntax of this option, check the
  15934. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15935. If the special value "none" is selected then no
  15936. background is printed (useful for example if the background is never shown).
  15937. Default value is "black".
  15938. @end table
  15939. The expressions for the angle and the output size can contain the
  15940. following constants and functions:
  15941. @table @option
  15942. @item n
  15943. sequential number of the input frame, starting from 0. It is always NAN
  15944. before the first frame is filtered.
  15945. @item t
  15946. time in seconds of the input frame, it is set to 0 when the filter is
  15947. configured. It is always NAN before the first frame is filtered.
  15948. @item hsub
  15949. @item vsub
  15950. horizontal and vertical chroma subsample values. For example for the
  15951. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  15952. @item in_w, iw
  15953. @item in_h, ih
  15954. the input video width and height
  15955. @item out_w, ow
  15956. @item out_h, oh
  15957. the output width and height, that is the size of the padded area as
  15958. specified by the @var{width} and @var{height} expressions
  15959. @item rotw(a)
  15960. @item roth(a)
  15961. the minimal width/height required for completely containing the input
  15962. video rotated by @var{a} radians.
  15963. These are only available when computing the @option{out_w} and
  15964. @option{out_h} expressions.
  15965. @end table
  15966. @subsection Examples
  15967. @itemize
  15968. @item
  15969. Rotate the input by PI/6 radians clockwise:
  15970. @example
  15971. rotate=PI/6
  15972. @end example
  15973. @item
  15974. Rotate the input by PI/6 radians counter-clockwise:
  15975. @example
  15976. rotate=-PI/6
  15977. @end example
  15978. @item
  15979. Rotate the input by 45 degrees clockwise:
  15980. @example
  15981. rotate=45*PI/180
  15982. @end example
  15983. @item
  15984. Apply a constant rotation with period T, starting from an angle of PI/3:
  15985. @example
  15986. rotate=PI/3+2*PI*t/T
  15987. @end example
  15988. @item
  15989. Make the input video rotation oscillating with a period of T
  15990. seconds and an amplitude of A radians:
  15991. @example
  15992. rotate=A*sin(2*PI/T*t)
  15993. @end example
  15994. @item
  15995. Rotate the video, output size is chosen so that the whole rotating
  15996. input video is always completely contained in the output:
  15997. @example
  15998. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  15999. @end example
  16000. @item
  16001. Rotate the video, reduce the output size so that no background is ever
  16002. shown:
  16003. @example
  16004. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  16005. @end example
  16006. @end itemize
  16007. @subsection Commands
  16008. The filter supports the following commands:
  16009. @table @option
  16010. @item a, angle
  16011. Set the angle expression.
  16012. The command accepts the same syntax of the corresponding option.
  16013. If the specified expression is not valid, it is kept at its current
  16014. value.
  16015. @end table
  16016. @section sab
  16017. Apply Shape Adaptive Blur.
  16018. The filter accepts the following options:
  16019. @table @option
  16020. @item luma_radius, lr
  16021. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  16022. value is 1.0. A greater value will result in a more blurred image, and
  16023. in slower processing.
  16024. @item luma_pre_filter_radius, lpfr
  16025. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  16026. value is 1.0.
  16027. @item luma_strength, ls
  16028. Set luma maximum difference between pixels to still be considered, must
  16029. be a value in the 0.1-100.0 range, default value is 1.0.
  16030. @item chroma_radius, cr
  16031. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  16032. greater value will result in a more blurred image, and in slower
  16033. processing.
  16034. @item chroma_pre_filter_radius, cpfr
  16035. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  16036. @item chroma_strength, cs
  16037. Set chroma maximum difference between pixels to still be considered,
  16038. must be a value in the -0.9-100.0 range.
  16039. @end table
  16040. Each chroma option value, if not explicitly specified, is set to the
  16041. corresponding luma option value.
  16042. @anchor{scale}
  16043. @section scale
  16044. Scale (resize) the input video, using the libswscale library.
  16045. The scale filter forces the output display aspect ratio to be the same
  16046. of the input, by changing the output sample aspect ratio.
  16047. If the input image format is different from the format requested by
  16048. the next filter, the scale filter will convert the input to the
  16049. requested format.
  16050. @subsection Options
  16051. The filter accepts the following options, any of the options supported
  16052. by the libswscale scaler, as well as any of the @ref{framesync} options.
  16053. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  16054. the complete list of scaler options.
  16055. @table @option
  16056. @item width, w
  16057. @item height, h
  16058. Set the output video dimension expression. Default value is the input
  16059. dimension.
  16060. If the @var{width} or @var{w} value is 0, the input width is used for
  16061. the output. If the @var{height} or @var{h} value is 0, the input height
  16062. is used for the output.
  16063. If one and only one of the values is -n with n >= 1, the scale filter
  16064. will use a value that maintains the aspect ratio of the input image,
  16065. calculated from the other specified dimension. After that it will,
  16066. however, make sure that the calculated dimension is divisible by n and
  16067. adjust the value if necessary.
  16068. If both values are -n with n >= 1, the behavior will be identical to
  16069. both values being set to 0 as previously detailed.
  16070. See below for the list of accepted constants for use in the dimension
  16071. expression.
  16072. @item eval
  16073. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  16074. @table @samp
  16075. @item init
  16076. Only evaluate expressions once during the filter initialization or when a command is processed.
  16077. @item frame
  16078. Evaluate expressions for each incoming frame.
  16079. @end table
  16080. Default value is @samp{init}.
  16081. @item interl
  16082. Set the interlacing mode. It accepts the following values:
  16083. @table @samp
  16084. @item 1
  16085. Force interlaced aware scaling.
  16086. @item 0
  16087. Do not apply interlaced scaling.
  16088. @item -1
  16089. Select interlaced aware scaling depending on whether the source frames
  16090. are flagged as interlaced or not.
  16091. @end table
  16092. Default value is @samp{0}.
  16093. @item flags
  16094. Set libswscale scaling flags. See
  16095. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  16096. complete list of values. If not explicitly specified the filter applies
  16097. the default flags.
  16098. @item param0, param1
  16099. Set libswscale input parameters for scaling algorithms that need them. See
  16100. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  16101. complete documentation. If not explicitly specified the filter applies
  16102. empty parameters.
  16103. @item intent
  16104. Set the ICC rendering intent to use when transforming between different color
  16105. spaces. It accepts the following values:
  16106. @table @samp
  16107. @item perceptual
  16108. Use a perceptually guided tone and gamut mapping curve. The exact details of
  16109. the mapping used may change at any time and should not be relied on as stable.
  16110. This intent is recommended for final viewing of image/video content in typical
  16111. viewing settings.
  16112. @item relative_colorimetric
  16113. Statically clip out-of-gamut colors using a colorimetric clipping curve which
  16114. attempts to find the colorimetrically least dissimilar in-gamut color. This
  16115. intent performs white point adaptation and black point adaptation. This is
  16116. the default. This intent is recommended wherever faithful color reproduction
  16117. is of the utmost importance, even at the cost of clipping.
  16118. @item absolute_colorimetric
  16119. Hard clip out-of-gamut colors with no attempt at white or black point
  16120. reproduction. This intent will reproduce in-gamut colors 1:1 on the output
  16121. display as they would appear on the reference display, assuming the output
  16122. display is appropriately calibrated.
  16123. @item saturation
  16124. Performs saturation mapping - that is, stretches the input color volume
  16125. directly onto the output color volume, in non-linear fashion that preserves the
  16126. original signal appearance as much as possible. This intent is recommended for
  16127. signal content evaluation, as it will not lead to any clipping. It is roughly
  16128. analogous to not performing any color mapping, although it still takes into
  16129. account the mastering display primaries and any differences in encoding TRC.
  16130. @end table
  16131. @item size, s
  16132. Set the video size. For the syntax of this option, check the
  16133. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  16134. @item in_color_matrix
  16135. @item out_color_matrix
  16136. Set in/output YCbCr color space type.
  16137. This allows the autodetected value to be overridden as well as allows forcing
  16138. a specific value used for the output and encoder.
  16139. If not specified, the color space type depends on the pixel format.
  16140. Possible values:
  16141. @table @samp
  16142. @item auto
  16143. Choose automatically.
  16144. @item bt709
  16145. Format conforming to International Telecommunication Union (ITU)
  16146. Recommendation BT.709.
  16147. @item fcc
  16148. Set color space conforming to the United States Federal Communications
  16149. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  16150. @item bt601
  16151. @item bt470
  16152. @item smpte170m
  16153. Set color space conforming to:
  16154. @itemize
  16155. @item
  16156. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  16157. @item
  16158. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  16159. @item
  16160. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  16161. @end itemize
  16162. @item smpte240m
  16163. Set color space conforming to SMPTE ST 240:1999.
  16164. @item bt2020
  16165. Set color space conforming to ITU-R BT.2020 non-constant luminance system.
  16166. @end table
  16167. @item in_range
  16168. @item out_range
  16169. Set in/output YCbCr sample range.
  16170. This allows the autodetected value to be overridden as well as allows forcing
  16171. a specific value used for the output and encoder. If not specified, the
  16172. range depends on the pixel format. Possible values:
  16173. @table @samp
  16174. @item auto/unknown
  16175. Choose automatically.
  16176. @item jpeg/full/pc
  16177. Set full range (0-255 in case of 8-bit luma).
  16178. @item mpeg/limited/tv
  16179. Set "MPEG" range (16-235 in case of 8-bit luma).
  16180. @end table
  16181. @item in_chroma_loc
  16182. @item out_chroma_loc
  16183. Set in/output chroma sample location. If not specified, center-sited chroma
  16184. is used by default. Possible values:
  16185. @table @samp
  16186. @item auto, unknown
  16187. @item left
  16188. @item center
  16189. @item topleft
  16190. @item top
  16191. @item bottomleft
  16192. @item bottom
  16193. @end table
  16194. @item in_primaries
  16195. @item out_primaries
  16196. Set in/output RGB primaries.
  16197. This allows the autodetected value to be overridden as well as allows forcing
  16198. a specific value used for the output and encoder. Possible values:
  16199. @table @samp
  16200. @item auto
  16201. Choose automatically. This is the default.
  16202. @item bt709
  16203. @item bt470m
  16204. @item bt470bg
  16205. @item smpte170m
  16206. @item smpte240m
  16207. @item film
  16208. @item bt2020
  16209. @item smpte428
  16210. @item smpte431
  16211. @item smpte432
  16212. @item jedec-p22
  16213. @item ebu3213
  16214. @end table
  16215. @item in_transfer
  16216. @item out_transfer
  16217. Set in/output transfer response curve (TRC).
  16218. This allows the autodetected value to be overridden as well as allows forcing
  16219. a specific value used for the output and encoder. Possible values:
  16220. @table @samp
  16221. @item auto
  16222. Choose automatically. This is the default.
  16223. @item bt709
  16224. @item bt470m
  16225. @item gamma22
  16226. @item bt470bg
  16227. @item gamma28
  16228. @item smpte170m
  16229. @item smpte240m
  16230. @item linear
  16231. @item iec61966-2-1
  16232. @item srgb
  16233. @item iec61966-2-4
  16234. @item xvycc
  16235. @item bt1361e
  16236. @item bt2020-10
  16237. @item bt2020-12
  16238. @item smpte2084
  16239. @item smpte428
  16240. @item arib-std-b67
  16241. @end table
  16242. @item force_original_aspect_ratio
  16243. Enable decreasing or increasing output video width or height if necessary to
  16244. keep the original aspect ratio. Possible values:
  16245. @table @samp
  16246. @item disable
  16247. Scale the video as specified and disable this feature.
  16248. @item decrease
  16249. The output video dimensions will automatically be decreased if needed.
  16250. @item increase
  16251. The output video dimensions will automatically be increased if needed.
  16252. @end table
  16253. One useful instance of this option is that when you know a specific device's
  16254. maximum allowed resolution, you can use this to limit the output video to
  16255. that, while retaining the aspect ratio. For example, device A allows
  16256. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  16257. decrease) and specifying 1280x720 to the command line makes the output
  16258. 1280x533.
  16259. Please note that this is a different thing than specifying -1 for @option{w}
  16260. or @option{h}, you still need to specify the output resolution for this option
  16261. to work.
  16262. @item force_divisible_by
  16263. Ensures that both the output dimensions, width and height, are divisible by the
  16264. given integer when used together with @option{force_original_aspect_ratio}. This
  16265. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16266. This option respects the value set for @option{force_original_aspect_ratio},
  16267. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16268. may be slightly modified.
  16269. This option can be handy if you need to have a video fit within or exceed
  16270. a defined resolution using @option{force_original_aspect_ratio} but also have
  16271. encoder restrictions on width or height divisibility.
  16272. @end table
  16273. The values of the @option{w} and @option{h} options are expressions
  16274. containing the following constants:
  16275. @table @var
  16276. @item in_w
  16277. @item in_h
  16278. The input width and height
  16279. @item iw
  16280. @item ih
  16281. These are the same as @var{in_w} and @var{in_h}.
  16282. @item out_w
  16283. @item out_h
  16284. The output (scaled) width and height
  16285. @item ow
  16286. @item oh
  16287. These are the same as @var{out_w} and @var{out_h}
  16288. @item a
  16289. The same as @var{iw} / @var{ih}
  16290. @item sar
  16291. input sample aspect ratio
  16292. @item dar
  16293. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16294. @item hsub
  16295. @item vsub
  16296. horizontal and vertical input chroma subsample values. For example for the
  16297. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16298. @item ohsub
  16299. @item ovsub
  16300. horizontal and vertical output chroma subsample values. For example for the
  16301. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16302. @item n
  16303. The (sequential) number of the input frame, starting from 0.
  16304. Only available with @code{eval=frame}.
  16305. @item t
  16306. The presentation timestamp of the input frame, expressed as a number of
  16307. seconds. Only available with @code{eval=frame}.
  16308. @item pos
  16309. The position (byte offset) of the frame in the input stream, or NaN if
  16310. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16311. Only available with @code{eval=frame}.
  16312. Deprecated, do not use.
  16313. @item ref_w, rw
  16314. @item ref_h, rh
  16315. @item ref_a
  16316. @item ref_dar, rdar
  16317. @item ref_n
  16318. @item ref_t
  16319. @item ref_pos
  16320. Eqvuialent to the above, but for a second reference input. If any of these
  16321. variables are present, this filter accepts two inputs.
  16322. @end table
  16323. @subsection Examples
  16324. @itemize
  16325. @item
  16326. Scale the input video to a size of 200x100
  16327. @example
  16328. scale=w=200:h=100
  16329. @end example
  16330. This is equivalent to:
  16331. @example
  16332. scale=200:100
  16333. @end example
  16334. or:
  16335. @example
  16336. scale=200x100
  16337. @end example
  16338. @item
  16339. Specify a size abbreviation for the output size:
  16340. @example
  16341. scale=qcif
  16342. @end example
  16343. which can also be written as:
  16344. @example
  16345. scale=size=qcif
  16346. @end example
  16347. @item
  16348. Scale the input to 2x:
  16349. @example
  16350. scale=w=2*iw:h=2*ih
  16351. @end example
  16352. @item
  16353. The above is the same as:
  16354. @example
  16355. scale=2*in_w:2*in_h
  16356. @end example
  16357. @item
  16358. Scale the input to 2x with forced interlaced scaling:
  16359. @example
  16360. scale=2*iw:2*ih:interl=1
  16361. @end example
  16362. @item
  16363. Scale the input to half size:
  16364. @example
  16365. scale=w=iw/2:h=ih/2
  16366. @end example
  16367. @item
  16368. Increase the width, and set the height to the same size:
  16369. @example
  16370. scale=3/2*iw:ow
  16371. @end example
  16372. @item
  16373. Seek Greek harmony:
  16374. @example
  16375. scale=iw:1/PHI*iw
  16376. scale=ih*PHI:ih
  16377. @end example
  16378. @item
  16379. Increase the height, and set the width to 3/2 of the height:
  16380. @example
  16381. scale=w=3/2*oh:h=3/5*ih
  16382. @end example
  16383. @item
  16384. Increase the size, making the size a multiple of the chroma
  16385. subsample values:
  16386. @example
  16387. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  16388. @end example
  16389. @item
  16390. Increase the width to a maximum of 500 pixels,
  16391. keeping the same aspect ratio as the input:
  16392. @example
  16393. scale=w='min(500\, iw*3/2):h=-1'
  16394. @end example
  16395. @item
  16396. Make pixels square by combining scale and setsar:
  16397. @example
  16398. scale='trunc(ih*dar):ih',setsar=1/1
  16399. @end example
  16400. @item
  16401. Make pixels square by combining scale and setsar,
  16402. making sure the resulting resolution is even (required by some codecs):
  16403. @example
  16404. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  16405. @end example
  16406. @item
  16407. Scale a subtitle stream (sub) to match the main video (main) in size before
  16408. overlaying. ("scale2ref")
  16409. @example
  16410. '[main]split[a][b]; [ref][a]scale=rw:rh[c]; [b][c]overlay'
  16411. @end example
  16412. @item
  16413. Scale a logo to 1/10th the height of a video, while preserving its display
  16414. aspect ratio.
  16415. @example
  16416. [logo-in][video-in]scale=w=oh*dar:h=rh/10[logo-out]
  16417. @end example
  16418. @end itemize
  16419. @subsection Commands
  16420. This filter supports the following commands:
  16421. @table @option
  16422. @item width, w
  16423. @item height, h
  16424. Set the output video dimension expression.
  16425. The command accepts the same syntax of the corresponding option.
  16426. If the specified expression is not valid, it is kept at its current
  16427. value.
  16428. @end table
  16429. @anchor{scale_cuda}
  16430. @section scale_cuda
  16431. Scale (resize) and convert (pixel format) the input video, using accelerated CUDA kernels.
  16432. Setting the output width and height works in the same way as for the @ref{scale} filter.
  16433. The filter accepts the following options:
  16434. @table @option
  16435. @item w
  16436. @item h
  16437. Set the output video dimension expression. Default value is the input dimension.
  16438. Allows for the same expressions as the @ref{scale} filter.
  16439. @item interp_algo
  16440. Sets the algorithm used for scaling:
  16441. @table @var
  16442. @item nearest
  16443. Nearest neighbour
  16444. Used by default if input parameters match the desired output.
  16445. @item bilinear
  16446. Bilinear
  16447. @item bicubic
  16448. Bicubic
  16449. This is the default.
  16450. @item lanczos
  16451. Lanczos
  16452. @end table
  16453. @item format
  16454. Controls the output pixel format. By default, or if none is specified, the input
  16455. pixel format is used.
  16456. The filter does not support converting between YUV and RGB pixel formats.
  16457. @item passthrough
  16458. If set to 0, every frame is processed, even if no conversion is necessary.
  16459. This mode can be useful to use the filter as a buffer for a downstream
  16460. frame-consumer that exhausts the limited decoder frame pool.
  16461. If set to 1, frames are passed through as-is if they match the desired output
  16462. parameters. This is the default behaviour.
  16463. @item param
  16464. Algorithm-Specific parameter.
  16465. Affects the curves of the bicubic algorithm.
  16466. @item force_original_aspect_ratio
  16467. @item force_divisible_by
  16468. Work the same as the identical @ref{scale} filter options.
  16469. @end table
  16470. @subsection Examples
  16471. @itemize
  16472. @item
  16473. Scale input to 720p, keeping aspect ratio and ensuring the output is yuv420p.
  16474. @example
  16475. scale_cuda=-2:720:format=yuv420p
  16476. @end example
  16477. @item
  16478. Upscale to 4K using nearest neighbour algorithm.
  16479. @example
  16480. scale_cuda=4096:2160:interp_algo=nearest
  16481. @end example
  16482. @item
  16483. Don't do any conversion or scaling, but copy all input frames into newly allocated ones.
  16484. This can be useful to deal with a filter and encode chain that otherwise exhausts the
  16485. decoders frame pool.
  16486. @example
  16487. scale_cuda=passthrough=0
  16488. @end example
  16489. @end itemize
  16490. @anchor{scale_npp}
  16491. @section scale_npp
  16492. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  16493. format conversion on CUDA video frames. Setting the output width and height
  16494. works in the same way as for the @var{scale} filter.
  16495. The following additional options are accepted:
  16496. @table @option
  16497. @item format
  16498. The pixel format of the output CUDA frames. If set to the string "same" (the
  16499. default), the input format will be kept. Note that automatic format negotiation
  16500. and conversion is not yet supported for hardware frames
  16501. @item interp_algo
  16502. The interpolation algorithm used for resizing. One of the following:
  16503. @table @option
  16504. @item nn
  16505. Nearest neighbour.
  16506. @item linear
  16507. @item cubic
  16508. @item cubic2p_bspline
  16509. 2-parameter cubic (B=1, C=0)
  16510. @item cubic2p_catmullrom
  16511. 2-parameter cubic (B=0, C=1/2)
  16512. @item cubic2p_b05c03
  16513. 2-parameter cubic (B=1/2, C=3/10)
  16514. @item super
  16515. Supersampling
  16516. @item lanczos
  16517. @end table
  16518. @item force_original_aspect_ratio
  16519. Enable decreasing or increasing output video width or height if necessary to
  16520. keep the original aspect ratio. Possible values:
  16521. @table @samp
  16522. @item disable
  16523. Scale the video as specified and disable this feature.
  16524. @item decrease
  16525. The output video dimensions will automatically be decreased if needed.
  16526. @item increase
  16527. The output video dimensions will automatically be increased if needed.
  16528. @end table
  16529. One useful instance of this option is that when you know a specific device's
  16530. maximum allowed resolution, you can use this to limit the output video to
  16531. that, while retaining the aspect ratio. For example, device A allows
  16532. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  16533. decrease) and specifying 1280x720 to the command line makes the output
  16534. 1280x533.
  16535. Please note that this is a different thing than specifying -1 for @option{w}
  16536. or @option{h}, you still need to specify the output resolution for this option
  16537. to work.
  16538. @item force_divisible_by
  16539. Ensures that both the output dimensions, width and height, are divisible by the
  16540. given integer when used together with @option{force_original_aspect_ratio}. This
  16541. works similar to using @code{-n} in the @option{w} and @option{h} options.
  16542. This option respects the value set for @option{force_original_aspect_ratio},
  16543. increasing or decreasing the resolution accordingly. The video's aspect ratio
  16544. may be slightly modified.
  16545. This option can be handy if you need to have a video fit within or exceed
  16546. a defined resolution using @option{force_original_aspect_ratio} but also have
  16547. encoder restrictions on width or height divisibility.
  16548. @item eval
  16549. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  16550. @table @samp
  16551. @item init
  16552. Only evaluate expressions once during the filter initialization or when a command is processed.
  16553. @item frame
  16554. Evaluate expressions for each incoming frame.
  16555. @end table
  16556. @end table
  16557. The values of the @option{w} and @option{h} options are expressions
  16558. containing the following constants:
  16559. @table @var
  16560. @item in_w
  16561. @item in_h
  16562. The input width and height
  16563. @item iw
  16564. @item ih
  16565. These are the same as @var{in_w} and @var{in_h}.
  16566. @item out_w
  16567. @item out_h
  16568. The output (scaled) width and height
  16569. @item ow
  16570. @item oh
  16571. These are the same as @var{out_w} and @var{out_h}
  16572. @item a
  16573. The same as @var{iw} / @var{ih}
  16574. @item sar
  16575. input sample aspect ratio
  16576. @item dar
  16577. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  16578. @item n
  16579. The (sequential) number of the input frame, starting from 0.
  16580. Only available with @code{eval=frame}.
  16581. @item t
  16582. The presentation timestamp of the input frame, expressed as a number of
  16583. seconds. Only available with @code{eval=frame}.
  16584. @item pos
  16585. The position (byte offset) of the frame in the input stream, or NaN if
  16586. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16587. Only available with @code{eval=frame}.
  16588. Deprecated, do not use.
  16589. @end table
  16590. @section scale2ref_npp
  16591. Use the NVIDIA Performance Primitives (libnpp) to scale (resize) the input
  16592. video, based on a reference video.
  16593. See the @ref{scale_npp} filter for available options, scale2ref_npp supports the same
  16594. but uses the reference video instead of the main input as basis. scale2ref_npp
  16595. also supports the following additional constants for the @option{w} and
  16596. @option{h} options:
  16597. @table @var
  16598. @item main_w
  16599. @item main_h
  16600. The main input video's width and height
  16601. @item main_a
  16602. The same as @var{main_w} / @var{main_h}
  16603. @item main_sar
  16604. The main input video's sample aspect ratio
  16605. @item main_dar, mdar
  16606. The main input video's display aspect ratio. Calculated from
  16607. @code{(main_w / main_h) * main_sar}.
  16608. @item main_n
  16609. The (sequential) number of the main input frame, starting from 0.
  16610. Only available with @code{eval=frame}.
  16611. @item main_t
  16612. The presentation timestamp of the main input frame, expressed as a number of
  16613. seconds. Only available with @code{eval=frame}.
  16614. @item main_pos
  16615. The position (byte offset) of the frame in the main input stream, or NaN if
  16616. this information is unavailable and/or meaningless (for example in case of synthetic video).
  16617. Only available with @code{eval=frame}.
  16618. @end table
  16619. @subsection Examples
  16620. @itemize
  16621. @item
  16622. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  16623. @example
  16624. 'scale2ref_npp[b][a];[a][b]overlay_cuda'
  16625. @end example
  16626. @item
  16627. Scale a logo to 1/10th the height of a video, while preserving its display aspect ratio.
  16628. @example
  16629. [logo-in][video-in]scale2ref_npp=w=oh*mdar:h=ih/10[logo-out][video-out]
  16630. @end example
  16631. @end itemize
  16632. @section scale_vt
  16633. Scale and convert the color parameters using VTPixelTransferSession.
  16634. The filter accepts the following options:
  16635. @table @option
  16636. @item w
  16637. @item h
  16638. Set the output video dimension expression. Default value is the input dimension.
  16639. @item color_matrix
  16640. Set the output colorspace matrix.
  16641. @item color_primaries
  16642. Set the output color primaries.
  16643. @item color_transfer
  16644. Set the output transfer characteristics.
  16645. @end table
  16646. @section scharr
  16647. Apply scharr operator to input video stream.
  16648. The filter accepts the following option:
  16649. @table @option
  16650. @item planes
  16651. Set which planes will be processed, unprocessed planes will be copied.
  16652. By default value 0xf, all planes will be processed.
  16653. @item scale
  16654. Set value which will be multiplied with filtered result.
  16655. @item delta
  16656. Set value which will be added to filtered result.
  16657. @end table
  16658. @subsection Commands
  16659. This filter supports the all above options as @ref{commands}.
  16660. @section scroll
  16661. Scroll input video horizontally and/or vertically by constant speed.
  16662. The filter accepts the following options:
  16663. @table @option
  16664. @item horizontal, h
  16665. Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16666. Negative values changes scrolling direction.
  16667. @item vertical, v
  16668. Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to 1.
  16669. Negative values changes scrolling direction.
  16670. @item hpos
  16671. Set the initial horizontal scrolling position. Default is 0. Allowed range is from 0 to 1.
  16672. @item vpos
  16673. Set the initial vertical scrolling position. Default is 0. Allowed range is from 0 to 1.
  16674. @end table
  16675. @subsection Commands
  16676. This filter supports the following @ref{commands}:
  16677. @table @option
  16678. @item horizontal, h
  16679. Set the horizontal scrolling speed.
  16680. @item vertical, v
  16681. Set the vertical scrolling speed.
  16682. @end table
  16683. @anchor{scdet}
  16684. @section scdet
  16685. Detect video scene change.
  16686. This filter sets frame metadata with mafd between frame, the scene score, and
  16687. forward the frame to the next filter, so they can use these metadata to detect
  16688. scene change or others.
  16689. In addition, this filter logs a message and sets frame metadata when it detects
  16690. a scene change by @option{threshold}.
  16691. @code{lavfi.scd.mafd} metadata keys are set with mafd for every frame.
  16692. @code{lavfi.scd.score} metadata keys are set with scene change score for every frame
  16693. to detect scene change.
  16694. @code{lavfi.scd.time} metadata keys are set with current filtered frame time which
  16695. detect scene change with @option{threshold}.
  16696. The filter accepts the following options:
  16697. @table @option
  16698. @item threshold, t
  16699. Set the scene change detection threshold as a percentage of maximum change. Good
  16700. values are in the @code{[8.0, 14.0]} range. The range for @option{threshold} is
  16701. @code{[0., 100.]}.
  16702. Default value is @code{10.}.
  16703. @item sc_pass, s
  16704. Set the flag to pass scene change frames to the next filter. Default value is @code{0}
  16705. You can enable it if you want to get snapshot of scene change frames only.
  16706. @end table
  16707. @anchor{selectivecolor}
  16708. @section selectivecolor
  16709. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  16710. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  16711. by the "purity" of the color (that is, how saturated it already is).
  16712. This filter is similar to the Adobe Photoshop Selective Color tool.
  16713. The filter accepts the following options:
  16714. @table @option
  16715. @item correction_method
  16716. Select color correction method.
  16717. Available values are:
  16718. @table @samp
  16719. @item absolute
  16720. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  16721. component value).
  16722. @item relative
  16723. Specified adjustments are relative to the original component value.
  16724. @end table
  16725. Default is @code{absolute}.
  16726. @item reds
  16727. Adjustments for red pixels (pixels where the red component is the maximum)
  16728. @item yellows
  16729. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  16730. @item greens
  16731. Adjustments for green pixels (pixels where the green component is the maximum)
  16732. @item cyans
  16733. Adjustments for cyan pixels (pixels where the red component is the minimum)
  16734. @item blues
  16735. Adjustments for blue pixels (pixels where the blue component is the maximum)
  16736. @item magentas
  16737. Adjustments for magenta pixels (pixels where the green component is the minimum)
  16738. @item whites
  16739. Adjustments for white pixels (pixels where all components are greater than 128)
  16740. @item neutrals
  16741. Adjustments for all pixels except pure black and pure white
  16742. @item blacks
  16743. Adjustments for black pixels (pixels where all components are lesser than 128)
  16744. @item psfile
  16745. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  16746. @end table
  16747. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  16748. 4 space separated floating point adjustment values in the [-1,1] range,
  16749. respectively to adjust the amount of cyan, magenta, yellow and black for the
  16750. pixels of its range.
  16751. @subsection Examples
  16752. @itemize
  16753. @item
  16754. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  16755. increase magenta by 27% in blue areas:
  16756. @example
  16757. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  16758. @end example
  16759. @item
  16760. Use a Photoshop selective color preset:
  16761. @example
  16762. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  16763. @end example
  16764. @end itemize
  16765. @anchor{separatefields}
  16766. @section separatefields
  16767. The @code{separatefields} takes a frame-based video input and splits
  16768. each frame into its components fields, producing a new half height clip
  16769. with twice the frame rate and twice the frame count.
  16770. This filter use field-dominance information in frame to decide which
  16771. of each pair of fields to place first in the output.
  16772. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  16773. @section setdar, setsar
  16774. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  16775. output video.
  16776. This is done by changing the specified Sample (aka Pixel) Aspect
  16777. Ratio, according to the following equation:
  16778. @example
  16779. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  16780. @end example
  16781. Keep in mind that the @code{setdar} filter does not modify the pixel
  16782. dimensions of the video frame. Also, the display aspect ratio set by
  16783. this filter may be changed by later filters in the filterchain,
  16784. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  16785. applied.
  16786. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  16787. the filter output video.
  16788. Note that as a consequence of the application of this filter, the
  16789. output display aspect ratio will change according to the equation
  16790. above.
  16791. Keep in mind that the sample aspect ratio set by the @code{setsar}
  16792. filter may be changed by later filters in the filterchain, e.g. if
  16793. another "setsar" or a "setdar" filter is applied.
  16794. It accepts the following parameters:
  16795. @table @option
  16796. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  16797. Set the aspect ratio used by the filter.
  16798. The parameter can be a floating point number string, or an expression. If the
  16799. parameter is not specified, the value "0" is assumed, meaning that the same
  16800. input value is used.
  16801. @item max
  16802. Set the maximum integer value to use for expressing numerator and
  16803. denominator when reducing the expressed aspect ratio to a rational.
  16804. Default value is @code{100}.
  16805. @end table
  16806. The parameter @var{sar} is an expression containing the following constants:
  16807. @table @option
  16808. @item w, h
  16809. The input width and height.
  16810. @item a
  16811. Same as @var{w} / @var{h}.
  16812. @item sar
  16813. The input sample aspect ratio.
  16814. @item dar
  16815. The input display aspect ratio. It is the same as
  16816. (@var{w} / @var{h}) * @var{sar}.
  16817. @item hsub, vsub
  16818. Horizontal and vertical chroma subsample values. For example, for the
  16819. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  16820. @end table
  16821. @subsection Examples
  16822. @itemize
  16823. @item
  16824. To change the display aspect ratio to 16:9, specify one of the following:
  16825. @example
  16826. setdar=dar=1.77777
  16827. setdar=dar=16/9
  16828. @end example
  16829. @item
  16830. To change the sample aspect ratio to 10:11, specify:
  16831. @example
  16832. setsar=sar=10/11
  16833. @end example
  16834. @item
  16835. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  16836. 1000 in the aspect ratio reduction, use the command:
  16837. @example
  16838. setdar=ratio=16/9:max=1000
  16839. @end example
  16840. @end itemize
  16841. @anchor{setfield}
  16842. @section setfield
  16843. Force field for the output video frame.
  16844. The @code{setfield} filter marks the interlace type field for the
  16845. output frames. It does not change the input frame, but only sets the
  16846. corresponding property, which affects how the frame is treated by
  16847. following filters (e.g. @code{fieldorder} or @code{yadif}).
  16848. The filter accepts the following options:
  16849. @table @option
  16850. @item mode
  16851. Available values are:
  16852. @table @samp
  16853. @item auto
  16854. Keep the same field property.
  16855. @item bff
  16856. Mark the frame as bottom-field-first.
  16857. @item tff
  16858. Mark the frame as top-field-first.
  16859. @item prog
  16860. Mark the frame as progressive.
  16861. @end table
  16862. @end table
  16863. @anchor{setparams}
  16864. @section setparams
  16865. Force frame parameter for the output video frame.
  16866. The @code{setparams} filter marks interlace and color range for the
  16867. output frames. It does not change the input frame, but only sets the
  16868. corresponding property, which affects how the frame is treated by
  16869. filters/encoders.
  16870. @table @option
  16871. @item field_mode
  16872. Available values are:
  16873. @table @samp
  16874. @item auto
  16875. Keep the same field property (default).
  16876. @item bff
  16877. Mark the frame as bottom-field-first.
  16878. @item tff
  16879. Mark the frame as top-field-first.
  16880. @item prog
  16881. Mark the frame as progressive.
  16882. @end table
  16883. @item range
  16884. Available values are:
  16885. @table @samp
  16886. @item auto
  16887. Keep the same color range property (default).
  16888. @item unspecified, unknown
  16889. Mark the frame as unspecified color range.
  16890. @item limited, tv, mpeg
  16891. Mark the frame as limited range.
  16892. @item full, pc, jpeg
  16893. Mark the frame as full range.
  16894. @end table
  16895. @item color_primaries
  16896. Set the color primaries.
  16897. Available values are:
  16898. @table @samp
  16899. @item auto
  16900. Keep the same color primaries property (default).
  16901. @item bt709
  16902. @item unknown
  16903. @item bt470m
  16904. @item bt470bg
  16905. @item smpte170m
  16906. @item smpte240m
  16907. @item film
  16908. @item bt2020
  16909. @item smpte428
  16910. @item smpte431
  16911. @item smpte432
  16912. @item jedec-p22
  16913. @end table
  16914. @item color_trc
  16915. Set the color transfer.
  16916. Available values are:
  16917. @table @samp
  16918. @item auto
  16919. Keep the same color trc property (default).
  16920. @item bt709
  16921. @item unknown
  16922. @item bt470m
  16923. @item bt470bg
  16924. @item smpte170m
  16925. @item smpte240m
  16926. @item linear
  16927. @item log100
  16928. @item log316
  16929. @item iec61966-2-4
  16930. @item bt1361e
  16931. @item iec61966-2-1
  16932. @item bt2020-10
  16933. @item bt2020-12
  16934. @item smpte2084
  16935. @item smpte428
  16936. @item arib-std-b67
  16937. @end table
  16938. @item colorspace
  16939. Set the colorspace.
  16940. Available values are:
  16941. @table @samp
  16942. @item auto
  16943. Keep the same colorspace property (default).
  16944. @item gbr
  16945. @item bt709
  16946. @item unknown
  16947. @item fcc
  16948. @item bt470bg
  16949. @item smpte170m
  16950. @item smpte240m
  16951. @item ycgco
  16952. @item bt2020nc
  16953. @item bt2020c
  16954. @item smpte2085
  16955. @item chroma-derived-nc
  16956. @item chroma-derived-c
  16957. @item ictcp
  16958. @end table
  16959. @item chroma_location
  16960. Set the chroma sample location.
  16961. Available values are:
  16962. @table @samp
  16963. @item auto
  16964. Keep the same chroma location (default).
  16965. @item unspecified, unknown
  16966. @item left
  16967. @item center
  16968. @item topleft
  16969. @item top
  16970. @item bottomleft
  16971. @item bottom
  16972. @end table
  16973. @end table
  16974. @section sharpen_npp
  16975. Use the NVIDIA Performance Primitives (libnpp) to perform image sharpening with
  16976. border control.
  16977. The following additional options are accepted:
  16978. @table @option
  16979. @item border_type
  16980. Type of sampling to be used ad frame borders. One of the following:
  16981. @table @option
  16982. @item replicate
  16983. Replicate pixel values.
  16984. @end table
  16985. @end table
  16986. @section shear
  16987. Apply shear transform to input video.
  16988. This filter supports the following options:
  16989. @table @option
  16990. @item shx
  16991. Shear factor in X-direction. Default value is 0.
  16992. Allowed range is from -2 to 2.
  16993. @item shy
  16994. Shear factor in Y-direction. Default value is 0.
  16995. Allowed range is from -2 to 2.
  16996. @item fillcolor, c
  16997. Set the color used to fill the output area not covered by the transformed
  16998. video. For the general syntax of this option, check the
  16999. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17000. If the special value "none" is selected then no
  17001. background is printed (useful for example if the background is never shown).
  17002. Default value is "black".
  17003. @item interp
  17004. Set interpolation type. Can be @code{bilinear} or @code{nearest}. Default is @code{bilinear}.
  17005. @end table
  17006. @subsection Commands
  17007. This filter supports the all above options as @ref{commands}.
  17008. @section showinfo
  17009. Show a line containing various information for each input video frame.
  17010. The input video is not modified.
  17011. This filter supports the following options:
  17012. @table @option
  17013. @item checksum
  17014. Calculate checksums of each plane. By default enabled.
  17015. @item udu_sei_as_ascii
  17016. Try to print user data unregistered SEI as ascii character when possible,
  17017. in hex format otherwise.
  17018. @end table
  17019. The shown line contains a sequence of key/value pairs of the form
  17020. @var{key}:@var{value}.
  17021. The following values are shown in the output:
  17022. @table @option
  17023. @item n
  17024. The (sequential) number of the input frame, starting from 0.
  17025. @item pts
  17026. The Presentation TimeStamp of the input frame, expressed as a number of
  17027. time base units. The time base unit depends on the filter input pad.
  17028. @item pts_time
  17029. The Presentation TimeStamp of the input frame, expressed as a number of
  17030. seconds.
  17031. @item fmt
  17032. The pixel format name.
  17033. @item sar
  17034. The sample aspect ratio of the input frame, expressed in the form
  17035. @var{num}/@var{den}.
  17036. @item s
  17037. The size of the input frame. For the syntax of this option, check the
  17038. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17039. @item i
  17040. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  17041. for bottom field first).
  17042. @item iskey
  17043. This is 1 if the frame is a key frame, 0 otherwise.
  17044. @item type
  17045. The picture type of the input frame ("I" for an I-frame, "P" for a
  17046. P-frame, "B" for a B-frame, or "?" for an unknown type).
  17047. Also refer to the documentation of the @code{AVPictureType} enum and of
  17048. the @code{av_get_picture_type_char} function defined in
  17049. @file{libavutil/avutil.h}.
  17050. @item checksum
  17051. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  17052. @item plane_checksum
  17053. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  17054. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  17055. @item mean
  17056. The mean value of pixels in each plane of the input frame, expressed in the form
  17057. "[@var{mean0} @var{mean1} @var{mean2} @var{mean3}]".
  17058. @item stdev
  17059. The standard deviation of pixel values in each plane of the input frame, expressed
  17060. in the form "[@var{stdev0} @var{stdev1} @var{stdev2} @var{stdev3}]".
  17061. @end table
  17062. @section showpalette
  17063. Displays the 256 colors palette of each frame. This filter is only relevant for
  17064. @var{pal8} pixel format frames.
  17065. It accepts the following option:
  17066. @table @option
  17067. @item s
  17068. Set the size of the box used to represent one palette color entry. Default is
  17069. @code{30} (for a @code{30x30} pixel box).
  17070. @end table
  17071. @section shuffleframes
  17072. Reorder and/or duplicate and/or drop video frames.
  17073. It accepts the following parameters:
  17074. @table @option
  17075. @item mapping
  17076. Set the destination indexes of input frames.
  17077. This is space or '|' separated list of indexes that maps input frames to output
  17078. frames. Number of indexes also sets maximal value that each index may have.
  17079. '-1' index have special meaning and that is to drop frame.
  17080. @end table
  17081. The first frame has the index 0. The default is to keep the input unchanged.
  17082. @subsection Examples
  17083. @itemize
  17084. @item
  17085. Swap second and third frame of every three frames of the input:
  17086. @example
  17087. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  17088. @end example
  17089. @item
  17090. Swap 10th and 1st frame of every ten frames of the input:
  17091. @example
  17092. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  17093. @end example
  17094. @end itemize
  17095. @section shufflepixels
  17096. Reorder pixels in video frames.
  17097. This filter accepts the following options:
  17098. @table @option
  17099. @item direction, d
  17100. Set shuffle direction. Can be forward or inverse direction.
  17101. Default direction is forward.
  17102. @item mode, m
  17103. Set shuffle mode. Can be horizontal, vertical or block mode.
  17104. @item width, w
  17105. @item height, h
  17106. Set shuffle block_size. In case of horizontal shuffle mode only width
  17107. part of size is used, and in case of vertical shuffle mode only height
  17108. part of size is used.
  17109. @item seed, s
  17110. Set random seed used with shuffling pixels. Mainly useful to set to be able
  17111. to reverse filtering process to get original input.
  17112. For example, to reverse forward shuffle you need to use same parameters
  17113. and exact same seed and to set direction to inverse.
  17114. @end table
  17115. @section shuffleplanes
  17116. Reorder and/or duplicate video planes.
  17117. It accepts the following parameters:
  17118. @table @option
  17119. @item map0
  17120. The index of the input plane to be used as the first output plane.
  17121. @item map1
  17122. The index of the input plane to be used as the second output plane.
  17123. @item map2
  17124. The index of the input plane to be used as the third output plane.
  17125. @item map3
  17126. The index of the input plane to be used as the fourth output plane.
  17127. @end table
  17128. The first plane has the index 0. The default is to keep the input unchanged.
  17129. @subsection Examples
  17130. @itemize
  17131. @item
  17132. Swap the second and third planes of the input:
  17133. @example
  17134. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  17135. @end example
  17136. @end itemize
  17137. @anchor{signalstats}
  17138. @section signalstats
  17139. Evaluate various visual metrics that assist in determining issues associated
  17140. with the digitization of analog video media.
  17141. By default the filter will log these metadata values:
  17142. @table @option
  17143. @item YMIN
  17144. Display the minimal Y value contained within the input frame. Expressed in
  17145. range of [0-255].
  17146. @item YLOW
  17147. Display the Y value at the 10% percentile within the input frame. Expressed in
  17148. range of [0-255].
  17149. @item YAVG
  17150. Display the average Y value within the input frame. Expressed in range of
  17151. [0-255].
  17152. @item YHIGH
  17153. Display the Y value at the 90% percentile within the input frame. Expressed in
  17154. range of [0-255].
  17155. @item YMAX
  17156. Display the maximum Y value contained within the input frame. Expressed in
  17157. range of [0-255].
  17158. @item UMIN
  17159. Display the minimal U value contained within the input frame. Expressed in
  17160. range of [0-255].
  17161. @item ULOW
  17162. Display the U value at the 10% percentile within the input frame. Expressed in
  17163. range of [0-255].
  17164. @item UAVG
  17165. Display the average U value within the input frame. Expressed in range of
  17166. [0-255].
  17167. @item UHIGH
  17168. Display the U value at the 90% percentile within the input frame. Expressed in
  17169. range of [0-255].
  17170. @item UMAX
  17171. Display the maximum U value contained within the input frame. Expressed in
  17172. range of [0-255].
  17173. @item VMIN
  17174. Display the minimal V value contained within the input frame. Expressed in
  17175. range of [0-255].
  17176. @item VLOW
  17177. Display the V value at the 10% percentile within the input frame. Expressed in
  17178. range of [0-255].
  17179. @item VAVG
  17180. Display the average V value within the input frame. Expressed in range of
  17181. [0-255].
  17182. @item VHIGH
  17183. Display the V value at the 90% percentile within the input frame. Expressed in
  17184. range of [0-255].
  17185. @item VMAX
  17186. Display the maximum V value contained within the input frame. Expressed in
  17187. range of [0-255].
  17188. @item SATMIN
  17189. Display the minimal saturation value contained within the input frame.
  17190. Expressed in range of [0-~181.02].
  17191. @item SATLOW
  17192. Display the saturation value at the 10% percentile within the input frame.
  17193. Expressed in range of [0-~181.02].
  17194. @item SATAVG
  17195. Display the average saturation value within the input frame. Expressed in range
  17196. of [0-~181.02].
  17197. @item SATHIGH
  17198. Display the saturation value at the 90% percentile within the input frame.
  17199. Expressed in range of [0-~181.02].
  17200. @item SATMAX
  17201. Display the maximum saturation value contained within the input frame.
  17202. Expressed in range of [0-~181.02].
  17203. @item HUEMED
  17204. Display the median value for hue within the input frame. Expressed in range of
  17205. [0-360].
  17206. @item HUEAVG
  17207. Display the average value for hue within the input frame. Expressed in range of
  17208. [0-360].
  17209. @item YDIF
  17210. Display the average of sample value difference between all values of the Y
  17211. plane in the current frame and corresponding values of the previous input frame.
  17212. Expressed in range of [0-255].
  17213. @item UDIF
  17214. Display the average of sample value difference between all values of the U
  17215. plane in the current frame and corresponding values of the previous input frame.
  17216. Expressed in range of [0-255].
  17217. @item VDIF
  17218. Display the average of sample value difference between all values of the V
  17219. plane in the current frame and corresponding values of the previous input frame.
  17220. Expressed in range of [0-255].
  17221. @item YBITDEPTH
  17222. Display bit depth of Y plane in current frame.
  17223. Expressed in range of [0-16].
  17224. @item UBITDEPTH
  17225. Display bit depth of U plane in current frame.
  17226. Expressed in range of [0-16].
  17227. @item VBITDEPTH
  17228. Display bit depth of V plane in current frame.
  17229. Expressed in range of [0-16].
  17230. @end table
  17231. The filter accepts the following options:
  17232. @table @option
  17233. @item stat
  17234. @item out
  17235. @option{stat} specify an additional form of image analysis.
  17236. @option{out} output video with the specified type of pixel highlighted.
  17237. Both options accept the following values:
  17238. @table @samp
  17239. @item tout
  17240. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  17241. unlike the neighboring pixels of the same field. Examples of temporal outliers
  17242. include the results of video dropouts, head clogs, or tape tracking issues.
  17243. @item vrep
  17244. Identify @var{vertical line repetition}. Vertical line repetition includes
  17245. similar rows of pixels within a frame. In born-digital video vertical line
  17246. repetition is common, but this pattern is uncommon in video digitized from an
  17247. analog source. When it occurs in video that results from the digitization of an
  17248. analog source it can indicate concealment from a dropout compensator.
  17249. @item brng
  17250. Identify pixels that fall outside of legal broadcast range.
  17251. @end table
  17252. @item color, c
  17253. Set the highlight color for the @option{out} option. The default color is
  17254. yellow.
  17255. @end table
  17256. @subsection Examples
  17257. @itemize
  17258. @item
  17259. Output data of various video metrics:
  17260. @example
  17261. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  17262. @end example
  17263. @item
  17264. Output specific data about the minimum and maximum values of the Y plane per frame:
  17265. @example
  17266. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  17267. @end example
  17268. @item
  17269. Playback video while highlighting pixels that are outside of broadcast range in red.
  17270. @example
  17271. ffplay example.mov -vf signalstats="out=brng:color=red"
  17272. @end example
  17273. @item
  17274. Playback video with signalstats metadata drawn over the frame.
  17275. @example
  17276. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  17277. @end example
  17278. The contents of signalstat_drawtext.txt used in the command are:
  17279. @example
  17280. time %@{pts:hms@}
  17281. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  17282. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  17283. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  17284. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  17285. @end example
  17286. @end itemize
  17287. @anchor{signature}
  17288. @section signature
  17289. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  17290. input. In this case the matching between the inputs can be calculated additionally.
  17291. The filter always passes through the first input. The signature of each stream can
  17292. be written into a file.
  17293. It accepts the following options:
  17294. @table @option
  17295. @item detectmode
  17296. Enable or disable the matching process.
  17297. Available values are:
  17298. @table @samp
  17299. @item off
  17300. Disable the calculation of a matching (default).
  17301. @item full
  17302. Calculate the matching for the whole video and output whether the whole video
  17303. matches or only parts.
  17304. @item fast
  17305. Calculate only until a matching is found or the video ends. Should be faster in
  17306. some cases.
  17307. @end table
  17308. @item nb_inputs
  17309. Set the number of inputs. The option value must be a non negative integer.
  17310. Default value is 1.
  17311. @item filename
  17312. Set the path to which the output is written. If there is more than one input,
  17313. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  17314. integer), that will be replaced with the input number. If no filename is
  17315. specified, no output will be written. This is the default.
  17316. @item format
  17317. Choose the output format.
  17318. Available values are:
  17319. @table @samp
  17320. @item binary
  17321. Use the specified binary representation (default).
  17322. @item xml
  17323. Use the specified xml representation.
  17324. @end table
  17325. @item th_d
  17326. Set threshold to detect one word as similar. The option value must be an integer
  17327. greater than zero. The default value is 9000.
  17328. @item th_dc
  17329. Set threshold to detect all words as similar. The option value must be an integer
  17330. greater than zero. The default value is 60000.
  17331. @item th_xh
  17332. Set threshold to detect frames as similar. The option value must be an integer
  17333. greater than zero. The default value is 116.
  17334. @item th_di
  17335. Set the minimum length of a sequence in frames to recognize it as matching
  17336. sequence. The option value must be a non negative integer value.
  17337. The default value is 0.
  17338. @item th_it
  17339. Set the minimum relation, that matching frames to all frames must have.
  17340. The option value must be a double value between 0 and 1. The default value is 0.5.
  17341. @end table
  17342. @subsection Examples
  17343. @itemize
  17344. @item
  17345. To calculate the signature of an input video and store it in signature.bin:
  17346. @example
  17347. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  17348. @end example
  17349. @item
  17350. To detect whether two videos match and store the signatures in XML format in
  17351. signature0.xml and signature1.xml:
  17352. @example
  17353. 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 -
  17354. @end example
  17355. @end itemize
  17356. @anchor{siti}
  17357. @section siti
  17358. Calculate Spatial Information (SI) and Temporal Information (TI) scores for a video,
  17359. as defined in ITU-T Rec. P.910 (11/21): Subjective video quality assessment methods
  17360. for multimedia applications. Available PDF at @url{https://www.itu.int/rec/T-REC-P.910-202111-S/en}.
  17361. Note that this is a legacy implementation that corresponds to a superseded recommendation.
  17362. 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}
  17363. It accepts the following option:
  17364. @table @option
  17365. @item print_summary
  17366. If set to 1, Summary statistics will be printed to the console. Default 0.
  17367. @end table
  17368. @subsection Examples
  17369. @itemize
  17370. @item
  17371. To calculate SI/TI metrics and print summary:
  17372. @example
  17373. ffmpeg -i input.mp4 -vf siti=print_summary=1 -f null -
  17374. @end example
  17375. @end itemize
  17376. @anchor{smartblur}
  17377. @section smartblur
  17378. Blur the input video without impacting the outlines.
  17379. It accepts the following options:
  17380. @table @option
  17381. @item luma_radius, lr
  17382. Set the luma radius. The option value must be a float number in
  17383. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17384. used to blur the image (slower if larger). Default value is 1.0.
  17385. @item luma_strength, ls
  17386. Set the luma strength. The option value must be a float number
  17387. in the range [-1.0,1.0] that configures the blurring. A value included
  17388. in [0.0,1.0] will blur the image whereas a value included in
  17389. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  17390. @item luma_threshold, lt
  17391. Set the luma threshold used as a coefficient to determine
  17392. whether a pixel should be blurred or not. The option value must be an
  17393. integer in the range [-30,30]. A value of 0 will filter all the image,
  17394. a value included in [0,30] will filter flat areas and a value included
  17395. in [-30,0] will filter edges. Default value is 0.
  17396. @item chroma_radius, cr
  17397. Set the chroma radius. The option value must be a float number in
  17398. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17399. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  17400. @item chroma_strength, cs
  17401. Set the chroma strength. The option value must be a float number
  17402. in the range [-1.0,1.0] that configures the blurring. A value included
  17403. in [0.0,1.0] will blur the image whereas a value included in
  17404. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  17405. @item chroma_threshold, ct
  17406. Set the chroma threshold used as a coefficient to determine
  17407. whether a pixel should be blurred or not. The option value must be an
  17408. integer in the range [-30,30]. A value of 0 will filter all the image,
  17409. a value included in [0,30] will filter flat areas and a value included
  17410. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  17411. @item alpha_radius, ar
  17412. Set the alpha radius. The option value must be a float number in
  17413. the range [0.1,5.0] that specifies the variance of the gaussian filter
  17414. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  17415. @item alpha_strength, as
  17416. Set the alpha strength. The option value must be a float number
  17417. in the range [-1.0,1.0] that configures the blurring. A value included
  17418. in [0.0,1.0] will blur the image whereas a value included in
  17419. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  17420. @item alpha_threshold, at
  17421. Set the alpha threshold used as a coefficient to determine
  17422. whether a pixel should be blurred or not. The option value must be an
  17423. integer in the range [-30,30]. A value of 0 will filter all the image,
  17424. a value included in [0,30] will filter flat areas and a value included
  17425. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  17426. @end table
  17427. If a chroma or alpha option is not explicitly set, the corresponding luma value
  17428. is set.
  17429. @section sobel
  17430. Apply sobel operator to input video stream.
  17431. The filter accepts the following option:
  17432. @table @option
  17433. @item planes
  17434. Set which planes will be processed, unprocessed planes will be copied.
  17435. By default value 0xf, all planes will be processed.
  17436. @item scale
  17437. Set value which will be multiplied with filtered result.
  17438. @item delta
  17439. Set value which will be added to filtered result.
  17440. @end table
  17441. @subsection Commands
  17442. This filter supports the all above options as @ref{commands}.
  17443. @anchor{spp}
  17444. @section spp
  17445. Apply a simple postprocessing filter that compresses and decompresses the image
  17446. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  17447. and average the results.
  17448. The filter accepts the following options:
  17449. @table @option
  17450. @item quality
  17451. Set quality. This option defines the number of levels for averaging. It accepts
  17452. an integer in the range 0-6. If set to @code{0}, the filter will have no
  17453. effect. A value of @code{6} means the higher quality. For each increment of
  17454. that value the speed drops by a factor of approximately 2. Default value is
  17455. @code{3}.
  17456. @item qp
  17457. Force a constant quantization parameter. If not set, the filter will use the QP
  17458. from the video stream (if available).
  17459. @item mode
  17460. Set thresholding mode. Available modes are:
  17461. @table @samp
  17462. @item hard
  17463. Set hard thresholding (default).
  17464. @item soft
  17465. Set soft thresholding (better de-ringing effect, but likely blurrier).
  17466. @end table
  17467. @item use_bframe_qp
  17468. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  17469. option may cause flicker since the B-Frames have often larger QP. Default is
  17470. @code{0} (not enabled).
  17471. @end table
  17472. @subsection Commands
  17473. This filter supports the following commands:
  17474. @table @option
  17475. @item quality, level
  17476. Set quality level. The value @code{max} can be used to set the maximum level,
  17477. currently @code{6}.
  17478. @end table
  17479. @anchor{sr}
  17480. @section sr
  17481. Scale the input by applying one of the super-resolution methods based on
  17482. convolutional neural networks. Supported models:
  17483. @itemize
  17484. @item
  17485. Super-Resolution Convolutional Neural Network model (SRCNN).
  17486. See @url{https://arxiv.org/abs/1501.00092}.
  17487. @item
  17488. Efficient Sub-Pixel Convolutional Neural Network model (ESPCN).
  17489. See @url{https://arxiv.org/abs/1609.05158}.
  17490. @end itemize
  17491. Training scripts as well as scripts for model file (.pb) saving can be found at
  17492. @url{https://github.com/XueweiMeng/sr/tree/sr_dnn_native}. Original repository
  17493. is at @url{https://github.com/HighVoltageRocknRoll/sr.git}.
  17494. The filter accepts the following options:
  17495. @table @option
  17496. @item dnn_backend
  17497. Specify which DNN backend to use for model loading and execution. This option accepts
  17498. the following values:
  17499. @table @samp
  17500. @item tensorflow
  17501. TensorFlow backend. To enable this backend you
  17502. need to install the TensorFlow for C library (see
  17503. @url{https://www.tensorflow.org/install/lang_c}) and configure FFmpeg with
  17504. @code{--enable-libtensorflow}
  17505. @end table
  17506. @item model
  17507. Set path to model file specifying network architecture and its parameters.
  17508. Note that different backends use different file formats. TensorFlow, OpenVINO backend
  17509. can load files for only its format.
  17510. @item scale_factor
  17511. Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}.
  17512. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts
  17513. input upscaled using bicubic upscaling with proper scale factor.
  17514. @end table
  17515. To get full functionality (such as async execution), please use the @ref{dnn_processing} filter.
  17516. @section ssim
  17517. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  17518. This filter takes in input two input videos, the first input is
  17519. considered the "main" source and is passed unchanged to the
  17520. output. The second input is used as a "reference" video for computing
  17521. the SSIM.
  17522. Both video inputs must have the same resolution and pixel format for
  17523. this filter to work correctly. Also it assumes that both inputs
  17524. have the same number of frames, which are compared one by one.
  17525. The filter stores the calculated SSIM of each frame.
  17526. The description of the accepted parameters follows.
  17527. @table @option
  17528. @item stats_file, f
  17529. If specified the filter will use the named file to save the SSIM of
  17530. each individual frame. When filename equals "-" the data is sent to
  17531. standard output.
  17532. @end table
  17533. The file printed if @var{stats_file} is selected, contains a sequence of
  17534. key/value pairs of the form @var{key}:@var{value} for each compared
  17535. couple of frames.
  17536. A description of each shown parameter follows:
  17537. @table @option
  17538. @item n
  17539. sequential number of the input frame, starting from 1
  17540. @item Y, U, V, R, G, B
  17541. SSIM of the compared frames for the component specified by the suffix.
  17542. @item All
  17543. SSIM of the compared frames for the whole frame.
  17544. @item dB
  17545. Same as above but in dB representation.
  17546. @end table
  17547. This filter also supports the @ref{framesync} options.
  17548. @subsection Examples
  17549. @itemize
  17550. @item
  17551. For example:
  17552. @example
  17553. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  17554. [main][ref] ssim="stats_file=stats.log" [out]
  17555. @end example
  17556. On this example the input file being processed is compared with the
  17557. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  17558. is stored in @file{stats.log}.
  17559. @item
  17560. Another example with both psnr and ssim at same time:
  17561. @example
  17562. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  17563. @end example
  17564. @item
  17565. Another example with different containers:
  17566. @example
  17567. 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 -
  17568. @end example
  17569. @end itemize
  17570. @section stereo3d
  17571. Convert between different stereoscopic image formats.
  17572. The filters accept the following options:
  17573. @table @option
  17574. @item in
  17575. Set stereoscopic image format of input.
  17576. Available values for input image formats are:
  17577. @table @samp
  17578. @item sbsl
  17579. side by side parallel (left eye left, right eye right)
  17580. @item sbsr
  17581. side by side crosseye (right eye left, left eye right)
  17582. @item sbs2l
  17583. side by side parallel with half width resolution
  17584. (left eye left, right eye right)
  17585. @item sbs2r
  17586. side by side crosseye with half width resolution
  17587. (right eye left, left eye right)
  17588. @item abl
  17589. @item tbl
  17590. above-below (left eye above, right eye below)
  17591. @item abr
  17592. @item tbr
  17593. above-below (right eye above, left eye below)
  17594. @item ab2l
  17595. @item tb2l
  17596. above-below with half height resolution
  17597. (left eye above, right eye below)
  17598. @item ab2r
  17599. @item tb2r
  17600. above-below with half height resolution
  17601. (right eye above, left eye below)
  17602. @item al
  17603. alternating frames (left eye first, right eye second)
  17604. @item ar
  17605. alternating frames (right eye first, left eye second)
  17606. @item irl
  17607. interleaved rows (left eye has top row, right eye starts on next row)
  17608. @item irr
  17609. interleaved rows (right eye has top row, left eye starts on next row)
  17610. @item icl
  17611. interleaved columns, left eye first
  17612. @item icr
  17613. interleaved columns, right eye first
  17614. Default value is @samp{sbsl}.
  17615. @end table
  17616. @item out
  17617. Set stereoscopic image format of output.
  17618. @table @samp
  17619. @item sbsl
  17620. side by side parallel (left eye left, right eye right)
  17621. @item sbsr
  17622. side by side crosseye (right eye left, left eye right)
  17623. @item sbs2l
  17624. side by side parallel with half width resolution
  17625. (left eye left, right eye right)
  17626. @item sbs2r
  17627. side by side crosseye with half width resolution
  17628. (right eye left, left eye right)
  17629. @item abl
  17630. @item tbl
  17631. above-below (left eye above, right eye below)
  17632. @item abr
  17633. @item tbr
  17634. above-below (right eye above, left eye below)
  17635. @item ab2l
  17636. @item tb2l
  17637. above-below with half height resolution
  17638. (left eye above, right eye below)
  17639. @item ab2r
  17640. @item tb2r
  17641. above-below with half height resolution
  17642. (right eye above, left eye below)
  17643. @item al
  17644. alternating frames (left eye first, right eye second)
  17645. @item ar
  17646. alternating frames (right eye first, left eye second)
  17647. @item irl
  17648. interleaved rows (left eye has top row, right eye starts on next row)
  17649. @item irr
  17650. interleaved rows (right eye has top row, left eye starts on next row)
  17651. @item arbg
  17652. anaglyph red/blue gray
  17653. (red filter on left eye, blue filter on right eye)
  17654. @item argg
  17655. anaglyph red/green gray
  17656. (red filter on left eye, green filter on right eye)
  17657. @item arcg
  17658. anaglyph red/cyan gray
  17659. (red filter on left eye, cyan filter on right eye)
  17660. @item arch
  17661. anaglyph red/cyan half colored
  17662. (red filter on left eye, cyan filter on right eye)
  17663. @item arcc
  17664. anaglyph red/cyan color
  17665. (red filter on left eye, cyan filter on right eye)
  17666. @item arcd
  17667. anaglyph red/cyan color optimized with the least squares projection of dubois
  17668. (red filter on left eye, cyan filter on right eye)
  17669. @item agmg
  17670. anaglyph green/magenta gray
  17671. (green filter on left eye, magenta filter on right eye)
  17672. @item agmh
  17673. anaglyph green/magenta half colored
  17674. (green filter on left eye, magenta filter on right eye)
  17675. @item agmc
  17676. anaglyph green/magenta colored
  17677. (green filter on left eye, magenta filter on right eye)
  17678. @item agmd
  17679. anaglyph green/magenta color optimized with the least squares projection of dubois
  17680. (green filter on left eye, magenta filter on right eye)
  17681. @item aybg
  17682. anaglyph yellow/blue gray
  17683. (yellow filter on left eye, blue filter on right eye)
  17684. @item aybh
  17685. anaglyph yellow/blue half colored
  17686. (yellow filter on left eye, blue filter on right eye)
  17687. @item aybc
  17688. anaglyph yellow/blue colored
  17689. (yellow filter on left eye, blue filter on right eye)
  17690. @item aybd
  17691. anaglyph yellow/blue color optimized with the least squares projection of dubois
  17692. (yellow filter on left eye, blue filter on right eye)
  17693. @item ml
  17694. mono output (left eye only)
  17695. @item mr
  17696. mono output (right eye only)
  17697. @item chl
  17698. checkerboard, left eye first
  17699. @item chr
  17700. checkerboard, right eye first
  17701. @item icl
  17702. interleaved columns, left eye first
  17703. @item icr
  17704. interleaved columns, right eye first
  17705. @item hdmi
  17706. HDMI frame pack
  17707. @end table
  17708. Default value is @samp{arcd}.
  17709. @end table
  17710. @subsection Examples
  17711. @itemize
  17712. @item
  17713. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  17714. @example
  17715. stereo3d=sbsl:aybd
  17716. @end example
  17717. @item
  17718. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  17719. @example
  17720. stereo3d=abl:sbsr
  17721. @end example
  17722. @end itemize
  17723. @section streamselect, astreamselect
  17724. Select video or audio streams.
  17725. The filter accepts the following options:
  17726. @table @option
  17727. @item inputs
  17728. Set number of inputs. Default is 2.
  17729. @item map
  17730. Set input indexes to remap to outputs.
  17731. @end table
  17732. @subsection Commands
  17733. The @code{streamselect} and @code{astreamselect} filter supports the following
  17734. commands:
  17735. @table @option
  17736. @item map
  17737. Set input indexes to remap to outputs.
  17738. @end table
  17739. @subsection Examples
  17740. @itemize
  17741. @item
  17742. Select first 5 seconds 1st stream and rest of time 2nd stream:
  17743. @example
  17744. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  17745. @end example
  17746. @item
  17747. Same as above, but for audio:
  17748. @example
  17749. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  17750. @end example
  17751. @end itemize
  17752. @anchor{subtitles}
  17753. @section subtitles
  17754. Draw subtitles on top of input video using the libass library.
  17755. To enable compilation of this filter you need to configure FFmpeg with
  17756. @code{--enable-libass}. This filter also requires a build with libavcodec and
  17757. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  17758. Alpha) subtitles format.
  17759. The filter accepts the following options:
  17760. @table @option
  17761. @item filename, f
  17762. Set the filename of the subtitle file to read. It must be specified.
  17763. @item original_size
  17764. Specify the size of the original video, the video for which the ASS file
  17765. was composed. For the syntax of this option, check the
  17766. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  17767. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  17768. correctly scale the fonts if the aspect ratio has been changed.
  17769. @item fontsdir
  17770. Set a directory path containing fonts that can be used by the filter.
  17771. These fonts will be used in addition to whatever the font provider uses.
  17772. @item alpha
  17773. Process alpha channel, by default alpha channel is untouched.
  17774. @item charenc
  17775. Set subtitles input character encoding. @code{subtitles} filter only. Only
  17776. useful if not UTF-8.
  17777. @item stream_index, si
  17778. Set subtitles stream index. @code{subtitles} filter only.
  17779. @item force_style
  17780. Override default style or script info parameters of the subtitles. It accepts a
  17781. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  17782. @item wrap_unicode
  17783. Break lines according to the Unicode Line Breaking Algorithm. Availability requires
  17784. at least libass release 0.17.0 (or LIBASS_VERSION 0x01600010), @emph{and} libass must
  17785. have been built with libunibreak.
  17786. The option is enabled by default except for native ASS.
  17787. @end table
  17788. If the first key is not specified, it is assumed that the first value
  17789. specifies the @option{filename}.
  17790. For example, to render the file @file{sub.srt} on top of the input
  17791. video, use the command:
  17792. @example
  17793. subtitles=sub.srt
  17794. @end example
  17795. which is equivalent to:
  17796. @example
  17797. subtitles=filename=sub.srt
  17798. @end example
  17799. To render the default subtitles stream from file @file{video.mkv}, use:
  17800. @example
  17801. subtitles=video.mkv
  17802. @end example
  17803. To render the second subtitles stream from that file, use:
  17804. @example
  17805. subtitles=video.mkv:si=1
  17806. @end example
  17807. To make the subtitles stream from @file{sub.srt} appear in 80% transparent blue
  17808. @code{DejaVu Serif}, use:
  17809. @example
  17810. subtitles=sub.srt:force_style='Fontname=DejaVu Serif,PrimaryColour=&HCCFF0000'
  17811. @end example
  17812. @section super2xsai
  17813. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  17814. Interpolate) pixel art scaling algorithm.
  17815. Useful for enlarging pixel art images without reducing sharpness.
  17816. @section swaprect
  17817. Swap two rectangular objects in video.
  17818. This filter accepts the following options:
  17819. @table @option
  17820. @item w
  17821. Set object width.
  17822. @item h
  17823. Set object height.
  17824. @item x1
  17825. Set 1st rect x coordinate.
  17826. @item y1
  17827. Set 1st rect y coordinate.
  17828. @item x2
  17829. Set 2nd rect x coordinate.
  17830. @item y2
  17831. Set 2nd rect y coordinate.
  17832. All expressions are evaluated once for each frame.
  17833. @end table
  17834. The all options are expressions containing the following constants:
  17835. @table @option
  17836. @item w
  17837. @item h
  17838. The input width and height.
  17839. @item a
  17840. same as @var{w} / @var{h}
  17841. @item sar
  17842. input sample aspect ratio
  17843. @item dar
  17844. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  17845. @item n
  17846. The number of the input frame, starting from 0.
  17847. @item t
  17848. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  17849. @item pos
  17850. the position in the file of the input frame, NAN if unknown; deprecated,
  17851. do not use
  17852. @end table
  17853. @subsection Commands
  17854. This filter supports the all above options as @ref{commands}.
  17855. @section swapuv
  17856. Swap U & V plane.
  17857. @section tblend
  17858. Blend successive video frames.
  17859. See @ref{blend}
  17860. @section telecine
  17861. Apply telecine process to the video.
  17862. This filter accepts the following options:
  17863. @table @option
  17864. @item first_field
  17865. @table @samp
  17866. @item top, t
  17867. top field first
  17868. @item bottom, b
  17869. bottom field first
  17870. The default value is @code{top}.
  17871. @end table
  17872. @item pattern
  17873. A string of numbers representing the pulldown pattern you wish to apply.
  17874. The default value is @code{23}.
  17875. @end table
  17876. @example
  17877. Some typical patterns:
  17878. NTSC output (30i):
  17879. 27.5p: 32222
  17880. 24p: 23 (classic)
  17881. 24p: 2332 (preferred)
  17882. 20p: 33
  17883. 18p: 334
  17884. 16p: 3444
  17885. PAL output (25i):
  17886. 27.5p: 12222
  17887. 24p: 222222222223 ("Euro pulldown")
  17888. 16.67p: 33
  17889. 16p: 33333334
  17890. @end example
  17891. @section thistogram
  17892. Compute and draw a color distribution histogram for the input video across time.
  17893. Unlike @ref{histogram} video filter which only shows histogram of single input frame
  17894. at certain time, this filter shows also past histograms of number of frames defined
  17895. by @code{width} option.
  17896. The computed histogram is a representation of the color component
  17897. distribution in an image.
  17898. The filter accepts the following options:
  17899. @table @option
  17900. @item width, w
  17901. Set width of single color component output. Default value is @code{0}.
  17902. Value of @code{0} means width will be picked from input video.
  17903. This also set number of passed histograms to keep.
  17904. Allowed range is [0, 8192].
  17905. @item display_mode, d
  17906. Set display mode.
  17907. It accepts the following values:
  17908. @table @samp
  17909. @item stack
  17910. Per color component graphs are placed below each other.
  17911. @item parade
  17912. Per color component graphs are placed side by side.
  17913. @item overlay
  17914. Presents information identical to that in the @code{parade}, except
  17915. that the graphs representing color components are superimposed directly
  17916. over one another.
  17917. @end table
  17918. Default is @code{stack}.
  17919. @item levels_mode, m
  17920. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  17921. Default is @code{linear}.
  17922. @item components, c
  17923. Set what color components to display.
  17924. Default is @code{7}.
  17925. @item bgopacity, b
  17926. Set background opacity. Default is @code{0.9}.
  17927. @item envelope, e
  17928. Show envelope. Default is disabled.
  17929. @item ecolor, ec
  17930. Set envelope color. Default is @code{gold}.
  17931. @item slide
  17932. Set slide mode.
  17933. Available values for slide is:
  17934. @table @samp
  17935. @item frame
  17936. Draw new frame when right border is reached.
  17937. @item replace
  17938. Replace old columns with new ones.
  17939. @item scroll
  17940. Scroll from right to left.
  17941. @item rscroll
  17942. Scroll from left to right.
  17943. @item picture
  17944. Draw single picture.
  17945. @end table
  17946. Default is @code{replace}.
  17947. @end table
  17948. @section threshold
  17949. Apply threshold effect to video stream.
  17950. This filter needs four video streams to perform thresholding.
  17951. First stream is stream we are filtering.
  17952. Second stream is holding threshold values, third stream is holding min values,
  17953. and last, fourth stream is holding max values.
  17954. The filter accepts the following option:
  17955. @table @option
  17956. @item planes
  17957. Set which planes will be processed, unprocessed planes will be copied.
  17958. By default value 0xf, all planes will be processed.
  17959. @end table
  17960. For example if first stream pixel's component value is less then threshold value
  17961. of pixel component from 2nd threshold stream, third stream value will picked,
  17962. otherwise fourth stream pixel component value will be picked.
  17963. Using color source filter one can perform various types of thresholding:
  17964. @subsection Commands
  17965. This filter supports the all options as @ref{commands}.
  17966. @subsection Examples
  17967. @itemize
  17968. @item
  17969. Binary threshold, using gray color as threshold:
  17970. @example
  17971. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  17972. @end example
  17973. @item
  17974. Inverted binary threshold, using gray color as threshold:
  17975. @example
  17976. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  17977. @end example
  17978. @item
  17979. Truncate binary threshold, using gray color as threshold:
  17980. @example
  17981. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  17982. @end example
  17983. @item
  17984. Threshold to zero, using gray color as threshold:
  17985. @example
  17986. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  17987. @end example
  17988. @item
  17989. Inverted threshold to zero, using gray color as threshold:
  17990. @example
  17991. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  17992. @end example
  17993. @end itemize
  17994. @section thumbnail
  17995. Select the most representative frame in a given sequence of consecutive frames.
  17996. The filter accepts the following options:
  17997. @table @option
  17998. @item n
  17999. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  18000. will pick one of them, and then handle the next batch of @var{n} frames until
  18001. the end. Default is @code{100}.
  18002. @item log
  18003. Set the log level to display picked frame stats.
  18004. Default is @code{info}.
  18005. @end table
  18006. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  18007. value will result in a higher memory usage, so a high value is not recommended.
  18008. @subsection Examples
  18009. @itemize
  18010. @item
  18011. Extract one picture each 50 frames:
  18012. @example
  18013. thumbnail=50
  18014. @end example
  18015. @item
  18016. Complete example of a thumbnail creation with @command{ffmpeg}:
  18017. @example
  18018. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  18019. @end example
  18020. @end itemize
  18021. @anchor{tile}
  18022. @section tile
  18023. Tile several successive frames together.
  18024. The @ref{untile} filter can do the reverse.
  18025. The filter accepts the following options:
  18026. @table @option
  18027. @item layout
  18028. Set the grid size in the form @code{COLUMNSxROWS}. Range is up to UINT_MAX cells.
  18029. Default is @code{6x5}.
  18030. @item nb_frames
  18031. Set the maximum number of frames to render in the given area. It must be less
  18032. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  18033. the area will be used.
  18034. @item margin
  18035. Set the outer border margin in pixels. Range is 0 to 1024. Default is @code{0}.
  18036. @item padding
  18037. Set the inner border thickness (i.e. the number of pixels between frames). For
  18038. more advanced padding options (such as having different values for the edges),
  18039. refer to the pad video filter. Range is 0 to 1024. Default is @code{0}.
  18040. @item color
  18041. Specify the color of the unused area. For the syntax of this option, check the
  18042. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18043. The default value of @var{color} is "black".
  18044. @item overlap
  18045. Set the number of frames to overlap when tiling several successive frames together.
  18046. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  18047. @item init_padding
  18048. Set the number of frames to initially be empty before displaying first output frame.
  18049. This controls how soon will one get first output frame.
  18050. The value must be between @code{0} and @var{nb_frames - 1}. Default is @code{0}.
  18051. @end table
  18052. @subsection Examples
  18053. @itemize
  18054. @item
  18055. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  18056. @example
  18057. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  18058. @end example
  18059. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  18060. duplicating each output frame to accommodate the originally detected frame
  18061. rate.
  18062. @item
  18063. Display @code{5} pictures in an area of @code{3x2} frames,
  18064. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  18065. mixed flat and named options:
  18066. @example
  18067. tile=3x2:nb_frames=5:padding=7:margin=2
  18068. @end example
  18069. @end itemize
  18070. @section tiltandshift
  18071. Apply tilt-and-shift effect.
  18072. What happens when you invert time and space?
  18073. Normally a video is composed of several frames that represent a different
  18074. instant of time and shows a scene that evolves in the space captured by the
  18075. frame. This filter is the antipode of that concept, taking inspiration from
  18076. tilt and shift photography.
  18077. A filtered frame contains the whole timeline of events composing the sequence,
  18078. and this is obtained by placing a slice of pixels from each frame into a single
  18079. one. However, since there are no infinite-width frames, this is done up the
  18080. width of the input frame, and a video is recomposed by shifting away one
  18081. column for each subsequent frame. In order to map space to time, the filter
  18082. tilts each input frame as well, so that motion is preserved. This is accomplished
  18083. by progressively selecting a different column from each input frame.
  18084. The end result is a sort of inverted parallax, so that far away objects move
  18085. much faster that the ones in the front. The ideal conditions for this video
  18086. effect are when there is either very little motion and the backgroud is static,
  18087. or when there is a lot of motion and a very wide depth of field (e.g. wide
  18088. panorama, while moving on a train).
  18089. The filter accepts the following parameters:
  18090. @table @option
  18091. @item tilt
  18092. Tilt video while shifting (default). When unset, video will be sliding a
  18093. static image, composed of the first column of each frame.
  18094. @item start
  18095. What to do at the start of filtering (see below).
  18096. @item end
  18097. What to do at the end of filtering (see below).
  18098. @item hold
  18099. How many columns should pass through before start of filtering.
  18100. @item pad
  18101. How many columns should be inserted before end of filtering.
  18102. @end table
  18103. Normally the filter shifts and tilts from the very first frame, and stops when
  18104. the last one is received. However, before filtering starts, normal video may
  18105. be preseved, so that the effect is slowly shifted in its place. Similarly,
  18106. the last video frame may be reconstructed at the end. Alternatively it is
  18107. possible to just start and end with black.
  18108. @table @samp
  18109. @item none
  18110. Filtering starts immediately and ends when the last frame is received.
  18111. @item frame
  18112. The first frames or the very last frame are kept intact during processing.
  18113. @item black
  18114. Black is padded at the beginning or at the end of filtering.
  18115. @end table
  18116. @section tinterlace
  18117. Perform various types of temporal field interlacing.
  18118. Frames are counted starting from 1, so the first input frame is
  18119. considered odd.
  18120. The filter accepts the following options:
  18121. @table @option
  18122. @item mode
  18123. Specify the mode of the interlacing. This option can also be specified
  18124. as a value alone. See below for a list of values for this option.
  18125. Available values are:
  18126. @table @samp
  18127. @item merge, 0
  18128. Move odd frames into the upper field, even into the lower field,
  18129. generating a double height frame at half frame rate.
  18130. @example
  18131. ------> time
  18132. Input:
  18133. Frame 1 Frame 2 Frame 3 Frame 4
  18134. 11111 22222 33333 44444
  18135. 11111 22222 33333 44444
  18136. 11111 22222 33333 44444
  18137. 11111 22222 33333 44444
  18138. Output:
  18139. 11111 33333
  18140. 22222 44444
  18141. 11111 33333
  18142. 22222 44444
  18143. 11111 33333
  18144. 22222 44444
  18145. 11111 33333
  18146. 22222 44444
  18147. @end example
  18148. @item drop_even, 1
  18149. Only output odd frames, even frames are dropped, generating a frame with
  18150. unchanged height at half frame rate.
  18151. @example
  18152. ------> time
  18153. Input:
  18154. Frame 1 Frame 2 Frame 3 Frame 4
  18155. 11111 22222 33333 44444
  18156. 11111 22222 33333 44444
  18157. 11111 22222 33333 44444
  18158. 11111 22222 33333 44444
  18159. Output:
  18160. 11111 33333
  18161. 11111 33333
  18162. 11111 33333
  18163. 11111 33333
  18164. @end example
  18165. @item drop_odd, 2
  18166. Only output even frames, odd frames are dropped, generating a frame with
  18167. unchanged height at half frame rate.
  18168. @example
  18169. ------> time
  18170. Input:
  18171. Frame 1 Frame 2 Frame 3 Frame 4
  18172. 11111 22222 33333 44444
  18173. 11111 22222 33333 44444
  18174. 11111 22222 33333 44444
  18175. 11111 22222 33333 44444
  18176. Output:
  18177. 22222 44444
  18178. 22222 44444
  18179. 22222 44444
  18180. 22222 44444
  18181. @end example
  18182. @item pad, 3
  18183. Expand each frame to full height, but pad alternate lines with black,
  18184. generating a frame with double height at the same input frame rate.
  18185. @example
  18186. ------> time
  18187. Input:
  18188. Frame 1 Frame 2 Frame 3 Frame 4
  18189. 11111 22222 33333 44444
  18190. 11111 22222 33333 44444
  18191. 11111 22222 33333 44444
  18192. 11111 22222 33333 44444
  18193. Output:
  18194. 11111 ..... 33333 .....
  18195. ..... 22222 ..... 44444
  18196. 11111 ..... 33333 .....
  18197. ..... 22222 ..... 44444
  18198. 11111 ..... 33333 .....
  18199. ..... 22222 ..... 44444
  18200. 11111 ..... 33333 .....
  18201. ..... 22222 ..... 44444
  18202. @end example
  18203. @item interleave_top, 4
  18204. Interleave the upper field from odd frames with the lower field from
  18205. even frames, generating a frame with unchanged height at half frame rate.
  18206. @example
  18207. ------> time
  18208. Input:
  18209. Frame 1 Frame 2 Frame 3 Frame 4
  18210. 11111<- 22222 33333<- 44444
  18211. 11111 22222<- 33333 44444<-
  18212. 11111<- 22222 33333<- 44444
  18213. 11111 22222<- 33333 44444<-
  18214. Output:
  18215. 11111 33333
  18216. 22222 44444
  18217. 11111 33333
  18218. 22222 44444
  18219. @end example
  18220. @item interleave_bottom, 5
  18221. Interleave the lower field from odd frames with the upper field from
  18222. even frames, generating a frame with unchanged height at half frame rate.
  18223. @example
  18224. ------> time
  18225. Input:
  18226. Frame 1 Frame 2 Frame 3 Frame 4
  18227. 11111 22222<- 33333 44444<-
  18228. 11111<- 22222 33333<- 44444
  18229. 11111 22222<- 33333 44444<-
  18230. 11111<- 22222 33333<- 44444
  18231. Output:
  18232. 22222 44444
  18233. 11111 33333
  18234. 22222 44444
  18235. 11111 33333
  18236. @end example
  18237. @item interlacex2, 6
  18238. Double frame rate with unchanged height. Frames are inserted each
  18239. containing the second temporal field from the previous input frame and
  18240. the first temporal field from the next input frame. This mode relies on
  18241. the top_field_first flag. Useful for interlaced video displays with no
  18242. field synchronisation.
  18243. @example
  18244. ------> time
  18245. Input:
  18246. Frame 1 Frame 2 Frame 3 Frame 4
  18247. 11111 22222 33333 44444
  18248. 11111 22222 33333 44444
  18249. 11111 22222 33333 44444
  18250. 11111 22222 33333 44444
  18251. Output:
  18252. 11111 22222 22222 33333 33333 44444 44444
  18253. 11111 11111 22222 22222 33333 33333 44444
  18254. 11111 22222 22222 33333 33333 44444 44444
  18255. 11111 11111 22222 22222 33333 33333 44444
  18256. @end example
  18257. @item mergex2, 7
  18258. Move odd frames into the upper field, even into the lower field,
  18259. generating a double height frame at same frame rate.
  18260. @example
  18261. ------> time
  18262. Input:
  18263. Frame 1 Frame 2 Frame 3 Frame 4
  18264. 11111 22222 33333 44444
  18265. 11111 22222 33333 44444
  18266. 11111 22222 33333 44444
  18267. 11111 22222 33333 44444
  18268. Output:
  18269. 11111 33333 33333 55555
  18270. 22222 22222 44444 44444
  18271. 11111 33333 33333 55555
  18272. 22222 22222 44444 44444
  18273. 11111 33333 33333 55555
  18274. 22222 22222 44444 44444
  18275. 11111 33333 33333 55555
  18276. 22222 22222 44444 44444
  18277. @end example
  18278. @end table
  18279. Numeric values are deprecated but are accepted for backward
  18280. compatibility reasons.
  18281. Default mode is @code{merge}.
  18282. @item flags
  18283. Specify flags influencing the filter process.
  18284. Available value for @var{flags} is:
  18285. @table @option
  18286. @item low_pass_filter, vlpf
  18287. Enable linear vertical low-pass filtering in the filter.
  18288. Vertical low-pass filtering is required when creating an interlaced
  18289. destination from a progressive source which contains high-frequency
  18290. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  18291. patterning.
  18292. @item complex_filter, cvlpf
  18293. Enable complex vertical low-pass filtering.
  18294. This will slightly less reduce interlace 'twitter' and Moire
  18295. patterning but better retain detail and subjective sharpness impression.
  18296. @item bypass_il
  18297. Bypass already interlaced frames, only adjust the frame rate.
  18298. @end table
  18299. Vertical low-pass filtering and bypassing already interlaced frames can only be
  18300. enabled for @option{mode} @var{interleave_top} and @var{interleave_bottom}.
  18301. @end table
  18302. @section tmedian
  18303. Pick median pixels from several successive input video frames.
  18304. The filter accepts the following options:
  18305. @table @option
  18306. @item radius
  18307. Set radius of median filter.
  18308. Default is 1. Allowed range is from 1 to 127.
  18309. @item planes
  18310. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  18311. @item percentile
  18312. Set median percentile. Default value is @code{0.5}.
  18313. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  18314. minimum values, and @code{1} maximum values.
  18315. @end table
  18316. @subsection Commands
  18317. This filter supports all above options as @ref{commands}, excluding option @code{radius}.
  18318. @section tmidequalizer
  18319. Apply Temporal Midway Video Equalization effect.
  18320. Midway Video Equalization adjusts a sequence of video frames to have the same
  18321. histograms, while maintaining their dynamics as much as possible. It's
  18322. useful for e.g. matching exposures from a video frames sequence.
  18323. This filter accepts the following option:
  18324. @table @option
  18325. @item radius
  18326. Set filtering radius. Default is @code{5}. Allowed range is from 1 to 127.
  18327. @item sigma
  18328. Set filtering sigma. Default is @code{0.5}. This controls strength of filtering.
  18329. Setting this option to 0 effectively does nothing.
  18330. @item planes
  18331. Set which planes to process. Default is @code{15}, which is all available planes.
  18332. @end table
  18333. @section tmix
  18334. Mix successive video frames.
  18335. A description of the accepted options follows.
  18336. @table @option
  18337. @item frames
  18338. The number of successive frames to mix. If unspecified, it defaults to 3.
  18339. @item weights
  18340. Specify weight of each input video frame.
  18341. Each weight is separated by space. If number of weights is smaller than
  18342. number of @var{frames} last specified weight will be used for all remaining
  18343. unset weights.
  18344. @item scale
  18345. Specify scale, if it is set it will be multiplied with sum
  18346. of each weight multiplied with pixel values to give final destination
  18347. pixel value. By default @var{scale} is auto scaled to sum of weights.
  18348. @item planes
  18349. Set which planes to filter. Default is all. Allowed range is from 0 to 15.
  18350. @end table
  18351. @subsection Examples
  18352. @itemize
  18353. @item
  18354. Average 7 successive frames:
  18355. @example
  18356. tmix=frames=7:weights="1 1 1 1 1 1 1"
  18357. @end example
  18358. @item
  18359. Apply simple temporal convolution:
  18360. @example
  18361. tmix=frames=3:weights="-1 3 -1"
  18362. @end example
  18363. @item
  18364. Similar as above but only showing temporal differences:
  18365. @example
  18366. tmix=frames=3:weights="-1 2 -1":scale=1
  18367. @end example
  18368. @end itemize
  18369. @subsection Commands
  18370. This filter supports the following commands:
  18371. @table @option
  18372. @item weights
  18373. @item scale
  18374. @item planes
  18375. Syntax is same as option with same name.
  18376. @end table
  18377. @anchor{tonemap}
  18378. @section tonemap
  18379. Tone map colors from different dynamic ranges.
  18380. This filter expects data in single precision floating point, as it needs to
  18381. operate on (and can output) out-of-range values. Another filter, such as
  18382. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  18383. The tonemapping algorithms implemented only work on linear light, so input
  18384. data should be linearized beforehand (and possibly correctly tagged).
  18385. @example
  18386. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  18387. @end example
  18388. @subsection Options
  18389. The filter accepts the following options.
  18390. @table @option
  18391. @item tonemap
  18392. Set the tone map algorithm to use.
  18393. Possible values are:
  18394. @table @var
  18395. @item none
  18396. Do not apply any tone map, only desaturate overbright pixels.
  18397. @item clip
  18398. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  18399. in-range values, while distorting out-of-range values.
  18400. @item linear
  18401. Stretch the entire reference gamut to a linear multiple of the display.
  18402. @item gamma
  18403. Fit a logarithmic transfer between the tone curves.
  18404. @item reinhard
  18405. Preserve overall image brightness with a simple curve, using nonlinear
  18406. contrast, which results in flattening details and degrading color accuracy.
  18407. @item hable
  18408. Preserve both dark and bright details better than @var{reinhard}, at the cost
  18409. of slightly darkening everything. Use it when detail preservation is more
  18410. important than color and brightness accuracy.
  18411. @item mobius
  18412. Smoothly map out-of-range values, while retaining contrast and colors for
  18413. in-range material as much as possible. Use it when color accuracy is more
  18414. important than detail preservation.
  18415. @end table
  18416. Default is none.
  18417. @item param
  18418. Tune the tone mapping algorithm.
  18419. This affects the following algorithms:
  18420. @table @var
  18421. @item none
  18422. Ignored.
  18423. @item linear
  18424. Specifies the scale factor to use while stretching.
  18425. Default to 1.0.
  18426. @item gamma
  18427. Specifies the exponent of the function.
  18428. Default to 1.8.
  18429. @item clip
  18430. Specify an extra linear coefficient to multiply into the signal before clipping.
  18431. Default to 1.0.
  18432. @item reinhard
  18433. Specify the local contrast coefficient at the display peak.
  18434. Default to 0.5, which means that in-gamut values will be about half as bright
  18435. as when clipping.
  18436. @item hable
  18437. Ignored.
  18438. @item mobius
  18439. Specify the transition point from linear to mobius transform. Every value
  18440. below this point is guaranteed to be mapped 1:1. The higher the value, the
  18441. more accurate the result will be, at the cost of losing bright details.
  18442. Default to 0.3, which due to the steep initial slope still preserves in-range
  18443. colors fairly accurately.
  18444. @end table
  18445. @item desat
  18446. Apply desaturation for highlights that exceed this level of brightness. The
  18447. higher the parameter, the more color information will be preserved. This
  18448. setting helps prevent unnaturally blown-out colors for super-highlights, by
  18449. (smoothly) turning into white instead. This makes images feel more natural,
  18450. at the cost of reducing information about out-of-range colors.
  18451. The default of 2.0 is somewhat conservative and will mostly just apply to
  18452. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  18453. This option works only if the input frame has a supported color tag.
  18454. @item peak
  18455. Override signal/nominal/reference peak with this value. Useful when the
  18456. embedded peak information in display metadata is not reliable or when tone
  18457. mapping from a lower range to a higher range.
  18458. @end table
  18459. @section tpad
  18460. Temporarily pad video frames.
  18461. The filter accepts the following options:
  18462. @table @option
  18463. @item start
  18464. Specify number of delay frames before input video stream. Default is 0.
  18465. @item stop
  18466. Specify number of padding frames after input video stream.
  18467. Set to -1 to pad indefinitely. Default is 0.
  18468. @item start_mode
  18469. Set kind of frames added to beginning of stream.
  18470. Can be either @var{add} or @var{clone}.
  18471. With @var{add} frames of solid-color are added.
  18472. With @var{clone} frames are clones of first frame.
  18473. Default is @var{add}.
  18474. @item stop_mode
  18475. Set kind of frames added to end of stream.
  18476. Can be either @var{add} or @var{clone}.
  18477. With @var{add} frames of solid-color are added.
  18478. With @var{clone} frames are clones of last frame.
  18479. Default is @var{add}.
  18480. @item start_duration, stop_duration
  18481. Specify the duration of the start/stop delay. See
  18482. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18483. for the accepted syntax.
  18484. These options override @var{start} and @var{stop}. Default is 0.
  18485. @item color
  18486. Specify the color of the padded area. For the syntax of this option,
  18487. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  18488. manual,ffmpeg-utils}.
  18489. The default value of @var{color} is "black".
  18490. @end table
  18491. @anchor{transpose}
  18492. @section transpose
  18493. Transpose rows with columns in the input video and optionally flip it.
  18494. It accepts the following parameters:
  18495. @table @option
  18496. @item dir
  18497. Specify the transposition direction.
  18498. Can assume the following values:
  18499. @table @samp
  18500. @item 0, 4, cclock_flip
  18501. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  18502. @example
  18503. L.R L.l
  18504. . . -> . .
  18505. l.r R.r
  18506. @end example
  18507. @item 1, 5, clock
  18508. Rotate by 90 degrees clockwise, that is:
  18509. @example
  18510. L.R l.L
  18511. . . -> . .
  18512. l.r r.R
  18513. @end example
  18514. @item 2, 6, cclock
  18515. Rotate by 90 degrees counterclockwise, that is:
  18516. @example
  18517. L.R R.r
  18518. . . -> . .
  18519. l.r L.l
  18520. @end example
  18521. @item 3, 7, clock_flip
  18522. Rotate by 90 degrees clockwise and vertically flip, that is:
  18523. @example
  18524. L.R r.R
  18525. . . -> . .
  18526. l.r l.L
  18527. @end example
  18528. @end table
  18529. For values between 4-7, the transposition is only done if the input
  18530. video geometry is portrait and not landscape. These values are
  18531. deprecated, the @code{passthrough} option should be used instead.
  18532. Numerical values are deprecated, and should be dropped in favor of
  18533. symbolic constants.
  18534. @item passthrough
  18535. Do not apply the transposition if the input geometry matches the one
  18536. specified by the specified value. It accepts the following values:
  18537. @table @samp
  18538. @item none
  18539. Always apply transposition.
  18540. @item portrait
  18541. Preserve portrait geometry (when @var{height} >= @var{width}).
  18542. @item landscape
  18543. Preserve landscape geometry (when @var{width} >= @var{height}).
  18544. @end table
  18545. Default value is @code{none}.
  18546. @end table
  18547. For example to rotate by 90 degrees clockwise and preserve portrait
  18548. layout:
  18549. @example
  18550. transpose=dir=1:passthrough=portrait
  18551. @end example
  18552. The command above can also be specified as:
  18553. @example
  18554. transpose=1:portrait
  18555. @end example
  18556. @section transpose_npp
  18557. Transpose rows with columns in the input video and optionally flip it.
  18558. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  18559. It accepts the following parameters:
  18560. @table @option
  18561. @item dir
  18562. Specify the transposition direction.
  18563. Can assume the following values:
  18564. @table @samp
  18565. @item cclock_flip
  18566. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  18567. @item clock
  18568. Rotate by 90 degrees clockwise.
  18569. @item cclock
  18570. Rotate by 90 degrees counterclockwise.
  18571. @item clock_flip
  18572. Rotate by 90 degrees clockwise and vertically flip.
  18573. @end table
  18574. @item passthrough
  18575. Do not apply the transposition if the input geometry matches the one
  18576. specified by the specified value. It accepts the following values:
  18577. @table @samp
  18578. @item none
  18579. Always apply transposition. (default)
  18580. @item portrait
  18581. Preserve portrait geometry (when @var{height} >= @var{width}).
  18582. @item landscape
  18583. Preserve landscape geometry (when @var{width} >= @var{height}).
  18584. @end table
  18585. @end table
  18586. @section trim
  18587. Trim the input so that the output contains one continuous subpart of the input.
  18588. It accepts the following parameters:
  18589. @table @option
  18590. @item start
  18591. Specify the time of the start of the kept section, i.e. the frame with the
  18592. timestamp @var{start} will be the first frame in the output.
  18593. @item end
  18594. Specify the time of the first frame that will be dropped, i.e. the frame
  18595. immediately preceding the one with the timestamp @var{end} will be the last
  18596. frame in the output.
  18597. @item start_pts
  18598. This is the same as @var{start}, except this option sets the start timestamp
  18599. in timebase units instead of seconds.
  18600. @item end_pts
  18601. This is the same as @var{end}, except this option sets the end timestamp
  18602. in timebase units instead of seconds.
  18603. @item duration
  18604. The maximum duration of the output in seconds.
  18605. @item start_frame
  18606. The number of the first frame that should be passed to the output.
  18607. @item end_frame
  18608. The number of the first frame that should be dropped.
  18609. @end table
  18610. @option{start}, @option{end}, and @option{duration} are expressed as time
  18611. duration specifications; see
  18612. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  18613. for the accepted syntax.
  18614. Note that the first two sets of the start/end options and the @option{duration}
  18615. option look at the frame timestamp, while the _frame variants simply count the
  18616. frames that pass through the filter. Also note that this filter does not modify
  18617. the timestamps. If you wish for the output timestamps to start at zero, insert a
  18618. setpts filter after the trim filter.
  18619. If multiple start or end options are set, this filter tries to be greedy and
  18620. keep all the frames that match at least one of the specified constraints. To keep
  18621. only the part that matches all the constraints at once, chain multiple trim
  18622. filters.
  18623. The defaults are such that all the input is kept. So it is possible to set e.g.
  18624. just the end values to keep everything before the specified time.
  18625. Examples:
  18626. @itemize
  18627. @item
  18628. Drop everything except the second minute of input:
  18629. @example
  18630. ffmpeg -i INPUT -vf trim=60:120
  18631. @end example
  18632. @item
  18633. Keep only the first second:
  18634. @example
  18635. ffmpeg -i INPUT -vf trim=duration=1
  18636. @end example
  18637. @end itemize
  18638. @section unpremultiply
  18639. Apply alpha unpremultiply effect to input video stream using first plane
  18640. of second stream as alpha.
  18641. Both streams must have same dimensions and same pixel format.
  18642. The filter accepts the following option:
  18643. @table @option
  18644. @item planes
  18645. Set which planes will be processed, unprocessed planes will be copied.
  18646. By default value 0xf, all planes will be processed.
  18647. If the format has 1 or 2 components, then luma is bit 0.
  18648. If the format has 3 or 4 components:
  18649. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  18650. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  18651. If present, the alpha channel is always the last bit.
  18652. @item inplace
  18653. Do not require 2nd input for processing, instead use alpha plane from input stream.
  18654. @end table
  18655. @anchor{unsharp}
  18656. @section unsharp
  18657. Sharpen or blur the input video.
  18658. It accepts the following parameters:
  18659. @table @option
  18660. @item luma_msize_x, lx
  18661. Set the luma matrix horizontal size. It must be an odd integer between
  18662. 3 and 23. The default value is 5.
  18663. @item luma_msize_y, ly
  18664. Set the luma matrix vertical size. It must be an odd integer between 3
  18665. and 23. The default value is 5.
  18666. @item luma_amount, la
  18667. Set the luma effect strength. It must be a floating point number, reasonable
  18668. values lay between -1.5 and 1.5.
  18669. Negative values will blur the input video, while positive values will
  18670. sharpen it, a value of zero will disable the effect.
  18671. Default value is 1.0.
  18672. @item chroma_msize_x, cx
  18673. Set the chroma matrix horizontal size. It must be an odd integer
  18674. between 3 and 23. The default value is 5.
  18675. @item chroma_msize_y, cy
  18676. Set the chroma matrix vertical size. It must be an odd integer
  18677. between 3 and 23. The default value is 5.
  18678. @item chroma_amount, ca
  18679. Set the chroma effect strength. It must be a floating point number, reasonable
  18680. values lay between -1.5 and 1.5.
  18681. Negative values will blur the input video, while positive values will
  18682. sharpen it, a value of zero will disable the effect.
  18683. Default value is 0.0.
  18684. @item alpha_msize_x, ax
  18685. Set the alpha matrix horizontal size. It must be an odd integer
  18686. between 3 and 23. The default value is 5.
  18687. @item alpha_msize_y, ay
  18688. Set the alpha matrix vertical size. It must be an odd integer
  18689. between 3 and 23. The default value is 5.
  18690. @item alpha_amount, aa
  18691. Set the alpha effect strength. It must be a floating point number, reasonable
  18692. values lay between -1.5 and 1.5.
  18693. Negative values will blur the input video, while positive values will
  18694. sharpen it, a value of zero will disable the effect.
  18695. Default value is 0.0.
  18696. @end table
  18697. All parameters are optional and default to the equivalent of the
  18698. string '5:5:1.0:5:5:0.0'.
  18699. @subsection Examples
  18700. @itemize
  18701. @item
  18702. Apply strong luma sharpen effect:
  18703. @example
  18704. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  18705. @end example
  18706. @item
  18707. Apply a strong blur of both luma and chroma parameters:
  18708. @example
  18709. unsharp=7:7:-2:7:7:-2
  18710. @end example
  18711. @end itemize
  18712. @anchor{untile}
  18713. @section untile
  18714. Decompose a video made of tiled images into the individual images.
  18715. The frame rate of the output video is the frame rate of the input video
  18716. multiplied by the number of tiles.
  18717. This filter does the reverse of @ref{tile}.
  18718. The filter accepts the following options:
  18719. @table @option
  18720. @item layout
  18721. Set the grid size (i.e. the number of lines and columns). For the syntax of
  18722. this option, check the
  18723. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  18724. @end table
  18725. @subsection Examples
  18726. @itemize
  18727. @item
  18728. Produce a 1-second video from a still image file made of 25 frames stacked
  18729. vertically, like an analogic film reel:
  18730. @example
  18731. ffmpeg -r 1 -i image.jpg -vf untile=1x25 movie.mkv
  18732. @end example
  18733. @end itemize
  18734. @section uspp
  18735. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  18736. the image at several (or - in the case of @option{quality} level @code{8} - all)
  18737. shifts and average the results.
  18738. The way this differs from the behavior of spp is that uspp actually encodes &
  18739. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  18740. DCT similar to MJPEG.
  18741. This filter is not available in ffmpeg versions between 5.0 and 6.0.
  18742. The filter accepts the following options:
  18743. @table @option
  18744. @item quality
  18745. Set quality. This option defines the number of levels for averaging. It accepts
  18746. an integer in the range 0-8. If set to @code{0}, the filter will have no
  18747. effect. A value of @code{8} means the higher quality. For each increment of
  18748. that value the speed drops by a factor of approximately 2. Default value is
  18749. @code{3}.
  18750. @item qp
  18751. Force a constant quantization parameter. If not set, the filter will use the QP
  18752. from the video stream (if available).
  18753. @item codec
  18754. Use specified codec instead of snow.
  18755. @end table
  18756. @section v360
  18757. Convert 360 videos between various formats.
  18758. The filter accepts the following options:
  18759. @table @option
  18760. @item input
  18761. @item output
  18762. Set format of the input/output video.
  18763. Available formats:
  18764. @table @samp
  18765. @item e
  18766. @item equirect
  18767. Equirectangular projection.
  18768. @item c3x2
  18769. @item c6x1
  18770. @item c1x6
  18771. Cubemap with 3x2/6x1/1x6 layout.
  18772. Format specific options:
  18773. @table @option
  18774. @item in_pad
  18775. @item out_pad
  18776. Set padding proportion for the input/output cubemap. Values in decimals.
  18777. Example values:
  18778. @table @samp
  18779. @item 0
  18780. No padding.
  18781. @item 0.01
  18782. 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)
  18783. @end table
  18784. Default value is @b{@samp{0}}.
  18785. Maximum value is @b{@samp{0.1}}.
  18786. @item fin_pad
  18787. @item fout_pad
  18788. Set fixed padding for the input/output cubemap. Values in pixels.
  18789. Default value is @b{@samp{0}}. If greater than zero it overrides other padding options.
  18790. @item in_forder
  18791. @item out_forder
  18792. Set order of faces for the input/output cubemap. Choose one direction for each position.
  18793. Designation of directions:
  18794. @table @samp
  18795. @item r
  18796. right
  18797. @item l
  18798. left
  18799. @item u
  18800. up
  18801. @item d
  18802. down
  18803. @item f
  18804. forward
  18805. @item b
  18806. back
  18807. @end table
  18808. Default value is @b{@samp{rludfb}}.
  18809. @item in_frot
  18810. @item out_frot
  18811. Set rotation of faces for the input/output cubemap. Choose one angle for each position.
  18812. Designation of angles:
  18813. @table @samp
  18814. @item 0
  18815. 0 degrees clockwise
  18816. @item 1
  18817. 90 degrees clockwise
  18818. @item 2
  18819. 180 degrees clockwise
  18820. @item 3
  18821. 270 degrees clockwise
  18822. @end table
  18823. Default value is @b{@samp{000000}}.
  18824. @end table
  18825. @item eac
  18826. Equi-Angular Cubemap.
  18827. @item flat
  18828. @item gnomonic
  18829. @item rectilinear
  18830. Regular video.
  18831. Format specific options:
  18832. @table @option
  18833. @item h_fov
  18834. @item v_fov
  18835. @item d_fov
  18836. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18837. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18838. @item ih_fov
  18839. @item iv_fov
  18840. @item id_fov
  18841. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18842. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18843. @end table
  18844. @item dfisheye
  18845. Dual fisheye.
  18846. Format specific options:
  18847. @table @option
  18848. @item h_fov
  18849. @item v_fov
  18850. @item d_fov
  18851. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18852. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18853. @item ih_fov
  18854. @item iv_fov
  18855. @item id_fov
  18856. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18857. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18858. @end table
  18859. @item barrel
  18860. @item fb
  18861. @item barrelsplit
  18862. Facebook's 360 formats.
  18863. @item sg
  18864. Stereographic format.
  18865. Format specific options:
  18866. @table @option
  18867. @item h_fov
  18868. @item v_fov
  18869. @item d_fov
  18870. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18871. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18872. @item ih_fov
  18873. @item iv_fov
  18874. @item id_fov
  18875. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18876. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18877. @end table
  18878. @item mercator
  18879. Mercator format.
  18880. @item ball
  18881. Ball format, gives significant distortion toward the back.
  18882. @item hammer
  18883. Hammer-Aitoff map projection format.
  18884. @item sinusoidal
  18885. Sinusoidal map projection format.
  18886. @item fisheye
  18887. Fisheye projection.
  18888. Format specific options:
  18889. @table @option
  18890. @item h_fov
  18891. @item v_fov
  18892. @item d_fov
  18893. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18894. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18895. @item ih_fov
  18896. @item iv_fov
  18897. @item id_fov
  18898. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18899. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18900. @end table
  18901. @item pannini
  18902. Pannini projection.
  18903. Format specific options:
  18904. @table @option
  18905. @item h_fov
  18906. Set output pannini parameter.
  18907. @item ih_fov
  18908. Set input pannini parameter.
  18909. @end table
  18910. @item cylindrical
  18911. Cylindrical projection.
  18912. Format specific options:
  18913. @table @option
  18914. @item h_fov
  18915. @item v_fov
  18916. @item d_fov
  18917. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18918. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18919. @item ih_fov
  18920. @item iv_fov
  18921. @item id_fov
  18922. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18923. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18924. @end table
  18925. @item perspective
  18926. Perspective projection. @i{(output only)}
  18927. Format specific options:
  18928. @table @option
  18929. @item v_fov
  18930. Set perspective parameter.
  18931. @end table
  18932. @item tetrahedron
  18933. Tetrahedron projection.
  18934. @item tsp
  18935. Truncated square pyramid projection.
  18936. @item he
  18937. @item hequirect
  18938. Half equirectangular projection.
  18939. @item equisolid
  18940. Equisolid format.
  18941. Format specific options:
  18942. @table @option
  18943. @item h_fov
  18944. @item v_fov
  18945. @item d_fov
  18946. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18947. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18948. @item ih_fov
  18949. @item iv_fov
  18950. @item id_fov
  18951. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18952. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18953. @end table
  18954. @item og
  18955. Orthographic format.
  18956. Format specific options:
  18957. @table @option
  18958. @item h_fov
  18959. @item v_fov
  18960. @item d_fov
  18961. Set output horizontal/vertical/diagonal field of view. Values in degrees.
  18962. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18963. @item ih_fov
  18964. @item iv_fov
  18965. @item id_fov
  18966. Set input horizontal/vertical/diagonal field of view. Values in degrees.
  18967. If diagonal field of view is set it overrides horizontal and vertical field of view.
  18968. @end table
  18969. @item octahedron
  18970. Octahedron projection.
  18971. @item cylindricalea
  18972. Cylindrical Equal Area projection.
  18973. @end table
  18974. @item interp
  18975. Set interpolation method.@*
  18976. @i{Note: more complex interpolation methods require much more memory to run.}
  18977. Available methods:
  18978. @table @samp
  18979. @item near
  18980. @item nearest
  18981. Nearest neighbour.
  18982. @item line
  18983. @item linear
  18984. Bilinear interpolation.
  18985. @item lagrange9
  18986. Lagrange9 interpolation.
  18987. @item cube
  18988. @item cubic
  18989. Bicubic interpolation.
  18990. @item lanc
  18991. @item lanczos
  18992. Lanczos interpolation.
  18993. @item sp16
  18994. @item spline16
  18995. Spline16 interpolation.
  18996. @item gauss
  18997. @item gaussian
  18998. Gaussian interpolation.
  18999. @item mitchell
  19000. Mitchell interpolation.
  19001. @end table
  19002. Default value is @b{@samp{line}}.
  19003. @item w
  19004. @item h
  19005. Set the output video resolution.
  19006. Default resolution depends on formats.
  19007. @item in_stereo
  19008. @item out_stereo
  19009. Set the input/output stereo format.
  19010. @table @samp
  19011. @item 2d
  19012. 2D mono
  19013. @item sbs
  19014. Side by side
  19015. @item tb
  19016. Top bottom
  19017. @end table
  19018. Default value is @b{@samp{2d}} for input and output format.
  19019. @item yaw
  19020. @item pitch
  19021. @item roll
  19022. Set rotation for the output video. Values in degrees.
  19023. @item rorder
  19024. Set rotation order for the output video. Choose one item for each position.
  19025. @table @samp
  19026. @item y, Y
  19027. yaw
  19028. @item p, P
  19029. pitch
  19030. @item r, R
  19031. roll
  19032. @end table
  19033. Default value is @b{@samp{ypr}}.
  19034. @item h_flip
  19035. @item v_flip
  19036. @item d_flip
  19037. Flip the output video horizontally(swaps left-right)/vertically(swaps up-down)/in-depth(swaps back-forward). Boolean values.
  19038. @item ih_flip
  19039. @item iv_flip
  19040. Set if input video is flipped horizontally/vertically. Boolean values.
  19041. @item in_trans
  19042. Set if input video is transposed. Boolean value, by default disabled.
  19043. @item out_trans
  19044. Set if output video needs to be transposed. Boolean value, by default disabled.
  19045. @item h_offset
  19046. @item v_offset
  19047. Set output horizontal/vertical off-axis offset. Default is set to 0.
  19048. Allowed range is from -1 to 1.
  19049. @item alpha_mask
  19050. Build mask in alpha plane for all unmapped pixels by marking them fully transparent. Boolean value, by default disabled.
  19051. @item reset_rot
  19052. Reset rotation of output video. Boolean value, by default disabled.
  19053. @end table
  19054. @subsection Examples
  19055. @itemize
  19056. @item
  19057. Convert equirectangular video to cubemap with 3x2 layout and 1% padding using bicubic interpolation:
  19058. @example
  19059. ffmpeg -i input.mkv -vf v360=e:c3x2:cubic:out_pad=0.01 output.mkv
  19060. @end example
  19061. @item
  19062. Extract back view of Equi-Angular Cubemap:
  19063. @example
  19064. ffmpeg -i input.mkv -vf v360=eac:flat:yaw=180 output.mkv
  19065. @end example
  19066. @item
  19067. Convert transposed and horizontally flipped Equi-Angular Cubemap in side-by-side stereo format to equirectangular top-bottom stereo format:
  19068. @example
  19069. v360=eac:equirect:in_stereo=sbs:in_trans=1:ih_flip=1:out_stereo=tb
  19070. @end example
  19071. @end itemize
  19072. @subsection Commands
  19073. This filter supports subset of above options as @ref{commands}.
  19074. @section vaguedenoiser
  19075. Apply a wavelet based denoiser.
  19076. It transforms each frame from the video input into the wavelet domain,
  19077. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  19078. the obtained coefficients. It does an inverse wavelet transform after.
  19079. Due to wavelet properties, it should give a nice smoothed result, and
  19080. reduced noise, without blurring picture features.
  19081. This filter accepts the following options:
  19082. @table @option
  19083. @item threshold
  19084. The filtering strength. The higher, the more filtered the video will be.
  19085. Hard thresholding can use a higher threshold than soft thresholding
  19086. before the video looks overfiltered. Default value is 2.
  19087. @item method
  19088. The filtering method the filter will use.
  19089. It accepts the following values:
  19090. @table @samp
  19091. @item hard
  19092. All values under the threshold will be zeroed.
  19093. @item soft
  19094. All values under the threshold will be zeroed. All values above will be
  19095. reduced by the threshold.
  19096. @item garrote
  19097. Scales or nullifies coefficients - intermediary between (more) soft and
  19098. (less) hard thresholding.
  19099. @end table
  19100. Default is garrote.
  19101. @item nsteps
  19102. Number of times, the wavelet will decompose the picture. Picture can't
  19103. be decomposed beyond a particular point (typically, 8 for a 640x480
  19104. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  19105. @item percent
  19106. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  19107. @item planes
  19108. A list of the planes to process. By default all planes are processed.
  19109. @item type
  19110. The threshold type the filter will use.
  19111. It accepts the following values:
  19112. @table @samp
  19113. @item universal
  19114. Threshold used is same for all decompositions.
  19115. @item bayes
  19116. Threshold used depends also on each decomposition coefficients.
  19117. @end table
  19118. Default is universal.
  19119. @end table
  19120. @section varblur
  19121. Apply variable blur filter by using 2nd video stream to set blur radius.
  19122. The 2nd stream must have the same dimensions.
  19123. This filter accepts the following options:
  19124. @table @option
  19125. @item min_r
  19126. Set min allowed radius. Allowed range is from 0 to 254. Default is 0.
  19127. @item max_r
  19128. Set max allowed radius. Allowed range is from 1 to 255. Default is 8.
  19129. @item planes
  19130. Set which planes to process. By default, all are used.
  19131. @end table
  19132. The @code{varblur} filter also supports the @ref{framesync} options.
  19133. @subsection Commands
  19134. This filter supports all the above options as @ref{commands}.
  19135. @section vectorscope
  19136. Display 2 color component values in the two dimensional graph (which is called
  19137. a vectorscope).
  19138. This filter accepts the following options:
  19139. @table @option
  19140. @item mode, m
  19141. Set vectorscope mode.
  19142. It accepts the following values:
  19143. @table @samp
  19144. @item gray
  19145. @item tint
  19146. Gray values are displayed on graph, higher brightness means more pixels have
  19147. same component color value on location in graph. This is the default mode.
  19148. @item color
  19149. Gray values are displayed on graph. Surrounding pixels values which are not
  19150. present in video frame are drawn in gradient of 2 color components which are
  19151. set by option @code{x} and @code{y}. The 3rd color component is static.
  19152. @item color2
  19153. Actual color components values present in video frame are displayed on graph.
  19154. @item color3
  19155. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  19156. on graph increases value of another color component, which is luminance by
  19157. default values of @code{x} and @code{y}.
  19158. @item color4
  19159. Actual colors present in video frame are displayed on graph. If two different
  19160. colors map to same position on graph then color with higher value of component
  19161. not present in graph is picked.
  19162. @item color5
  19163. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  19164. component picked from radial gradient.
  19165. @end table
  19166. @item x
  19167. Set which color component will be represented on X-axis. Default is @code{1}.
  19168. @item y
  19169. Set which color component will be represented on Y-axis. Default is @code{2}.
  19170. @item intensity, i
  19171. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  19172. of color component which represents frequency of (X, Y) location in graph.
  19173. @item envelope, e
  19174. @table @samp
  19175. @item none
  19176. No envelope, this is default.
  19177. @item instant
  19178. Instant envelope, even darkest single pixel will be clearly highlighted.
  19179. @item peak
  19180. Hold maximum and minimum values presented in graph over time. This way you
  19181. can still spot out of range values without constantly looking at vectorscope.
  19182. @item peak+instant
  19183. Peak and instant envelope combined together.
  19184. @end table
  19185. @item graticule, g
  19186. Set what kind of graticule to draw.
  19187. @table @samp
  19188. @item none
  19189. @item green
  19190. @item color
  19191. @item invert
  19192. @end table
  19193. @item opacity, o
  19194. Set graticule opacity.
  19195. @item flags, f
  19196. Set graticule flags.
  19197. @table @samp
  19198. @item white
  19199. Draw graticule for white point.
  19200. @item black
  19201. Draw graticule for black point.
  19202. @item name
  19203. Draw color points short names.
  19204. @end table
  19205. @item bgopacity, b
  19206. Set background opacity.
  19207. @item lthreshold, l
  19208. Set low threshold for color component not represented on X or Y axis.
  19209. Values lower than this value will be ignored. Default is 0.
  19210. Note this value is multiplied with actual max possible value one pixel component
  19211. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  19212. is 0.1 * 255 = 25.
  19213. @item hthreshold, h
  19214. Set high threshold for color component not represented on X or Y axis.
  19215. Values higher than this value will be ignored. Default is 1.
  19216. Note this value is multiplied with actual max possible value one pixel component
  19217. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  19218. is 0.9 * 255 = 230.
  19219. @item colorspace, c
  19220. Set what kind of colorspace to use when drawing graticule.
  19221. @table @samp
  19222. @item auto
  19223. @item 601
  19224. @item 709
  19225. @end table
  19226. Default is auto.
  19227. @item tint0, t0
  19228. @item tint1, t1
  19229. Set color tint for gray/tint vectorscope mode. By default both options are zero.
  19230. This means no tint, and output will remain gray.
  19231. @end table
  19232. @anchor{vidstabdetect}
  19233. @section vidstabdetect
  19234. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  19235. @ref{vidstabtransform} for pass 2.
  19236. This filter generates a file with relative translation and rotation
  19237. transform information about subsequent frames, which is then used by
  19238. the @ref{vidstabtransform} filter.
  19239. To enable compilation of this filter you need to configure FFmpeg with
  19240. @code{--enable-libvidstab}.
  19241. This filter accepts the following options:
  19242. @table @option
  19243. @item result
  19244. Set the path to the file used to write the transforms information.
  19245. Default value is @file{transforms.trf}.
  19246. @item shakiness
  19247. Set how shaky the video is and how quick the camera is. It accepts an
  19248. integer in the range 1-10, a value of 1 means little shakiness, a
  19249. value of 10 means strong shakiness. Default value is 5.
  19250. @item accuracy
  19251. Set the accuracy of the detection process. It must be a value in the
  19252. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  19253. accuracy. Default value is 15.
  19254. @item stepsize
  19255. Set stepsize of the search process. The region around minimum is
  19256. scanned with 1 pixel resolution. Default value is 6.
  19257. @item mincontrast
  19258. Set minimum contrast. Below this value a local measurement field is
  19259. discarded. Must be a floating point value in the range 0-1. Default
  19260. value is 0.3.
  19261. @item tripod
  19262. Set reference frame number for tripod mode.
  19263. If enabled, the motion of the frames is compared to a reference frame
  19264. in the filtered stream, identified by the specified number. The idea
  19265. is to compensate all movements in a more-or-less static scene and keep
  19266. the camera view absolutely still.
  19267. If set to 0, it is disabled. The frames are counted starting from 1.
  19268. @item show
  19269. Show fields and transforms in the resulting frames. It accepts an
  19270. integer in the range 0-2. Default value is 0, which disables any
  19271. visualization.
  19272. @item fileformat
  19273. Format for the transforms data file to be written.
  19274. Acceptable values are
  19275. @table @samp
  19276. @item ascii
  19277. Human-readable plain text
  19278. @item binary
  19279. Binary format, roughly 40% smaller than @code{ascii}. (@emph{default})
  19280. @end table
  19281. @end table
  19282. @subsection Examples
  19283. @itemize
  19284. @item
  19285. Use default values:
  19286. @example
  19287. vidstabdetect
  19288. @end example
  19289. @item
  19290. Analyze strongly shaky movie and put the results in file
  19291. @file{mytransforms.trf}:
  19292. @example
  19293. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  19294. @end example
  19295. @item
  19296. Visualize the result of internal transformations in the resulting
  19297. video:
  19298. @example
  19299. vidstabdetect=show=1
  19300. @end example
  19301. @item
  19302. Analyze a video with medium shakiness using @command{ffmpeg}:
  19303. @example
  19304. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  19305. @end example
  19306. @end itemize
  19307. @anchor{vidstabtransform}
  19308. @section vidstabtransform
  19309. Video stabilization/deshaking: pass 2 of 2,
  19310. see @ref{vidstabdetect} for pass 1.
  19311. Read a file with transform information for each frame and
  19312. apply/compensate them. Together with the @ref{vidstabdetect}
  19313. filter this can be used to deshake videos. See also
  19314. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  19315. the @ref{unsharp} filter, see below.
  19316. To enable compilation of this filter you need to configure FFmpeg with
  19317. @code{--enable-libvidstab}.
  19318. @subsection Options
  19319. @table @option
  19320. @item input
  19321. Set path to the file used to read the transforms. Default value is
  19322. @file{transforms.trf}.
  19323. @item smoothing
  19324. Set the number of frames (value*2 + 1) used for lowpass filtering the
  19325. camera movements. Default value is 10.
  19326. For example a number of 10 means that 21 frames are used (10 in the
  19327. past and 10 in the future) to smoothen the motion in the video. A
  19328. larger value leads to a smoother video, but limits the acceleration of
  19329. the camera (pan/tilt movements). 0 is a special case where a static
  19330. camera is simulated.
  19331. @item optalgo
  19332. Set the camera path optimization algorithm.
  19333. Accepted values are:
  19334. @table @samp
  19335. @item gauss
  19336. gaussian kernel low-pass filter on camera motion (default)
  19337. @item avg
  19338. averaging on transformations
  19339. @end table
  19340. @item maxshift
  19341. Set maximal number of pixels to translate frames. Default value is -1,
  19342. meaning no limit.
  19343. @item maxangle
  19344. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  19345. value is -1, meaning no limit.
  19346. @item crop
  19347. Specify how to deal with borders that may be visible due to movement
  19348. compensation.
  19349. Available values are:
  19350. @table @samp
  19351. @item keep
  19352. keep image information from previous frame (default)
  19353. @item black
  19354. fill the border black
  19355. @end table
  19356. @item invert
  19357. Invert transforms if set to 1. Default value is 0.
  19358. @item relative
  19359. Consider transforms as relative to previous frame if set to 1,
  19360. absolute if set to 0. Default value is 0.
  19361. @item zoom
  19362. Set percentage to zoom. A positive value will result in a zoom-in
  19363. effect, a negative value in a zoom-out effect. Default value is 0 (no
  19364. zoom).
  19365. @item optzoom
  19366. Set optimal zooming to avoid borders.
  19367. Accepted values are:
  19368. @table @samp
  19369. @item 0
  19370. disabled
  19371. @item 1
  19372. optimal static zoom value is determined (only very strong movements
  19373. will lead to visible borders) (default)
  19374. @item 2
  19375. optimal adaptive zoom value is determined (no borders will be
  19376. visible), see @option{zoomspeed}
  19377. @end table
  19378. Note that the value given at zoom is added to the one calculated here.
  19379. @item zoomspeed
  19380. Set percent to zoom maximally each frame (enabled when
  19381. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  19382. 0.25.
  19383. @item interpol
  19384. Specify type of interpolation.
  19385. Available values are:
  19386. @table @samp
  19387. @item no
  19388. no interpolation
  19389. @item linear
  19390. linear only horizontal
  19391. @item bilinear
  19392. linear in both directions (default)
  19393. @item bicubic
  19394. cubic in both directions (slow)
  19395. @end table
  19396. @item tripod
  19397. Enable virtual tripod mode if set to 1, which is equivalent to
  19398. @code{relative=0:smoothing=0}. Default value is 0.
  19399. Use also @code{tripod} option of @ref{vidstabdetect}.
  19400. @item debug
  19401. Increase log verbosity if set to 1. Also the detected global motions
  19402. are written to the temporary file @file{global_motions.trf}. Default
  19403. value is 0.
  19404. @end table
  19405. @subsection Examples
  19406. @itemize
  19407. @item
  19408. Use @command{ffmpeg} for a typical stabilization with default values:
  19409. @example
  19410. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  19411. @end example
  19412. Note the use of the @ref{unsharp} filter which is always recommended.
  19413. @item
  19414. Zoom in a bit more and load transform data from a given file:
  19415. @example
  19416. vidstabtransform=zoom=5:input="mytransforms.trf"
  19417. @end example
  19418. @item
  19419. Smoothen the video even more:
  19420. @example
  19421. vidstabtransform=smoothing=30
  19422. @end example
  19423. @end itemize
  19424. @section vflip
  19425. Flip the input video vertically.
  19426. For example, to vertically flip a video with @command{ffmpeg}:
  19427. @example
  19428. ffmpeg -i in.avi -vf "vflip" out.avi
  19429. @end example
  19430. @section vfrdet
  19431. Detect variable frame rate video.
  19432. This filter tries to detect if the input is variable or constant frame rate.
  19433. At end it will output number of frames detected as having variable delta pts,
  19434. and ones with constant delta pts.
  19435. If there was frames with variable delta, than it will also show min, max and
  19436. average delta encountered.
  19437. @section vibrance
  19438. Boost or alter saturation.
  19439. The filter accepts the following options:
  19440. @table @option
  19441. @item intensity
  19442. Set strength of boost if positive value or strength of alter if negative value.
  19443. Default is 0. Allowed range is from -2 to 2.
  19444. @item rbal
  19445. Set the red balance. Default is 1. Allowed range is from -10 to 10.
  19446. @item gbal
  19447. Set the green balance. Default is 1. Allowed range is from -10 to 10.
  19448. @item bbal
  19449. Set the blue balance. Default is 1. Allowed range is from -10 to 10.
  19450. @item rlum
  19451. Set the red luma coefficient.
  19452. @item glum
  19453. Set the green luma coefficient.
  19454. @item blum
  19455. Set the blue luma coefficient.
  19456. @item alternate
  19457. If @code{intensity} is negative and this is set to 1, colors will change,
  19458. otherwise colors will be less saturated, more towards gray.
  19459. @end table
  19460. @subsection Commands
  19461. This filter supports the all above options as @ref{commands}.
  19462. @section vif
  19463. Obtain the average VIF (Visual Information Fidelity) between two input videos.
  19464. This filter takes two input videos.
  19465. Both input videos must have the same resolution and pixel format for
  19466. this filter to work correctly. Also it assumes that both inputs
  19467. have the same number of frames, which are compared one by one.
  19468. The obtained average VIF score is printed through the logging system.
  19469. The filter stores the calculated VIF score of each frame.
  19470. This filter also supports the @ref{framesync} options.
  19471. In the below example the input file @file{main.mpg} being processed is compared
  19472. with the reference file @file{ref.mpg}.
  19473. @example
  19474. ffmpeg -i main.mpg -i ref.mpg -lavfi vif -f null -
  19475. @end example
  19476. @anchor{vignette}
  19477. @section vignette
  19478. Make or reverse a natural vignetting effect.
  19479. The filter accepts the following options:
  19480. @table @option
  19481. @item angle, a
  19482. Set lens angle expression as a number of radians.
  19483. The value is clipped in the @code{[0,PI/2]} range.
  19484. Default value: @code{"PI/5"}
  19485. @item x0
  19486. @item y0
  19487. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  19488. by default.
  19489. @item mode
  19490. Set forward/backward mode.
  19491. Available modes are:
  19492. @table @samp
  19493. @item forward
  19494. The larger the distance from the central point, the darker the image becomes.
  19495. @item backward
  19496. The larger the distance from the central point, the brighter the image becomes.
  19497. This can be used to reverse a vignette effect, though there is no automatic
  19498. detection to extract the lens @option{angle} and other settings (yet). It can
  19499. also be used to create a burning effect.
  19500. @end table
  19501. Default value is @samp{forward}.
  19502. @item eval
  19503. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  19504. It accepts the following values:
  19505. @table @samp
  19506. @item init
  19507. Evaluate expressions only once during the filter initialization.
  19508. @item frame
  19509. Evaluate expressions for each incoming frame. This is way slower than the
  19510. @samp{init} mode since it requires all the scalers to be re-computed, but it
  19511. allows advanced dynamic expressions.
  19512. @end table
  19513. Default value is @samp{init}.
  19514. @item dither
  19515. Set dithering to reduce the circular banding effects. Default is @code{1}
  19516. (enabled).
  19517. @item aspect
  19518. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  19519. Setting this value to the SAR of the input will make a rectangular vignetting
  19520. following the dimensions of the video.
  19521. Default is @code{1/1}.
  19522. @end table
  19523. @subsection Expressions
  19524. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  19525. following parameters.
  19526. @table @option
  19527. @item w
  19528. @item h
  19529. input width and height
  19530. @item n
  19531. the number of input frame, starting from 0
  19532. @item pts
  19533. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  19534. @var{TB} units, NAN if undefined
  19535. @item r
  19536. frame rate of the input video, NAN if the input frame rate is unknown
  19537. @item t
  19538. the PTS (Presentation TimeStamp) of the filtered video frame,
  19539. expressed in seconds, NAN if undefined
  19540. @item tb
  19541. time base of the input video
  19542. @end table
  19543. @subsection Examples
  19544. @itemize
  19545. @item
  19546. Apply simple strong vignetting effect:
  19547. @example
  19548. vignette=PI/4
  19549. @end example
  19550. @item
  19551. Make a flickering vignetting:
  19552. @example
  19553. vignette='PI/4+random(1)*PI/50':eval=frame
  19554. @end example
  19555. @end itemize
  19556. @section vmafmotion
  19557. Obtain the average VMAF motion score of a video.
  19558. It is one of the component metrics of VMAF.
  19559. The obtained average motion score is printed through the logging system.
  19560. The filter accepts the following options:
  19561. @table @option
  19562. @item stats_file
  19563. If specified, the filter will use the named file to save the motion score of
  19564. each frame with respect to the previous frame.
  19565. When filename equals "-" the data is sent to standard output.
  19566. @end table
  19567. Example:
  19568. @example
  19569. ffmpeg -i ref.mpg -vf vmafmotion -f null -
  19570. @end example
  19571. @anchor{vstack}
  19572. @section vstack
  19573. Stack input videos vertically.
  19574. All streams must be of same pixel format and of same width.
  19575. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  19576. to create same output.
  19577. The filter accepts the following options:
  19578. @table @option
  19579. @item inputs
  19580. Set number of input streams. Default is 2.
  19581. @item shortest
  19582. If set to 1, force the output to terminate when the shortest input
  19583. terminates. Default value is 0.
  19584. @end table
  19585. @section w3fdif
  19586. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  19587. Deinterlacing Filter").
  19588. Based on the process described by Martin Weston for BBC R&D, and
  19589. implemented based on the de-interlace algorithm written by Jim
  19590. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  19591. uses filter coefficients calculated by BBC R&D.
  19592. This filter uses field-dominance information in frame to decide which
  19593. of each pair of fields to place first in the output.
  19594. If it gets it wrong use @ref{setfield} filter before @code{w3fdif} filter.
  19595. There are two sets of filter coefficients, so called "simple"
  19596. and "complex". Which set of filter coefficients is used can
  19597. be set by passing an optional parameter:
  19598. @table @option
  19599. @item filter
  19600. Set the interlacing filter coefficients. Accepts one of the following values:
  19601. @table @samp
  19602. @item simple
  19603. Simple filter coefficient set.
  19604. @item complex
  19605. More-complex filter coefficient set.
  19606. @end table
  19607. Default value is @samp{complex}.
  19608. @item mode
  19609. The interlacing mode to adopt. It accepts one of the following values:
  19610. @table @option
  19611. @item frame
  19612. Output one frame for each frame.
  19613. @item field
  19614. Output one frame for each field.
  19615. @end table
  19616. The default value is @code{field}.
  19617. @item parity
  19618. The picture field parity assumed for the input interlaced video. It accepts one
  19619. of the following values:
  19620. @table @option
  19621. @item tff
  19622. Assume the top field is first.
  19623. @item bff
  19624. Assume the bottom field is first.
  19625. @item auto
  19626. Enable automatic detection of field parity.
  19627. @end table
  19628. The default value is @code{auto}.
  19629. If the interlacing is unknown or the decoder does not export this information,
  19630. top field first will be assumed.
  19631. @item deint
  19632. Specify which frames to deinterlace. Accepts one of the following values:
  19633. @table @samp
  19634. @item all
  19635. Deinterlace all frames,
  19636. @item interlaced
  19637. Only deinterlace frames marked as interlaced.
  19638. @end table
  19639. Default value is @samp{all}.
  19640. @end table
  19641. @subsection Commands
  19642. This filter supports same @ref{commands} as options.
  19643. @section waveform
  19644. Video waveform monitor.
  19645. The waveform monitor plots color component intensity. By default luma
  19646. only. Each column of the waveform corresponds to a column of pixels in the
  19647. source video.
  19648. It accepts the following options:
  19649. @table @option
  19650. @item mode, m
  19651. Can be either @code{row}, or @code{column}. Default is @code{column}.
  19652. In row mode, the graph on the left side represents color component value 0 and
  19653. the right side represents value = 255. In column mode, the top side represents
  19654. color component value = 0 and bottom side represents value = 255.
  19655. @item intensity, i
  19656. Set intensity. Smaller values are useful to find out how many values of the same
  19657. luminance are distributed across input rows/columns.
  19658. Default value is @code{0.04}. Allowed range is [0, 1].
  19659. @item mirror, r
  19660. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  19661. In mirrored mode, higher values will be represented on the left
  19662. side for @code{row} mode and at the top for @code{column} mode. Default is
  19663. @code{1} (mirrored).
  19664. @item display, d
  19665. Set display mode.
  19666. It accepts the following values:
  19667. @table @samp
  19668. @item overlay
  19669. Presents information identical to that in the @code{parade}, except
  19670. that the graphs representing color components are superimposed directly
  19671. over one another.
  19672. This display mode makes it easier to spot relative differences or similarities
  19673. in overlapping areas of the color components that are supposed to be identical,
  19674. such as neutral whites, grays, or blacks.
  19675. @item stack
  19676. Display separate graph for the color components side by side in
  19677. @code{row} mode or one below the other in @code{column} mode.
  19678. @item parade
  19679. Display separate graph for the color components side by side in
  19680. @code{column} mode or one below the other in @code{row} mode.
  19681. Using this display mode makes it easy to spot color casts in the highlights
  19682. and shadows of an image, by comparing the contours of the top and the bottom
  19683. graphs of each waveform. Since whites, grays, and blacks are characterized
  19684. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  19685. should display three waveforms of roughly equal width/height. If not, the
  19686. correction is easy to perform by making level adjustments the three waveforms.
  19687. @end table
  19688. Default is @code{stack}.
  19689. @item components, c
  19690. Set which color components to display. Default is 1, which means only luma
  19691. or red color component if input is in RGB colorspace. If is set for example to
  19692. 7 it will display all 3 (if) available color components.
  19693. @item envelope, e
  19694. @table @samp
  19695. @item none
  19696. No envelope, this is default.
  19697. @item instant
  19698. Instant envelope, minimum and maximum values presented in graph will be easily
  19699. visible even with small @code{step} value.
  19700. @item peak
  19701. Hold minimum and maximum values presented in graph across time. This way you
  19702. can still spot out of range values without constantly looking at waveforms.
  19703. @item peak+instant
  19704. Peak and instant envelope combined together.
  19705. @end table
  19706. @item filter, f
  19707. @table @samp
  19708. @item lowpass
  19709. No filtering, this is default.
  19710. @item flat
  19711. Luma and chroma combined together.
  19712. @item aflat
  19713. Similar as above, but shows difference between blue and red chroma.
  19714. @item xflat
  19715. Similar as above, but use different colors.
  19716. @item yflat
  19717. Similar as above, but again with different colors.
  19718. @item chroma
  19719. Displays only chroma.
  19720. @item color
  19721. Displays actual color value on waveform.
  19722. @item acolor
  19723. Similar as above, but with luma showing frequency of chroma values.
  19724. @end table
  19725. @item graticule, g
  19726. Set which graticule to display.
  19727. @table @samp
  19728. @item none
  19729. Do not display graticule.
  19730. @item green
  19731. Display green graticule showing legal broadcast ranges.
  19732. @item orange
  19733. Display orange graticule showing legal broadcast ranges.
  19734. @item invert
  19735. Display invert graticule showing legal broadcast ranges.
  19736. @end table
  19737. @item opacity, o
  19738. Set graticule opacity.
  19739. @item flags, fl
  19740. Set graticule flags.
  19741. @table @samp
  19742. @item numbers
  19743. Draw numbers above lines. By default enabled.
  19744. @item dots
  19745. Draw dots instead of lines.
  19746. @end table
  19747. @item scale, s
  19748. Set scale used for displaying graticule.
  19749. @table @samp
  19750. @item digital
  19751. @item millivolts
  19752. @item ire
  19753. @end table
  19754. Default is digital.
  19755. @item bgopacity, b
  19756. Set background opacity.
  19757. @item tint0, t0
  19758. @item tint1, t1
  19759. Set tint for output.
  19760. Only used with lowpass filter and when display is not overlay and input
  19761. pixel formats are not RGB.
  19762. @item fitmode, fm
  19763. Set sample aspect ratio of video output frames.
  19764. Can be used to configure waveform so it is not
  19765. streched too much in one of directions.
  19766. @table @samp
  19767. @item none
  19768. Set sample aspect ration to 1/1.
  19769. @item size
  19770. Set sample aspect ratio to match input size of video
  19771. @end table
  19772. Default is @samp{none}.
  19773. @item input
  19774. Set input formats for filter to pick from.
  19775. Can be @samp{all}, for selecting from all available formats,
  19776. or @samp{first}, for selecting first available format.
  19777. Default is @samp{first}.
  19778. @end table
  19779. @section weave, doubleweave
  19780. The @code{weave} takes a field-based video input and join
  19781. each two sequential fields into single frame, producing a new double
  19782. height clip with half the frame rate and half the frame count.
  19783. The @code{doubleweave} works same as @code{weave} but without
  19784. halving frame rate and frame count.
  19785. It accepts the following option:
  19786. @table @option
  19787. @item first_field
  19788. Set first field. Available values are:
  19789. @table @samp
  19790. @item top, t
  19791. Set the frame as top-field-first.
  19792. @item bottom, b
  19793. Set the frame as bottom-field-first.
  19794. @end table
  19795. @end table
  19796. @subsection Examples
  19797. @itemize
  19798. @item
  19799. Interlace video using @ref{select} and @ref{separatefields} filter:
  19800. @example
  19801. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  19802. @end example
  19803. @end itemize
  19804. @section xbr
  19805. Apply the xBR high-quality magnification filter which is designed for pixel
  19806. art. It follows a set of edge-detection rules, see
  19807. @url{https://forums.libretro.com/t/xbr-algorithm-tutorial/123}.
  19808. It accepts the following option:
  19809. @table @option
  19810. @item n
  19811. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  19812. @code{3xBR} and @code{4} for @code{4xBR}.
  19813. Default is @code{3}.
  19814. @end table
  19815. @section xcorrelate
  19816. Apply normalized cross-correlation between first and second input video stream.
  19817. Second input video stream dimensions must be lower than first input video stream.
  19818. The filter accepts the following options:
  19819. @table @option
  19820. @item planes
  19821. Set which planes to process.
  19822. @item secondary
  19823. Set which secondary video frames will be processed from second input video stream,
  19824. can be @var{first} or @var{all}. Default is @var{all}.
  19825. @end table
  19826. The @code{xcorrelate} filter also supports the @ref{framesync} options.
  19827. @section xfade
  19828. Apply cross fade from one input video stream to another input video stream.
  19829. The cross fade is applied for specified duration.
  19830. Both inputs must be constant frame-rate and have the same resolution, pixel format,
  19831. frame rate and timebase.
  19832. The filter accepts the following options:
  19833. @table @option
  19834. @item transition
  19835. Set one of available transition effects:
  19836. @table @samp
  19837. @item custom
  19838. @item fade
  19839. @item wipeleft
  19840. @item wiperight
  19841. @item wipeup
  19842. @item wipedown
  19843. @item slideleft
  19844. @item slideright
  19845. @item slideup
  19846. @item slidedown
  19847. @item circlecrop
  19848. @item rectcrop
  19849. @item distance
  19850. @item fadeblack
  19851. @item fadewhite
  19852. @item radial
  19853. @item smoothleft
  19854. @item smoothright
  19855. @item smoothup
  19856. @item smoothdown
  19857. @item circleopen
  19858. @item circleclose
  19859. @item vertopen
  19860. @item vertclose
  19861. @item horzopen
  19862. @item horzclose
  19863. @item dissolve
  19864. @item pixelize
  19865. @item diagtl
  19866. @item diagtr
  19867. @item diagbl
  19868. @item diagbr
  19869. @item hlslice
  19870. @item hrslice
  19871. @item vuslice
  19872. @item vdslice
  19873. @item hblur
  19874. @item fadegrays
  19875. @item wipetl
  19876. @item wipetr
  19877. @item wipebl
  19878. @item wipebr
  19879. @item squeezeh
  19880. @item squeezev
  19881. @item zoomin
  19882. @item fadefast
  19883. @item fadeslow
  19884. @item hlwind
  19885. @item hrwind
  19886. @item vuwind
  19887. @item vdwind
  19888. @item coverleft
  19889. @item coverright
  19890. @item coverup
  19891. @item coverdown
  19892. @item revealleft
  19893. @item revealright
  19894. @item revealup
  19895. @item revealdown
  19896. @end table
  19897. Default transition effect is fade.
  19898. @item duration
  19899. Set cross fade duration in seconds.
  19900. Range is 0 to 60 seconds.
  19901. Default duration is 1 second.
  19902. @item offset
  19903. Set cross fade start relative to first input stream in seconds.
  19904. Default offset is 0.
  19905. @item expr
  19906. Set expression for custom transition effect.
  19907. The expressions can use the following variables and functions:
  19908. @table @option
  19909. @item X
  19910. @item Y
  19911. The coordinates of the current sample.
  19912. @item W
  19913. @item H
  19914. The width and height of the image.
  19915. @item P
  19916. Progress of transition effect.
  19917. @item PLANE
  19918. Currently processed plane.
  19919. @item A
  19920. Return value of first input at current location and plane.
  19921. @item B
  19922. Return value of second input at current location and plane.
  19923. @item a0(x, y)
  19924. @item a1(x, y)
  19925. @item a2(x, y)
  19926. @item a3(x, y)
  19927. Return the value of the pixel at location (@var{x},@var{y}) of the
  19928. first/second/third/fourth component of first input.
  19929. @item b0(x, y)
  19930. @item b1(x, y)
  19931. @item b2(x, y)
  19932. @item b3(x, y)
  19933. Return the value of the pixel at location (@var{x},@var{y}) of the
  19934. first/second/third/fourth component of second input.
  19935. @end table
  19936. @end table
  19937. @subsection Examples
  19938. @itemize
  19939. @item
  19940. Cross fade from one input video to another input video, with fade transition and duration of transition
  19941. of 2 seconds starting at offset of 5 seconds:
  19942. @example
  19943. ffmpeg -i first.mp4 -i second.mp4 -filter_complex xfade=transition=fade:duration=2:offset=5 output.mp4
  19944. @end example
  19945. @end itemize
  19946. @section xmedian
  19947. Pick median pixels from several input videos.
  19948. The filter accepts the following options:
  19949. @table @option
  19950. @item inputs
  19951. Set number of inputs.
  19952. Default is 3. Allowed range is from 3 to 255.
  19953. If number of inputs is even number, than result will be mean value between two median values.
  19954. @item planes
  19955. Set which planes to filter. Default value is @code{15}, by which all planes are processed.
  19956. @item percentile
  19957. Set median percentile. Default value is @code{0.5}.
  19958. Default value of @code{0.5} will pick always median values, while @code{0} will pick
  19959. minimum values, and @code{1} maximum values.
  19960. @end table
  19961. @subsection Commands
  19962. This filter supports all above options as @ref{commands}, excluding option @code{inputs}.
  19963. @anchor{xpsnr}
  19964. @section xpsnr
  19965. Obtain the average (across all input frames) and minimum (across all color plane averages)
  19966. eXtended Perceptually weighted peak Signal-to-Noise Ratio (XPSNR) between two input videos.
  19967. The XPSNR is a low-complexity psychovisually motivated distortion measurement algorithm for
  19968. assessing the difference between two video streams or images. This is especially useful for
  19969. objectively quantifying the distortions caused by video and image codecs, as an alternative
  19970. to a formal subjective test. The logarithmic XPSNR output values are in a similar range as
  19971. those of traditional @ref{psnr} assessments but better reflect human impressions of visual
  19972. coding quality. More details on the XPSNR measure, which essentially represents a blockwise
  19973. weighted variant of the PSNR measure, can be found in the following freely available papers:
  19974. @itemize
  19975. @item
  19976. C. R. Helmrich, M. Siekmann, S. Becker, S. Bosse, D. Marpe, and T. Wiegand, "XPSNR: A
  19977. Low-Complexity Extension of the Perceptually Weighted Peak Signal-to-Noise Ratio for
  19978. High-Resolution Video Quality Assessment," in Proc. IEEE Int. Conf. Acoustics, Speech,
  19979. Sig. Process. (ICASSP), virt./online, May 2020. @url{www.ecodis.de/xpsnr.htm}
  19980. @item
  19981. C. R. Helmrich, S. Bosse, H. Schwarz, D. Marpe, and T. Wiegand, "A Study of the
  19982. Extended Perceptually Weighted Peak Signal-to-Noise Ratio (XPSNR) for Video Compression
  19983. with Different Resolutions and Bit Depths," ITU Journal: ICT Discoveries, vol. 3, no.
  19984. 1, pp. 65 - 72, May 2020. @url{http://handle.itu.int/11.1002/pub/8153d78b-en}
  19985. @end itemize
  19986. When publishing the results of XPSNR assessments obtained using, e.g., this FFmpeg filter, a
  19987. reference to the above papers as a means of documentation is strongly encouraged. The filter
  19988. requires two input videos. The first input is considered a (usually not distorted) reference
  19989. source and is passed unchanged to the output, whereas the second input is a (distorted) test
  19990. signal. Except for the bit depth, these two video inputs must have the same pixel format. In
  19991. addition, for best performance, both compared input videos should be in YCbCr color format.
  19992. The obtained overall XPSNR values mentioned above are printed through the logging system. In
  19993. case of input with multiple color planes, we suggest reporting of the minimum XPSNR average.
  19994. The following parameter, which behaves like the one for the @ref{psnr} filter, is accepted:
  19995. @table @option
  19996. @item stats_file, f
  19997. If specified, the filter will use the named file to save the XPSNR value of each individual
  19998. frame and color plane. When the file name equals "-", that data is sent to standard output.
  19999. @end table
  20000. This filter also supports the @ref{framesync} options.
  20001. @subsection Examples
  20002. @itemize
  20003. @item
  20004. XPSNR analysis of two 1080p HD videos, ref_source.yuv and test_video.yuv, both at 24 frames
  20005. per second, with color format 4:2:0, bit depth 8, and output of a logfile named "xpsnr.log":
  20006. @example
  20007. ffmpeg -s 1920x1080 -framerate 24 -pix_fmt yuv420p -i ref_source.yuv -s 1920x1080 -framerate
  20008. 24 -pix_fmt yuv420p -i test_video.yuv -lavfi xpsnr="stats_file=xpsnr.log" -f null -
  20009. @end example
  20010. @item
  20011. XPSNR analysis of two 2160p UHD videos, ref_source.yuv with bit depth 8 and test_video.yuv
  20012. with bit depth 10, both at 60 frames per second with color format 4:2:0, no logfile output:
  20013. @example
  20014. ffmpeg -s 3840x2160 -framerate 60 -pix_fmt yuv420p -i ref_source.yuv -s 3840x2160 -framerate
  20015. 60 -pix_fmt yuv420p10le -i test_video.yuv -lavfi xpsnr="stats_file=-" -f null -
  20016. @end example
  20017. @end itemize
  20018. @anchor{xstack}
  20019. @section xstack
  20020. Stack video inputs into custom layout.
  20021. All streams must be of same pixel format.
  20022. The filter accepts the following options:
  20023. @table @option
  20024. @item inputs
  20025. Set number of input streams. Default is 2.
  20026. @item layout
  20027. Specify layout of inputs.
  20028. This option requires the desired layout configuration to be explicitly set by the user.
  20029. This sets position of each video input in output. Each input
  20030. is separated by '|'.
  20031. The first number represents the column, and the second number represents the row.
  20032. Numbers start at 0 and are separated by '_'. Optionally one can use wX and hX,
  20033. where X is video input from which to take width or height.
  20034. Multiple values can be used when separated by '+'. In such
  20035. case values are summed together.
  20036. Note that if inputs are of different sizes gaps may appear, as not all of
  20037. the output video frame will be filled. Similarly, videos can overlap each
  20038. other if their position doesn't leave enough space for the full frame of
  20039. adjoining videos.
  20040. For 2 inputs, a default layout of @code{0_0|w0_0} (equivalent to
  20041. @code{grid=2x1}) is set. In all other cases, a layout or a grid must be set by
  20042. the user. Either @code{grid} or @code{layout} can be specified at a time.
  20043. Specifying both will result in an error.
  20044. @item grid
  20045. Specify a fixed size grid of inputs.
  20046. This option is used to create a fixed size grid of the input streams. Set the
  20047. grid size in the form @code{COLUMNSxROWS}. There must be @code{ROWS * COLUMNS}
  20048. input streams and they will be arranged as a grid with @code{ROWS} rows and
  20049. @code{COLUMNS} columns. When using this option, each input stream within a row
  20050. must have the same height and all the rows must have the same width.
  20051. If @code{grid} is set, then @code{inputs} option is ignored and is implicitly
  20052. set to @code{ROWS * COLUMNS}.
  20053. For 2 inputs, a default grid of @code{2x1} (equivalent to
  20054. @code{layout=0_0|w0_0}) is set. In all other cases, a layout or a grid must be
  20055. set by the user. Either @code{grid} or @code{layout} can be specified at a time.
  20056. Specifying both will result in an error.
  20057. @item shortest
  20058. If set to 1, force the output to terminate when the shortest input
  20059. terminates. Default value is 0.
  20060. @item fill
  20061. If set to valid color, all unused pixels will be filled with that color.
  20062. By default fill is set to none, so it is disabled.
  20063. @end table
  20064. @subsection Examples
  20065. @itemize
  20066. @item
  20067. Display 4 inputs into 2x2 grid.
  20068. Layout:
  20069. @example
  20070. input1(0, 0) | input3(w0, 0)
  20071. input2(0, h0) | input4(w0, h0)
  20072. @end example
  20073. @example
  20074. xstack=inputs=4:layout=0_0|0_h0|w0_0|w0_h0
  20075. @end example
  20076. Note that if inputs are of different sizes, gaps or overlaps may occur.
  20077. @item
  20078. Display 4 inputs into 1x4 grid.
  20079. Layout:
  20080. @example
  20081. input1(0, 0)
  20082. input2(0, h0)
  20083. input3(0, h0+h1)
  20084. input4(0, h0+h1+h2)
  20085. @end example
  20086. @example
  20087. xstack=inputs=4:layout=0_0|0_h0|0_h0+h1|0_h0+h1+h2
  20088. @end example
  20089. Note that if inputs are of different widths, unused space will appear.
  20090. @item
  20091. Display 9 inputs into 3x3 grid.
  20092. Layout:
  20093. @example
  20094. input1(0, 0) | input4(w0, 0) | input7(w0+w3, 0)
  20095. input2(0, h0) | input5(w0, h0) | input8(w0+w3, h0)
  20096. input3(0, h0+h1) | input6(w0, h0+h1) | input9(w0+w3, h0+h1)
  20097. @end example
  20098. @example
  20099. 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
  20100. @end example
  20101. Note that if inputs are of different sizes, gaps or overlaps may occur.
  20102. @item
  20103. Display 16 inputs into 4x4 grid.
  20104. Layout:
  20105. @example
  20106. input1(0, 0) | input5(w0, 0) | input9 (w0+w4, 0) | input13(w0+w4+w8, 0)
  20107. input2(0, h0) | input6(w0, h0) | input10(w0+w4, h0) | input14(w0+w4+w8, h0)
  20108. input3(0, h0+h1) | input7(w0, h0+h1) | input11(w0+w4, h0+h1) | input15(w0+w4+w8, h0+h1)
  20109. input4(0, h0+h1+h2)| input8(w0, h0+h1+h2)| input12(w0+w4, h0+h1+h2)| input16(w0+w4+w8, h0+h1+h2)
  20110. @end example
  20111. @example
  20112. 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|
  20113. 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
  20114. @end example
  20115. Note that if inputs are of different sizes, gaps or overlaps may occur.
  20116. @end itemize
  20117. @anchor{yadif}
  20118. @section yadif
  20119. Deinterlace the input video ("yadif" means "yet another deinterlacing
  20120. filter").
  20121. It accepts the following parameters:
  20122. @table @option
  20123. @item mode
  20124. The interlacing mode to adopt. It accepts one of the following values:
  20125. @table @option
  20126. @item 0, send_frame
  20127. Output one frame for each frame.
  20128. @item 1, send_field
  20129. Output one frame for each field.
  20130. @item 2, send_frame_nospatial
  20131. Like @code{send_frame}, but it skips the spatial interlacing check.
  20132. @item 3, send_field_nospatial
  20133. Like @code{send_field}, but it skips the spatial interlacing check.
  20134. @end table
  20135. The default value is @code{send_frame}.
  20136. @item parity
  20137. The picture field parity assumed for the input interlaced video. It accepts one
  20138. of the following values:
  20139. @table @option
  20140. @item 0, tff
  20141. Assume the top field is first.
  20142. @item 1, bff
  20143. Assume the bottom field is first.
  20144. @item -1, auto
  20145. Enable automatic detection of field parity.
  20146. @end table
  20147. The default value is @code{auto}.
  20148. If the interlacing is unknown or the decoder does not export this information,
  20149. top field first will be assumed.
  20150. @item deint
  20151. Specify which frames to deinterlace. Accepts one of the following
  20152. values:
  20153. @table @option
  20154. @item 0, all
  20155. Deinterlace all frames.
  20156. @item 1, interlaced
  20157. Only deinterlace frames marked as interlaced.
  20158. @end table
  20159. The default value is @code{all}.
  20160. @end table
  20161. @section yadif_cuda
  20162. Deinterlace the input video using the @ref{yadif} algorithm, but implemented
  20163. in CUDA so that it can work as part of a GPU accelerated pipeline with nvdec
  20164. and/or nvenc.
  20165. It accepts the following parameters:
  20166. @table @option
  20167. @item mode
  20168. The interlacing mode to adopt. It accepts one of the following values:
  20169. @table @option
  20170. @item 0, send_frame
  20171. Output one frame for each frame.
  20172. @item 1, send_field
  20173. Output one frame for each field.
  20174. @item 2, send_frame_nospatial
  20175. Like @code{send_frame}, but it skips the spatial interlacing check.
  20176. @item 3, send_field_nospatial
  20177. Like @code{send_field}, but it skips the spatial interlacing check.
  20178. @end table
  20179. The default value is @code{send_frame}.
  20180. @item parity
  20181. The picture field parity assumed for the input interlaced video. It accepts one
  20182. of the following values:
  20183. @table @option
  20184. @item 0, tff
  20185. Assume the top field is first.
  20186. @item 1, bff
  20187. Assume the bottom field is first.
  20188. @item -1, auto
  20189. Enable automatic detection of field parity.
  20190. @end table
  20191. The default value is @code{auto}.
  20192. If the interlacing is unknown or the decoder does not export this information,
  20193. top field first will be assumed.
  20194. @item deint
  20195. Specify which frames to deinterlace. Accepts one of the following
  20196. values:
  20197. @table @option
  20198. @item 0, all
  20199. Deinterlace all frames.
  20200. @item 1, interlaced
  20201. Only deinterlace frames marked as interlaced.
  20202. @end table
  20203. The default value is @code{all}.
  20204. @end table
  20205. @section yaepblur
  20206. Apply blur filter while preserving edges ("yaepblur" means "yet another edge preserving blur filter").
  20207. The algorithm is described in
  20208. "J. S. Lee, Digital image enhancement and noise filtering by use of local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
  20209. It accepts the following parameters:
  20210. @table @option
  20211. @item radius, r
  20212. Set the window radius. Default value is 3.
  20213. @item planes, p
  20214. Set which planes to filter. Default is only the first plane.
  20215. @item sigma, s
  20216. Set blur strength. Default value is 128.
  20217. @end table
  20218. @subsection Commands
  20219. This filter supports same @ref{commands} as options.
  20220. @section zoompan
  20221. Apply Zoom & Pan effect.
  20222. This filter accepts the following options:
  20223. @table @option
  20224. @item zoom, z
  20225. Set the zoom expression. Range is 1-10. Default is 1.
  20226. @item x
  20227. @item y
  20228. Set the x and y expression. Default is 0.
  20229. @item d
  20230. Set the duration expression in number of frames.
  20231. This sets for how many number of frames effect will last for
  20232. single input image. Default is 90.
  20233. @item s
  20234. Set the output image size, default is 'hd720'.
  20235. @item fps
  20236. Set the output frame rate, default is '25'.
  20237. @end table
  20238. Each expression can contain the following constants:
  20239. @table @option
  20240. @item in_w, iw
  20241. Input width.
  20242. @item in_h, ih
  20243. Input height.
  20244. @item out_w, ow
  20245. Output width.
  20246. @item out_h, oh
  20247. Output height.
  20248. @item in
  20249. Input frame count.
  20250. @item on
  20251. Output frame count.
  20252. @item in_time, it
  20253. The input timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  20254. @item out_time, time, ot
  20255. The output timestamp expressed in seconds.
  20256. @item x
  20257. @item y
  20258. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  20259. for current input frame.
  20260. @item px
  20261. @item py
  20262. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  20263. not yet such frame (first input frame).
  20264. @item zoom
  20265. Last calculated zoom from 'z' expression for current input frame.
  20266. @item pzoom
  20267. Last calculated zoom of last output frame of previous input frame.
  20268. @item duration
  20269. Number of output frames for current input frame. Calculated from 'd' expression
  20270. for each input frame.
  20271. @item pduration
  20272. number of output frames created for previous input frame
  20273. @item a
  20274. Rational number: input width / input height
  20275. @item sar
  20276. sample aspect ratio
  20277. @item dar
  20278. display aspect ratio
  20279. @end table
  20280. @subsection Examples
  20281. @itemize
  20282. @item
  20283. Zoom in up to 1.5x and pan at same time to some spot near center of picture:
  20284. @example
  20285. 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
  20286. @end example
  20287. @item
  20288. Zoom in up to 1.5x and pan always at center of picture:
  20289. @example
  20290. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20291. @end example
  20292. @item
  20293. Same as above but without pausing:
  20294. @example
  20295. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20296. @end example
  20297. @item
  20298. Zoom in 2x into center of picture only for the first second of the input video:
  20299. @example
  20300. zoompan=z='if(between(in_time,0,1),2,1)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  20301. @end example
  20302. @end itemize
  20303. @anchor{zscale}
  20304. @section zscale
  20305. Scale (resize) the input video, using the z.lib library:
  20306. @url{https://github.com/sekrit-twc/zimg}. To enable compilation of this
  20307. filter, you need to configure FFmpeg with @code{--enable-libzimg}.
  20308. The zscale filter forces the output display aspect ratio to be the same
  20309. as the input, by changing the output sample aspect ratio.
  20310. If the input image format is different from the format requested by
  20311. the next filter, the zscale filter will convert the input to the
  20312. requested format.
  20313. @subsection Options
  20314. The filter accepts the following options.
  20315. @table @option
  20316. @item width, w
  20317. @item height, h
  20318. Set the output video dimension expression. Default value is the input
  20319. dimension.
  20320. If the @var{width} or @var{w} value is 0, the input width is used for
  20321. the output. If the @var{height} or @var{h} value is 0, the input height
  20322. is used for the output.
  20323. If one and only one of the values is -n with n >= 1, the zscale filter
  20324. will use a value that maintains the aspect ratio of the input image,
  20325. calculated from the other specified dimension. After that it will,
  20326. however, make sure that the calculated dimension is divisible by n and
  20327. adjust the value if necessary.
  20328. If both values are -n with n >= 1, the behavior will be identical to
  20329. both values being set to 0 as previously detailed.
  20330. See below for the list of accepted constants for use in the dimension
  20331. expression.
  20332. @item size, s
  20333. Set the video size. For the syntax of this option, check the
  20334. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  20335. @item dither, d
  20336. Set the dither type.
  20337. Possible values are:
  20338. @table @var
  20339. @item none
  20340. @item ordered
  20341. @item random
  20342. @item error_diffusion
  20343. @end table
  20344. Default is none.
  20345. @item filter, f
  20346. Set the resize filter type.
  20347. Possible values are:
  20348. @table @var
  20349. @item point
  20350. @item bilinear
  20351. @item bicubic
  20352. @item spline16
  20353. @item spline36
  20354. @item lanczos
  20355. @end table
  20356. Default is bilinear.
  20357. @item range, r
  20358. Set the color range.
  20359. Possible values are:
  20360. @table @var
  20361. @item input
  20362. @item limited
  20363. @item full
  20364. @end table
  20365. Default is same as input.
  20366. @item primaries, p
  20367. Set the color primaries.
  20368. Possible values are:
  20369. @table @var
  20370. @item input
  20371. @item 709
  20372. @item unspecified
  20373. @item 170m
  20374. @item 240m
  20375. @item 2020
  20376. @end table
  20377. Default is same as input.
  20378. @item transfer, t
  20379. Set the transfer characteristics.
  20380. Possible values are:
  20381. @table @var
  20382. @item input
  20383. @item 709
  20384. @item unspecified
  20385. @item 601
  20386. @item linear
  20387. @item 2020_10
  20388. @item 2020_12
  20389. @item smpte2084
  20390. @item iec61966-2-1
  20391. @item arib-std-b67
  20392. @end table
  20393. Default is same as input.
  20394. @item matrix, m
  20395. Set the colorspace matrix.
  20396. Possible value are:
  20397. @table @var
  20398. @item input
  20399. @item 709
  20400. @item unspecified
  20401. @item 470bg
  20402. @item 170m
  20403. @item 2020_ncl
  20404. @item 2020_cl
  20405. @end table
  20406. Default is same as input.
  20407. @item rangein, rin
  20408. Set the input color range.
  20409. Possible values are:
  20410. @table @var
  20411. @item input
  20412. @item limited
  20413. @item full
  20414. @end table
  20415. Default is same as input.
  20416. @item primariesin, pin
  20417. Set the input color primaries.
  20418. Possible values are:
  20419. @table @var
  20420. @item input
  20421. @item 709
  20422. @item unspecified
  20423. @item 170m
  20424. @item 240m
  20425. @item 2020
  20426. @end table
  20427. Default is same as input.
  20428. @item transferin, tin
  20429. Set the input transfer characteristics.
  20430. Possible values are:
  20431. @table @var
  20432. @item input
  20433. @item 709
  20434. @item unspecified
  20435. @item 601
  20436. @item linear
  20437. @item 2020_10
  20438. @item 2020_12
  20439. @end table
  20440. Default is same as input.
  20441. @item matrixin, min
  20442. Set the input colorspace matrix.
  20443. Possible value are:
  20444. @table @var
  20445. @item input
  20446. @item 709
  20447. @item unspecified
  20448. @item 470bg
  20449. @item 170m
  20450. @item 2020_ncl
  20451. @item 2020_cl
  20452. @end table
  20453. @item chromal, c
  20454. Set the output chroma location.
  20455. Possible values are:
  20456. @table @var
  20457. @item input
  20458. @item left
  20459. @item center
  20460. @item topleft
  20461. @item top
  20462. @item bottomleft
  20463. @item bottom
  20464. @end table
  20465. @item chromalin, cin
  20466. Set the input chroma location.
  20467. Possible values are:
  20468. @table @var
  20469. @item input
  20470. @item left
  20471. @item center
  20472. @item topleft
  20473. @item top
  20474. @item bottomleft
  20475. @item bottom
  20476. @end table
  20477. @item npl
  20478. Set the nominal peak luminance.
  20479. @item param_a
  20480. Parameter A for scaling filters. Parameter "b" for bicubic, and the number of
  20481. filter taps for lanczos.
  20482. @item param_b
  20483. Parameter B for scaling filters. Parameter "c" for bicubic.
  20484. @end table
  20485. The values of the @option{w} and @option{h} options are expressions
  20486. containing the following constants:
  20487. @table @var
  20488. @item in_w
  20489. @item in_h
  20490. The input width and height
  20491. @item iw
  20492. @item ih
  20493. These are the same as @var{in_w} and @var{in_h}.
  20494. @item out_w
  20495. @item out_h
  20496. The output (scaled) width and height
  20497. @item ow
  20498. @item oh
  20499. These are the same as @var{out_w} and @var{out_h}
  20500. @item a
  20501. The same as @var{iw} / @var{ih}
  20502. @item sar
  20503. input sample aspect ratio
  20504. @item dar
  20505. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  20506. @item hsub
  20507. @item vsub
  20508. horizontal and vertical input chroma subsample values. For example for the
  20509. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20510. @item ohsub
  20511. @item ovsub
  20512. horizontal and vertical output chroma subsample values. For example for the
  20513. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  20514. @end table
  20515. @subsection Commands
  20516. This filter supports the following commands:
  20517. @table @option
  20518. @item width, w
  20519. @item height, h
  20520. Set the output video dimension expression.
  20521. The command accepts the same syntax of the corresponding option.
  20522. If the specified expression is not valid, it is kept at its current
  20523. value.
  20524. @end table
  20525. @c man end VIDEO FILTERS
  20526. @chapter OpenCL Video Filters
  20527. @c man begin OPENCL VIDEO FILTERS
  20528. Below is a description of the currently available OpenCL video filters.
  20529. To enable compilation of these filters you need to configure FFmpeg with
  20530. @code{--enable-opencl}.
  20531. Running OpenCL filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  20532. @table @option
  20533. @item -init_hw_device opencl[=@var{name}][:@var{device}[,@var{key=value}...]]
  20534. Initialise a new hardware device of type @var{opencl} called @var{name}, using the
  20535. given device parameters.
  20536. @item -filter_hw_device @var{name}
  20537. Pass the hardware device called @var{name} to all filters in any filter graph.
  20538. @end table
  20539. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  20540. @itemize
  20541. @item
  20542. Example of choosing the first device on the second platform and running avgblur_opencl filter with default parameters on it.
  20543. @example
  20544. -init_hw_device opencl=gpu:1.0 -filter_hw_device gpu -i INPUT -vf "hwupload, avgblur_opencl, hwdownload" OUTPUT
  20545. @end example
  20546. @end itemize
  20547. 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.
  20548. @section avgblur_opencl
  20549. Apply average blur filter.
  20550. The filter accepts the following options:
  20551. @table @option
  20552. @item sizeX
  20553. Set horizontal radius size.
  20554. Range is @code{[1, 1024]} and default value is @code{1}.
  20555. @item planes
  20556. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20557. @item sizeY
  20558. Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
  20559. @end table
  20560. @subsection Example
  20561. @itemize
  20562. @item
  20563. 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.
  20564. @example
  20565. -i INPUT -vf "hwupload, avgblur_opencl=3, hwdownload" OUTPUT
  20566. @end example
  20567. @end itemize
  20568. @section boxblur_opencl
  20569. Apply a boxblur algorithm to the input video.
  20570. It accepts the following parameters:
  20571. @table @option
  20572. @item luma_radius, lr
  20573. @item luma_power, lp
  20574. @item chroma_radius, cr
  20575. @item chroma_power, cp
  20576. @item alpha_radius, ar
  20577. @item alpha_power, ap
  20578. @end table
  20579. A description of the accepted options follows.
  20580. @table @option
  20581. @item luma_radius, lr
  20582. @item chroma_radius, cr
  20583. @item alpha_radius, ar
  20584. Set an expression for the box radius in pixels used for blurring the
  20585. corresponding input plane.
  20586. The radius value must be a non-negative number, and must not be
  20587. greater than the value of the expression @code{min(w,h)/2} for the
  20588. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  20589. planes.
  20590. Default value for @option{luma_radius} is "2". If not specified,
  20591. @option{chroma_radius} and @option{alpha_radius} default to the
  20592. corresponding value set for @option{luma_radius}.
  20593. The expressions can contain the following constants:
  20594. @table @option
  20595. @item w
  20596. @item h
  20597. The input width and height in pixels.
  20598. @item cw
  20599. @item ch
  20600. The input chroma image width and height in pixels.
  20601. @item hsub
  20602. @item vsub
  20603. The horizontal and vertical chroma subsample values. For example, for the
  20604. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  20605. @end table
  20606. @item luma_power, lp
  20607. @item chroma_power, cp
  20608. @item alpha_power, ap
  20609. Specify how many times the boxblur filter is applied to the
  20610. corresponding plane.
  20611. Default value for @option{luma_power} is 2. If not specified,
  20612. @option{chroma_power} and @option{alpha_power} default to the
  20613. corresponding value set for @option{luma_power}.
  20614. A value of 0 will disable the effect.
  20615. @end table
  20616. @subsection Examples
  20617. 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.
  20618. @itemize
  20619. @item
  20620. Apply a boxblur filter with the luma, chroma, and alpha radius
  20621. 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.
  20622. @example
  20623. -i INPUT -vf "hwupload, boxblur_opencl=luma_radius=2:luma_power=3, hwdownload" OUTPUT
  20624. -i INPUT -vf "hwupload, boxblur_opencl=2:3, hwdownload" OUTPUT
  20625. @end example
  20626. @item
  20627. 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.
  20628. For the luma plane, a 2x2 box radius will be run once.
  20629. For the chroma plane, a 4x4 box radius will be run 5 times.
  20630. For the alpha plane, a 3x3 box radius will be run 7 times.
  20631. @example
  20632. -i INPUT -vf "hwupload, boxblur_opencl=2:1:4:5:3:7, hwdownload" OUTPUT
  20633. @end example
  20634. @end itemize
  20635. @section colorkey_opencl
  20636. RGB colorspace color keying.
  20637. The filter accepts the following options:
  20638. @table @option
  20639. @item color
  20640. The color which will be replaced with transparency.
  20641. @item similarity
  20642. Similarity percentage with the key color.
  20643. 0.01 matches only the exact key color, while 1.0 matches everything.
  20644. @item blend
  20645. Blend percentage.
  20646. 0.0 makes pixels either fully transparent, or not transparent at all.
  20647. Higher values result in semi-transparent pixels, with a higher transparency
  20648. the more similar the pixels color is to the key color.
  20649. @end table
  20650. @subsection Examples
  20651. @itemize
  20652. @item
  20653. Make every semi-green pixel in the input transparent with some slight blending:
  20654. @example
  20655. -i INPUT -vf "hwupload, colorkey_opencl=green:0.3:0.1, hwdownload" OUTPUT
  20656. @end example
  20657. @end itemize
  20658. @section convolution_opencl
  20659. Apply convolution of 3x3, 5x5, 7x7 matrix.
  20660. The filter accepts the following options:
  20661. @table @option
  20662. @item 0m
  20663. @item 1m
  20664. @item 2m
  20665. @item 3m
  20666. Set matrix for each plane.
  20667. Matrix is sequence of 9, 25 or 49 signed numbers.
  20668. Default value for each plane is @code{0 0 0 0 1 0 0 0 0}.
  20669. @item 0rdiv
  20670. @item 1rdiv
  20671. @item 2rdiv
  20672. @item 3rdiv
  20673. Set multiplier for calculated value for each plane.
  20674. If unset or 0, it will be sum of all matrix elements.
  20675. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{1.0}.
  20676. @item 0bias
  20677. @item 1bias
  20678. @item 2bias
  20679. @item 3bias
  20680. Set bias for each plane. This value is added to the result of the multiplication.
  20681. Useful for making the overall image brighter or darker.
  20682. The option value must be a float number greater or equal to @code{0.0}. Default value is @code{0.0}.
  20683. @end table
  20684. @subsection Examples
  20685. @itemize
  20686. @item
  20687. Apply sharpen:
  20688. @example
  20689. -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
  20690. @end example
  20691. @item
  20692. Apply blur:
  20693. @example
  20694. -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
  20695. @end example
  20696. @item
  20697. Apply edge enhance:
  20698. @example
  20699. -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
  20700. @end example
  20701. @item
  20702. Apply edge detect:
  20703. @example
  20704. -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
  20705. @end example
  20706. @item
  20707. Apply laplacian edge detector which includes diagonals:
  20708. @example
  20709. -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
  20710. @end example
  20711. @item
  20712. Apply emboss:
  20713. @example
  20714. -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
  20715. @end example
  20716. @end itemize
  20717. @section erosion_opencl
  20718. Apply erosion effect to the video.
  20719. This filter replaces the pixel by the local(3x3) minimum.
  20720. It accepts the following options:
  20721. @table @option
  20722. @item threshold0
  20723. @item threshold1
  20724. @item threshold2
  20725. @item threshold3
  20726. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20727. If @code{0}, plane will remain unchanged.
  20728. @item coordinates
  20729. Flag which specifies the pixel to refer to.
  20730. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20731. Flags to local 3x3 coordinates region centered on @code{x}:
  20732. 1 2 3
  20733. 4 x 5
  20734. 6 7 8
  20735. @end table
  20736. @subsection Example
  20737. @itemize
  20738. @item
  20739. 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.
  20740. @example
  20741. -i INPUT -vf "hwupload, erosion_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20742. @end example
  20743. @end itemize
  20744. @section deshake_opencl
  20745. Feature-point based video stabilization filter.
  20746. The filter accepts the following options:
  20747. @table @option
  20748. @item tripod
  20749. Simulates a tripod by preventing any camera movement whatsoever from the original frame. Defaults to @code{0}.
  20750. @item debug
  20751. Whether or not additional debug info should be displayed, both in the processed output and in the console.
  20752. Note that in order to see console debug output you will also need to pass @code{-v verbose} to ffmpeg.
  20753. Viewing point matches in the output video is only supported for RGB input.
  20754. Defaults to @code{0}.
  20755. @item adaptive_crop
  20756. Whether or not to do a tiny bit of cropping at the borders to cut down on the amount of mirrored pixels.
  20757. Defaults to @code{1}.
  20758. @item refine_features
  20759. Whether or not feature points should be refined at a sub-pixel level.
  20760. This can be turned off for a slight performance gain at the cost of precision.
  20761. Defaults to @code{1}.
  20762. @item smooth_strength
  20763. The strength of the smoothing applied to the camera path from @code{0.0} to @code{1.0}.
  20764. @code{1.0} is the maximum smoothing strength while values less than that result in less smoothing.
  20765. @code{0.0} causes the filter to adaptively choose a smoothing strength on a per-frame basis.
  20766. Defaults to @code{0.0}.
  20767. @item smooth_window_multiplier
  20768. Controls the size of the smoothing window (the number of frames buffered to determine motion information from).
  20769. The size of the smoothing window is determined by multiplying the framerate of the video by this number.
  20770. Acceptable values range from @code{0.1} to @code{10.0}.
  20771. Larger values increase the amount of motion data available for determining how to smooth the camera path,
  20772. potentially improving smoothness, but also increase latency and memory usage.
  20773. Defaults to @code{2.0}.
  20774. @end table
  20775. @subsection Examples
  20776. @itemize
  20777. @item
  20778. Stabilize a video with a fixed, medium smoothing strength:
  20779. @example
  20780. -i INPUT -vf "hwupload, deshake_opencl=smooth_strength=0.5, hwdownload" OUTPUT
  20781. @end example
  20782. @item
  20783. Stabilize a video with debugging (both in console and in rendered video):
  20784. @example
  20785. -i INPUT -filter_complex "[0:v]format=rgba, hwupload, deshake_opencl=debug=1, hwdownload, format=rgba, format=yuv420p" -v verbose OUTPUT
  20786. @end example
  20787. @end itemize
  20788. @section dilation_opencl
  20789. Apply dilation effect to the video.
  20790. This filter replaces the pixel by the local(3x3) maximum.
  20791. It accepts the following options:
  20792. @table @option
  20793. @item threshold0
  20794. @item threshold1
  20795. @item threshold2
  20796. @item threshold3
  20797. Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
  20798. If @code{0}, plane will remain unchanged.
  20799. @item coordinates
  20800. Flag which specifies the pixel to refer to.
  20801. Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
  20802. Flags to local 3x3 coordinates region centered on @code{x}:
  20803. 1 2 3
  20804. 4 x 5
  20805. 6 7 8
  20806. @end table
  20807. @subsection Example
  20808. @itemize
  20809. @item
  20810. 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.
  20811. @example
  20812. -i INPUT -vf "hwupload, dilation_opencl=30:40:50:coordinates=231, hwdownload" OUTPUT
  20813. @end example
  20814. @end itemize
  20815. @anchor{nlmeans_opencl}
  20816. @section nlmeans_opencl
  20817. Non-local Means denoise filter through OpenCL, this filter accepts same options as @ref{nlmeans}.
  20818. @section overlay_opencl
  20819. Overlay one video on top of another.
  20820. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  20821. This filter requires same memory layout for all the inputs. So, format conversion may be needed.
  20822. The filter accepts the following options:
  20823. @table @option
  20824. @item x
  20825. Set the x coordinate of the overlaid video on the main video.
  20826. Default value is @code{0}.
  20827. @item y
  20828. Set the y coordinate of the overlaid video on the main video.
  20829. Default value is @code{0}.
  20830. @end table
  20831. @subsection Examples
  20832. @itemize
  20833. @item
  20834. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs are yuv420p format.
  20835. @example
  20836. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20837. @end example
  20838. @item
  20839. The inputs have same memory layout for color channels , the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  20840. @example
  20841. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuva420p, hwupload[b], [a][b]overlay_opencl, hwdownload" OUTPUT
  20842. @end example
  20843. @end itemize
  20844. @section pad_opencl
  20845. Add paddings to the input image, and place the original input at the
  20846. provided @var{x}, @var{y} coordinates.
  20847. It accepts the following options:
  20848. @table @option
  20849. @item width, w
  20850. @item height, h
  20851. Specify an expression for the size of the output image with the
  20852. paddings added. If the value for @var{width} or @var{height} is 0, the
  20853. corresponding input size is used for the output.
  20854. The @var{width} expression can reference the value set by the
  20855. @var{height} expression, and vice versa.
  20856. The default value of @var{width} and @var{height} is 0.
  20857. @item x
  20858. @item y
  20859. Specify the offsets to place the input image at within the padded area,
  20860. with respect to the top/left border of the output image.
  20861. The @var{x} expression can reference the value set by the @var{y}
  20862. expression, and vice versa.
  20863. The default value of @var{x} and @var{y} is 0.
  20864. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  20865. so the input image is centered on the padded area.
  20866. @item color
  20867. Specify the color of the padded area. For the syntax of this option,
  20868. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  20869. manual,ffmpeg-utils}.
  20870. @item aspect
  20871. Pad to an aspect instead to a resolution.
  20872. @end table
  20873. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  20874. options are expressions containing the following constants:
  20875. @table @option
  20876. @item in_w
  20877. @item in_h
  20878. The input video width and height.
  20879. @item iw
  20880. @item ih
  20881. These are the same as @var{in_w} and @var{in_h}.
  20882. @item out_w
  20883. @item out_h
  20884. The output width and height (the size of the padded area), as
  20885. specified by the @var{width} and @var{height} expressions.
  20886. @item ow
  20887. @item oh
  20888. These are the same as @var{out_w} and @var{out_h}.
  20889. @item x
  20890. @item y
  20891. The x and y offsets as specified by the @var{x} and @var{y}
  20892. expressions, or NAN if not yet specified.
  20893. @item a
  20894. same as @var{iw} / @var{ih}
  20895. @item sar
  20896. input sample aspect ratio
  20897. @item dar
  20898. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  20899. @end table
  20900. @section prewitt_opencl
  20901. Apply the Prewitt operator (@url{https://en.wikipedia.org/wiki/Prewitt_operator}) to input video stream.
  20902. The filter accepts the following option:
  20903. @table @option
  20904. @item planes
  20905. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  20906. @item scale
  20907. Set value which will be multiplied with filtered result.
  20908. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  20909. @item delta
  20910. Set value which will be added to filtered result.
  20911. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  20912. @end table
  20913. @subsection Example
  20914. @itemize
  20915. @item
  20916. Apply the Prewitt operator with scale set to 2 and delta set to 10.
  20917. @example
  20918. -i INPUT -vf "hwupload, prewitt_opencl=scale=2:delta=10, hwdownload" OUTPUT
  20919. @end example
  20920. @end itemize
  20921. @anchor{program_opencl}
  20922. @section program_opencl
  20923. Filter video using an OpenCL program.
  20924. @table @option
  20925. @item source
  20926. OpenCL program source file.
  20927. @item kernel
  20928. Kernel name in program.
  20929. @item inputs
  20930. Number of inputs to the filter. Defaults to 1.
  20931. @item size, s
  20932. Size of output frames. Defaults to the same as the first input.
  20933. @end table
  20934. The @code{program_opencl} filter also supports the @ref{framesync} options.
  20935. The program source file must contain a kernel function with the given name,
  20936. which will be run once for each plane of the output. Each run on a plane
  20937. gets enqueued as a separate 2D global NDRange with one work-item for each
  20938. pixel to be generated. The global ID offset for each work-item is therefore
  20939. the coordinates of a pixel in the destination image.
  20940. The kernel function needs to take the following arguments:
  20941. @itemize
  20942. @item
  20943. Destination image, @var{__write_only image2d_t}.
  20944. This image will become the output; the kernel should write all of it.
  20945. @item
  20946. Frame index, @var{unsigned int}.
  20947. This is a counter starting from zero and increasing by one for each frame.
  20948. @item
  20949. Source images, @var{__read_only image2d_t}.
  20950. These are the most recent images on each input. The kernel may read from
  20951. them to generate the output, but they can't be written to.
  20952. @end itemize
  20953. Example programs:
  20954. @itemize
  20955. @item
  20956. Copy the input to the output (output must be the same size as the input).
  20957. @verbatim
  20958. __kernel void copy(__write_only image2d_t destination,
  20959. unsigned int index,
  20960. __read_only image2d_t source)
  20961. {
  20962. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  20963. int2 location = (int2)(get_global_id(0), get_global_id(1));
  20964. float4 value = read_imagef(source, sampler, location);
  20965. write_imagef(destination, location, value);
  20966. }
  20967. @end verbatim
  20968. @item
  20969. Apply a simple transformation, rotating the input by an amount increasing
  20970. with the index counter. Pixel values are linearly interpolated by the
  20971. sampler, and the output need not have the same dimensions as the input.
  20972. @verbatim
  20973. __kernel void rotate_image(__write_only image2d_t dst,
  20974. unsigned int index,
  20975. __read_only image2d_t src)
  20976. {
  20977. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  20978. CLK_FILTER_LINEAR);
  20979. float angle = (float)index / 100.0f;
  20980. float2 dst_dim = convert_float2(get_image_dim(dst));
  20981. float2 src_dim = convert_float2(get_image_dim(src));
  20982. float2 dst_cen = dst_dim / 2.0f;
  20983. float2 src_cen = src_dim / 2.0f;
  20984. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  20985. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  20986. float2 src_pos = {
  20987. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  20988. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  20989. };
  20990. src_pos = src_pos * src_dim / dst_dim;
  20991. float2 src_loc = src_pos + src_cen;
  20992. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  20993. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  20994. write_imagef(dst, dst_loc, 0.5f);
  20995. else
  20996. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  20997. }
  20998. @end verbatim
  20999. @item
  21000. Blend two inputs together, with the amount of each input used varying
  21001. with the index counter.
  21002. @verbatim
  21003. __kernel void blend_images(__write_only image2d_t dst,
  21004. unsigned int index,
  21005. __read_only image2d_t src1,
  21006. __read_only image2d_t src2)
  21007. {
  21008. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21009. CLK_FILTER_LINEAR);
  21010. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  21011. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  21012. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  21013. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  21014. float4 val1 = read_imagef(src1, sampler, src1_loc);
  21015. float4 val2 = read_imagef(src2, sampler, src2_loc);
  21016. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  21017. }
  21018. @end verbatim
  21019. @end itemize
  21020. @section remap_opencl
  21021. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  21022. Destination pixel at position (X, Y) will be picked from source (x, y) position
  21023. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  21024. value for pixel will be used for destination pixel.
  21025. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  21026. will have Xmap/Ymap video stream dimensions.
  21027. Xmap and Ymap input video streams are 32bit float pixel format, single channel.
  21028. @table @option
  21029. @item interp
  21030. Specify interpolation used for remapping of pixels.
  21031. Allowed values are @code{near} and @code{linear}.
  21032. Default value is @code{linear}.
  21033. @item fill
  21034. Specify the color of the unmapped pixels. For the syntax of this option,
  21035. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21036. manual,ffmpeg-utils}. Default color is @code{black}.
  21037. @end table
  21038. @section roberts_opencl
  21039. Apply the Roberts cross operator (@url{https://en.wikipedia.org/wiki/Roberts_cross}) to input video stream.
  21040. The filter accepts the following option:
  21041. @table @option
  21042. @item planes
  21043. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21044. @item scale
  21045. Set value which will be multiplied with filtered result.
  21046. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  21047. @item delta
  21048. Set value which will be added to filtered result.
  21049. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  21050. @end table
  21051. @subsection Example
  21052. @itemize
  21053. @item
  21054. Apply the Roberts cross operator with scale set to 2 and delta set to 10
  21055. @example
  21056. -i INPUT -vf "hwupload, roberts_opencl=scale=2:delta=10, hwdownload" OUTPUT
  21057. @end example
  21058. @end itemize
  21059. @section sobel_opencl
  21060. Apply the Sobel operator (@url{https://en.wikipedia.org/wiki/Sobel_operator}) to input video stream.
  21061. The filter accepts the following option:
  21062. @table @option
  21063. @item planes
  21064. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21065. @item scale
  21066. Set value which will be multiplied with filtered result.
  21067. Range is @code{[0.0, 65535]} and default value is @code{1.0}.
  21068. @item delta
  21069. Set value which will be added to filtered result.
  21070. Range is @code{[-65535, 65535]} and default value is @code{0.0}.
  21071. @end table
  21072. @subsection Example
  21073. @itemize
  21074. @item
  21075. Apply sobel operator with scale set to 2 and delta set to 10
  21076. @example
  21077. -i INPUT -vf "hwupload, sobel_opencl=scale=2:delta=10, hwdownload" OUTPUT
  21078. @end example
  21079. @end itemize
  21080. @section tonemap_opencl
  21081. Perform HDR(PQ/HLG) to SDR conversion with tone-mapping.
  21082. It accepts the following parameters:
  21083. @table @option
  21084. @item tonemap
  21085. Specify the tone-mapping operator to be used. Same as tonemap option in @ref{tonemap}.
  21086. @item param
  21087. Tune the tone mapping algorithm. same as param option in @ref{tonemap}.
  21088. @item desat
  21089. Apply desaturation for highlights that exceed this level of brightness. The
  21090. higher the parameter, the more color information will be preserved. This
  21091. setting helps prevent unnaturally blown-out colors for super-highlights, by
  21092. (smoothly) turning into white instead. This makes images feel more natural,
  21093. at the cost of reducing information about out-of-range colors.
  21094. The default value is 0.5, and the algorithm here is a little different from
  21095. the cpu version tonemap currently. A setting of 0.0 disables this option.
  21096. @item threshold
  21097. The tonemapping algorithm parameters is fine-tuned per each scene. And a threshold
  21098. is used to detect whether the scene has changed or not. If the distance between
  21099. the current frame average brightness and the current running average exceeds
  21100. a threshold value, we would re-calculate scene average and peak brightness.
  21101. The default value is 0.2.
  21102. @item format
  21103. Specify the output pixel format.
  21104. Currently supported formats are:
  21105. @table @var
  21106. @item p010
  21107. @item nv12
  21108. @end table
  21109. @item range, r
  21110. Set the output color range.
  21111. Possible values are:
  21112. @table @var
  21113. @item tv/mpeg
  21114. @item pc/jpeg
  21115. @end table
  21116. Default is same as input.
  21117. @item primaries, p
  21118. Set the output color primaries.
  21119. Possible values are:
  21120. @table @var
  21121. @item bt709
  21122. @item bt2020
  21123. @end table
  21124. Default is same as input.
  21125. @item transfer, t
  21126. Set the output transfer characteristics.
  21127. Possible values are:
  21128. @table @var
  21129. @item bt709
  21130. @item bt2020
  21131. @end table
  21132. Default is bt709.
  21133. @item matrix, m
  21134. Set the output colorspace matrix.
  21135. Possible value are:
  21136. @table @var
  21137. @item bt709
  21138. @item bt2020
  21139. @end table
  21140. Default is same as input.
  21141. @end table
  21142. @subsection Example
  21143. @itemize
  21144. @item
  21145. Convert HDR(PQ/HLG) video to bt2020-transfer-characteristic p010 format using linear operator.
  21146. @example
  21147. -i INPUT -vf "format=p010,hwupload,tonemap_opencl=t=bt2020:tonemap=linear:format=p010,hwdownload,format=p010" OUTPUT
  21148. @end example
  21149. @end itemize
  21150. @section unsharp_opencl
  21151. Sharpen or blur the input video.
  21152. It accepts the following parameters:
  21153. @table @option
  21154. @item luma_msize_x, lx
  21155. Set the luma matrix horizontal size.
  21156. Range is @code{[1, 23]} and default value is @code{5}.
  21157. @item luma_msize_y, ly
  21158. Set the luma matrix vertical size.
  21159. Range is @code{[1, 23]} and default value is @code{5}.
  21160. @item luma_amount, la
  21161. Set the luma effect strength.
  21162. Range is @code{[-10, 10]} and default value is @code{1.0}.
  21163. Negative values will blur the input video, while positive values will
  21164. sharpen it, a value of zero will disable the effect.
  21165. @item chroma_msize_x, cx
  21166. Set the chroma matrix horizontal size.
  21167. Range is @code{[1, 23]} and default value is @code{5}.
  21168. @item chroma_msize_y, cy
  21169. Set the chroma matrix vertical size.
  21170. Range is @code{[1, 23]} and default value is @code{5}.
  21171. @item chroma_amount, ca
  21172. Set the chroma effect strength.
  21173. Range is @code{[-10, 10]} and default value is @code{0.0}.
  21174. Negative values will blur the input video, while positive values will
  21175. sharpen it, a value of zero will disable the effect.
  21176. @end table
  21177. All parameters are optional and default to the equivalent of the
  21178. string '5:5:1.0:5:5:0.0'.
  21179. @subsection Examples
  21180. @itemize
  21181. @item
  21182. Apply strong luma sharpen effect:
  21183. @example
  21184. -i INPUT -vf "hwupload, unsharp_opencl=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5, hwdownload" OUTPUT
  21185. @end example
  21186. @item
  21187. Apply a strong blur of both luma and chroma parameters:
  21188. @example
  21189. -i INPUT -vf "hwupload, unsharp_opencl=7:7:-2:7:7:-2, hwdownload" OUTPUT
  21190. @end example
  21191. @end itemize
  21192. @section xfade_opencl
  21193. Cross fade two videos with custom transition effect by using OpenCL.
  21194. It accepts the following options:
  21195. @table @option
  21196. @item transition
  21197. Set one of possible transition effects.
  21198. @table @option
  21199. @item custom
  21200. Select custom transition effect, the actual transition description
  21201. will be picked from source and kernel options.
  21202. @item fade
  21203. @item wipeleft
  21204. @item wiperight
  21205. @item wipeup
  21206. @item wipedown
  21207. @item slideleft
  21208. @item slideright
  21209. @item slideup
  21210. @item slidedown
  21211. Default transition is fade.
  21212. @end table
  21213. @item source
  21214. OpenCL program source file for custom transition.
  21215. @item kernel
  21216. Set name of kernel to use for custom transition from program source file.
  21217. @item duration
  21218. Set duration of video transition.
  21219. @item offset
  21220. Set time of start of transition relative to first video.
  21221. @end table
  21222. The program source file must contain a kernel function with the given name,
  21223. which will be run once for each plane of the output. Each run on a plane
  21224. gets enqueued as a separate 2D global NDRange with one work-item for each
  21225. pixel to be generated. The global ID offset for each work-item is therefore
  21226. the coordinates of a pixel in the destination image.
  21227. The kernel function needs to take the following arguments:
  21228. @itemize
  21229. @item
  21230. Destination image, @var{__write_only image2d_t}.
  21231. This image will become the output; the kernel should write all of it.
  21232. @item
  21233. First Source image, @var{__read_only image2d_t}.
  21234. Second Source image, @var{__read_only image2d_t}.
  21235. These are the most recent images on each input. The kernel may read from
  21236. them to generate the output, but they can't be written to.
  21237. @item
  21238. Transition progress, @var{float}. This value is always between 0 and 1 inclusive.
  21239. @end itemize
  21240. Example programs:
  21241. @itemize
  21242. @item
  21243. Apply dots curtain transition effect:
  21244. @verbatim
  21245. __kernel void blend_images(__write_only image2d_t dst,
  21246. __read_only image2d_t src1,
  21247. __read_only image2d_t src2,
  21248. float progress)
  21249. {
  21250. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  21251. CLK_FILTER_LINEAR);
  21252. int2 p = (int2)(get_global_id(0), get_global_id(1));
  21253. float2 rp = (float2)(get_global_id(0), get_global_id(1));
  21254. float2 dim = (float2)(get_image_dim(src1).x, get_image_dim(src1).y);
  21255. rp = rp / dim;
  21256. float2 dots = (float2)(20.0, 20.0);
  21257. float2 center = (float2)(0,0);
  21258. float2 unused;
  21259. float4 val1 = read_imagef(src1, sampler, p);
  21260. float4 val2 = read_imagef(src2, sampler, p);
  21261. bool next = distance(fract(rp * dots, &unused), (float2)(0.5, 0.5)) < (progress / distance(rp, center));
  21262. write_imagef(dst, p, next ? val1 : val2);
  21263. }
  21264. @end verbatim
  21265. @end itemize
  21266. @c man end OPENCL VIDEO FILTERS
  21267. @chapter VAAPI Video Filters
  21268. @c man begin VAAPI VIDEO FILTERS
  21269. VAAPI Video filters are usually used with VAAPI decoder and VAAPI encoder. Below is a description of VAAPI video filters.
  21270. To enable compilation of these filters you need to configure FFmpeg with
  21271. @code{--enable-vaapi}.
  21272. 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}
  21273. @section overlay_vaapi
  21274. Overlay one video on the top of another.
  21275. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21276. The filter accepts the following options:
  21277. @table @option
  21278. @item x
  21279. @item y
  21280. Set expressions for the x and y coordinates of the overlaid video
  21281. on the main video.
  21282. Default value is "0" for both expressions.
  21283. @item w
  21284. @item h
  21285. Set expressions for the width and height the overlaid video
  21286. on the main video.
  21287. Default values are 'overlay_iw' for 'w' and 'overlay_ih*w/overlay_iw' for 'h'.
  21288. The expressions can contain the following parameters:
  21289. @table @option
  21290. @item main_w, W
  21291. @item main_h, H
  21292. The main input width and height.
  21293. @item overlay_iw
  21294. @item overlay_ih
  21295. The overlay input width and height.
  21296. @item overlay_w, w
  21297. @item overlay_h, h
  21298. The overlay output width and height.
  21299. @item overlay_x, x
  21300. @item overlay_y, y
  21301. Position of the overlay layer inside of main
  21302. @end table
  21303. @item alpha
  21304. Set transparency of overlaid video. Allowed range is 0.0 to 1.0.
  21305. Higher value means lower transparency.
  21306. Default value is @code{1.0}.
  21307. @item eof_action
  21308. See @ref{framesync}.
  21309. @item shortest
  21310. See @ref{framesync}.
  21311. @item repeatlast
  21312. See @ref{framesync}.
  21313. @end table
  21314. This filter also supports the @ref{framesync} options.
  21315. @subsection Examples
  21316. @itemize
  21317. @item
  21318. Overlay an image LOGO at the top-left corner of the INPUT video. Both inputs for this filter are yuv420p format.
  21319. @example
  21320. -i INPUT -i LOGO -filter_complex "[0:v]hwupload[a], [1:v]format=yuv420p, hwupload[b], [a][b]overlay_vaapi" OUTPUT
  21321. @end example
  21322. @item
  21323. Overlay an image LOGO at the offset (200, 100) from the top-left corner of the INPUT video.
  21324. The inputs have same memory layout for color channels, the overlay has additional alpha plane, like INPUT is yuv420p, and the LOGO is yuva420p.
  21325. @example
  21326. -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
  21327. @end example
  21328. @end itemize
  21329. @section tonemap_vaapi
  21330. Perform HDR-to-SDR or HDR-to-HDR tone-mapping.
  21331. It currently only accepts HDR10 as input.
  21332. It accepts the following parameters:
  21333. @table @option
  21334. @item format
  21335. Specify the output pixel format.
  21336. Default is nv12 for HDR-to-SDR tone-mapping and p010 for HDR-to-HDR
  21337. tone-mapping.
  21338. @item primaries, p
  21339. Set the output color primaries.
  21340. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21341. tone-mapping.
  21342. @item transfer, t
  21343. Set the output transfer characteristics.
  21344. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21345. tone-mapping.
  21346. @item matrix, m
  21347. Set the output colorspace matrix.
  21348. Default is bt709 for HDR-to-SDR tone-mapping and same as input for HDR-to-HDR
  21349. tone-mapping.
  21350. @item display
  21351. Set the output mastering display colour volume. It is given by a '|'-separated
  21352. list of two values, two values are space separated. It set display primaries
  21353. x & y in G, B, R order, then white point x & y, the nominal minimum & maximum
  21354. display luminances.
  21355. HDR-to-HDR tone-mapping will be performed when this option is set.
  21356. @item light
  21357. Set the output content light level information. It accepts 2 space-separated
  21358. values, the first input is the maximum light level and the second input is
  21359. the maximum average light level.
  21360. It is ignored for HDR-to-SDR tone-mapping, and optional for HDR-to-HDR
  21361. tone-mapping.
  21362. @end table
  21363. @subsection Example
  21364. @itemize
  21365. @item
  21366. Convert HDR(HDR10) video to bt2020-transfer-characteristic p010 format
  21367. @example
  21368. tonemap_vaapi=format=p010:t=bt2020-10
  21369. @end example
  21370. @item
  21371. Convert HDR video to HDR video
  21372. @example
  21373. tonemap_vaapi=display=7500\ 3000|34000\ 16000|13250\ 34500|15635\ 16450|500\ 10000000
  21374. @end example
  21375. @end itemize
  21376. @section hstack_vaapi
  21377. Stack input videos horizontally.
  21378. This is the VA-API variant of the @ref{hstack} filter, each input stream may
  21379. have different height, this filter will scale down/up each input stream while
  21380. keeping the original aspect.
  21381. It accepts the following options:
  21382. @table @option
  21383. @item inputs
  21384. See @ref{hstack}.
  21385. @item shortest
  21386. See @ref{hstack}.
  21387. @item height
  21388. Set height of output. If set to 0, this filter will set height of output to
  21389. height of the first input stream. Default value is 0.
  21390. @end table
  21391. @section vstack_vaapi
  21392. Stack input videos vertically.
  21393. This is the VA-API variant of the @ref{vstack} filter, each input stream may
  21394. have different width, this filter will scale down/up each input stream while
  21395. keeping the original aspect.
  21396. It accepts the following options:
  21397. @table @option
  21398. @item inputs
  21399. See @ref{vstack}.
  21400. @item shortest
  21401. See @ref{vstack}.
  21402. @item width
  21403. Set width of output. If set to 0, this filter will set width of output to
  21404. width of the first input stream. Default value is 0.
  21405. @end table
  21406. @section xstack_vaapi
  21407. Stack video inputs into custom layout.
  21408. This is the VA-API variant of the @ref{xstack} filter, each input stream may
  21409. have different size, this filter will scale down/up each input stream to the
  21410. given output size, or the size of the first input stream.
  21411. It accepts the following options:
  21412. @table @option
  21413. @item inputs
  21414. See @ref{xstack}.
  21415. @item shortest
  21416. See @ref{xstack}.
  21417. @item layout
  21418. See @ref{xstack}.
  21419. Moreover, this permits the user to supply output size for each input stream.
  21420. @example
  21421. xstack_vaapi=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21422. @end example
  21423. @item grid
  21424. See @ref{xstack}.
  21425. @item grid_tile_size
  21426. Set output size for each input stream when @option{grid} is set. If this option
  21427. is not set, this filter will set output size by default to the size of the
  21428. first input stream. For the syntax of this option, check the
  21429. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21430. @item fill
  21431. See @ref{xstack}.
  21432. @end table
  21433. @section pad_vaapi
  21434. Add paddings to the input image, and place the original input at the
  21435. provided @var{x}, @var{y} coordinates.
  21436. It accepts the following options:
  21437. @table @option
  21438. @item width, w
  21439. @item height, h
  21440. Specify an expression for the size of the output image with the
  21441. paddings added. If the value for @var{width} or @var{height} is 0, the
  21442. corresponding input size is used for the output.
  21443. The @var{width} expression can reference the value set by the
  21444. @var{height} expression, and vice versa.
  21445. The default value of @var{width} and @var{height} is 0.
  21446. @item x
  21447. @item y
  21448. Specify the offsets to place the input image at within the padded area,
  21449. with respect to the top/left border of the output image.
  21450. The @var{x} expression can reference the value set by the @var{y}
  21451. expression, and vice versa.
  21452. The default value of @var{x} and @var{y} is 0.
  21453. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  21454. so the input image is centered on the padded area.
  21455. @item color
  21456. Specify the color of the padded area. For the syntax of this option,
  21457. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  21458. manual,ffmpeg-utils}.
  21459. @item aspect
  21460. Pad to an aspect instead to a resolution.
  21461. @end table
  21462. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  21463. options are expressions containing the following constants:
  21464. @table @option
  21465. @item in_w
  21466. @item in_h
  21467. The input video width and height.
  21468. @item iw
  21469. @item ih
  21470. These are the same as @var{in_w} and @var{in_h}.
  21471. @item out_w
  21472. @item out_h
  21473. The output width and height (the size of the padded area), as
  21474. specified by the @var{width} and @var{height} expressions.
  21475. @item ow
  21476. @item oh
  21477. These are the same as @var{out_w} and @var{out_h}.
  21478. @item x
  21479. @item y
  21480. The x and y offsets as specified by the @var{x} and @var{y}
  21481. expressions, or NAN if not yet specified.
  21482. @item a
  21483. same as @var{iw} / @var{ih}
  21484. @item sar
  21485. input sample aspect ratio
  21486. @item dar
  21487. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  21488. @end table
  21489. @section drawbox_vaapi
  21490. Draw a colored box on the input image.
  21491. It accepts the following parameters:
  21492. @table @option
  21493. @item x
  21494. @item y
  21495. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  21496. @item width, w
  21497. @item height, h
  21498. The expressions which specify the width and height of the box; if 0 they are interpreted as
  21499. the input width and height. It defaults to 0.
  21500. @item color, c
  21501. Specify the color of the box to write. For the general syntax of this option,
  21502. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21503. @item thickness, t
  21504. The expression which sets the thickness of the box edge.
  21505. A value of @code{fill} will create a filled box. Default value is @code{3}.
  21506. See below for the list of accepted constants.
  21507. @item replace
  21508. With value @code{1}, the pixels of the painted box will overwrite the video's color and alpha pixels.
  21509. Default is @code{0}, which composites the box onto the input video.
  21510. @end table
  21511. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  21512. following constants:
  21513. @table @option
  21514. @item in_h, ih
  21515. @item in_w, iw
  21516. The input width and height.
  21517. @item x
  21518. @item y
  21519. The x and y offset coordinates where the box is drawn.
  21520. @item w
  21521. @item h
  21522. The width and height of the drawn box.
  21523. @item t
  21524. The thickness of the drawn box.
  21525. @end table
  21526. @subsection Examples
  21527. @itemize
  21528. @item
  21529. Draw a black box around the edge of the input image:
  21530. @example
  21531. drawbox
  21532. @end example
  21533. @item
  21534. Draw a box with color red and an opacity of 50%:
  21535. @example
  21536. drawbox=10:20:200:60:red@@0.5
  21537. @end example
  21538. The previous example can be specified as:
  21539. @example
  21540. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  21541. @end example
  21542. @item
  21543. Fill the box with pink color:
  21544. @example
  21545. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  21546. @end example
  21547. @item
  21548. Draw a 2-pixel red 2.40:1 mask:
  21549. @example
  21550. 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
  21551. @end example
  21552. @end itemize
  21553. @c man end VAAPI VIDEO FILTERS
  21554. @chapter Vulkan Video Filters
  21555. @c man begin VULKAN VIDEO FILTERS
  21556. Below is a description of the currently available Vulkan video filters.
  21557. To enable compilation of these filters you need to configure FFmpeg with
  21558. @code{--enable-vulkan} and either @code{--enable-libglslang} or @code{--enable-libshaderc}.
  21559. Running Vulkan filters requires you to initialize a hardware device and to pass that device to all filters in any filter graph.
  21560. @table @option
  21561. @item -init_hw_device vulkan[=@var{name}][:@var{device}[,@var{key=value}...]]
  21562. Initialise a new hardware device of type @var{vulkan} called @var{name}, using the
  21563. given device parameters and options in @var{key=value}. The following options
  21564. are supported:
  21565. @table @option
  21566. @item debug
  21567. Switches validation layers on if set to 1.
  21568. @item linear_images
  21569. Allocates linear images. Does not apply to decoding.
  21570. @item disable_multiplane
  21571. Disables multiplane images. Does not apply to decoding.
  21572. @end table
  21573. @item -filter_hw_device @var{name}
  21574. Pass the hardware device called @var{name} to all filters in any filter graph.
  21575. @end table
  21576. For more detailed information see @url{https://www.ffmpeg.org/ffmpeg.html#Advanced-Video-options}
  21577. @itemize
  21578. @item
  21579. Example of choosing the first device and running nlmeans_vulkan filter with default parameters on it.
  21580. @example
  21581. -init_hw_device vulkan=vk:0 -filter_hw_device vk -i INPUT -vf "hwupload,nlmeans_vulkan,hwdownload" OUTPUT
  21582. @end example
  21583. @end itemize
  21584. 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.
  21585. @section avgblur_vulkan
  21586. Apply an average blur filter, implemented on the GPU using Vulkan.
  21587. The filter accepts the following options:
  21588. @table @option
  21589. @item sizeX
  21590. Set horizontal radius size.
  21591. Range is @code{[1, 32]} and default value is @code{3}.
  21592. @item sizeY
  21593. Set vertical radius size. Range is @code{[1, 32]} and default value is @code{3}.
  21594. @item planes
  21595. Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
  21596. @end table
  21597. @section blend_vulkan
  21598. Blend two Vulkan frames into each other.
  21599. The @code{blend} filter takes two input streams and outputs one
  21600. stream, the first input is the "top" layer and second input is
  21601. "bottom" layer. By default, the output terminates when the longest input terminates.
  21602. A description of the accepted options follows.
  21603. @table @option
  21604. @item c0_mode
  21605. @item c1_mode
  21606. @item c2_mode
  21607. @item c3_mode
  21608. @item all_mode
  21609. Set blend mode for specific pixel component or all pixel components in case
  21610. of @var{all_mode}. Default value is @code{normal}.
  21611. Available values for component modes are:
  21612. @table @samp
  21613. @item normal
  21614. @item multiply
  21615. @end table
  21616. @end table
  21617. @section bwdif_vulkan
  21618. Deinterlacer using @ref{bwdif}, the "Bob Weaver Deinterlacing Filter" algorithm, implemented
  21619. on the GPU using Vulkan.
  21620. It accepts the following parameters:
  21621. @table @option
  21622. @item mode
  21623. The interlacing mode to adopt. It accepts one of the following values:
  21624. @table @option
  21625. @item 0, send_frame
  21626. Output one frame for each frame.
  21627. @item 1, send_field
  21628. Output one frame for each field.
  21629. @end table
  21630. The default value is @code{send_field}.
  21631. @item parity
  21632. The picture field parity assumed for the input interlaced video. It accepts one
  21633. of the following values:
  21634. @table @option
  21635. @item 0, tff
  21636. Assume the top field is first.
  21637. @item 1, bff
  21638. Assume the bottom field is first.
  21639. @item -1, auto
  21640. Enable automatic detection of field parity.
  21641. @end table
  21642. The default value is @code{auto}.
  21643. If the interlacing is unknown or the decoder does not export this information,
  21644. top field first will be assumed.
  21645. @item deint
  21646. Specify which frames to deinterlace. Accepts one of the following
  21647. values:
  21648. @table @option
  21649. @item 0, all
  21650. Deinterlace all frames.
  21651. @item 1, interlaced
  21652. Only deinterlace frames marked as interlaced.
  21653. @end table
  21654. The default value is @code{all}.
  21655. @end table
  21656. @section chromaber_vulkan
  21657. Apply an effect that emulates chromatic aberration. Works best with RGB inputs,
  21658. but provides a similar effect with YCbCr inputs too.
  21659. @table @option
  21660. @item dist_x
  21661. Horizontal displacement multiplier. Each chroma pixel's position will be multiplied
  21662. by this amount, starting from the center of the image. Default is @code{0}.
  21663. @item dist_y
  21664. Similarly, this sets the vertical displacement multiplier. Default is @code{0}.
  21665. @end table
  21666. @section color_vulkan
  21667. Video source that creates a Vulkan frame of a solid color.
  21668. Useful for benchmarking, or overlaying.
  21669. It accepts the following parameters:
  21670. @table @option
  21671. @item color
  21672. The color to use. Either a name, or a hexadecimal value.
  21673. The default value is @code{black}.
  21674. @item size
  21675. The size of the output frame. Default value is @code{1920x1080}.
  21676. @item rate
  21677. The framerate to output at. Default value is @code{60} frames per second.
  21678. @item duration
  21679. The video duration. Default value is @code{-0.000001}.
  21680. @item sar
  21681. The video signal aspect ratio. Default value is @code{1/1}.
  21682. @item format
  21683. The pixel format of the output Vulkan frames. Default value is @code{yuv444p}.
  21684. @item out_range
  21685. Set the output YCbCr sample range.
  21686. This allows the autodetected value to be overridden as well as allows forcing
  21687. a specific value used for the output and encoder. If not specified, the
  21688. range depends on the pixel format. Possible values:
  21689. @table @samp
  21690. @item auto/unknown
  21691. Choose automatically.
  21692. @item jpeg/full/pc
  21693. Set full range (0-255 in case of 8-bit luma).
  21694. @item mpeg/limited/tv
  21695. Set "MPEG" range (16-235 in case of 8-bit luma).
  21696. @end table
  21697. @end table
  21698. @section vflip_vulkan
  21699. Flips an image vertically.
  21700. @section hflip_vulkan
  21701. Flips an image horizontally.
  21702. @section flip_vulkan
  21703. Flips an image along both the vertical and horizontal axis.
  21704. @section gblur_vulkan
  21705. Apply Gaussian blur filter on Vulkan frames.
  21706. The filter accepts the following options:
  21707. @table @option
  21708. @item sigma
  21709. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  21710. @item sigmaV
  21711. Set vertical sigma, if negative it will be same as @code{sigma}.
  21712. Default is @code{-1}.
  21713. @item planes
  21714. Set which planes to filter. By default all planes are filtered.
  21715. @item size
  21716. Set the kernel size along the horizontal axis. Default is @code{19}.
  21717. @item sizeV
  21718. Set the kernel size along the vertical axis. Default is @code{0},
  21719. which sets to use the same value as @var{size}.
  21720. @end table
  21721. @section nlmeans_vulkan
  21722. Denoise frames using Non-Local Means algorithm, implemented on the GPU using
  21723. Vulkan.
  21724. Supports more pixel formats than @ref{nlmeans} or @ref{nlmeans_opencl}, including
  21725. alpha channel support.
  21726. The filter accepts the following options.
  21727. @table @option
  21728. @item s
  21729. Set denoising strength for all components. Default is 1.0. Must be in range [1.0, 100.0].
  21730. @item p
  21731. Set patch size for all planes. Default is 7. Must be odd number in range [0, 99].
  21732. @item r
  21733. Set research size. Default is 15. Must be odd number in range [0, 99].
  21734. @item t
  21735. Set parallelism. Default is 36. Must be a number in the range [1, 168].
  21736. Larger values may speed up processing, at the cost of more VRAM.
  21737. Lower values will slow it down, reducing VRAM usage.
  21738. Only supported on GPUs with atomic float operations (RDNA3+, Ampere+).
  21739. @item s0
  21740. @item s1
  21741. @item s2
  21742. @item s3
  21743. Set denoising strength for a specific component. Default is @var{1}, equal to @option{s}.
  21744. Must be odd number in range [1, 100].
  21745. @item p0
  21746. @item p1
  21747. @item p2
  21748. @item p3
  21749. Set patch size for a specific component. Default is @var{7}, equal to @option{p}.
  21750. Must be odd number in range [0, 99].
  21751. @end table
  21752. @section overlay_vulkan
  21753. Overlay one video on top of another.
  21754. It takes two inputs and has one output. The first input is the "main" video on which the second input is overlaid.
  21755. This filter requires all inputs to use the same pixel format. So, format conversion may be needed.
  21756. The filter accepts the following options:
  21757. @table @option
  21758. @item x
  21759. Set the x coordinate of the overlaid video on the main video.
  21760. Default value is @code{0}.
  21761. @item y
  21762. Set the y coordinate of the overlaid video on the main video.
  21763. Default value is @code{0}.
  21764. @end table
  21765. @section transpose_vt
  21766. Transpose rows with columns in the input video and optionally flip it.
  21767. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21768. It accepts the following parameters:
  21769. @table @option
  21770. @item dir
  21771. Specify the transposition direction.
  21772. Can assume the following values:
  21773. @table @samp
  21774. @item cclock_flip
  21775. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21776. @item clock
  21777. Rotate by 90 degrees clockwise.
  21778. @item cclock
  21779. Rotate by 90 degrees counterclockwise.
  21780. @item clock_flip
  21781. Rotate by 90 degrees clockwise and vertically flip.
  21782. @item hflip
  21783. Flip the input video horizontally.
  21784. @item vflip
  21785. Flip the input video vertically.
  21786. @end table
  21787. @item passthrough
  21788. Do not apply the transposition if the input geometry matches the one
  21789. specified by the specified value. It accepts the following values:
  21790. @table @samp
  21791. @item none
  21792. Always apply transposition. (default)
  21793. @item portrait
  21794. Preserve portrait geometry (when @var{height} >= @var{width}).
  21795. @item landscape
  21796. Preserve landscape geometry (when @var{width} >= @var{height}).
  21797. @end table
  21798. @end table
  21799. @section transpose_vulkan
  21800. Transpose rows with columns in the input video and optionally flip it.
  21801. For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options.
  21802. It accepts the following parameters:
  21803. @table @option
  21804. @item dir
  21805. Specify the transposition direction.
  21806. Can assume the following values:
  21807. @table @samp
  21808. @item cclock_flip
  21809. Rotate by 90 degrees counterclockwise and vertically flip. (default)
  21810. @item clock
  21811. Rotate by 90 degrees clockwise.
  21812. @item cclock
  21813. Rotate by 90 degrees counterclockwise.
  21814. @item clock_flip
  21815. Rotate by 90 degrees clockwise and vertically flip.
  21816. @end table
  21817. @item passthrough
  21818. Do not apply the transposition if the input geometry matches the one
  21819. specified by the specified value. It accepts the following values:
  21820. @table @samp
  21821. @item none
  21822. Always apply transposition. (default)
  21823. @item portrait
  21824. Preserve portrait geometry (when @var{height} >= @var{width}).
  21825. @item landscape
  21826. Preserve landscape geometry (when @var{width} >= @var{height}).
  21827. @end table
  21828. @end table
  21829. @c man end VULKAN VIDEO FILTERS
  21830. @chapter QSV Video Filters
  21831. @c man begin QSV VIDEO FILTERS
  21832. Below is a description of the currently available QSV video filters.
  21833. To enable compilation of these filters you need to configure FFmpeg with
  21834. @code{--enable-libmfx} or @code{--enable-libvpl}.
  21835. 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}
  21836. @section hstack_qsv
  21837. Stack input videos horizontally.
  21838. This is the QSV variant of the @ref{hstack} filter, each input stream may
  21839. have different height, this filter will scale down/up each input stream while
  21840. keeping the original aspect.
  21841. It accepts the following options:
  21842. @table @option
  21843. @item inputs
  21844. See @ref{hstack}.
  21845. @item shortest
  21846. See @ref{hstack}.
  21847. @item height
  21848. Set height of output. If set to 0, this filter will set height of output to
  21849. height of the first input stream. Default value is 0.
  21850. @end table
  21851. @section vstack_qsv
  21852. Stack input videos vertically.
  21853. This is the QSV variant of the @ref{vstack} filter, each input stream may
  21854. have different width, this filter will scale down/up each input stream while
  21855. keeping the original aspect.
  21856. It accepts the following options:
  21857. @table @option
  21858. @item inputs
  21859. See @ref{vstack}.
  21860. @item shortest
  21861. See @ref{vstack}.
  21862. @item width
  21863. Set width of output. If set to 0, this filter will set width of output to
  21864. width of the first input stream. Default value is 0.
  21865. @end table
  21866. @section xstack_qsv
  21867. Stack video inputs into custom layout.
  21868. This is the QSV variant of the @ref{xstack} filter.
  21869. It accepts the following options:
  21870. @table @option
  21871. @item inputs
  21872. See @ref{xstack}.
  21873. @item shortest
  21874. See @ref{xstack}.
  21875. @item layout
  21876. See @ref{xstack}.
  21877. Moreover, this permits the user to supply output size for each input stream.
  21878. @example
  21879. xstack_qsv=inputs=4:layout=0_0_1920x1080|0_h0_1920x1080|w0_0_1920x1080|w0_h0_1920x1080
  21880. @end example
  21881. @item grid
  21882. See @ref{xstack}.
  21883. @item grid_tile_size
  21884. Set output size for each input stream when @option{grid} is set. If this option
  21885. is not set, this filter will set output size by default to the size of the
  21886. first input stream. For the syntax of this option, check the
  21887. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21888. @item fill
  21889. See @ref{xstack}.
  21890. @end table
  21891. @c man end QSV VIDEO FILTERS
  21892. @chapter Video Sources
  21893. @c man begin VIDEO SOURCES
  21894. Below is a description of the currently available video sources.
  21895. @section buffer
  21896. Buffer video frames, and make them available to the filter chain.
  21897. This source is mainly intended for a programmatic use, in particular
  21898. through the interface defined in @file{libavfilter/buffersrc.h}.
  21899. It accepts the following parameters:
  21900. @table @option
  21901. @item video_size
  21902. Specify the size (width and height) of the buffered video frames. For the
  21903. syntax of this option, check the
  21904. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21905. @item width
  21906. The input video width.
  21907. @item height
  21908. The input video height.
  21909. @item pix_fmt
  21910. A string representing the pixel format of the buffered video frames.
  21911. It may be a number corresponding to a pixel format, or a pixel format
  21912. name.
  21913. @item time_base
  21914. Specify the timebase assumed by the timestamps of the buffered frames.
  21915. @item frame_rate
  21916. Specify the frame rate expected for the video stream.
  21917. @item colorspace
  21918. A string representing the color space of the buffered video frames.
  21919. It may be a number corresponding to a color space, or a color space
  21920. name.
  21921. @item range
  21922. A string representing the color range of the buffered video frames.
  21923. It may be a number corresponding to a color range, or a color range
  21924. name.
  21925. @item pixel_aspect, sar
  21926. The sample (pixel) aspect ratio of the input video.
  21927. @item hw_frames_ctx
  21928. When using a hardware pixel format, this should be a reference to an
  21929. AVHWFramesContext describing input frames.
  21930. @end table
  21931. For example:
  21932. @example
  21933. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  21934. @end example
  21935. will instruct the source to accept video frames with size 320x240 and
  21936. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  21937. square pixels (1:1 sample aspect ratio).
  21938. Since the pixel format with name "yuv410p" corresponds to the number 6
  21939. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  21940. this example corresponds to:
  21941. @example
  21942. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  21943. @end example
  21944. Alternatively, the options can be specified as a flat string, but this
  21945. syntax is deprecated:
  21946. @var{width}:@var{height}:@var{pix_fmt}:@var{time_base.num}:@var{time_base.den}:@var{pixel_aspect.num}:@var{pixel_aspect.den}
  21947. @section cellauto
  21948. Create a pattern generated by an elementary cellular automaton.
  21949. The initial state of the cellular automaton can be defined through the
  21950. @option{filename} and @option{pattern} options. If such options are
  21951. not specified an initial state is created randomly.
  21952. At each new frame a new row in the video is filled with the result of
  21953. the cellular automaton next generation. The behavior when the whole
  21954. frame is filled is defined by the @option{scroll} option.
  21955. This source accepts the following options:
  21956. @table @option
  21957. @item filename, f
  21958. Read the initial cellular automaton state, i.e. the starting row, from
  21959. the specified file.
  21960. In the file, each non-whitespace character is considered an alive
  21961. cell, a newline will terminate the row, and further characters in the
  21962. file will be ignored.
  21963. @item pattern, p
  21964. Read the initial cellular automaton state, i.e. the starting row, from
  21965. the specified string.
  21966. Each non-whitespace character in the string is considered an alive
  21967. cell, a newline will terminate the row, and further characters in the
  21968. string will be ignored.
  21969. @item rate, r
  21970. Set the video rate, that is the number of frames generated per second.
  21971. Default is 25.
  21972. @item random_fill_ratio, ratio
  21973. Set the random fill ratio for the initial cellular automaton row. It
  21974. is a floating point number value ranging from 0 to 1, defaults to
  21975. 1/PHI.
  21976. This option is ignored when a file or a pattern is specified.
  21977. @item random_seed, seed
  21978. Set the seed for filling randomly the initial row, must be an integer
  21979. included between 0 and UINT32_MAX. If not specified, or if explicitly
  21980. set to -1, the filter will try to use a good random seed on a best
  21981. effort basis.
  21982. @item rule
  21983. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  21984. Default value is 110.
  21985. @item size, s
  21986. Set the size of the output video. For the syntax of this option, check the
  21987. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  21988. If @option{filename} or @option{pattern} is specified, the size is set
  21989. by default to the width of the specified initial state row, and the
  21990. height is set to @var{width} * PHI.
  21991. If @option{size} is set, it must contain the width of the specified
  21992. pattern string, and the specified pattern will be centered in the
  21993. larger row.
  21994. If a filename or a pattern string is not specified, the size value
  21995. defaults to "320x518" (used for a randomly generated initial state).
  21996. @item scroll
  21997. If set to 1, scroll the output upward when all the rows in the output
  21998. have been already filled. If set to 0, the new generated row will be
  21999. written over the top row just after the bottom row is filled.
  22000. Defaults to 1.
  22001. @item start_full, full
  22002. If set to 1, completely fill the output with generated rows before
  22003. outputting the first frame.
  22004. This is the default behavior, for disabling set the value to 0.
  22005. @item stitch
  22006. If set to 1, stitch the left and right row edges together.
  22007. This is the default behavior, for disabling set the value to 0.
  22008. @end table
  22009. @subsection Examples
  22010. @itemize
  22011. @item
  22012. Read the initial state from @file{pattern}, and specify an output of
  22013. size 200x400.
  22014. @example
  22015. cellauto=f=pattern:s=200x400
  22016. @end example
  22017. @item
  22018. Generate a random initial row with a width of 200 cells, with a fill
  22019. ratio of 2/3:
  22020. @example
  22021. cellauto=ratio=2/3:s=200x200
  22022. @end example
  22023. @item
  22024. Create a pattern generated by rule 18 starting by a single alive cell
  22025. centered on an initial row with width 100:
  22026. @example
  22027. cellauto=p=@@:s=100x400:full=0:rule=18
  22028. @end example
  22029. @item
  22030. Specify a more elaborated initial pattern:
  22031. @example
  22032. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  22033. @end example
  22034. @end itemize
  22035. @anchor{coreimagesrc}
  22036. @section coreimagesrc
  22037. Video source generated on GPU using Apple's CoreImage API on OSX.
  22038. This video source is a specialized version of the @ref{coreimage} video filter.
  22039. Use a core image generator at the beginning of the applied filterchain to
  22040. generate the content.
  22041. The coreimagesrc video source accepts the following options:
  22042. @table @option
  22043. @item list_generators
  22044. List all available generators along with all their respective options as well as
  22045. possible minimum and maximum values along with the default values.
  22046. @example
  22047. list_generators=true
  22048. @end example
  22049. @item size, s
  22050. Specify the size of the sourced video. For the syntax of this option, check the
  22051. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22052. The default value is @code{320x240}.
  22053. @item rate, r
  22054. Specify the frame rate of the sourced video, as the number of frames
  22055. generated per second. It has to be a string in the format
  22056. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22057. number or a valid video frame rate abbreviation. The default value is
  22058. "25".
  22059. @item sar
  22060. Set the sample aspect ratio of the sourced video.
  22061. @item duration, d
  22062. Set the duration of the sourced video. See
  22063. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22064. for the accepted syntax.
  22065. If not specified, or the expressed duration is negative, the video is
  22066. supposed to be generated forever.
  22067. @end table
  22068. Additionally, all options of the @ref{coreimage} video filter are accepted.
  22069. A complete filterchain can be used for further processing of the
  22070. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  22071. and examples for details.
  22072. @subsection Examples
  22073. @itemize
  22074. @item
  22075. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  22076. given as complete and escaped command-line for Apple's standard bash shell:
  22077. @example
  22078. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  22079. @end example
  22080. This example is equivalent to the QRCode example of @ref{coreimage} without the
  22081. need for a nullsrc video source.
  22082. @end itemize
  22083. @section ddagrab
  22084. Captures the Windows Desktop via Desktop Duplication API.
  22085. The filter exclusively returns D3D11 Hardware Frames, for on-gpu encoding
  22086. or processing. So an explicit @ref{hwdownload} is needed for any kind of
  22087. software processing.
  22088. It accepts the following options:
  22089. @table @option
  22090. @item output_idx
  22091. DXGI Output Index to capture.
  22092. Usually corresponds to the index Windows has given the screen minus one,
  22093. so it's starting at 0.
  22094. Defaults to output 0.
  22095. @item draw_mouse
  22096. Whether to draw the mouse cursor.
  22097. Defaults to true.
  22098. Only affects hardware cursors. If a game or application renders its own cursor,
  22099. it'll always be captured.
  22100. @item framerate
  22101. Maximum framerate at which the desktop will be captured - the interval between
  22102. successive frames will not be smaller than the inverse of the framerate. When
  22103. @var{dup_frames} is true (the default) and the desktop is not being updated
  22104. often enough, the filter will duplicate a previous frame. Note that there is no
  22105. background buffering going on, so when the filter is not polled often enough
  22106. then the actual inter-frame interval may be significantly larger.
  22107. Defaults to 30 FPS.
  22108. @item video_size
  22109. Specify the size of the captured video.
  22110. Defaults to the full size of the screen.
  22111. Cropped from the bottom/right if smaller than screen size.
  22112. @item offset_x
  22113. Horizontal offset of the captured video.
  22114. @item offset_y
  22115. Vertical offset of the captured video.
  22116. @item output_fmt
  22117. Desired filter output format.
  22118. Defaults to 8 Bit BGRA.
  22119. It accepts the following values:
  22120. @table @samp
  22121. @item auto
  22122. Passes all supported output formats to DDA and returns what DDA decides to use.
  22123. @item 8bit
  22124. @item bgra
  22125. 8 Bit formats always work, and DDA will convert to them if necessary.
  22126. @item 10bit
  22127. @item x2bgr10
  22128. Filter initialization will fail if 10 bit format is requested but unavailable.
  22129. @end table
  22130. @item dup_frames
  22131. When this option is set to true (the default), the filter will duplicate frames
  22132. when the desktop has not been updated in order to maintain approximately
  22133. constant target framerate. When this option is set to false, the filter will
  22134. wait for the desktop to be updated (inter-frame intervals may vary significantly
  22135. in this case).
  22136. @end table
  22137. @subsection Examples
  22138. Capture primary screen and encode using nvenc:
  22139. @example
  22140. ffmpeg -f lavfi -i ddagrab -c:v h264_nvenc -cq 18 output.mp4
  22141. @end example
  22142. You can also skip the lavfi device and directly use the filter.
  22143. Also demonstrates downloading the frame and encoding with libx264.
  22144. Explicit output format specification is required in this case:
  22145. @example
  22146. ffmpeg -filter_complex ddagrab=output_idx=1:framerate=60,hwdownload,format=bgra -c:v libx264 -crf 18 output.mp4
  22147. @end example
  22148. If you want to capture only a subsection of the desktop, this can be achieved
  22149. by specifying a smaller size and its offsets into the screen:
  22150. @example
  22151. ddagrab=video_size=800x600:offset_x=100:offset_y=100
  22152. @end example
  22153. @section gradients
  22154. Generate several gradients.
  22155. @table @option
  22156. @item size, s
  22157. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22158. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22159. @item rate, r
  22160. Set frame rate, expressed as number of frames per second. Default
  22161. value is "25".
  22162. @item c0, c1, c2, c3, c4, c5, c6, c7
  22163. Set 8 colors. Default values for colors is to pick random one.
  22164. @item x0, y0, y0, y1
  22165. Set gradient line source and destination points. If negative or out of range, random ones
  22166. are picked.
  22167. @item nb_colors, n
  22168. Set number of colors to use at once. Allowed range is from 2 to 8. Default value is 2.
  22169. @item seed
  22170. Set seed for picking gradient line points.
  22171. @item duration, d
  22172. Set the duration of the sourced video. See
  22173. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22174. for the accepted syntax.
  22175. If not specified, or the expressed duration is negative, the video is
  22176. supposed to be generated forever.
  22177. @item speed
  22178. Set speed of gradients rotation.
  22179. @item type, t
  22180. Set type of gradients.
  22181. Available values are:
  22182. @table @samp
  22183. @item linear
  22184. @item radial
  22185. @item circular
  22186. @item spiral
  22187. @item square
  22188. @end table
  22189. Default type is @var{linear}.
  22190. @end table
  22191. @subsection Commands
  22192. This source supports the some above options as @ref{commands}.
  22193. @section mandelbrot
  22194. Generate a Mandelbrot set fractal, and progressively zoom towards the
  22195. point specified with @var{start_x} and @var{start_y}.
  22196. This source accepts the following options:
  22197. @table @option
  22198. @item end_pts
  22199. Set the terminal pts value. Default value is 400.
  22200. @item end_scale
  22201. Set the terminal scale value.
  22202. Must be a floating point value. Default value is 0.3.
  22203. @item inner
  22204. Set the inner coloring mode, that is the algorithm used to draw the
  22205. Mandelbrot fractal internal region.
  22206. It shall assume one of the following values:
  22207. @table @option
  22208. @item black
  22209. Set black mode.
  22210. @item convergence
  22211. Show time until convergence.
  22212. @item mincol
  22213. Set color based on point closest to the origin of the iterations.
  22214. @item period
  22215. Set period mode.
  22216. @end table
  22217. Default value is @var{mincol}.
  22218. @item bailout
  22219. Set the bailout value. Default value is 10.0.
  22220. @item maxiter
  22221. Set the maximum of iterations performed by the rendering
  22222. algorithm. Default value is 7189.
  22223. @item outer
  22224. Set outer coloring mode.
  22225. It shall assume one of following values:
  22226. @table @option
  22227. @item iteration_count
  22228. Set iteration count mode.
  22229. @item normalized_iteration_count
  22230. set normalized iteration count mode.
  22231. @end table
  22232. Default value is @var{normalized_iteration_count}.
  22233. @item rate, r
  22234. Set frame rate, expressed as number of frames per second. Default
  22235. value is "25".
  22236. @item size, s
  22237. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22238. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22239. @item start_scale
  22240. Set the initial scale value. Default value is 3.0.
  22241. @item start_x
  22242. Set the initial x position. Must be a floating point value between
  22243. -100 and 100. Default value is -0.743643887037158704752191506114774.
  22244. @item start_y
  22245. Set the initial y position. Must be a floating point value between
  22246. -100 and 100. Default value is -0.131825904205311970493132056385139.
  22247. @end table
  22248. @section mptestsrc
  22249. Generate various test patterns, as generated by the MPlayer test filter.
  22250. The size of the generated video is fixed, and is 256x256.
  22251. This source is useful in particular for testing encoding features.
  22252. This source accepts the following options:
  22253. @table @option
  22254. @item rate, r
  22255. Specify the frame rate of the sourced video, as the number of frames
  22256. generated per second. It has to be a string in the format
  22257. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22258. number or a valid video frame rate abbreviation. The default value is
  22259. "25".
  22260. @item duration, d
  22261. Set the duration of the sourced video. See
  22262. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22263. for the accepted syntax.
  22264. If not specified, or the expressed duration is negative, the video is
  22265. supposed to be generated forever.
  22266. @item test, t
  22267. Set the number or the name of the test to perform. Supported tests are:
  22268. @table @option
  22269. @item dc_luma
  22270. @item dc_chroma
  22271. @item freq_luma
  22272. @item freq_chroma
  22273. @item amp_luma
  22274. @item amp_chroma
  22275. @item cbp
  22276. @item mv
  22277. @item ring1
  22278. @item ring2
  22279. @item all
  22280. @item max_frames, m
  22281. Set the maximum number of frames generated for each test, default value is 30.
  22282. @end table
  22283. Default value is "all", which will cycle through the list of all tests.
  22284. @end table
  22285. Some examples:
  22286. @example
  22287. mptestsrc=t=dc_luma
  22288. @end example
  22289. will generate a "dc_luma" test pattern.
  22290. @section frei0r_src
  22291. Provide a frei0r source.
  22292. To enable compilation of this filter you need to install the frei0r
  22293. header and configure FFmpeg with @code{--enable-frei0r}.
  22294. This source accepts the following parameters:
  22295. @table @option
  22296. @item size
  22297. The size of the video to generate. For the syntax of this option, check the
  22298. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22299. @item framerate
  22300. The framerate of the generated video. It may be a string of the form
  22301. @var{num}/@var{den} or a frame rate abbreviation.
  22302. @item filter_name
  22303. The name to the frei0r source to load. For more information regarding frei0r and
  22304. how to set the parameters, read the @ref{frei0r} section in the video filters
  22305. documentation.
  22306. @item filter_params
  22307. A '|'-separated list of parameters to pass to the frei0r source.
  22308. @end table
  22309. For example, to generate a frei0r partik0l source with size 200x200
  22310. and frame rate 10 which is overlaid on the overlay filter main input:
  22311. @example
  22312. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  22313. @end example
  22314. @section life
  22315. Generate a life pattern.
  22316. This source is based on a generalization of John Conway's life game.
  22317. The sourced input represents a life grid, each pixel represents a cell
  22318. which can be in one of two possible states, alive or dead. Every cell
  22319. interacts with its eight neighbours, which are the cells that are
  22320. horizontally, vertically, or diagonally adjacent.
  22321. At each interaction the grid evolves according to the adopted rule,
  22322. which specifies the number of neighbor alive cells which will make a
  22323. cell stay alive or born. The @option{rule} option allows one to specify
  22324. the rule to adopt.
  22325. This source accepts the following options:
  22326. @table @option
  22327. @item filename, f
  22328. Set the file from which to read the initial grid state. In the file,
  22329. each non-whitespace character is considered an alive cell, and newline
  22330. is used to delimit the end of each row.
  22331. If this option is not specified, the initial grid is generated
  22332. randomly.
  22333. @item rate, r
  22334. Set the video rate, that is the number of frames generated per second.
  22335. Default is 25.
  22336. @item random_fill_ratio, ratio
  22337. Set the random fill ratio for the initial random grid. It is a
  22338. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  22339. It is ignored when a file is specified.
  22340. @item random_seed, seed
  22341. Set the seed for filling the initial random grid, must be an integer
  22342. included between 0 and UINT32_MAX. If not specified, or if explicitly
  22343. set to -1, the filter will try to use a good random seed on a best
  22344. effort basis.
  22345. @item rule
  22346. Set the life rule.
  22347. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  22348. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  22349. @var{NS} specifies the number of alive neighbor cells which make a
  22350. live cell stay alive, and @var{NB} the number of alive neighbor cells
  22351. which make a dead cell to become alive (i.e. to "born").
  22352. "s" and "b" can be used in place of "S" and "B", respectively.
  22353. Alternatively a rule can be specified by an 18-bits integer. The 9
  22354. high order bits are used to encode the next cell state if it is alive
  22355. for each number of neighbor alive cells, the low order bits specify
  22356. the rule for "borning" new cells. Higher order bits encode for an
  22357. higher number of neighbor cells.
  22358. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  22359. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  22360. Default value is "S23/B3", which is the original Conway's game of life
  22361. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  22362. cells, and will born a new cell if there are three alive cells around
  22363. a dead cell.
  22364. @item size, s
  22365. Set the size of the output video. For the syntax of this option, check the
  22366. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22367. If @option{filename} is specified, the size is set by default to the
  22368. same size of the input file. If @option{size} is set, it must contain
  22369. the size specified in the input file, and the initial grid defined in
  22370. that file is centered in the larger resulting area.
  22371. If a filename is not specified, the size value defaults to "320x240"
  22372. (used for a randomly generated initial grid).
  22373. @item stitch
  22374. If set to 1, stitch the left and right grid edges together, and the
  22375. top and bottom edges also. Defaults to 1.
  22376. @item mold
  22377. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  22378. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  22379. value from 0 to 255.
  22380. @item life_color
  22381. Set the color of living (or new born) cells.
  22382. @item death_color
  22383. Set the color of dead cells. If @option{mold} is set, this is the first color
  22384. used to represent a dead cell.
  22385. @item mold_color
  22386. Set mold color, for definitely dead and moldy cells.
  22387. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  22388. ffmpeg-utils manual,ffmpeg-utils}.
  22389. @end table
  22390. @subsection Examples
  22391. @itemize
  22392. @item
  22393. Read a grid from @file{pattern}, and center it on a grid of size
  22394. 300x300 pixels:
  22395. @example
  22396. life=f=pattern:s=300x300
  22397. @end example
  22398. @item
  22399. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  22400. @example
  22401. life=ratio=2/3:s=200x200
  22402. @end example
  22403. @item
  22404. Specify a custom rule for evolving a randomly generated grid:
  22405. @example
  22406. life=rule=S14/B34
  22407. @end example
  22408. @item
  22409. Full example with slow death effect (mold) using @command{ffplay}:
  22410. @example
  22411. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  22412. @end example
  22413. @end itemize
  22414. @section perlin
  22415. Generate Perlin noise.
  22416. Perlin noise is a kind of noise with local continuity in space. This
  22417. can be used to generate patterns with continuity in space and time,
  22418. e.g. to simulate smoke, fluids, or terrain.
  22419. In case more than one octave is specified through the @option{octaves}
  22420. option, Perlin noise is generated as a sum of components, each one
  22421. with doubled frequency. In this case the @option{persistence} option
  22422. specify the ratio of the amplitude with respect to the previous
  22423. component. More octave components enable to specify more high
  22424. frequency details in the generated noise (e.g. small size variations
  22425. due to boulders in a generated terrain).
  22426. @subsection Options
  22427. @table @option
  22428. @item size, s
  22429. Specify the size (width and height) of the buffered video frames. For the
  22430. syntax of this option, check the
  22431. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22432. Default value is @code{320x240}.
  22433. @item rate, r
  22434. Specify the frame rate expected for the video stream, expressed as a
  22435. number of frames per second. Default value is @code{25}.
  22436. @item octaves
  22437. Specify the total number of components making up the noise, each one
  22438. with doubled frequency. Default value is @code{1}.
  22439. @item persistence
  22440. Set the ratio used to compute the amplitude of the next octave
  22441. component with respect to the previous component amplitude. Default
  22442. value is @code{1}.
  22443. @item xscale
  22444. @item yscale
  22445. Define a scale factor used to multiple the x, y coordinates. This can
  22446. be useful to define an effect with a pattern stretched along the x or
  22447. y axis. Default value is @code{1}.
  22448. @item tscale
  22449. Define a scale factor used to multiple the time coordinate. This can
  22450. be useful to change the time variation speed. Default value is @code{1}.
  22451. @item random_mode
  22452. Set random mode used to compute initial pattern.
  22453. Supported values are:
  22454. @table @option
  22455. @item random
  22456. Compute and use random seed.
  22457. @item ken
  22458. Use the predefined initial pattern defined by Ken Perlin in the
  22459. original article, can be useful to compare the output with other
  22460. sources.
  22461. @item seed
  22462. Use the value specified by @option{random_seed} option.
  22463. @end table
  22464. Default value is @code{random}.
  22465. @item random_seed, seed
  22466. When @option{random_mode} is set to @var{random_seed}, use this value
  22467. to compute the initial pattern. Default value is @code{0}.
  22468. @end table
  22469. @subsection Examples
  22470. @itemize
  22471. @item
  22472. Generate single component:
  22473. @example
  22474. perlin
  22475. @end example
  22476. @item
  22477. Use Perlin noise with 7 components, each one with a halved contribution
  22478. to total amplitude:
  22479. @example
  22480. perlin=octaves=7:persistence=0.5
  22481. @end example
  22482. @item
  22483. Chain Perlin noise with the @ref{lutyuv} to generate a black&white
  22484. effect:
  22485. @example
  22486. perlin=octaves=3:tscale=0.3,lutyuv=y='if(lt(val\,128)\,255\,0)'
  22487. @end example
  22488. @item
  22489. Stretch noise along the y axis, and convert gray level to red-only
  22490. signal:
  22491. @example
  22492. perlin=octaves=7:tscale=0.4:yscale=0.3,lutrgb=r=val:b=0:g=0
  22493. @end example
  22494. @end itemize
  22495. @section qrencodesrc
  22496. Generate a QR code using the libqrencode library (see
  22497. @url{https://fukuchi.org/works/qrencode/}).
  22498. To enable the compilation of this source, you need to configure FFmpeg with
  22499. @code{--enable-libqrencode}.
  22500. The QR code is generated from the provided text or text pattern. The
  22501. corresponding QR code is scaled and put in the video output according to the
  22502. specified output size options.
  22503. In case no text is specified, the QR code is not generated, but an empty colored
  22504. output is returned instead.
  22505. This source accepts the following options:
  22506. @table @option
  22507. @item qrcode_width, q
  22508. @item padded_qrcode_width, Q
  22509. Specify an expression for the width of the rendered QR code, with and without
  22510. padding. The @var{qrcode_width} expression can reference the value set by the
  22511. @var{padded_qrcode_width} expression, and vice versa.
  22512. By default @var{padded_qrcode_width} is set to @var{qrcode_width}, meaning that
  22513. there is no padding.
  22514. These expressions are evaluated only once, when initializing the source.
  22515. See the @ref{qrencode_expressions,,qrencode Expressions} section for details.
  22516. Note that some of the constants are missing for the source (for example the
  22517. @var{x} or @var{t} or ¸@var{n}), since they only makes sense when evaluating the
  22518. expression for each frame rather than at initialization time.
  22519. @item rate, r
  22520. Specify the frame rate of the sourced video, as the number of frames
  22521. generated per second. It has to be a string in the format
  22522. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22523. number or a valid video frame rate abbreviation. The default value is
  22524. "25".
  22525. @item case_sensitive, cs
  22526. Instruct libqrencode to use case sensitive encoding. This is enabled by
  22527. default. This can be disabled to reduce the QR encoding size.
  22528. @item level, l
  22529. Specify the QR encoding error correction level. With an higher correction level,
  22530. the encoding size will increase but the code will be more robust to corruption.
  22531. Lower level is @var{L}.
  22532. It accepts the following values:
  22533. @table @samp
  22534. @item L
  22535. @item M
  22536. @item Q
  22537. @item H
  22538. @end table
  22539. @item expansion
  22540. Select how the input text is expanded. Can be either @code{none}, or
  22541. @code{normal} (default). See the @ref{qrencode_text_expansion,,qrencode Text expansion}
  22542. section for details.
  22543. @item text
  22544. @item textfile
  22545. Define the text to be rendered. In case neither is specified, no QR is encoded
  22546. (just an empty colored frame).
  22547. In case expansion is enabled, the text is treated as a text template, using the
  22548. qrencode expansion mechanism. See the @ref{qrencode_text_expansion,,qrencode
  22549. Text expansion} section for details.
  22550. @item background_color, bc
  22551. @item foreground_color, fc
  22552. Set the QR code and background color. The default value of
  22553. @var{foreground_color} is "black", the default value of @var{background_color}
  22554. is "white".
  22555. For the syntax of the color options, check the @ref{color syntax,,"Color"
  22556. section in the ffmpeg-utils manual,ffmpeg-utils}.
  22557. @end table
  22558. @subsection Examples
  22559. @itemize
  22560. @item
  22561. Generate a QR code encoding the specified text with the default size:
  22562. @example
  22563. qrencodesrc=text=www.ffmpeg.org
  22564. @end example
  22565. @item
  22566. Same as below, but select blue on pink colors:
  22567. @example
  22568. qrencodesrc=text=www.ffmpeg.org:bc=pink:fc=blue
  22569. @end example
  22570. @item
  22571. Generate a QR code with width of 200 pixels and padding, making the padded width
  22572. 4/3 of the QR code width:
  22573. @example
  22574. qrencodesrc=text=www.ffmpeg.org:q=200:Q=4/3*q
  22575. @end example
  22576. @item
  22577. Generate a QR code with padded width of 200 pixels and padding, making the QR
  22578. code width 3/4 of the padded width:
  22579. @example
  22580. qrencodesrc=text=www.ffmpeg.org:Q=200:q=3/4*Q
  22581. @end example
  22582. @item
  22583. Generate a QR code encoding the frame number:
  22584. @example
  22585. qrencodesrc=text=%@{n@}
  22586. @end example
  22587. @item
  22588. Generate a QR code encoding the GMT timestamp:
  22589. @example
  22590. qrencodesrc=text=%@{gmtime@}
  22591. @end example
  22592. @item
  22593. Generate a QR code encoding the timestamp expressed as a float:
  22594. @example
  22595. qrencodesrc=text=%@{pts@}
  22596. @end example
  22597. @end itemize
  22598. @anchor{allrgb}
  22599. @anchor{allyuv}
  22600. @anchor{color}
  22601. @anchor{colorchart}
  22602. @anchor{colorspectrum}
  22603. @anchor{haldclutsrc}
  22604. @anchor{nullsrc}
  22605. @anchor{pal75bars}
  22606. @anchor{pal100bars}
  22607. @anchor{rgbtestsrc}
  22608. @anchor{smptebars}
  22609. @anchor{smptehdbars}
  22610. @anchor{testsrc}
  22611. @anchor{testsrc2}
  22612. @anchor{yuvtestsrc}
  22613. @section allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  22614. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  22615. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  22616. The @code{color} source provides an uniformly colored input.
  22617. The @code{colorchart} source provides a colors checker chart.
  22618. The @code{colorspectrum} source provides a color spectrum input.
  22619. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  22620. @ref{haldclut} filter.
  22621. The @code{nullsrc} source returns unprocessed video frames. It is
  22622. mainly useful to be employed in analysis / debugging tools, or as the
  22623. source for filters which ignore the input data.
  22624. The @code{pal75bars} source generates a color bars pattern, based on
  22625. EBU PAL recommendations with 75% color levels.
  22626. The @code{pal100bars} source generates a color bars pattern, based on
  22627. EBU PAL recommendations with 100% color levels.
  22628. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  22629. detecting RGB vs BGR issues. You should see a red, green and blue
  22630. stripe from top to bottom.
  22631. The @code{smptebars} source generates a color bars pattern, based on
  22632. the SMPTE Engineering Guideline EG 1-1990.
  22633. The @code{smptehdbars} source generates a color bars pattern, based on
  22634. the SMPTE RP 219-2002.
  22635. The @code{testsrc} source generates a test video pattern, showing a
  22636. color pattern, a scrolling gradient and a timestamp. This is mainly
  22637. intended for testing purposes.
  22638. The @code{testsrc2} source is similar to testsrc, but supports more
  22639. pixel formats instead of just @code{rgb24}. This allows using it as an
  22640. input for other tests without requiring a format conversion.
  22641. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  22642. see a y, cb and cr stripe from top to bottom.
  22643. The sources accept the following parameters:
  22644. @table @option
  22645. @item level
  22646. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  22647. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  22648. pixels to be used as identity matrix for 3D lookup tables. Each component is
  22649. coded on a @code{1/(N*N)} scale.
  22650. @item color, c
  22651. Specify the color of the source, only available in the @code{color}
  22652. source. For the syntax of this option, check the
  22653. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22654. @item size, s
  22655. Specify the size of the sourced video. For the syntax of this option, check the
  22656. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22657. The default value is @code{320x240}.
  22658. This option is not available with the @code{allrgb}, @code{allyuv}, and
  22659. @code{haldclutsrc} filters.
  22660. @item rate, r
  22661. Specify the frame rate of the sourced video, as the number of frames
  22662. generated per second. It has to be a string in the format
  22663. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  22664. number or a valid video frame rate abbreviation. The default value is
  22665. "25".
  22666. @item duration, d
  22667. Set the duration of the sourced video. See
  22668. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22669. for the accepted syntax.
  22670. If not specified, or the expressed duration is negative, the video is
  22671. supposed to be generated forever.
  22672. Since the frame rate is used as time base, all frames including the last one
  22673. will have their full duration. If the specified duration is not a multiple
  22674. of the frame duration, it will be rounded up.
  22675. @item sar
  22676. Set the sample aspect ratio of the sourced video.
  22677. @item alpha
  22678. Specify the alpha (opacity) of the background, only available in the
  22679. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  22680. 255 (fully opaque, the default).
  22681. @item decimals, n
  22682. Set the number of decimals to show in the timestamp, only available in the
  22683. @code{testsrc} source.
  22684. The displayed timestamp value will correspond to the original
  22685. timestamp value multiplied by the power of 10 of the specified
  22686. value. Default value is 0.
  22687. @item type
  22688. Set the type of the color spectrum, only available in the
  22689. @code{colorspectrum} source. Can be one of the following:
  22690. @table @samp
  22691. @item black
  22692. @item white
  22693. @item all
  22694. @end table
  22695. @item patch_size
  22696. Set patch size of single color patch, only available in the
  22697. @code{colorchart} source. Default is @code{64x64}.
  22698. @item preset
  22699. Set colorchecker colors preset, only available in the
  22700. @code{colorchart} source.
  22701. Available values are:
  22702. @table @samp
  22703. @item reference
  22704. @item skintones
  22705. @end table
  22706. Default value is @code{reference}.
  22707. @end table
  22708. @subsection Examples
  22709. @itemize
  22710. @item
  22711. Generate a video with a duration of 5.3 seconds, with size
  22712. 176x144 and a frame rate of 10 frames per second:
  22713. @example
  22714. testsrc=duration=5.3:size=qcif:rate=10
  22715. @end example
  22716. @item
  22717. The following graph description will generate a red source
  22718. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  22719. frames per second:
  22720. @example
  22721. color=c=red@@0.2:s=qcif:r=10
  22722. @end example
  22723. @item
  22724. If the input content is to be ignored, @code{nullsrc} can be used. The
  22725. following command generates noise in the luma plane by employing
  22726. the @code{geq} filter:
  22727. @example
  22728. nullsrc=s=256x256, geq=random(1)*255:128:128
  22729. @end example
  22730. @end itemize
  22731. @subsection Commands
  22732. The @code{color} source supports the following commands:
  22733. @table @option
  22734. @item c, color
  22735. Set the color of the created image. Accepts the same syntax of the
  22736. corresponding @option{color} option.
  22737. @end table
  22738. @section openclsrc
  22739. Generate video using an OpenCL program.
  22740. @table @option
  22741. @item source
  22742. OpenCL program source file.
  22743. @item kernel
  22744. Kernel name in program.
  22745. @item size, s
  22746. Size of frames to generate. This must be set.
  22747. @item format
  22748. Pixel format to use for the generated frames. This must be set.
  22749. @item rate, r
  22750. Number of frames generated every second. Default value is '25'.
  22751. @end table
  22752. For details of how the program loading works, see the @ref{program_opencl}
  22753. filter.
  22754. Example programs:
  22755. @itemize
  22756. @item
  22757. Generate a colour ramp by setting pixel values from the position of the pixel
  22758. in the output image. (Note that this will work with all pixel formats, but
  22759. the generated output will not be the same.)
  22760. @verbatim
  22761. __kernel void ramp(__write_only image2d_t dst,
  22762. unsigned int index)
  22763. {
  22764. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22765. float4 val;
  22766. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  22767. write_imagef(dst, loc, val);
  22768. }
  22769. @end verbatim
  22770. @item
  22771. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  22772. @verbatim
  22773. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  22774. unsigned int index)
  22775. {
  22776. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  22777. float4 value = 0.0f;
  22778. int x = loc.x + index;
  22779. int y = loc.y + index;
  22780. while (x > 0 || y > 0) {
  22781. if (x % 3 == 1 && y % 3 == 1) {
  22782. value = 1.0f;
  22783. break;
  22784. }
  22785. x /= 3;
  22786. y /= 3;
  22787. }
  22788. write_imagef(dst, loc, value);
  22789. }
  22790. @end verbatim
  22791. @end itemize
  22792. @section sierpinski
  22793. Generate a Sierpinski carpet/triangle fractal, and randomly pan around.
  22794. This source accepts the following options:
  22795. @table @option
  22796. @item size, s
  22797. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22798. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  22799. @item rate, r
  22800. Set frame rate, expressed as number of frames per second. Default
  22801. value is "25".
  22802. @item seed
  22803. Set seed which is used for random panning.
  22804. @item jump
  22805. Set max jump for single pan destination. Allowed range is from 1 to 10000.
  22806. @item type
  22807. Set fractal type, can be default @code{carpet} or @code{triangle}.
  22808. @end table
  22809. @section zoneplate
  22810. Generate a zoneplate test video pattern.
  22811. This source accepts the following options:
  22812. @table @option
  22813. @item size, s
  22814. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  22815. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "320x240".
  22816. @item rate, r
  22817. Set frame rate, expressed as number of frames per second. Default
  22818. value is "25".
  22819. @item duration, d
  22820. Set the duration of the sourced video. See
  22821. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  22822. for the accepted syntax.
  22823. If not specified, or the expressed duration is negative, the video is
  22824. supposed to be generated forever.
  22825. @item sar
  22826. Set the sample aspect ratio of the sourced video.
  22827. @item precision
  22828. Set precision in bits for look-up table for sine calculations. Default value is 10.
  22829. Allowed range is from 4 to 16.
  22830. @item xo
  22831. Set horizontal axis offset for output signal. Default value is 0.
  22832. @item yo
  22833. Set vertical axis offset for output signal. Default value is 0.
  22834. @item to
  22835. Set time axis offset for output signal. Default value is 0.
  22836. @item k0
  22837. Set 0-order, constant added to signal phase. Default value is 0.
  22838. @item kx
  22839. Set 1-order, phase factor multiplier for horizontal axis. Default value is 0.
  22840. @item ky
  22841. Set 1-order, phase factor multiplier for vertical axis. Default value is 0.
  22842. @item kt
  22843. Set 1-order, phase factor multiplier for time axis. Default value is 0.
  22844. @item kxt, kyt, kxy
  22845. Set phase factor multipliers for combination of spatial and temporal axis.
  22846. Default value is 0.
  22847. @item kx2
  22848. Set 2-order, phase factor multiplier for horizontal axis. Default value is 0.
  22849. @item ky2
  22850. Set 2-order, phase factor multiplier for vertical axis. Default value is 0.
  22851. @item kt2
  22852. Set 2-order, phase factor multiplier for time axis. Default value is 0.
  22853. @item ku
  22854. Set the constant added to final phase to produce chroma-blue component of signal.
  22855. Default value is 0.
  22856. @item kv
  22857. Set the constant added to final phase to produce chroma-red component of signal.
  22858. Default value is 0.
  22859. @end table
  22860. @subsection Commands
  22861. This source supports the some above options as @ref{commands}.
  22862. @subsection Examples
  22863. @itemize
  22864. @item
  22865. Generate horizontal color sine sweep:
  22866. @example
  22867. zoneplate=ku=512:kv=0:kt2=0:kx2=256:s=wvga:xo=-426:kt=11
  22868. @end example
  22869. @item
  22870. Generate vertical color sine sweep:
  22871. @example
  22872. zoneplate=ku=512:kv=0:kt2=0:ky2=156:s=wvga:yo=-240:kt=11
  22873. @end example
  22874. @item
  22875. Generate circular zone-plate:
  22876. @example
  22877. zoneplate=ku=512:kv=100:kt2=0:ky2=256:kx2=556:s=wvga:yo=0:kt=11
  22878. @end example
  22879. @end itemize
  22880. @c man end VIDEO SOURCES
  22881. @chapter Video Sinks
  22882. @c man begin VIDEO SINKS
  22883. Below is a description of the currently available video sinks.
  22884. @section buffersink
  22885. Buffer video frames, and make them available to the end of the filter
  22886. graph.
  22887. This sink is mainly intended for programmatic use, in particular
  22888. through the interface defined in @file{libavfilter/buffersink.h}
  22889. or the options system.
  22890. It accepts a pointer to an AVBufferSinkContext structure, which
  22891. defines the incoming buffers' formats, to be passed as the opaque
  22892. parameter to @code{avfilter_init_filter} for initialization.
  22893. @section nullsink
  22894. Null video sink: do absolutely nothing with the input video. It is
  22895. mainly useful as a template and for use in analysis / debugging
  22896. tools.
  22897. @c man end VIDEO SINKS
  22898. @chapter Multimedia Filters
  22899. @c man begin MULTIMEDIA FILTERS
  22900. Below is a description of the currently available multimedia filters.
  22901. @section a3dscope
  22902. Convert input audio to 3d scope video output.
  22903. The filter accepts the following options:
  22904. @table @option
  22905. @item rate, r
  22906. Set frame rate, expressed as number of frames per second. Default
  22907. value is "25".
  22908. @item size, s
  22909. Specify the video size for the output. For the syntax of this option, check the
  22910. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22911. Default value is @code{hd720}.
  22912. @item fov
  22913. Set the camera field of view. Default is 90 degrees.
  22914. Allowed range is from 40 to 150.
  22915. @item roll
  22916. Set the camera roll.
  22917. @item pitch
  22918. Set the camera pitch.
  22919. @item yaw
  22920. Set the camera yaw.
  22921. @item xzoom
  22922. Set the camera zoom on X-axis.
  22923. @item yzoom
  22924. Set the camera zoom on Y-axis.
  22925. @item zzoom
  22926. Set the camera zoom on Z-axis.
  22927. @item xpos
  22928. Set the camera position on X-axis.
  22929. @item ypos
  22930. Set the camera position on Y-axis.
  22931. @item zpos
  22932. Set the camera position on Z-axis.
  22933. @item length
  22934. Set the length of displayed audio waves in number of frames.
  22935. @end table
  22936. @subsection Commands
  22937. Filter supports the some above options as @ref{commands}.
  22938. @section abitscope
  22939. Convert input audio to a video output, displaying the audio bit scope.
  22940. The filter accepts the following options:
  22941. @table @option
  22942. @item rate, r
  22943. Set frame rate, expressed as number of frames per second. Default
  22944. value is "25".
  22945. @item size, s
  22946. Specify the video size for the output. For the syntax of this option, check the
  22947. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22948. Default value is @code{1024x256}.
  22949. @item colors
  22950. Specify list of colors separated by space or by '|' which will be used to
  22951. draw channels. Unrecognized or missing colors will be replaced
  22952. by white color.
  22953. @item mode, m
  22954. Set output mode. Can be @code{bars} or @code{trace}. Default is @code{bars}.
  22955. @end table
  22956. @section adrawgraph
  22957. Draw a graph using input audio metadata.
  22958. See @ref{drawgraph}
  22959. @section agraphmonitor
  22960. See @ref{graphmonitor}.
  22961. @section ahistogram
  22962. Convert input audio to a video output, displaying the volume histogram.
  22963. The filter accepts the following options:
  22964. @table @option
  22965. @item dmode
  22966. Specify how histogram is calculated.
  22967. It accepts the following values:
  22968. @table @samp
  22969. @item single
  22970. Use single histogram for all channels.
  22971. @item separate
  22972. Use separate histogram for each channel.
  22973. @end table
  22974. Default is @code{single}.
  22975. @item rate, r
  22976. Set frame rate, expressed as number of frames per second. Default
  22977. value is "25".
  22978. @item size, s
  22979. Specify the video size for the output. For the syntax of this option, check the
  22980. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  22981. Default value is @code{hd720}.
  22982. @item scale
  22983. Set display scale.
  22984. It accepts the following values:
  22985. @table @samp
  22986. @item log
  22987. logarithmic
  22988. @item sqrt
  22989. square root
  22990. @item cbrt
  22991. cubic root
  22992. @item lin
  22993. linear
  22994. @item rlog
  22995. reverse logarithmic
  22996. @end table
  22997. Default is @code{log}.
  22998. @item ascale
  22999. Set amplitude scale.
  23000. It accepts the following values:
  23001. @table @samp
  23002. @item log
  23003. logarithmic
  23004. @item lin
  23005. linear
  23006. @end table
  23007. Default is @code{log}.
  23008. @item acount
  23009. Set how much frames to accumulate in histogram.
  23010. Default is 1. Setting this to -1 accumulates all frames.
  23011. @item rheight
  23012. Set histogram ratio of window height.
  23013. @item slide
  23014. Set sonogram sliding.
  23015. It accepts the following values:
  23016. @table @samp
  23017. @item replace
  23018. replace old rows with new ones.
  23019. @item scroll
  23020. scroll from top to bottom.
  23021. @end table
  23022. Default is @code{replace}.
  23023. @item hmode
  23024. Set histogram mode.
  23025. It accepts the following values:
  23026. @table @samp
  23027. @item abs
  23028. Use absolute values of samples.
  23029. @item sign
  23030. Use untouched values of samples.
  23031. @end table
  23032. Default is @code{abs}.
  23033. @end table
  23034. @section aphasemeter
  23035. Measures phase of input audio, which is exported as metadata @code{lavfi.aphasemeter.phase},
  23036. representing mean phase of current audio frame. A video output can also be produced and is
  23037. enabled by default. The audio is passed through as first output.
  23038. Audio will be rematrixed to stereo if it has a different channel layout. Phase value is in
  23039. range @code{[-1, 1]} where @code{-1} means left and right channels are completely out of phase
  23040. and @code{1} means channels are in phase.
  23041. The filter accepts the following options, all related to its video output:
  23042. @table @option
  23043. @item rate, r
  23044. Set the output frame rate. Default value is @code{25}.
  23045. @item size, s
  23046. Set the video size for the output. For the syntax of this option, check the
  23047. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23048. Default value is @code{800x400}.
  23049. @item rc
  23050. @item gc
  23051. @item bc
  23052. Specify the red, green, blue contrast. Default values are @code{2},
  23053. @code{7} and @code{1}.
  23054. Allowed range is @code{[0, 255]}.
  23055. @item mpc
  23056. Set color which will be used for drawing median phase. If color is
  23057. @code{none} which is default, no median phase value will be drawn.
  23058. @item video
  23059. Enable video output. Default is enabled.
  23060. @end table
  23061. @subsection phasing detection
  23062. The filter also detects out of phase and mono sequences in stereo streams.
  23063. It logs the sequence start, end and duration when it lasts longer or as long as the minimum set.
  23064. The filter accepts the following options for this detection:
  23065. @table @option
  23066. @item phasing
  23067. Enable mono and out of phase detection. Default is disabled.
  23068. @item tolerance, t
  23069. Set phase tolerance for mono detection, in amplitude ratio. Default is @code{0}.
  23070. Allowed range is @code{[0, 1]}.
  23071. @item angle, a
  23072. Set angle threshold for out of phase detection, in degree. Default is @code{170}.
  23073. Allowed range is @code{[90, 180]}.
  23074. @item duration, d
  23075. Set mono or out of phase duration until notification, expressed in seconds. Default is @code{2}.
  23076. @end table
  23077. @subsection Examples
  23078. @itemize
  23079. @item
  23080. Complete example with @command{ffmpeg} to detect 1 second of mono with 0.001 phase tolerance:
  23081. @example
  23082. ffmpeg -i stereo.wav -af aphasemeter=video=0:phasing=1:duration=1:tolerance=0.001 -f null -
  23083. @end example
  23084. @end itemize
  23085. @section avectorscope
  23086. Convert input audio to a video output, representing the audio vector
  23087. scope.
  23088. The filter is used to measure the difference between channels of stereo
  23089. audio stream. A monaural signal, consisting of identical left and right
  23090. signal, results in straight vertical line. Any stereo separation is visible
  23091. as a deviation from this line, creating a Lissajous figure.
  23092. If the straight (or deviation from it) but horizontal line appears this
  23093. indicates that the left and right channels are out of phase.
  23094. The filter accepts the following options:
  23095. @table @option
  23096. @item mode, m
  23097. Set the vectorscope mode.
  23098. Available values are:
  23099. @table @samp
  23100. @item lissajous
  23101. Lissajous rotated by 45 degrees.
  23102. @item lissajous_xy
  23103. Same as above but not rotated.
  23104. @item polar
  23105. Shape resembling half of circle.
  23106. @end table
  23107. Default value is @samp{lissajous}.
  23108. @item size, s
  23109. Set the video size for the output. For the syntax of this option, check the
  23110. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23111. Default value is @code{400x400}.
  23112. @item rate, r
  23113. Set the output frame rate. Default value is @code{25}.
  23114. @item rc
  23115. @item gc
  23116. @item bc
  23117. @item ac
  23118. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  23119. @code{160}, @code{80} and @code{255}.
  23120. Allowed range is @code{[0, 255]}.
  23121. @item rf
  23122. @item gf
  23123. @item bf
  23124. @item af
  23125. Specify the red, green, blue and alpha fade. Default values are @code{15},
  23126. @code{10}, @code{5} and @code{5}.
  23127. Allowed range is @code{[0, 255]}.
  23128. @item zoom
  23129. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  23130. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  23131. @item draw
  23132. Set the vectorscope drawing mode.
  23133. Available values are:
  23134. @table @samp
  23135. @item dot
  23136. Draw dot for each sample.
  23137. @item line
  23138. Draw line between previous and current sample.
  23139. @item aaline
  23140. Draw anti-aliased line between previous and current sample.
  23141. @end table
  23142. Default value is @samp{dot}.
  23143. @item scale
  23144. Specify amplitude scale of audio samples.
  23145. Available values are:
  23146. @table @samp
  23147. @item lin
  23148. Linear.
  23149. @item sqrt
  23150. Square root.
  23151. @item cbrt
  23152. Cubic root.
  23153. @item log
  23154. Logarithmic.
  23155. @end table
  23156. @item swap
  23157. Swap left channel axis with right channel axis.
  23158. @item mirror
  23159. Mirror axis.
  23160. @table @samp
  23161. @item none
  23162. No mirror.
  23163. @item x
  23164. Mirror only x axis.
  23165. @item y
  23166. Mirror only y axis.
  23167. @item xy
  23168. Mirror both axis.
  23169. @end table
  23170. @end table
  23171. @subsection Examples
  23172. @itemize
  23173. @item
  23174. Complete example using @command{ffplay}:
  23175. @example
  23176. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  23177. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  23178. @end example
  23179. @end itemize
  23180. @subsection Commands
  23181. This filter supports the all above options as commands except options @code{size} and @code{rate}.
  23182. @section bench, abench
  23183. Benchmark part of a filtergraph.
  23184. The filter accepts the following options:
  23185. @table @option
  23186. @item action
  23187. Start or stop a timer.
  23188. Available values are:
  23189. @table @samp
  23190. @item start
  23191. Get the current time, set it as frame metadata (using the key
  23192. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  23193. @item stop
  23194. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  23195. the input frame metadata to get the time difference. Time difference, average,
  23196. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  23197. @code{min}) are then printed. The timestamps are expressed in seconds.
  23198. @end table
  23199. @end table
  23200. @subsection Examples
  23201. @itemize
  23202. @item
  23203. Benchmark @ref{selectivecolor} filter:
  23204. @example
  23205. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  23206. @end example
  23207. @end itemize
  23208. @section concat
  23209. Concatenate audio and video streams, joining them together one after the
  23210. other.
  23211. The filter works on segments of synchronized video and audio streams. All
  23212. segments must have the same number of streams of each type, and that will
  23213. also be the number of streams at output.
  23214. The filter accepts the following options:
  23215. @table @option
  23216. @item n
  23217. Set the number of segments. Default is 2.
  23218. @item v
  23219. Set the number of output video streams, that is also the number of video
  23220. streams in each segment. Default is 1.
  23221. @item a
  23222. Set the number of output audio streams, that is also the number of audio
  23223. streams in each segment. Default is 0.
  23224. @item unsafe
  23225. Activate unsafe mode: do not fail if segments have a different format.
  23226. @end table
  23227. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  23228. @var{a} audio outputs.
  23229. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  23230. segment, in the same order as the outputs, then the inputs for the second
  23231. segment, etc.
  23232. Related streams do not always have exactly the same duration, for various
  23233. reasons including codec frame size or sloppy authoring. For that reason,
  23234. related synchronized streams (e.g. a video and its audio track) should be
  23235. concatenated at once. The concat filter will use the duration of the longest
  23236. stream in each segment (except the last one), and if necessary pad shorter
  23237. audio streams with silence.
  23238. For this filter to work correctly, all segments must start at timestamp 0.
  23239. All corresponding streams must have the same parameters in all segments; the
  23240. filtering system will automatically select a common pixel format for video
  23241. streams, and a common sample format, sample rate and channel layout for
  23242. audio streams, but other settings, such as resolution, must be converted
  23243. explicitly by the user.
  23244. Different frame rates are acceptable but will result in variable frame rate
  23245. at output; be sure to configure the output file to handle it.
  23246. @subsection Examples
  23247. @itemize
  23248. @item
  23249. Concatenate an opening, an episode and an ending, all in bilingual version
  23250. (video in stream 0, audio in streams 1 and 2):
  23251. @example
  23252. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  23253. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  23254. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  23255. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  23256. @end example
  23257. @item
  23258. Concatenate two parts, handling audio and video separately, using the
  23259. (a)movie sources, and adjusting the resolution:
  23260. @example
  23261. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  23262. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  23263. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  23264. @end example
  23265. Note that a desync will happen at the stitch if the audio and video streams
  23266. do not have exactly the same duration in the first file.
  23267. @end itemize
  23268. @subsection Commands
  23269. This filter supports the following commands:
  23270. @table @option
  23271. @item next
  23272. Close the current segment and step to the next one
  23273. @end table
  23274. @anchor{ebur128}
  23275. @section ebur128
  23276. EBU R128 scanner filter. This filter takes an audio stream and analyzes its loudness
  23277. level. By default, it logs a message at a frequency of 10Hz with the
  23278. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  23279. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  23280. The filter can only analyze streams which have
  23281. sample format is double-precision floating point. The input stream will be converted to
  23282. this specification, if needed. Users may need to insert aformat and/or aresample filters
  23283. after this filter to obtain the original parameters.
  23284. The filter also has a video output (see the @var{video} option) with a real
  23285. time graph to observe the loudness evolution. The graphic contains the logged
  23286. message mentioned above, so it is not printed anymore when this option is set,
  23287. unless the verbose logging is set. The main graphing area contains the
  23288. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  23289. the momentary loudness (400 milliseconds), but can optionally be configured
  23290. to instead display short-term loudness (see @var{gauge}).
  23291. The green area marks a +/- 1LU target range around the target loudness
  23292. (-23LUFS by default, unless modified through @var{target}).
  23293. More information about the Loudness Recommendation EBU R128 on
  23294. @url{http://tech.ebu.ch/loudness}.
  23295. The filter accepts the following options:
  23296. @table @option
  23297. @item video
  23298. Activate the video output. The audio stream is passed unchanged whether this
  23299. option is set or no. The video stream will be the first output stream if
  23300. activated. Default is @code{0}.
  23301. @item size
  23302. Set the video size. This option is for video only. For the syntax of this
  23303. option, check the
  23304. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  23305. Default and minimum resolution is @code{640x480}.
  23306. @item meter
  23307. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  23308. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  23309. other integer value between this range is allowed.
  23310. @item metadata
  23311. Set metadata injection. If set to @code{1}, the audio input will be segmented
  23312. into 100ms output frames, each of them containing various loudness information
  23313. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  23314. Default is @code{0}.
  23315. @item framelog
  23316. Force the frame logging level.
  23317. Available values are:
  23318. @table @samp
  23319. @item quiet
  23320. logging disabled
  23321. @item info
  23322. information logging level
  23323. @item verbose
  23324. verbose logging level
  23325. @end table
  23326. By default, the logging level is set to @var{info}. If the @option{video} or
  23327. the @option{metadata} options are set, it switches to @var{verbose}.
  23328. @item peak
  23329. Set peak mode(s).
  23330. Available modes can be cumulated (the option is a @code{flag} type). Possible
  23331. values are:
  23332. @table @samp
  23333. @item none
  23334. Disable any peak mode (default).
  23335. @item sample
  23336. Enable sample-peak mode.
  23337. Simple peak mode looking for the higher sample value. It logs a message
  23338. for sample-peak (identified by @code{SPK}).
  23339. @item true
  23340. Enable true-peak mode.
  23341. If enabled, the peak lookup is done on an over-sampled version of the input
  23342. stream for better peak accuracy. It logs a message for true-peak.
  23343. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  23344. This mode requires a build with @code{libswresample}.
  23345. @end table
  23346. @item dualmono
  23347. Treat mono input files as "dual mono". If a mono file is intended for playback
  23348. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  23349. If set to @code{true}, this option will compensate for this effect.
  23350. Multi-channel input files are not affected by this option.
  23351. @item panlaw
  23352. Set a specific pan law to be used for the measurement of dual mono files.
  23353. This parameter is optional, and has a default value of -3.01dB.
  23354. @item target
  23355. Set a specific target level (in LUFS) used as relative zero in the visualization.
  23356. This parameter is optional and has a default value of -23LUFS as specified
  23357. by EBU R128. However, material published online may prefer a level of -16LUFS
  23358. (e.g. for use with podcasts or video platforms).
  23359. @item gauge
  23360. Set the value displayed by the gauge. Valid values are @code{momentary} and s
  23361. @code{shortterm}. By default the momentary value will be used, but in certain
  23362. scenarios it may be more useful to observe the short term value instead (e.g.
  23363. live mixing).
  23364. @item scale
  23365. Sets the display scale for the loudness. Valid parameters are @code{absolute}
  23366. (in LUFS) or @code{relative} (LU) relative to the target. This only affects the
  23367. video output, not the summary or continuous log output.
  23368. @item integrated
  23369. Read-only exported value for measured integrated loudness, in LUFS.
  23370. @item range
  23371. Read-only exported value for measured loudness range, in LU.
  23372. @item lra_low
  23373. Read-only exported value for measured LRA low, in LUFS.
  23374. @item lra_high
  23375. Read-only exported value for measured LRA high, in LUFS.
  23376. @item sample_peak
  23377. Read-only exported value for measured sample peak, in dBFS.
  23378. @item true_peak
  23379. Read-only exported value for measured true peak, in dBFS.
  23380. @end table
  23381. @subsection Examples
  23382. @itemize
  23383. @item
  23384. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  23385. @example
  23386. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  23387. @end example
  23388. @item
  23389. Run an analysis with @command{ffmpeg}:
  23390. @example
  23391. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  23392. @end example
  23393. @end itemize
  23394. @section interleave, ainterleave
  23395. Temporally interleave frames from several inputs.
  23396. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  23397. These filters read frames from several inputs and send the oldest
  23398. queued frame to the output.
  23399. Input streams must have well defined, monotonically increasing frame
  23400. timestamp values.
  23401. In order to submit one frame to output, these filters need to enqueue
  23402. at least one frame for each input, so they cannot work in case one
  23403. input is not yet terminated and will not receive incoming frames.
  23404. For example consider the case when one input is a @code{select} filter
  23405. which always drops input frames. The @code{interleave} filter will keep
  23406. reading from that input, but it will never be able to send new frames
  23407. to output until the input sends an end-of-stream signal.
  23408. Also, depending on inputs synchronization, the filters will drop
  23409. frames in case one input receives more frames than the other ones, and
  23410. the queue is already filled.
  23411. These filters accept the following options:
  23412. @table @option
  23413. @item nb_inputs, n
  23414. Set the number of different inputs, it is 2 by default.
  23415. @item duration
  23416. How to determine the end-of-stream.
  23417. @table @option
  23418. @item longest
  23419. The duration of the longest input. (default)
  23420. @item shortest
  23421. The duration of the shortest input.
  23422. @item first
  23423. The duration of the first input.
  23424. @end table
  23425. @end table
  23426. @subsection Examples
  23427. @itemize
  23428. @item
  23429. Interleave frames belonging to different streams using @command{ffmpeg}:
  23430. @example
  23431. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  23432. @end example
  23433. @item
  23434. Add flickering blur effect:
  23435. @example
  23436. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  23437. @end example
  23438. @end itemize
  23439. @section latency, alatency
  23440. Measure filtering latency.
  23441. Report previous filter filtering latency, delay in number of audio samples for audio filters
  23442. or number of video frames for video filters.
  23443. On end of input stream, filter will report min and max measured latency for previous running filter
  23444. in filtergraph.
  23445. @section metadata, ametadata
  23446. Manipulate frame metadata.
  23447. This filter accepts the following options:
  23448. @table @option
  23449. @item mode
  23450. Set mode of operation of the filter.
  23451. Can be one of the following:
  23452. @table @samp
  23453. @item select
  23454. If both @code{value} and @code{key} is set, select frames
  23455. which have such metadata. If only @code{key} is set, select
  23456. every frame that has such key in metadata.
  23457. @item add
  23458. Add new metadata @code{key} and @code{value}. If key is already available
  23459. do nothing.
  23460. @item modify
  23461. Modify value of already present key.
  23462. @item delete
  23463. If @code{value} is set, delete only keys that have such value.
  23464. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  23465. the frame.
  23466. @item print
  23467. Print key and its value if metadata was found. If @code{key} is not set print all
  23468. metadata values available in frame.
  23469. @end table
  23470. @item key
  23471. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  23472. @item value
  23473. Set metadata value which will be used. This option is mandatory for
  23474. @code{modify} and @code{add} mode.
  23475. @item function
  23476. Which function to use when comparing metadata value and @code{value}.
  23477. Can be one of following:
  23478. @table @samp
  23479. @item same_str
  23480. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  23481. @item starts_with
  23482. Values are interpreted as strings, returns true if metadata value starts with
  23483. the @code{value} option string.
  23484. @item less
  23485. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  23486. @item equal
  23487. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  23488. @item greater
  23489. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  23490. @item expr
  23491. Values are interpreted as floats, returns true if expression from option @code{expr}
  23492. evaluates to true.
  23493. @item ends_with
  23494. Values are interpreted as strings, returns true if metadata value ends with
  23495. the @code{value} option string.
  23496. @end table
  23497. @item expr
  23498. Set expression which is used when @code{function} is set to @code{expr}.
  23499. The expression is evaluated through the eval API and can contain the following
  23500. constants:
  23501. @table @option
  23502. @item VALUE1, FRAMEVAL
  23503. Float representation of @code{value} from metadata key.
  23504. @item VALUE2, USERVAL
  23505. Float representation of @code{value} as supplied by user in @code{value} option.
  23506. @end table
  23507. @item file
  23508. If specified in @code{print} mode, output is written to the named file. Instead of
  23509. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  23510. for standard output. If @code{file} option is not set, output is written to the log
  23511. with AV_LOG_INFO loglevel.
  23512. @item direct
  23513. Reduces buffering in print mode when output is written to a URL set using @var{file}.
  23514. @end table
  23515. @subsection Examples
  23516. @itemize
  23517. @item
  23518. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  23519. between 0 and 1.
  23520. @example
  23521. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  23522. @end example
  23523. @item
  23524. Print silencedetect output to file @file{metadata.txt}.
  23525. @example
  23526. silencedetect,ametadata=mode=print:file=metadata.txt
  23527. @end example
  23528. @item
  23529. Direct all metadata to a pipe with file descriptor 4.
  23530. @example
  23531. metadata=mode=print:file='pipe\:4'
  23532. @end example
  23533. @end itemize
  23534. @section perms, aperms
  23535. Set read/write permissions for the output frames.
  23536. These filters are mainly aimed at developers to test direct path in the
  23537. following filter in the filtergraph.
  23538. The filters accept the following options:
  23539. @table @option
  23540. @item mode
  23541. Select the permissions mode.
  23542. It accepts the following values:
  23543. @table @samp
  23544. @item none
  23545. Do nothing. This is the default.
  23546. @item ro
  23547. Set all the output frames read-only.
  23548. @item rw
  23549. Set all the output frames directly writable.
  23550. @item toggle
  23551. Make the frame read-only if writable, and writable if read-only.
  23552. @item random
  23553. Set each output frame read-only or writable randomly.
  23554. @end table
  23555. @item seed
  23556. Set the seed for the @var{random} mode, must be an integer included between
  23557. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  23558. @code{-1}, the filter will try to use a good random seed on a best effort
  23559. basis.
  23560. @end table
  23561. Note: in case of auto-inserted filter between the permission filter and the
  23562. following one, the permission might not be received as expected in that
  23563. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  23564. perms/aperms filter can avoid this problem.
  23565. @section realtime, arealtime
  23566. Slow down filtering to match real time approximately.
  23567. These filters will pause the filtering for a variable amount of time to
  23568. match the output rate with the input timestamps.
  23569. They are similar to the @option{re} option to @code{ffmpeg}.
  23570. They accept the following options:
  23571. @table @option
  23572. @item limit
  23573. Time limit for the pauses. Any pause longer than that will be considered
  23574. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  23575. @item speed
  23576. Speed factor for processing. The value must be a float larger than zero.
  23577. Values larger than 1.0 will result in faster than realtime processing,
  23578. smaller will slow processing down. The @var{limit} is automatically adapted
  23579. accordingly. Default is 1.0.
  23580. A processing speed faster than what is possible without these filters cannot
  23581. be achieved.
  23582. @end table
  23583. @subsection Commands
  23584. Both filters supports the all above options as @ref{commands}.
  23585. @section segment, asegment
  23586. Split single input stream into multiple streams.
  23587. This filter does opposite of concat filters.
  23588. @code{segment} works on video frames, @code{asegment} on audio samples.
  23589. This filter accepts the following options:
  23590. @table @option
  23591. @item timestamps
  23592. Timestamps of output segments separated by '|'. The first segment will run
  23593. from the beginning of the input stream. The last segment will run until
  23594. the end of the input stream
  23595. @item frames, samples
  23596. Exact frame/sample count to split the segments.
  23597. @end table
  23598. In all cases, prefixing an each segment with '+' will make it relative to the
  23599. previous segment.
  23600. @subsection Examples
  23601. @itemize
  23602. @item
  23603. Split input audio stream into three output audio streams, starting at start of input audio stream
  23604. and storing that in 1st output audio stream, then following at 60th second and storing than in 2nd
  23605. output audio stream, and last after 150th second of input audio stream store in 3rd output audio stream:
  23606. @example
  23607. asegment=timestamps="60|150"
  23608. @end example
  23609. @end itemize
  23610. @anchor{select}
  23611. @section select, aselect
  23612. Select frames to pass in output.
  23613. This filter accepts the following options:
  23614. @table @option
  23615. @item expr, e
  23616. Set expression, which is evaluated for each input frame.
  23617. If the expression is evaluated to zero, the frame is discarded.
  23618. If the evaluation result is negative or NaN, the frame is sent to the
  23619. first output; otherwise it is sent to the output with index
  23620. @code{ceil(val)-1}, assuming that the input index starts from 0.
  23621. For example a value of @code{1.2} corresponds to the output with index
  23622. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  23623. @item outputs, n
  23624. Set the number of outputs. The output to which to send the selected
  23625. frame is based on the result of the evaluation. Default value is 1.
  23626. @end table
  23627. The expression can contain the following constants:
  23628. @table @option
  23629. @item n
  23630. The (sequential) number of the filtered frame, starting from 0.
  23631. @item selected_n
  23632. The (sequential) number of the selected frame, starting from 0.
  23633. @item prev_selected_n
  23634. The sequential number of the last selected frame. It's NAN if undefined.
  23635. @item TB
  23636. The timebase of the input timestamps.
  23637. @item pts
  23638. The PTS (Presentation TimeStamp) of the filtered frame,
  23639. expressed in @var{TB} units. It's NAN if undefined.
  23640. @item t
  23641. The PTS of the filtered frame,
  23642. expressed in seconds. It's NAN if undefined.
  23643. @item prev_pts
  23644. The PTS of the previously filtered frame. It's NAN if undefined.
  23645. @item prev_selected_pts
  23646. The PTS of the last previously filtered frame. It's NAN if undefined.
  23647. @item prev_selected_t
  23648. The PTS of the last previously selected frame, expressed in seconds. It's NAN if undefined.
  23649. @item start_pts
  23650. The first PTS in the stream which is not NAN. It remains NAN if not found.
  23651. @item start_t
  23652. The first PTS, in seconds, in the stream which is not NAN. It remains NAN if not found.
  23653. @item pict_type @emph{(video only)}
  23654. The type of the filtered frame. It can assume one of the following
  23655. values:
  23656. @table @option
  23657. @item I
  23658. @item P
  23659. @item B
  23660. @item S
  23661. @item SI
  23662. @item SP
  23663. @item BI
  23664. @end table
  23665. @item interlace_type @emph{(video only)}
  23666. The frame interlace type. It can assume one of the following values:
  23667. @table @option
  23668. @item PROGRESSIVE
  23669. The frame is progressive (not interlaced).
  23670. @item TOPFIRST
  23671. The frame is top-field-first.
  23672. @item BOTTOMFIRST
  23673. The frame is bottom-field-first.
  23674. @end table
  23675. @item consumed_sample_n @emph{(audio only)}
  23676. the number of selected samples before the current frame
  23677. @item samples_n @emph{(audio only)}
  23678. the number of samples in the current frame
  23679. @item sample_rate @emph{(audio only)}
  23680. the input sample rate
  23681. @item key
  23682. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  23683. @item pos
  23684. the position in the file of the filtered frame, -1 if the information
  23685. is not available (e.g. for synthetic video); deprecated, do not use
  23686. @item scene @emph{(video only)}
  23687. value between 0 and 1 to indicate a new scene; a low value reflects a low
  23688. probability for the current frame to introduce a new scene, while a higher
  23689. value means the current frame is more likely to be one (see the example below)
  23690. @item concatdec_select
  23691. The concat demuxer can select only part of a concat input file by setting an
  23692. inpoint and an outpoint, but the output packets may not be entirely contained
  23693. in the selected interval. By using this variable, it is possible to skip frames
  23694. generated by the concat demuxer which are not exactly contained in the selected
  23695. interval.
  23696. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  23697. and the @var{lavf.concat.duration} packet metadata values which are also
  23698. present in the decoded frames.
  23699. The @var{concatdec_select} variable is -1 if the frame pts is at least
  23700. start_time and either the duration metadata is missing or the frame pts is less
  23701. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  23702. missing.
  23703. That basically means that an input frame is selected if its pts is within the
  23704. interval set by the concat demuxer.
  23705. @item iw @emph{(video only)}
  23706. Represents the width of the input video frame.
  23707. @item ih @emph{(video only)}
  23708. Represents the height of the input video frame.
  23709. @item view @emph{(video only)}
  23710. View ID for multi-view video.
  23711. @end table
  23712. The default value of the select expression is "1".
  23713. @subsection Examples
  23714. @itemize
  23715. @item
  23716. Select all frames in input:
  23717. @example
  23718. select
  23719. @end example
  23720. The example above is the same as:
  23721. @example
  23722. select=1
  23723. @end example
  23724. @item
  23725. Skip all frames:
  23726. @example
  23727. select=0
  23728. @end example
  23729. @item
  23730. Select only I-frames:
  23731. @example
  23732. select='eq(pict_type\,I)'
  23733. @end example
  23734. @item
  23735. Select one frame every 100:
  23736. @example
  23737. select='not(mod(n\,100))'
  23738. @end example
  23739. @item
  23740. Select only frames contained in the 10-20 time interval:
  23741. @example
  23742. select=between(t\,10\,20)
  23743. @end example
  23744. @item
  23745. Select only I-frames contained in the 10-20 time interval:
  23746. @example
  23747. select=between(t\,10\,20)*eq(pict_type\,I)
  23748. @end example
  23749. @item
  23750. Select frames with a minimum distance of 10 seconds:
  23751. @example
  23752. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  23753. @end example
  23754. @item
  23755. Use aselect to select only audio frames with samples number > 100:
  23756. @example
  23757. aselect='gt(samples_n\,100)'
  23758. @end example
  23759. @item
  23760. Create a mosaic of the first scenes:
  23761. @example
  23762. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  23763. @end example
  23764. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  23765. choice.
  23766. @item
  23767. Send even and odd frames to separate outputs, and compose them:
  23768. @example
  23769. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  23770. @end example
  23771. @item
  23772. Select useful frames from an ffconcat file which is using inpoints and
  23773. outpoints but where the source files are not intra frame only.
  23774. @example
  23775. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  23776. @end example
  23777. @end itemize
  23778. @section sendcmd, asendcmd
  23779. Send commands to filters in the filtergraph.
  23780. These filters read commands to be sent to other filters in the
  23781. filtergraph.
  23782. @code{sendcmd} must be inserted between two video filters,
  23783. @code{asendcmd} must be inserted between two audio filters, but apart
  23784. from that they act the same way.
  23785. The specification of commands can be provided in the filter arguments
  23786. with the @var{commands} option, or in a file specified by the
  23787. @var{filename} option.
  23788. These filters accept the following options:
  23789. @table @option
  23790. @item commands, c
  23791. Set the commands to be read and sent to the other filters.
  23792. @item filename, f
  23793. Set the filename of the commands to be read and sent to the other
  23794. filters.
  23795. @end table
  23796. @subsection Commands syntax
  23797. A commands description consists of a sequence of interval
  23798. specifications, comprising a list of commands to be executed when a
  23799. particular event related to that interval occurs. The occurring event
  23800. is typically the current frame time entering or leaving a given time
  23801. interval.
  23802. An interval is specified by the following syntax:
  23803. @example
  23804. @var{START}[-@var{END}] @var{COMMANDS};
  23805. @end example
  23806. The time interval is specified by the @var{START} and @var{END} times.
  23807. @var{END} is optional and defaults to the maximum time.
  23808. The current frame time is considered within the specified interval if
  23809. it is included in the interval [@var{START}, @var{END}), that is when
  23810. the time is greater or equal to @var{START} and is lesser than
  23811. @var{END}.
  23812. @var{COMMANDS} consists of a sequence of one or more command
  23813. specifications, separated by ",", relating to that interval. The
  23814. syntax of a command specification is given by:
  23815. @example
  23816. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  23817. @end example
  23818. @var{FLAGS} is optional and specifies the type of events relating to
  23819. the time interval which enable sending the specified command, and must
  23820. be a non-null sequence of identifier flags separated by "+" or "|" and
  23821. enclosed between "[" and "]".
  23822. The following flags are recognized:
  23823. @table @option
  23824. @item enter
  23825. The command is sent when the current frame timestamp enters the
  23826. specified interval. In other words, the command is sent when the
  23827. previous frame timestamp was not in the given interval, and the
  23828. current is.
  23829. @item leave
  23830. The command is sent when the current frame timestamp leaves the
  23831. specified interval. In other words, the command is sent when the
  23832. previous frame timestamp was in the given interval, and the
  23833. current is not.
  23834. @item expr
  23835. The command @var{ARG} is interpreted as expression and result of
  23836. expression is passed as @var{ARG}.
  23837. The expression is evaluated through the eval API and can contain the following
  23838. constants:
  23839. @table @option
  23840. @item POS
  23841. Original position in the file of the frame, or undefined if undefined
  23842. for the current frame. Deprecated, do not use.
  23843. @item PTS
  23844. The presentation timestamp in input.
  23845. @item N
  23846. The count of the input frame for video or audio, starting from 0.
  23847. @item T
  23848. The time in seconds of the current frame.
  23849. @item TS
  23850. The start time in seconds of the current command interval.
  23851. @item TE
  23852. The end time in seconds of the current command interval.
  23853. @item TI
  23854. The interpolated time of the current command interval, TI = (T - TS) / (TE - TS).
  23855. @item W
  23856. The video frame width.
  23857. @item H
  23858. The video frame height.
  23859. @end table
  23860. @end table
  23861. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  23862. assumed.
  23863. @var{TARGET} specifies the target of the command, usually the name of
  23864. the filter class or a specific filter instance name.
  23865. @var{COMMAND} specifies the name of the command for the target filter.
  23866. @var{ARG} is optional and specifies the optional list of argument for
  23867. the given @var{COMMAND}.
  23868. Between one interval specification and another, whitespaces, or
  23869. sequences of characters starting with @code{#} until the end of line,
  23870. are ignored and can be used to annotate comments.
  23871. A simplified BNF description of the commands specification syntax
  23872. follows:
  23873. @example
  23874. @var{COMMAND_FLAG} ::= "enter" | "leave"
  23875. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  23876. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  23877. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  23878. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  23879. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  23880. @end example
  23881. @subsection Examples
  23882. @itemize
  23883. @item
  23884. Specify audio tempo change at second 4:
  23885. @example
  23886. asendcmd=c='4.0 atempo tempo 1.5',atempo
  23887. @end example
  23888. @item
  23889. Target a specific filter instance:
  23890. @example
  23891. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  23892. @end example
  23893. @item
  23894. Specify a list of drawtext and hue commands in a file.
  23895. @example
  23896. # show text in the interval 5-10
  23897. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  23898. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  23899. # desaturate the image in the interval 15-20
  23900. 15.0-20.0 [enter] hue s 0,
  23901. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  23902. [leave] hue s 1,
  23903. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  23904. # apply an exponential saturation fade-out effect, starting from time 25
  23905. 25 [enter] hue s exp(25-t)
  23906. @end example
  23907. A filtergraph allowing to read and process the above command list
  23908. stored in a file @file{test.cmd}, can be specified with:
  23909. @example
  23910. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  23911. @end example
  23912. @end itemize
  23913. @anchor{setpts}
  23914. @section setpts, asetpts
  23915. Change the PTS (presentation timestamp) of the input frames.
  23916. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  23917. This filter accepts the following options:
  23918. @table @option
  23919. @item expr
  23920. The expression which is evaluated for each frame to construct its timestamp.
  23921. @item strip_fps (@emph{video only})
  23922. Boolean option which determines if the original framerate metadata is unset.
  23923. If set to true, be advised that a sane frame rate should be explicitly
  23924. specified if output is sent to a constant frame rate muxer.
  23925. Default is @code{false}.
  23926. @end table
  23927. The expression is evaluated through the eval API and can contain the following
  23928. constants:
  23929. @table @option
  23930. @item FRAME_RATE, FR
  23931. frame rate, only defined for constant frame-rate video
  23932. @item PTS
  23933. The presentation timestamp in input
  23934. @item N
  23935. The count of the input frame for video or the number of consumed samples,
  23936. not including the current frame for audio, starting from 0.
  23937. @item NB_CONSUMED_SAMPLES
  23938. The number of consumed samples, not including the current frame (only
  23939. audio)
  23940. @item NB_SAMPLES, S
  23941. The number of samples in the current frame (only audio)
  23942. @item SAMPLE_RATE, SR
  23943. The audio sample rate.
  23944. @item STARTPTS
  23945. The PTS of the first frame.
  23946. @item STARTT
  23947. the time in seconds of the first frame
  23948. @item INTERLACED
  23949. State whether the current frame is interlaced.
  23950. @item T
  23951. the time in seconds of the current frame
  23952. @item POS
  23953. original position in the file of the frame, or undefined if undefined
  23954. for the current frame; deprecated, do not use
  23955. @item PREV_INPTS
  23956. The previous input PTS.
  23957. @item PREV_INT
  23958. previous input time in seconds
  23959. @item PREV_OUTPTS
  23960. The previous output PTS.
  23961. @item PREV_OUTT
  23962. previous output time in seconds
  23963. @item RTCTIME
  23964. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  23965. instead.
  23966. @item RTCSTART
  23967. The wallclock (RTC) time at the start of the movie in microseconds.
  23968. @item TB
  23969. The timebase of the input timestamps.
  23970. @item T_CHANGE
  23971. Time of the first frame after command was applied or time of the first frame if no commands.
  23972. @end table
  23973. @subsection Examples
  23974. @itemize
  23975. @item
  23976. Start counting PTS from zero
  23977. @example
  23978. setpts=PTS-STARTPTS
  23979. @end example
  23980. @item
  23981. Apply fast motion effect:
  23982. @example
  23983. setpts=0.5*PTS
  23984. @end example
  23985. @item
  23986. Apply slow motion effect:
  23987. @example
  23988. setpts=2.0*PTS
  23989. @end example
  23990. @item
  23991. Set fixed rate of 25 frames per second:
  23992. @example
  23993. setpts=N/(25*TB)
  23994. @end example
  23995. @item
  23996. Apply a random jitter effect of +/-100 TB units:
  23997. @example
  23998. setpts=PTS+randomi(0, -100\,100)
  23999. @end example
  24000. @item
  24001. Set fixed rate 25 fps with some jitter:
  24002. @example
  24003. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  24004. @end example
  24005. @item
  24006. Apply an offset of 10 seconds to the input PTS:
  24007. @example
  24008. setpts=PTS+10/TB
  24009. @end example
  24010. @item
  24011. Generate timestamps from a "live source" and rebase onto the current timebase:
  24012. @example
  24013. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  24014. @end example
  24015. @item
  24016. Generate timestamps by counting samples:
  24017. @example
  24018. asetpts=N/SR/TB
  24019. @end example
  24020. @end itemize
  24021. @subsection Commands
  24022. Both filters support all above options as @ref{commands}.
  24023. @section setrange
  24024. Force color range for the output video frame.
  24025. The @code{setrange} filter marks the color range property for the
  24026. output frames. It does not change the input frame, but only sets the
  24027. corresponding property, which affects how the frame is treated by
  24028. following filters.
  24029. The filter accepts the following options:
  24030. @table @option
  24031. @item range
  24032. Available values are:
  24033. @table @samp
  24034. @item auto
  24035. Keep the same color range property.
  24036. @item unspecified, unknown
  24037. Set the color range as unspecified.
  24038. @item limited, tv, mpeg
  24039. Set the color range as limited.
  24040. @item full, pc, jpeg
  24041. Set the color range as full.
  24042. @end table
  24043. @end table
  24044. @section settb, asettb
  24045. Set the timebase to use for the output frames timestamps.
  24046. It is mainly useful for testing timebase configuration.
  24047. It accepts the following parameters:
  24048. @table @option
  24049. @item expr, tb
  24050. The expression which is evaluated into the output timebase.
  24051. @end table
  24052. The value for @option{tb} is an arithmetic expression representing a
  24053. rational. The expression can contain the constants "AVTB" (the default
  24054. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  24055. audio only). Default value is "intb".
  24056. @subsection Examples
  24057. @itemize
  24058. @item
  24059. Set the timebase to 1/25:
  24060. @example
  24061. settb=expr=1/25
  24062. @end example
  24063. @item
  24064. Set the timebase to 1/10:
  24065. @example
  24066. settb=expr=0.1
  24067. @end example
  24068. @item
  24069. Set the timebase to 1001/1000:
  24070. @example
  24071. settb=1+0.001
  24072. @end example
  24073. @item
  24074. Set the timebase to 2*intb:
  24075. @example
  24076. settb=2*intb
  24077. @end example
  24078. @item
  24079. Set the default timebase value:
  24080. @example
  24081. settb=AVTB
  24082. @end example
  24083. @end itemize
  24084. @section showcqt
  24085. Convert input audio to a video output representing frequency spectrum
  24086. logarithmically using Brown-Puckette constant Q transform algorithm with
  24087. direct frequency domain coefficient calculation (but the transform itself
  24088. is not really constant Q, instead the Q factor is actually variable/clamped),
  24089. with musical tone scale, from E0 to D#10.
  24090. The filter accepts the following options:
  24091. @table @option
  24092. @item size, s
  24093. Specify the video size for the output. It must be even. For the syntax of this option,
  24094. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24095. Default value is @code{1920x1080}.
  24096. @item fps, rate, r
  24097. Set the output frame rate. Default value is @code{25}.
  24098. @item bar_h
  24099. Set the bargraph height. It must be even. Default value is @code{-1} which
  24100. computes the bargraph height automatically.
  24101. @item axis_h
  24102. Set the axis height. It must be even. Default value is @code{-1} which computes
  24103. the axis height automatically.
  24104. @item sono_h
  24105. Set the sonogram height. It must be even. Default value is @code{-1} which
  24106. computes the sonogram height automatically.
  24107. @item fullhd
  24108. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  24109. instead. Default value is @code{1}.
  24110. @item sono_v, volume
  24111. Specify the sonogram volume expression. It can contain variables:
  24112. @table @option
  24113. @item bar_v
  24114. the @var{bar_v} evaluated expression
  24115. @item frequency, freq, f
  24116. the frequency where it is evaluated
  24117. @item timeclamp, tc
  24118. the value of @var{timeclamp} option
  24119. @end table
  24120. and functions:
  24121. @table @option
  24122. @item a_weighting(f)
  24123. A-weighting of equal loudness
  24124. @item b_weighting(f)
  24125. B-weighting of equal loudness
  24126. @item c_weighting(f)
  24127. C-weighting of equal loudness.
  24128. @end table
  24129. Default value is @code{16}.
  24130. @item bar_v, volume2
  24131. Specify the bargraph volume expression. It can contain variables:
  24132. @table @option
  24133. @item sono_v
  24134. the @var{sono_v} evaluated expression
  24135. @item frequency, freq, f
  24136. the frequency where it is evaluated
  24137. @item timeclamp, tc
  24138. the value of @var{timeclamp} option
  24139. @end table
  24140. and functions:
  24141. @table @option
  24142. @item a_weighting(f)
  24143. A-weighting of equal loudness
  24144. @item b_weighting(f)
  24145. B-weighting of equal loudness
  24146. @item c_weighting(f)
  24147. C-weighting of equal loudness.
  24148. @end table
  24149. Default value is @code{sono_v}.
  24150. @item sono_g, gamma
  24151. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  24152. higher gamma makes the spectrum having more range. Default value is @code{3}.
  24153. Acceptable range is @code{[1, 7]}.
  24154. @item bar_g, gamma2
  24155. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  24156. @code{[1, 7]}.
  24157. @item bar_t
  24158. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  24159. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  24160. @item timeclamp, tc
  24161. Specify the transform timeclamp. At low frequency, there is trade-off between
  24162. accuracy in time domain and frequency domain. If timeclamp is lower,
  24163. event in time domain is represented more accurately (such as fast bass drum),
  24164. otherwise event in frequency domain is represented more accurately
  24165. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  24166. @item attack
  24167. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  24168. limits future samples by applying asymmetric windowing in time domain, useful
  24169. when low latency is required. Accepted range is @code{[0, 1]}.
  24170. @item basefreq
  24171. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  24172. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  24173. @item endfreq
  24174. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  24175. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  24176. @item coeffclamp
  24177. This option is deprecated and ignored.
  24178. @item tlength
  24179. Specify the transform length in time domain. Use this option to control accuracy
  24180. trade-off between time domain and frequency domain at every frequency sample.
  24181. It can contain variables:
  24182. @table @option
  24183. @item frequency, freq, f
  24184. the frequency where it is evaluated
  24185. @item timeclamp, tc
  24186. the value of @var{timeclamp} option.
  24187. @end table
  24188. Default value is @code{384*tc/(384+tc*f)}.
  24189. @item count
  24190. Specify the transform count for every video frame. Default value is @code{6}.
  24191. Acceptable range is @code{[1, 30]}.
  24192. @item fcount
  24193. Specify the transform count for every single pixel. Default value is @code{0},
  24194. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  24195. @item fontfile
  24196. Specify font file for use with freetype to draw the axis. If not specified,
  24197. use embedded font. Note that drawing with font file or embedded font is not
  24198. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  24199. option instead.
  24200. @item font
  24201. Specify fontconfig pattern. This has lower priority than @var{fontfile}. The
  24202. @code{:} in the pattern may be replaced by @code{|} to avoid unnecessary
  24203. escaping.
  24204. @item fontcolor
  24205. Specify font color expression. This is arithmetic expression that should return
  24206. integer value 0xRRGGBB. It can contain variables:
  24207. @table @option
  24208. @item frequency, freq, f
  24209. the frequency where it is evaluated
  24210. @item timeclamp, tc
  24211. the value of @var{timeclamp} option
  24212. @end table
  24213. and functions:
  24214. @table @option
  24215. @item midi(f)
  24216. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  24217. @item r(x), g(x), b(x)
  24218. red, green, and blue value of intensity x.
  24219. @end table
  24220. Default value is @code{st(0, (midi(f)-59.5)/12);
  24221. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  24222. r(1-ld(1)) + b(ld(1))}.
  24223. @item axisfile
  24224. Specify image file to draw the axis. This option override @var{fontfile} and
  24225. @var{fontcolor} option.
  24226. @item axis, text
  24227. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  24228. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  24229. Default value is @code{1}.
  24230. @item csp
  24231. Set colorspace. The accepted values are:
  24232. @table @samp
  24233. @item unspecified
  24234. Unspecified (default)
  24235. @item bt709
  24236. BT.709
  24237. @item fcc
  24238. FCC
  24239. @item bt470bg
  24240. BT.470BG or BT.601-6 625
  24241. @item smpte170m
  24242. SMPTE-170M or BT.601-6 525
  24243. @item smpte240m
  24244. SMPTE-240M
  24245. @item bt2020ncl
  24246. BT.2020 with non-constant luminance
  24247. @end table
  24248. @item cscheme
  24249. Set spectrogram color scheme. This is list of floating point values with format
  24250. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  24251. The default is @code{1|0.5|0|0|0.5|1}.
  24252. @end table
  24253. @subsection Examples
  24254. @itemize
  24255. @item
  24256. Playing audio while showing the spectrum:
  24257. @example
  24258. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  24259. @end example
  24260. @item
  24261. Same as above, but with frame rate 30 fps:
  24262. @example
  24263. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  24264. @end example
  24265. @item
  24266. Playing at 1280x720:
  24267. @example
  24268. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  24269. @end example
  24270. @item
  24271. Disable sonogram display:
  24272. @example
  24273. sono_h=0
  24274. @end example
  24275. @item
  24276. A1 and its harmonics: A1, A2, (near)E3, A3:
  24277. @example
  24278. 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),
  24279. asplit[a][out1]; [a] showcqt [out0]'
  24280. @end example
  24281. @item
  24282. Same as above, but with more accuracy in frequency domain:
  24283. @example
  24284. 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),
  24285. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  24286. @end example
  24287. @item
  24288. Custom volume:
  24289. @example
  24290. bar_v=10:sono_v=bar_v*a_weighting(f)
  24291. @end example
  24292. @item
  24293. Custom gamma, now spectrum is linear to the amplitude.
  24294. @example
  24295. bar_g=2:sono_g=2
  24296. @end example
  24297. @item
  24298. Custom tlength equation:
  24299. @example
  24300. 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)))'
  24301. @end example
  24302. @item
  24303. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  24304. @example
  24305. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  24306. @end example
  24307. @item
  24308. Custom font using fontconfig:
  24309. @example
  24310. font='Courier New,Monospace,mono|bold'
  24311. @end example
  24312. @item
  24313. Custom frequency range with custom axis using image file:
  24314. @example
  24315. axisfile=myaxis.png:basefreq=40:endfreq=10000
  24316. @end example
  24317. @end itemize
  24318. @section showcwt
  24319. Convert input audio to video output representing frequency spectrum
  24320. using Continuous Wavelet Transform and Morlet wavelet.
  24321. The filter accepts the following options:
  24322. @table @option
  24323. @item size, s
  24324. Specify the video size for the output. For the syntax of this option,
  24325. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24326. Default value is @code{640x512}.
  24327. @item rate, r
  24328. Set the output frame rate. Default value is @code{25}.
  24329. @item scale
  24330. Set the frequency scale used. Allowed values are:
  24331. @table @option
  24332. @item linear
  24333. @item log
  24334. @item bark
  24335. @item mel
  24336. @item erbs
  24337. @item sqrt
  24338. @item cbrt
  24339. @item qdrt
  24340. @item fm
  24341. @end table
  24342. Default value is @code{linear}.
  24343. @item iscale
  24344. Set the intensity scale used. Allowed values are:
  24345. @table @option
  24346. @item linear
  24347. @item log
  24348. @item sqrt
  24349. @item cbrt
  24350. @item qdrt
  24351. @end table
  24352. Default value is @code{log}.
  24353. @item min
  24354. Set the minimum frequency that will be used in output.
  24355. Default is @code{20} Hz.
  24356. @item max
  24357. Set the maximum frequency that will be used in output.
  24358. Default is @code{20000} Hz. The real frequency upper limit
  24359. depends on input audio's sample rate and such will be enforced
  24360. on this value when it is set to value greater than Nyquist frequency.
  24361. @item imin
  24362. Set the minimum intensity that will be used in output.
  24363. @item imax
  24364. Set the maximum intensity that will be used in output.
  24365. @item logb
  24366. Set the logarithmic basis for brightness strength when
  24367. mapping calculated magnitude values to pixel values.
  24368. Allowed range is from @code{0} to @code{1}.
  24369. Default value is @code{0.0001}.
  24370. @item deviation
  24371. Set the frequency deviation.
  24372. Lower values than @code{1} are more frequency oriented,
  24373. while higher values than @code{1} are more time oriented.
  24374. Allowed range is from @code{0} to @code{10}.
  24375. Default value is @code{1}.
  24376. @item pps
  24377. Set the number of pixel output per each second in one row.
  24378. Allowed range is from @code{1} to @code{1024}.
  24379. Default value is @code{64}.
  24380. @item mode
  24381. Set the output visual mode. Allowed values are:
  24382. @table @option
  24383. @item magnitude
  24384. Show magnitude.
  24385. @item phase
  24386. Show only phase.
  24387. @item magphase
  24388. Show combination of magnitude and phase.
  24389. Magnitude is mapped to brightness and phase to color.
  24390. @item channel
  24391. Show unique color per channel magnitude.
  24392. @item stereo
  24393. Show unique color per stereo difference.
  24394. @end table
  24395. Default value is @code{magnitude}.
  24396. @item slide
  24397. Set the output slide method. Allowed values are:
  24398. @table @option
  24399. @item replace
  24400. @item scroll
  24401. @item frame
  24402. @end table
  24403. @item direction
  24404. Set the direction method for output slide method. Allowed values are:
  24405. @table @option
  24406. @item lr
  24407. Direction from left to right.
  24408. @item rl
  24409. Direction from right to left.
  24410. @item ud
  24411. Direction from up to down.
  24412. @item du
  24413. Direction from down to up.
  24414. @end table
  24415. @item bar
  24416. Set the ratio of bargraph display to display size. Default is 0.
  24417. @item rotation
  24418. Set color rotation, must be in [-1.0, 1.0] range.
  24419. Default value is @code{0}.
  24420. @end table
  24421. @section showfreqs
  24422. Convert input audio to video output representing the audio power spectrum.
  24423. Audio amplitude is on Y-axis while frequency is on X-axis.
  24424. The filter accepts the following options:
  24425. @table @option
  24426. @item size, s
  24427. Specify size of video. For the syntax of this option, check the
  24428. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24429. Default is @code{1024x512}.
  24430. @item rate, r
  24431. Set video rate. Default is @code{25}.
  24432. @item mode
  24433. Set display mode.
  24434. This set how each frequency bin will be represented.
  24435. It accepts the following values:
  24436. @table @samp
  24437. @item line
  24438. @item bar
  24439. @item dot
  24440. @end table
  24441. Default is @code{bar}.
  24442. @item ascale
  24443. Set amplitude scale.
  24444. It accepts the following values:
  24445. @table @samp
  24446. @item lin
  24447. Linear scale.
  24448. @item sqrt
  24449. Square root scale.
  24450. @item cbrt
  24451. Cubic root scale.
  24452. @item log
  24453. Logarithmic scale.
  24454. @end table
  24455. Default is @code{log}.
  24456. @item fscale
  24457. Set frequency scale.
  24458. It accepts the following values:
  24459. @table @samp
  24460. @item lin
  24461. Linear scale.
  24462. @item log
  24463. Logarithmic scale.
  24464. @item rlog
  24465. Reverse logarithmic scale.
  24466. @end table
  24467. Default is @code{lin}.
  24468. @item win_size
  24469. Set window size. Allowed range is from 16 to 65536.
  24470. Default is @code{2048}
  24471. @item win_func
  24472. Set windowing function.
  24473. It accepts the following values:
  24474. @table @samp
  24475. @item rect
  24476. @item bartlett
  24477. @item hanning
  24478. @item hamming
  24479. @item blackman
  24480. @item welch
  24481. @item flattop
  24482. @item bharris
  24483. @item bnuttall
  24484. @item bhann
  24485. @item sine
  24486. @item nuttall
  24487. @item lanczos
  24488. @item gauss
  24489. @item tukey
  24490. @item dolph
  24491. @item cauchy
  24492. @item parzen
  24493. @item poisson
  24494. @item bohman
  24495. @item kaiser
  24496. @end table
  24497. Default is @code{hanning}.
  24498. @item overlap
  24499. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  24500. which means optimal overlap for selected window function will be picked.
  24501. @item averaging
  24502. Set time averaging. Setting this to 0 will display current maximal peaks.
  24503. Default is @code{1}, which means time averaging is disabled.
  24504. @item colors
  24505. Specify list of colors separated by space or by '|' which will be used to
  24506. draw channel frequencies. Unrecognized or missing colors will be replaced
  24507. by white color.
  24508. @item cmode
  24509. Set channel display mode.
  24510. It accepts the following values:
  24511. @table @samp
  24512. @item combined
  24513. @item separate
  24514. @end table
  24515. Default is @code{combined}.
  24516. @item minamp
  24517. Set minimum amplitude used in @code{log} amplitude scaler.
  24518. @item data
  24519. Set data display mode.
  24520. It accepts the following values:
  24521. @table @samp
  24522. @item magnitude
  24523. @item phase
  24524. @item delay
  24525. @end table
  24526. Default is @code{magnitude}.
  24527. @item channels
  24528. Set channels to use when processing audio. By default all are processed.
  24529. @end table
  24530. @section showspatial
  24531. Convert stereo input audio to a video output, representing the spatial relationship
  24532. between two channels.
  24533. The filter accepts the following options:
  24534. @table @option
  24535. @item size, s
  24536. Specify the video size for the output. For the syntax of this option, check the
  24537. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24538. Default value is @code{512x512}.
  24539. @item win_size
  24540. Set window size. Allowed range is from @var{1024} to @var{65536}. Default size is @var{4096}.
  24541. @item win_func
  24542. Set window function.
  24543. It accepts the following values:
  24544. @table @samp
  24545. @item rect
  24546. @item bartlett
  24547. @item hann
  24548. @item hanning
  24549. @item hamming
  24550. @item blackman
  24551. @item welch
  24552. @item flattop
  24553. @item bharris
  24554. @item bnuttall
  24555. @item bhann
  24556. @item sine
  24557. @item nuttall
  24558. @item lanczos
  24559. @item gauss
  24560. @item tukey
  24561. @item dolph
  24562. @item cauchy
  24563. @item parzen
  24564. @item poisson
  24565. @item bohman
  24566. @item kaiser
  24567. @end table
  24568. Default value is @code{hann}.
  24569. @item rate, r
  24570. Set output framerate.
  24571. @end table
  24572. @anchor{showspectrum}
  24573. @section showspectrum
  24574. Convert input audio to a video output, representing the audio frequency
  24575. spectrum.
  24576. The filter accepts the following options:
  24577. @table @option
  24578. @item size, s
  24579. Specify the video size for the output. For the syntax of this option, check the
  24580. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24581. Default value is @code{640x512}.
  24582. @item slide
  24583. Specify how the spectrum should slide along the window.
  24584. It accepts the following values:
  24585. @table @samp
  24586. @item replace
  24587. the samples start again on the left when they reach the right
  24588. @item scroll
  24589. the samples scroll from right to left
  24590. @item fullframe
  24591. frames are only produced when the samples reach the right
  24592. @item rscroll
  24593. the samples scroll from left to right
  24594. @item lreplace
  24595. the samples start again on the right when they reach the left
  24596. @end table
  24597. Default value is @code{replace}.
  24598. @item mode
  24599. Specify display mode.
  24600. It accepts the following values:
  24601. @table @samp
  24602. @item combined
  24603. all channels are displayed in the same row
  24604. @item separate
  24605. all channels are displayed in separate rows
  24606. @end table
  24607. Default value is @samp{combined}.
  24608. @item color
  24609. Specify display color mode.
  24610. It accepts the following values:
  24611. @table @samp
  24612. @item channel
  24613. each channel is displayed in a separate color
  24614. @item intensity
  24615. each channel is displayed using the same color scheme
  24616. @item rainbow
  24617. each channel is displayed using the rainbow color scheme
  24618. @item moreland
  24619. each channel is displayed using the moreland color scheme
  24620. @item nebulae
  24621. each channel is displayed using the nebulae color scheme
  24622. @item fire
  24623. each channel is displayed using the fire color scheme
  24624. @item fiery
  24625. each channel is displayed using the fiery color scheme
  24626. @item fruit
  24627. each channel is displayed using the fruit color scheme
  24628. @item cool
  24629. each channel is displayed using the cool color scheme
  24630. @item magma
  24631. each channel is displayed using the magma color scheme
  24632. @item green
  24633. each channel is displayed using the green color scheme
  24634. @item viridis
  24635. each channel is displayed using the viridis color scheme
  24636. @item plasma
  24637. each channel is displayed using the plasma color scheme
  24638. @item cividis
  24639. each channel is displayed using the cividis color scheme
  24640. @item terrain
  24641. each channel is displayed using the terrain color scheme
  24642. @end table
  24643. Default value is @samp{channel}.
  24644. @item scale
  24645. Specify scale used for calculating intensity color values.
  24646. It accepts the following values:
  24647. @table @samp
  24648. @item lin
  24649. linear
  24650. @item sqrt
  24651. square root, default
  24652. @item cbrt
  24653. cubic root
  24654. @item log
  24655. logarithmic
  24656. @item 4thrt
  24657. 4th root
  24658. @item 5thrt
  24659. 5th root
  24660. @end table
  24661. Default value is @samp{sqrt}.
  24662. @item fscale
  24663. Specify frequency scale.
  24664. It accepts the following values:
  24665. @table @samp
  24666. @item lin
  24667. linear
  24668. @item log
  24669. logarithmic
  24670. @end table
  24671. Default value is @samp{lin}.
  24672. @item saturation
  24673. Set saturation modifier for displayed colors. Negative values provide
  24674. alternative color scheme. @code{0} is no saturation at all.
  24675. Saturation must be in [-10.0, 10.0] range.
  24676. Default value is @code{1}.
  24677. @item win_func
  24678. Set window function.
  24679. It accepts the following values:
  24680. @table @samp
  24681. @item rect
  24682. @item bartlett
  24683. @item hann
  24684. @item hanning
  24685. @item hamming
  24686. @item blackman
  24687. @item welch
  24688. @item flattop
  24689. @item bharris
  24690. @item bnuttall
  24691. @item bhann
  24692. @item sine
  24693. @item nuttall
  24694. @item lanczos
  24695. @item gauss
  24696. @item tukey
  24697. @item dolph
  24698. @item cauchy
  24699. @item parzen
  24700. @item poisson
  24701. @item bohman
  24702. @item kaiser
  24703. @end table
  24704. Default value is @code{hann}.
  24705. @item orientation
  24706. Set orientation of time vs frequency axis. Can be @code{vertical} or
  24707. @code{horizontal}. Default is @code{vertical}.
  24708. @item overlap
  24709. Set ratio of overlap window. Default value is @code{0}.
  24710. When value is @code{1} overlap is set to recommended size for specific
  24711. window function currently used.
  24712. @item gain
  24713. Set scale gain for calculating intensity color values.
  24714. Default value is @code{1}.
  24715. @item data
  24716. Set which data to display. Can be @code{magnitude}, default or @code{phase},
  24717. or unwrapped phase: @code{uphase}.
  24718. @item rotation
  24719. Set color rotation, must be in [-1.0, 1.0] range.
  24720. Default value is @code{0}.
  24721. @item start
  24722. Set start frequency from which to display spectrogram. Default is @code{0}.
  24723. @item stop
  24724. Set stop frequency to which to display spectrogram. Default is @code{0}.
  24725. @item fps
  24726. Set upper frame rate limit. Default is @code{auto}, unlimited.
  24727. @item legend
  24728. Draw time and frequency axes and legends. Default is disabled.
  24729. @item drange
  24730. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  24731. Allowed range is from 10 to 200.
  24732. @item limit
  24733. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  24734. Allowed range is from -100 to 100.
  24735. @item opacity
  24736. Set opacity strength when using pixel format output with alpha component.
  24737. @end table
  24738. The usage is very similar to the showwaves filter; see the examples in that
  24739. section.
  24740. @subsection Examples
  24741. @itemize
  24742. @item
  24743. Large window with logarithmic color scaling:
  24744. @example
  24745. showspectrum=s=1280x480:scale=log
  24746. @end example
  24747. @item
  24748. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  24749. @example
  24750. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  24751. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  24752. @end example
  24753. @end itemize
  24754. @section showspectrumpic
  24755. Convert input audio to a single video frame, representing the audio frequency
  24756. spectrum.
  24757. The filter accepts the following options:
  24758. @table @option
  24759. @item size, s
  24760. Specify the video size for the output. For the syntax of this option, check the
  24761. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24762. Default value is @code{4096x2048}.
  24763. @item mode
  24764. Specify display mode.
  24765. It accepts the following values:
  24766. @table @samp
  24767. @item combined
  24768. all channels are displayed in the same row
  24769. @item separate
  24770. all channels are displayed in separate rows
  24771. @end table
  24772. Default value is @samp{combined}.
  24773. @item color
  24774. Specify display color mode.
  24775. It accepts the following values:
  24776. @table @samp
  24777. @item channel
  24778. each channel is displayed in a separate color
  24779. @item intensity
  24780. each channel is displayed using the same color scheme
  24781. @item rainbow
  24782. each channel is displayed using the rainbow color scheme
  24783. @item moreland
  24784. each channel is displayed using the moreland color scheme
  24785. @item nebulae
  24786. each channel is displayed using the nebulae color scheme
  24787. @item fire
  24788. each channel is displayed using the fire color scheme
  24789. @item fiery
  24790. each channel is displayed using the fiery color scheme
  24791. @item fruit
  24792. each channel is displayed using the fruit color scheme
  24793. @item cool
  24794. each channel is displayed using the cool color scheme
  24795. @item magma
  24796. each channel is displayed using the magma color scheme
  24797. @item green
  24798. each channel is displayed using the green color scheme
  24799. @item viridis
  24800. each channel is displayed using the viridis color scheme
  24801. @item plasma
  24802. each channel is displayed using the plasma color scheme
  24803. @item cividis
  24804. each channel is displayed using the cividis color scheme
  24805. @item terrain
  24806. each channel is displayed using the terrain color scheme
  24807. @end table
  24808. Default value is @samp{intensity}.
  24809. @item scale
  24810. Specify scale used for calculating intensity color values.
  24811. It accepts the following values:
  24812. @table @samp
  24813. @item lin
  24814. linear
  24815. @item sqrt
  24816. square root, default
  24817. @item cbrt
  24818. cubic root
  24819. @item log
  24820. logarithmic
  24821. @item 4thrt
  24822. 4th root
  24823. @item 5thrt
  24824. 5th root
  24825. @end table
  24826. Default value is @samp{log}.
  24827. @item fscale
  24828. Specify frequency scale.
  24829. It accepts the following values:
  24830. @table @samp
  24831. @item lin
  24832. linear
  24833. @item log
  24834. logarithmic
  24835. @end table
  24836. Default value is @samp{lin}.
  24837. @item saturation
  24838. Set saturation modifier for displayed colors. Negative values provide
  24839. alternative color scheme. @code{0} is no saturation at all.
  24840. Saturation must be in [-10.0, 10.0] range.
  24841. Default value is @code{1}.
  24842. @item win_func
  24843. Set window function.
  24844. It accepts the following values:
  24845. @table @samp
  24846. @item rect
  24847. @item bartlett
  24848. @item hann
  24849. @item hanning
  24850. @item hamming
  24851. @item blackman
  24852. @item welch
  24853. @item flattop
  24854. @item bharris
  24855. @item bnuttall
  24856. @item bhann
  24857. @item sine
  24858. @item nuttall
  24859. @item lanczos
  24860. @item gauss
  24861. @item tukey
  24862. @item dolph
  24863. @item cauchy
  24864. @item parzen
  24865. @item poisson
  24866. @item bohman
  24867. @item kaiser
  24868. @end table
  24869. Default value is @code{hann}.
  24870. @item orientation
  24871. Set orientation of time vs frequency axis. Can be @code{vertical} or
  24872. @code{horizontal}. Default is @code{vertical}.
  24873. @item gain
  24874. Set scale gain for calculating intensity color values.
  24875. Default value is @code{1}.
  24876. @item legend
  24877. Draw time and frequency axes and legends. Default is enabled.
  24878. @item rotation
  24879. Set color rotation, must be in [-1.0, 1.0] range.
  24880. Default value is @code{0}.
  24881. @item start
  24882. Set start frequency from which to display spectrogram. Default is @code{0}.
  24883. @item stop
  24884. Set stop frequency to which to display spectrogram. Default is @code{0}.
  24885. @item drange
  24886. Set dynamic range used to calculate intensity color values. Default is 120 dBFS.
  24887. Allowed range is from 10 to 200.
  24888. @item limit
  24889. Set upper limit of input audio samples volume in dBFS. Default is 0 dBFS.
  24890. Allowed range is from -100 to 100.
  24891. @item opacity
  24892. Set opacity strength when using pixel format output with alpha component.
  24893. @end table
  24894. @subsection Examples
  24895. @itemize
  24896. @item
  24897. Extract an audio spectrogram of a whole audio track
  24898. in a 1024x1024 picture using @command{ffmpeg}:
  24899. @example
  24900. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  24901. @end example
  24902. @end itemize
  24903. @section showvolume
  24904. Convert input audio volume to a video output.
  24905. The filter accepts the following options:
  24906. @table @option
  24907. @item rate, r
  24908. Set video rate.
  24909. @item b
  24910. Set border width, allowed range is [0, 5]. Default is 1.
  24911. @item w
  24912. Set channel width, allowed range is [80, 8192]. Default is 400.
  24913. @item h
  24914. Set channel height, allowed range is [1, 900]. Default is 20.
  24915. @item f
  24916. Set fade, allowed range is [0, 1]. Default is 0.95.
  24917. @item c
  24918. Set volume color expression.
  24919. The expression can use the following variables:
  24920. @table @option
  24921. @item VOLUME
  24922. Current max volume of channel in dB.
  24923. @item PEAK
  24924. Current peak.
  24925. @item CHANNEL
  24926. Current channel number, starting from 0.
  24927. @end table
  24928. @item t
  24929. If set, displays channel names. Default is enabled.
  24930. @item v
  24931. If set, displays volume values. Default is enabled.
  24932. @item o
  24933. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  24934. default is @code{h}.
  24935. @item s
  24936. Set step size, allowed range is [0, 5]. Default is 0, which means
  24937. step is disabled.
  24938. @item p
  24939. Set background opacity, allowed range is [0, 1]. Default is 0.
  24940. @item m
  24941. Set metering mode, can be peak: @code{p} or rms: @code{r},
  24942. default is @code{p}.
  24943. @item ds
  24944. Set display scale, can be linear: @code{lin} or log: @code{log},
  24945. default is @code{lin}.
  24946. @item dm
  24947. In second.
  24948. If set to > 0., display a line for the max level
  24949. in the previous seconds.
  24950. default is disabled: @code{0.}
  24951. @item dmc
  24952. The color of the max line. Use when @code{dm} option is set to > 0.
  24953. default is: @code{orange}
  24954. @end table
  24955. @section showwaves
  24956. Convert input audio to a video output, representing the samples waves.
  24957. The filter accepts the following options:
  24958. @table @option
  24959. @item size, s
  24960. Specify the video size for the output. For the syntax of this option, check the
  24961. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  24962. Default value is @code{600x240}.
  24963. @item mode
  24964. Set display mode.
  24965. Available values are:
  24966. @table @samp
  24967. @item point
  24968. Draw a point for each sample.
  24969. @item line
  24970. Draw a vertical line for each sample.
  24971. @item p2p
  24972. Draw a point for each sample and a line between them.
  24973. @item cline
  24974. Draw a centered vertical line for each sample.
  24975. @end table
  24976. Default value is @code{point}.
  24977. @item n
  24978. Set the number of samples which are printed on the same column. A
  24979. larger value will decrease the frame rate. Must be a positive
  24980. integer. This option can be set only if the value for @var{rate}
  24981. is not explicitly specified.
  24982. @item rate, r
  24983. Set the (approximate) output frame rate. This is done by setting the
  24984. option @var{n}. Default value is "25".
  24985. @item split_channels
  24986. Set if channels should be drawn separately or overlap. Default value is 0.
  24987. @item colors
  24988. Set colors separated by '|' which are going to be used for drawing of each channel.
  24989. @item scale
  24990. Set amplitude scale.
  24991. Available values are:
  24992. @table @samp
  24993. @item lin
  24994. Linear.
  24995. @item log
  24996. Logarithmic.
  24997. @item sqrt
  24998. Square root.
  24999. @item cbrt
  25000. Cubic root.
  25001. @end table
  25002. Default is linear.
  25003. @item draw
  25004. Set the draw mode. This is mostly useful to set for high @var{n}.
  25005. Available values are:
  25006. @table @samp
  25007. @item scale
  25008. Scale pixel values for each drawn sample.
  25009. @item full
  25010. Draw every sample directly.
  25011. @end table
  25012. Default value is @code{scale}.
  25013. @end table
  25014. @subsection Examples
  25015. @itemize
  25016. @item
  25017. Output the input file audio and the corresponding video representation
  25018. at the same time:
  25019. @example
  25020. amovie=a.mp3,asplit[out0],showwaves[out1]
  25021. @end example
  25022. @item
  25023. Create a synthetic signal and show it with showwaves, forcing a
  25024. frame rate of 30 frames per second:
  25025. @example
  25026. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  25027. @end example
  25028. @end itemize
  25029. @section showwavespic
  25030. Convert input audio to a single video frame, representing the samples waves.
  25031. The filter accepts the following options:
  25032. @table @option
  25033. @item size, s
  25034. Specify the video size for the output. For the syntax of this option, check the
  25035. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  25036. Default value is @code{600x240}.
  25037. @item split_channels
  25038. Set if channels should be drawn separately or overlap. Default value is 0.
  25039. @item colors
  25040. Set colors separated by '|' which are going to be used for drawing of each channel.
  25041. @item scale
  25042. Set amplitude scale.
  25043. Available values are:
  25044. @table @samp
  25045. @item lin
  25046. Linear.
  25047. @item log
  25048. Logarithmic.
  25049. @item sqrt
  25050. Square root.
  25051. @item cbrt
  25052. Cubic root.
  25053. @end table
  25054. Default is linear.
  25055. @item draw
  25056. Set the draw mode.
  25057. Available values are:
  25058. @table @samp
  25059. @item scale
  25060. Scale pixel values for each drawn sample.
  25061. @item full
  25062. Draw every sample directly.
  25063. @end table
  25064. Default value is @code{scale}.
  25065. @item filter
  25066. Set the filter mode.
  25067. Available values are:
  25068. @table @samp
  25069. @item average
  25070. Use average samples values for each drawn sample.
  25071. @item peak
  25072. Use peak samples values for each drawn sample.
  25073. @end table
  25074. Default value is @code{average}.
  25075. @end table
  25076. @subsection Examples
  25077. @itemize
  25078. @item
  25079. Extract a channel split representation of the wave form of a whole audio track
  25080. in a 1024x800 picture using @command{ffmpeg}:
  25081. @example
  25082. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  25083. @end example
  25084. @end itemize
  25085. @section sidedata, asidedata
  25086. Delete frame side data, or select frames based on it.
  25087. This filter accepts the following options:
  25088. @table @option
  25089. @item mode
  25090. Set mode of operation of the filter.
  25091. Can be one of the following:
  25092. @table @samp
  25093. @item select
  25094. Select every frame with side data of @code{type}.
  25095. @item delete
  25096. Delete side data of @code{type}. If @code{type} is not set, delete all side
  25097. data in the frame.
  25098. @end table
  25099. @item type
  25100. Set side data type used with all modes. Must be set for @code{select} mode. For
  25101. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  25102. in @file{libavutil/frame.h}. For example, to choose
  25103. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  25104. @end table
  25105. @section spectrumsynth
  25106. Synthesize audio from 2 input video spectrums, first input stream represents
  25107. magnitude across time and second represents phase across time.
  25108. The filter will transform from frequency domain as displayed in videos back
  25109. to time domain as presented in audio output.
  25110. This filter is primarily created for reversing processed @ref{showspectrum}
  25111. filter outputs, but can synthesize sound from other spectrograms too.
  25112. But in such case results are going to be poor if the phase data is not
  25113. available, because in such cases phase data need to be recreated, usually
  25114. it's just recreated from random noise.
  25115. For best results use gray only output (@code{channel} color mode in
  25116. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  25117. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  25118. @code{data} option. Inputs videos should generally use @code{fullframe}
  25119. slide mode as that saves resources needed for decoding video.
  25120. The filter accepts the following options:
  25121. @table @option
  25122. @item sample_rate
  25123. Specify sample rate of output audio, the sample rate of audio from which
  25124. spectrum was generated may differ.
  25125. @item channels
  25126. Set number of channels represented in input video spectrums.
  25127. @item scale
  25128. Set scale which was used when generating magnitude input spectrum.
  25129. Can be @code{lin} or @code{log}. Default is @code{log}.
  25130. @item slide
  25131. Set slide which was used when generating inputs spectrums.
  25132. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  25133. Default is @code{fullframe}.
  25134. @item win_func
  25135. Set window function used for resynthesis.
  25136. @item overlap
  25137. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  25138. which means optimal overlap for selected window function will be picked.
  25139. @item orientation
  25140. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  25141. Default is @code{vertical}.
  25142. @end table
  25143. @subsection Examples
  25144. @itemize
  25145. @item
  25146. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  25147. then resynthesize videos back to audio with spectrumsynth:
  25148. @example
  25149. 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
  25150. 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
  25151. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  25152. @end example
  25153. @end itemize
  25154. @section split, asplit
  25155. Split input into several identical outputs.
  25156. @code{asplit} works with audio input, @code{split} with video.
  25157. The filter accepts a single parameter which specifies the number of outputs. If
  25158. unspecified, it defaults to 2.
  25159. @subsection Examples
  25160. @itemize
  25161. @item
  25162. Create two separate outputs from the same input:
  25163. @example
  25164. [in] split [out0][out1]
  25165. @end example
  25166. @item
  25167. To create 3 or more outputs, you need to specify the number of
  25168. outputs, like in:
  25169. @example
  25170. [in] asplit=3 [out0][out1][out2]
  25171. @end example
  25172. @item
  25173. Create two separate outputs from the same input, one cropped and
  25174. one padded:
  25175. @example
  25176. [in] split [splitout1][splitout2];
  25177. [splitout1] crop=100:100:0:0 [cropout];
  25178. [splitout2] pad=200:200:100:100 [padout];
  25179. @end example
  25180. @item
  25181. Create 5 copies of the input audio with @command{ffmpeg}:
  25182. @example
  25183. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  25184. @end example
  25185. @end itemize
  25186. @section zmq, azmq
  25187. Receive commands sent through a libzmq client, and forward them to
  25188. filters in the filtergraph.
  25189. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  25190. must be inserted between two video filters, @code{azmq} between two
  25191. audio filters. Both are capable to send messages to any filter type.
  25192. To enable these filters you need to install the libzmq library and
  25193. headers and configure FFmpeg with @code{--enable-libzmq}.
  25194. For more information about libzmq see:
  25195. @url{http://www.zeromq.org/}
  25196. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  25197. receives messages sent through a network interface defined by the
  25198. @option{bind_address} (or the abbreviation "@option{b}") option.
  25199. Default value of this option is @file{tcp://localhost:5555}. You may
  25200. want to alter this value to your needs, but do not forget to escape any
  25201. ':' signs (see @ref{filtergraph escaping}).
  25202. The received message must be in the form:
  25203. @example
  25204. @var{TARGET} @var{COMMAND} [@var{ARG}]
  25205. @end example
  25206. @var{TARGET} specifies the target of the command, usually the name of
  25207. the filter class or a specific filter instance name. The default
  25208. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  25209. but you can override this by using the @samp{filter_name@@id} syntax
  25210. (see @ref{Filtergraph syntax}).
  25211. @var{COMMAND} specifies the name of the command for the target filter.
  25212. @var{ARG} is optional and specifies the optional argument list for the
  25213. given @var{COMMAND}.
  25214. Upon reception, the message is processed and the corresponding command
  25215. is injected into the filtergraph. Depending on the result, the filter
  25216. will send a reply to the client, adopting the format:
  25217. @example
  25218. @var{ERROR_CODE} @var{ERROR_REASON}
  25219. @var{MESSAGE}
  25220. @end example
  25221. @var{MESSAGE} is optional.
  25222. @subsection Examples
  25223. Look at @file{tools/zmqsend} for an example of a zmq client which can
  25224. be used to send commands processed by these filters.
  25225. Consider the following filtergraph generated by @command{ffplay}.
  25226. In this example the last overlay filter has an instance name. All other
  25227. filters will have default instance names.
  25228. @example
  25229. ffplay -dumpgraph 1 -f lavfi "
  25230. color=s=100x100:c=red [l];
  25231. color=s=100x100:c=blue [r];
  25232. nullsrc=s=200x100, zmq [bg];
  25233. [bg][l] overlay [bg+l];
  25234. [bg+l][r] overlay@@my=x=100 "
  25235. @end example
  25236. To change the color of the left side of the video, the following
  25237. command can be used:
  25238. @example
  25239. echo Parsed_color_0 c yellow | tools/zmqsend
  25240. @end example
  25241. To change the right side:
  25242. @example
  25243. echo Parsed_color_1 c pink | tools/zmqsend
  25244. @end example
  25245. To change the position of the right side:
  25246. @example
  25247. echo overlay@@my x 150 | tools/zmqsend
  25248. @end example
  25249. @c man end MULTIMEDIA FILTERS
  25250. @chapter Multimedia Sources
  25251. @c man begin MULTIMEDIA SOURCES
  25252. Below is a description of the currently available multimedia sources.
  25253. @section amovie
  25254. This is the same as @ref{movie} source, except it selects an audio
  25255. stream by default.
  25256. @section avsynctest
  25257. Generate an Audio/Video Sync Test.
  25258. Generated stream periodically shows flash video frame and emits beep in audio.
  25259. Useful to inspect A/V sync issues.
  25260. It accepts the following options:
  25261. @table @option
  25262. @item size, s
  25263. Set output video size. Default value is @code{hd720}.
  25264. @item framerate, fr
  25265. Set output video frame rate. Default value is @code{30}.
  25266. @item samplerate, sr
  25267. Set output audio sample rate. Default value is @code{44100}.
  25268. @item amplitude, a
  25269. Set output audio beep amplitude. Default value is @code{0.7}.
  25270. @item period, p
  25271. Set output audio beep period in seconds. Default value is @code{3}.
  25272. @item delay, dl
  25273. Set output video flash delay in number of frames. Default value is @code{0}.
  25274. @item cycle, c
  25275. Enable cycling of video delays, by default is disabled.
  25276. @item duration, d
  25277. Set stream output duration. By default duration is unlimited.
  25278. @item fg, bg, ag
  25279. Set foreground/background/additional color.
  25280. @end table
  25281. @subsection Commands
  25282. This source supports the some above options as @ref{commands}.
  25283. @anchor{movie}
  25284. @section movie
  25285. Read audio and/or video stream(s) from a movie container.
  25286. It accepts the following parameters:
  25287. @table @option
  25288. @item filename
  25289. The name of the resource to read (not necessarily a file; it can also be a
  25290. device or a stream accessed through some protocol).
  25291. @item format_name, f
  25292. Specifies the format assumed for the movie to read, and can be either
  25293. the name of a container or an input device. If not specified, the
  25294. format is guessed from @var{movie_name} or by probing.
  25295. @item seek_point, sp
  25296. Specifies the seek point in seconds. The frames will be output
  25297. starting from this seek point. The parameter is evaluated with
  25298. @code{av_strtod}, so the numerical value may be suffixed by an IS
  25299. postfix. The default value is "0".
  25300. @item streams, s
  25301. Specifies the streams to read. Several streams can be specified,
  25302. separated by "+". The source will then have as many outputs, in the
  25303. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  25304. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  25305. respectively the default (best suited) video and audio stream. Default
  25306. is "dv", or "da" if the filter is called as "amovie".
  25307. @item stream_index, si
  25308. Specifies the index of the video stream to read. If the value is -1,
  25309. the most suitable video stream will be automatically selected. The default
  25310. value is "-1". Deprecated. If the filter is called "amovie", it will select
  25311. audio instead of video.
  25312. @item loop
  25313. Specifies how many times to read the stream in sequence.
  25314. If the value is 0, the stream will be looped infinitely.
  25315. Default value is "1".
  25316. Note that when the movie is looped the source timestamps are not
  25317. changed, so it will generate non monotonically increasing timestamps.
  25318. @item discontinuity
  25319. Specifies the time difference between frames above which the point is
  25320. considered a timestamp discontinuity which is removed by adjusting the later
  25321. timestamps.
  25322. @item dec_threads
  25323. Specifies the number of threads for decoding
  25324. @item format_opts
  25325. Specify format options for the opened file. Format options can be specified
  25326. as a list of @var{key}=@var{value} pairs separated by ':'. The following example
  25327. shows how to add protocol_whitelist and protocol_blacklist options:
  25328. @example
  25329. ffplay -f lavfi
  25330. "movie=filename='1.sdp':format_opts='protocol_whitelist=file,rtp,udp\:protocol_blacklist=http'"
  25331. @end example
  25332. @end table
  25333. It allows overlaying a second video on top of the main input of
  25334. a filtergraph, as shown in this graph:
  25335. @example
  25336. input -----------> deltapts0 --> overlay --> output
  25337. ^
  25338. |
  25339. movie --> scale--> deltapts1 -------+
  25340. @end example
  25341. @subsection Examples
  25342. @itemize
  25343. @item
  25344. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  25345. on top of the input labelled "in":
  25346. @example
  25347. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25348. [in] setpts=PTS-STARTPTS [main];
  25349. [main][over] overlay=16:16 [out]
  25350. @end example
  25351. @item
  25352. Read from a video4linux2 device, and overlay it on top of the input
  25353. labelled "in":
  25354. @example
  25355. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  25356. [in] setpts=PTS-STARTPTS [main];
  25357. [main][over] overlay=16:16 [out]
  25358. @end example
  25359. @item
  25360. Read the first video stream and the audio stream with id 0x81 from
  25361. dvd.vob; the video is connected to the pad named "video" and the audio is
  25362. connected to the pad named "audio":
  25363. @example
  25364. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  25365. @end example
  25366. @end itemize
  25367. @subsection Commands
  25368. Both movie and amovie support the following commands:
  25369. @table @option
  25370. @item seek
  25371. Perform seek using "av_seek_frame".
  25372. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  25373. @itemize
  25374. @item
  25375. @var{stream_index}: If stream_index is -1, a default
  25376. stream is selected, and @var{timestamp} is automatically converted
  25377. from AV_TIME_BASE units to the stream specific time_base.
  25378. @item
  25379. @var{timestamp}: Timestamp in AVStream.time_base units
  25380. or, if no stream is specified, in AV_TIME_BASE units.
  25381. @item
  25382. @var{flags}: Flags which select direction and seeking mode.
  25383. @end itemize
  25384. @item get_duration
  25385. Get movie duration in AV_TIME_BASE units.
  25386. @end table
  25387. @c man end MULTIMEDIA SOURCES